tools: binman: etype: fit: Append DTB directory to the list of input directories
authorPaul HENRYS <paul.henrys_ext@softathome.com>
Mon, 25 Nov 2024 18:16:54 +0000 (19:16 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 19 Dec 2024 15:10:34 +0000 (09:10 -0600)
When specifying a directory containing DTBs with 'fit,fdt-list-dir', it can be
handy not to have to also specify this directory to the input directories of
binman with '-I' option and use the method tools.append_input_dirs() append it.
This avoids to have to specify the DTB directory in both the device tree
provided to binman and through '-I' option to binman.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/etype/fit.py
tools/binman/ftest.py

index 343094a..803fb66 100644 (file)
@@ -477,6 +477,8 @@ class Entry_fit(Entry_section):
             self._fdt_dir = fdt_util.GetString(self._node, 'fit,fdt-list-dir')
             if self._fdt_dir:
                 indir = tools.get_input_filename(self._fdt_dir)
+                if indir:
+                    tools.append_input_dirs(indir)
                 fdts = glob.glob('*.dtb', root_dir=indir)
                 self._fdts = [os.path.splitext(f)[0] for f in sorted(fdts)]
             else:
index 4a2a9f2..a553ca9 100644 (file)
@@ -4285,14 +4285,17 @@ class TestFunctional(unittest.TestCase):
         entry_args = {
             'default-dt': 'test-fdt2',
         }
+        extra_indirs = None
         if use_fdt_list:
             entry_args['of-list'] = 'test-fdt1 test-fdt2'
         if default_dt:
             entry_args['default-dt'] = default_dt
+        if use_fdt_list:
+            extra_indirs = [os.path.join(self._indir, TEST_FDT_SUBDIR)]
         data = self._DoReadFileDtb(
             dts,
             entry_args=entry_args,
-            extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])[0]
+            extra_indirs=extra_indirs)[0]
         self.assertEqual(U_BOOT_NODTB_DATA, data[-len(U_BOOT_NODTB_DATA):])
         fit_data = data[len(U_BOOT_DATA):-len(U_BOOT_NODTB_DATA)]