diff mbox series

[5/9] binman: Implement missing check functions in mkimage entry

Message ID 20230219220158.4160763-6-jonas@kwiboo.se
State Changes Requested
Delegated to: Simon Glass
Headers show
Series binman: Show missing blob message when building U-Boot | expand

Commit Message

Jonas Karlman Feb. 19, 2023, 10:02 p.m. UTC
The mkimage entry is working like a section entry but inherits from
Entry not Entry_section. Copy implementations of missing Check-functions
from Entry_section and adopt to Entry_mkimage.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 tools/binman/etype/mkimage.py | 44 ++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

Comments

Simon Glass Feb. 21, 2023, 7:41 p.m. UTC | #1
On Sun, 19 Feb 2023 at 15:02, Jonas Karlman <jonas@kwiboo.se> wrote:
>
> The mkimage entry is working like a section entry but inherits from
> Entry not Entry_section. Copy implementations of missing Check-functions
> from Entry_section and adopt to Entry_mkimage.
>
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> ---
>  tools/binman/etype/mkimage.py | 44 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 43 insertions(+), 1 deletion(-)

Again I suspect this needs a test to make sure it works?
diff mbox series

Patch

diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index cb264c3cad0b..49d3462a154c 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -206,16 +206,31 @@  class Entry_mkimage(Entry):
             self._imagename.SetAllowMissing(allow_missing)
 
     def SetAllowFakeBlob(self, allow_fake):
-        """Set whether the sub nodes allows to create a fake blob
+        """Set whether a section allows to create a fake blob
 
         Args:
             allow_fake: True if allowed, False if not allowed
         """
+        super().SetAllowFakeBlob(allow_fake)
         for entry in self._mkimage_entries.values():
             entry.SetAllowFakeBlob(allow_fake)
         if self._imagename:
             self._imagename.SetAllowFakeBlob(allow_fake)
 
+    def CheckMissing(self, missing_list):
+        """Check if any entries in this section have missing external blobs
+
+        If there are missing (non-optional) blobs, the entries are added to the
+        list
+
+        Args:
+            missing_list: List of Entry objects to be added to
+        """
+        for entry in self._mkimage_entries.values():
+            entry.CheckMissing(missing_list)
+        if self._imagename:
+            self._imagename.CheckMissing(missing_list)
+
     def CheckFakedBlobs(self, faked_blobs_list):
         """Check if any entries in this section have faked external blobs
 
@@ -229,6 +244,33 @@  class Entry_mkimage(Entry):
         if self._imagename:
             self._imagename.CheckFakedBlobs(faked_blobs_list)
 
+    def CheckOptional(self, optional_list):
+        """Check the section for missing but optional external blobs
+
+        If there are missing (optional) blobs, the entries are added to the list
+
+        Args:
+            optional_list (list): List of Entry objects to be added to
+        """
+        for entry in self._mkimage_entries.values():
+            entry.CheckOptional(optional_list)
+        if self._imagename:
+            self._imagename.CheckOptional(optional_list)
+
+    def check_missing_bintools(self, missing_list):
+        """Check if any entries in this section have missing bintools
+
+        If there are missing bintools, these are added to the list
+
+        Args:
+            missing_list: List of Bintool objects to be added to
+        """
+        super().check_missing_bintools(missing_list)
+        for entry in self._mkimage_entries.values():
+            entry.check_missing_bintools(missing_list)
+        if self._imagename:
+            self._imagename.check_missing_bintools(missing_list)
+
     def AddBintools(self, btools):
         super().AddBintools(btools)
         self.mkimage = self.AddBintool(btools, 'mkimage')