binman: Allow the image name to be the data file

Some image types use the -n parameter to pass in the data file. Add
support for this, with a new property.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-08-13 11:40:48 -06:00
parent e9b5e31a12
commit dfe1db4030
4 changed files with 75 additions and 2 deletions

View File

@@ -5722,6 +5722,23 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
"Node '/section': Replacing sections is not implemented yet",
str(exc.exception))
def testMkimageImagename(self):
"""Test using mkimage with -n holding the data too"""
data = self._DoReadFile('235_mkimage_name.dts')
# Check that the data appears in the file somewhere
self.assertIn(U_BOOT_SPL_DATA, data)
# Get struct image_header -> ih_name
name = data[0x20:0x40]
# Build the filename that we expect to be placed in there, by virtue of
# the -n paraameter
expect = os.path.join(tools.get_output_dir(), 'mkimage.mkimage')
# Check that the image name is set to the temporary filename used
self.assertEqual(expect.encode('utf-8')[:0x20], name)
if __name__ == "__main__":
unittest.main()