From: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>
Handle missing compression tools by returning empty data and marking the entry as 'missing'. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com> --- Changes in v4: - Add missing 236_compress_dtb_missing_bintool.dts file Changes in v3: - Added tools/binman/entry.py | 4 ++++ tools/binman/ftest.py | 8 ++++++++ .../test/236_compress_dtb_missing_bintool.dts | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tools/binman/test/236_compress_dtb_missing_bintool.dts 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""" diff --git a/tools/binman/test/236_compress_dtb_missing_bintool.dts b/tools/binman/test/236_compress_dtb_missing_bintool.dts new file mode 100644 index 0000000000..e7ce1b893d --- /dev/null +++ b/tools/binman/test/236_compress_dtb_missing_bintool.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-dtb { + compress = "_testing"; + }; + }; +}; -- 2.30.2