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

Jonas Karlman
2023-02-19T22:03:55Z

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(-)

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')
--
2.39.2