[PATCH 09/10] binman: Add support for u-boot-nodtb.bin.lzma as an input binary

Manoj Sai abbaraju.manojsai at amarulasolutions.com
Fri Jun 30 14:11:45 CEST 2023


Add an entry type for u-boot-nodtb.bin.lzma, which is a LZMA compressed
raw u-boot binary and a simple test.

Signed-off-by: Manoj Sai <abbaraju.manojsai at amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil at amarulasolutions.com>
---
 tools/binman/etype/283_u_boot_nodtb_lzma.dts | 11 ++++++++
 tools/binman/etype/u_boot_nodtb_lzma.py      | 28 ++++++++++++++++++++
 tools/binman/ftest.py                        |  6 +++++
 3 files changed, 45 insertions(+)
 create mode 100644 tools/binman/etype/283_u_boot_nodtb_lzma.dts
 create mode 100644 tools/binman/etype/u_boot_nodtb_lzma.py

diff --git a/tools/binman/etype/283_u_boot_nodtb_lzma.dts b/tools/binman/etype/283_u_boot_nodtb_lzma.dts
new file mode 100644
index 0000000000..d9a834acf6
--- /dev/null
+++ b/tools/binman/etype/283_u_boot_nodtb_lzma.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-nodtb-bin-lzma {
+		};
+	};
+};
diff --git a/tools/binman/etype/u_boot_nodtb_lzma.py b/tools/binman/etype/u_boot_nodtb_lzma.py
new file mode 100644
index 0000000000..c2874aa6e9
--- /dev/null
+++ b/tools/binman/etype/u_boot_nodtb_lzma.py
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2023 Amarula Solutions India
+# Written by Suniel Mahesh <sunil at amarulasolutions.com>
+# Reference from Simon Glass <sjg at chromium.org>
+#
+# Entry-type module for 'u-boot-nodtb.bin.lzma'
+#
+
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_nodtb_lzma(Entry_blob):
+    """U-Boot compressed flat binary without device tree appended
+
+    Properties / Entry arguments:
+        - filename: Filename to include ('u-boot-nodtb.bin.lzma')
+
+    This is the U-Boot compressed raw binary, before allowing it to relocate
+    itself at runtime it should be decompressed. It does not include a device
+    tree blob at the end of it so normally cannot work without it. You can add a
+    u-boot-dtb entry after this one, or use a u-boot entry instead, normally
+    expands to a section containing u-boot and u-boot-dtb
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+
+    def GetDefaultFilename(self):
+        return 'u-boot-nodtb.bin.lzma'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 933ebcbd35..d1715523d2 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -43,6 +43,7 @@ from u_boot_pylib import tout
 U_BOOT_DATA           = b'1234'
 U_BOOT_IMG_DATA       = b'img'
 U_BOOT_NODTB_GZ_DATA  = b'uboot nodtb gz'
+U_BOOT_NODTB_LZMA_DATA  = b'uboot nodtb lzma'
 U_BOOT_SPL_DATA       = b'56780123456789abcdefghijklm'
 U_BOOT_TPL_DATA       = b'tpl9876543210fedcbazywvuts'
 U_BOOT_VPL_DATA       = b'vpl76543210fedcbazywxyz_'
@@ -6682,5 +6683,10 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
 	data = self._DoReadFile('279_u_boot_nodtb_gzip.dts')
 	self.assertEqual(U_BOOT_NODTB_GZ_DATA, data)
 
+   def testUBootnodtbBinLzma(self):
+	"""Test that u-boot-nodtb.bin.lzma can be put in a file"""
+	data = self._DoReadFile('280_u_boot_nodtb_lzma.dts')
+	self.assertEqual(U_BOOT_NODTB_LZMA_DATA, data)
+
 if __name__ == "__main__":
     unittest.main()
-- 
2.25.1



More information about the U-Boot mailing list