diff options
| author | Yannic Moog <y.moog@phytec.de> | 2025-06-13 14:02:41 +0200 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-06-26 09:54:05 -0600 |
| commit | 3ae668b9d2101d111d257ee7d8912c19cfb0e102 (patch) | |
| tree | fbcc5ce03efe4f1e28c572e5bcdc49a385514475 | |
| parent | a657d87f08789c4c50423897bd5ee052c6223ee6 (diff) | |
binman: mark optional missing blobs as absent
Optional blobs should mark themselves as absent to avoid being packed
into an image.
Extend the documentation of this behaviour. Although the documentation
implied this before, the "optional" property had not been explained
properly before.
The behaviour will change as now absent entries are no longer
packed into an image. The image map will also reflect this.
As a result, the CheckForProblems() function will no longer alert on
optional (blob) entries. This is because the missing optional images
were removed before CheckForProblems is called.
Adjust the testExtblobOptional test case to highlight that we are
testing not only an optional image but the image is missing as well. The
behaviour for these is different where the latter will not be packaged
into the image.
Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Yannic Moog <y.moog@phytec.de>
Reviewed-by: Bryan Brattlof <bb@ti.com>
| -rw-r--r-- | tools/binman/binman.rst | 7 | ||||
| -rw-r--r-- | tools/binman/etype/blob.py | 2 | ||||
| -rw-r--r-- | tools/binman/ftest.py | 8 |
3 files changed, 12 insertions, 5 deletions
diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 84b1331df5c..392e507d449 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -1143,6 +1143,13 @@ Optional entries Some entries need to exist only if certain conditions are met. For example, an entry may want to appear in the image only if a file has a particular format. +Also, the ``optional`` property may be used to mark entries as optional:: + + tee-os { + filename = "tee.bin"; + optional; + }; + Obviously the entry must exist in the image description for it to be processed at all, so a way needs to be found to have the entry remove itself. diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py index 970fae91cd9..acd9ae34074 100644 --- a/tools/binman/etype/blob.py +++ b/tools/binman/etype/blob.py @@ -52,6 +52,8 @@ class Entry_blob(Entry): fake_size = self.assume_size self._pathname = self.check_fake_fname(self._filename, fake_size) self.missing = True + if self.optional: + self.mark_absent("missing but optional") if not self.faked: content_size = 0 if self.assume_size: # Ensure we get test coverage on next line diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 4cf7dfc8216..4a8d330c8f8 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -84,6 +84,7 @@ FILES_DATA = (b"sorry I'm late\nOh, don't bother apologising, I'm " + b"sorry you're alive\n") COMPRESS_DATA = b'compress xxxxxxxxxxxxxxxxxxxxxx data' COMPRESS_DATA_BIG = COMPRESS_DATA * 2 +MISSING_DATA = b'missing' REFCODE_DATA = b'refcode' FSP_M_DATA = b'fsp_m' FSP_S_DATA = b'fsp_s' @@ -6537,15 +6538,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)", str(exc.exception)) - def testExtblobOptional(self): + def testExtblobMissingOptional(self): """Test an image with an external blob that is optional""" with terminal.capture() as (stdout, stderr): data = self._DoReadFile('266_blob_ext_opt.dts') self.assertEqual(REFCODE_DATA, data) - err = stderr.getvalue() - self.assertRegex( - err, - "Image '.*' is missing optional external blobs but is still functional: missing") + self.assertNotIn(MISSING_DATA, data) def testSectionInner(self): """Test an inner section with a size""" |
