[PATCH v2 4/7] binman: Override CheckOptional in fit entry

Jonas Karlman jonas at kwiboo.se
Tue Jul 18 22:34:36 CEST 2023


Missing optional blobs was not reported for generated entries, e.g.
tee-os on rockchip targets. Implement a CheckOptional to fix this.

After this the following can be shown:

  Image 'simple-bin' is missing optional external blobs but is still functional: tee-os

  /binman/simple-bin/fit/images/@tee-SEQ/tee-os (tee-os):
     See the documentation for your board. You may need to build Open Portable
     Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v2:
- Add test
- Collect r-b tag

 tools/binman/etype/fit.py                | 7 +++++++
 tools/binman/ftest.py                    | 7 +++++++
 tools/binman/test/264_tee_os_opt_fit.dts | 1 +
 3 files changed, 15 insertions(+)

diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index ef4d0667578d..2c14b15b03cd 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -842,6 +842,13 @@ class Entry_fit(Entry_section):
         for entry in self._priv_entries.values():
             entry.CheckMissing(missing_list)
 
+    def CheckOptional(self, optional_list):
+        # We must use our private entry list for this since generator nodes
+        # which are removed from self._entries will otherwise not show up as
+        # optional
+        for entry in self._priv_entries.values():
+            entry.CheckOptional(optional_list)
+
     def CheckEntries(self):
         pass
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 152f800c676c..40ef6e5dce99 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6298,6 +6298,13 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
                          fdt_util.fdt32_to_cpu(node.props['entry'].value))
         self.assertEqual(U_BOOT_DATA, node.props['data'].bytes)
 
+        with test_util.capture_sys_output() as (stdout, stderr):
+            self.checkFitTee('264_tee_os_opt_fit.dts', '')
+        err = stderr.getvalue()
+        self.assertRegex(
+            err,
+            "Image '.*' is missing optional external blobs but is still functional: tee-os")
+
     def testFitTeeOsOptionalFitBad(self):
         """Test an image with a FIT with an optional OP-TEE binary"""
         with self.assertRaises(ValueError) as exc:
diff --git a/tools/binman/test/264_tee_os_opt_fit.dts b/tools/binman/test/264_tee_os_opt_fit.dts
index ae44b433edf1..e9634d3ccdcd 100644
--- a/tools/binman/test/264_tee_os_opt_fit.dts
+++ b/tools/binman/test/264_tee_os_opt_fit.dts
@@ -25,6 +25,7 @@
 					fit,data;
 
 					tee-os {
+						optional;
 					};
 				};
 			};
-- 
2.41.0



More information about the U-Boot mailing list