]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Allow faked blobs in blob-ext-list
authorSimon Glass <sjg@chromium.org>
Mon, 10 Jan 2022 03:13:46 +0000 (20:13 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 25 Jan 2022 19:36:11 +0000 (12:36 -0700)
Since this is a list of blobs, each blob should have the ability to be
faked, as with blob-ext. Update the Entry base class to set allow_fake
and use the base class in the section code also, so that this propagagtes
to blob-ext-list, which is not a section.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/entry.py
tools/binman/etype/blob_ext_list.py
tools/binman/etype/section.py
tools/binman/ftest.py
tools/binman/test/218_blob_ext_list_fake.dts [new file with mode: 0644]

index bac90bbbcde25794ca3d75657e7a7d3100ea7f95..e4a1f2d5d5c4e5a8db49bcf4fe0cb7de26eea972 100644 (file)
@@ -960,7 +960,7 @@ features to produce new behaviours.
         Args:
             allow_fake: True if allowed, False if not allowed
         """
-        pass
+        self.allow_fake = allow_fake
 
     def CheckMissing(self, missing_list):
         """Check if any entries in this section have missing external blobs
index 136ae819946fa5ae4748b1a0f6af3720b685b953..29c9092dc354765f9667468c76191c57ce45faff 100644 (file)
@@ -37,6 +37,7 @@ class Entry_blob_ext_list(Entry_blob):
         missing = False
         pathnames = []
         for fname in self._filenames:
+            fname = self.check_fake_fname(fname)
             pathname = tools.GetInputFilename(
                 fname, self.external and self.section.GetAllowMissing())
             # Allow the file to be missing
index 7a55d0323188828fcba434bb3ab43bdc3a1dba29..fdd4cbb21adbff2efa3f0631f65d70f9e1fe0297 100644 (file)
@@ -805,6 +805,7 @@ class Entry_section(Entry):
         Args:
             allow_fake_blob: True if allowed, False if not allowed
         """
+        super().SetAllowFakeBlob(allow_fake)
         for entry in self._entries.values():
             entry.SetAllowFakeBlob(allow_fake)
 
index 6a7647311ba37818955d5899dcbb3be691a8d717..ac6aabbf9c344a569b352c79543fb7e08078e544 100644 (file)
@@ -4982,6 +4982,14 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
             err,
             "Image '.*' has faked external blobs and is non-functional: .*")
 
+    def testExtblobListFaked(self):
+        """Test an extblob with missing external blob that are faked"""
+        with test_util.capture_sys_output() as (stdout, stderr):
+            self._DoTestFile('216_blob_ext_list_missing.dts',
+                             allow_fake_blobs=True)
+        err = stderr.getvalue()
+        self.assertRegex(err, "Image 'main-section'.*faked.*: blob-ext-list")
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/218_blob_ext_list_fake.dts b/tools/binman/test/218_blob_ext_list_fake.dts
new file mode 100644 (file)
index 0000000..54ee54f
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               blob-ext-list {
+                       filenames = "refcode.bin", "fake-file";
+               };
+       };
+};