binman: imx9image: respect BINMAN_INDIRS for external files
PATCH RESEND v4 1/1 binman: imx9image: respect BINMAN_INDIRS for external files
We have the BINMAN_INDIRS for any external binaries, so they don't have to be copied into the source/build directory of u-boot. This is especially important for image builders like buildroot.
Use the get_input_filename() helper which will also look up the paths in BINMAN_INDIRS. The append case only handle external files, thus we can use that helper unconditionally.
While at it, update and extend the test case for this image format. That is, first create the image in the input directory and then check if there is actually an append comand with that image name in the resulting .cfgout file.
---
v4:
- reword commit message
- update test case
- (RESEND) to the new uboot mailing list address.
v3:
- emit the command strings
v2:
- forgot to add second lookup. add the same fix
tools/binman/etype/nxp_imx9image.py | 22 ++++++++++++---------- tools/binman/ftest.py | 9 ++++++--- 2 files changed, 18 insertions(+), 13 deletions(-)
tools/binman/etype/nxp_imx9image.py +12 -10
@@ -50,21 +50,23 @@ class Entry_nxp_imx9image(Entry_mkimage): if key.startswith('image') and isinstance(value, list) and len(value) == 3: file = value[1] - image_path = os.path.join(tools.get_output_dir(), value[1]) - value[1] = image_path - combined = ' '.join(map(str, value)) - - if file in external_files and not os.path.exists(value[1]): - print(f"file '{image_path}' does not exist. flash.bin may be not-functional.") + if file in external_files: + value[1] = tools.get_input_filename(file, allow_missing=True) + if not value[1]: + print(f"file '{file}' does not exist. flash.bin may be not-functional.") + continue else: - f.write(f'image {combined}\n') + value[1] = os.path.join(tools.get_output_dir(), file) + + combined = ' '.join(map(str, value)) + f.write(f'image {combined}\n') elif isinstance(value, str): if key.startswith('append'): - file_path = os.path.join(tools.get_output_dir(), value) - if os.path.exists(file_path): + file_path = tools.get_input_filename(value, allow_missing=True) + if file_path: f.write(f'append {file_path}\n') else: - print(f"file '{file_path}' does not exist. flash.bin may be not-functional.") + print(f"file '{value}' does not exist. flash.bin may be not-functional.") else: f.write(f'{formatted_key} {value}\n') elif isinstance(value, bool):
tools/binman/ftest.py +6 -3
@@ -8126,12 +8126,15 @@ fdt fdtmap Extract the devicetree blob from the fdtmap image_path = os.path.join(testdir, 'image.bin') with open(image_path, 'w') as f: pass - container_path = os.path.join(testdir, 'mx95b0-ahab-container.img') - with open(container_path, 'w') as f: - f.write(bytes([0x87]).decode('latin1') * 32768) + self._MakeInputFile('mx95b0-ahab-container.img', bytes([0x87] * 32768)) with terminal.capture(): self._DoTestFile('vendor/nxp_imx95.dts', output_dir=testdir) + fname = tools.get_output_filename('u-boot-container.cfgout') + with open(fname, 'r') as fd: + data = fd.read() + self.assertRegex(data, "append .*/mx95b0-ahab-container.img\n") + def testFitSignSimple(self): """Test that image with FIT and signature nodes can be signed""" if not elf.ELF_TOOLS:
Signature · 1 line
2.47.3
Hi Michael,
Quoted 15 lines · Michael Walle
binman: imx9image: respect
BINMAN_INDIRSfor external filesWe have the
BINMAN_INDIRSfor any external binaries, so they don't have to be copied into the source/build directory of u-boot. This is especially important for image builders like buildroot.Use the
get_input_filename()helper which will also look up the paths inBINMAN_INDIRS. The append case only handle external files, thus we can use that helper unconditionally.While at it, update and extend the test case for this image format. That is, first create the image in the input directory and then check if there is actually an append comand with that image name in the resulting .cfgout file.
Quoted 5 lines
Signed-off-by Michael Walle <[email protected]>
tools/binman/etype/nxp_imx9image.py| 22 ++++++++++++----------tools/binman/ftest.py | 9 ++++++--- 2 files changed, 18 insertions(+), 13 deletions(-)
Test looks good. Two small typos if you respin for other reasons:
'only handle' should be 'only handles' and 'comand' should be 'command'.
Regards,
Simon
Fabio Estevam
reviewerHi Michael,
Quoted 5 lines · Michael Walle
We have the
BINMAN_INDIRSfor any external binaries, so they don't have to be copied into the source/build directory of u-boot. This is especially important for image builders like buildroot.
Quoted 8 lines
Use the
get_input_filename()helper which will also look up the paths inBINMAN_INDIRS. The append case only handle external files, thus we can use that helper unconditionally.While at it, update and extend the test case for this image format. That is, first create the image in the input directory and then check if there is actually an append comand with that image name in the resulting .cfgout file.
CI complains that some tests are missed:
tools/binman/etype/nxp_imx9image.py 51 2 96%
https://git.u-boot-project.org/u-boot/custodians/u-boot-imx/-/jobs/104929
Please fix and resend.