[PATCH v3 13/13] binman: Support missing compression tools

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Tue Aug 16 08:41:51 CEST 2022


From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

Handle missing compression tools by returning empty data and marking the
entry as 'missing'.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>

---

Changes in v3:
- Added

 tools/binman/entry.py | 4 ++++
 tools/binman/ftest.py | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 9ec5811b46..c86b757a4e 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -1078,7 +1078,11 @@ features to produce new behaviours.
         """
         self.uncomp_data = indata
         if self.compress != 'none':
+            if not comp_util.is_present(self.compress):
+                self.missing = True
+                return b''
             self.uncomp_size = len(indata)
+
         data = comp_util.compress(indata, self.compress)
         return data
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a360ebeef5..eac7ccb087 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -2557,6 +2557,14 @@ class TestFunctional(unittest.TestCase):
             }
         self.assertEqual(expected, props)
 
+    def testCompressMissingBintool(self):
+        """Test that compress of device-tree files with missing bintool is
+        supported
+        """
+        data = self.data = self._DoReadFileRealDtb('236_compress_dtb_missing_bintool.dts')
+        self.assertEqual(U_BOOT_DATA, data[:len(U_BOOT_DATA)])
+        dtb_data = data[len(U_BOOT_DATA):]
+        self.assertEqual(0, len(dtb_data))
 
     def testCbfsUpdateFdt(self):
         """Test that we can update the device tree with CBFS offset/size info"""
-- 
2.30.2



More information about the U-Boot mailing list