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

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


Add an entry type for u-boot-nodtb.bin.gz, which is a GZIP 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/u_boot_nodtb_gzip.py     | 28 +++++++++++++++++++++
 tools/binman/ftest.py                       |  5 ++++
 tools/binman/test/282_u_boot_nodtb_gzip.dts | 11 ++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_nodtb_gzip.py
 create mode 100644 tools/binman/test/282_u_boot_nodtb_gzip.dts

diff --git a/tools/binman/etype/u_boot_nodtb_gzip.py b/tools/binman/etype/u_boot_nodtb_gzip.py
new file mode 100644
index 0000000000..e8afd3de57
--- /dev/null
+++ b/tools/binman/etype/u_boot_nodtb_gzip.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.gz'
+#
+
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_nodtb_gzip(Entry_blob):
+    """U-Boot compressed flat binary without device tree appended
+
+    Properties / Entry arguments:
+        - filename: Filename to include ('u-boot-nodtb.bin.gz')
+
+    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.gz'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 43b4f850a6..933ebcbd35 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -42,6 +42,7 @@ from u_boot_pylib import tout
 # Contents of test files, corresponding to different entry types
 U_BOOT_DATA           = b'1234'
 U_BOOT_IMG_DATA       = b'img'
+U_BOOT_NODTB_GZ_DATA  = b'uboot nodtb gz'
 U_BOOT_SPL_DATA       = b'56780123456789abcdefghijklm'
 U_BOOT_TPL_DATA       = b'tpl9876543210fedcbazywvuts'
 U_BOOT_VPL_DATA       = b'vpl76543210fedcbazywxyz_'
@@ -6676,6 +6677,10 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
                                 ['fit'])
         self.assertIn("Node '/fit': Missing tool: 'mkimage'", str(e.exception))
 
+    def testUBootnodtbBinGz(self):
+	"""Test that u-boot-nodtb.bin.gz can be put in a file"""
+	data = self._DoReadFile('279_u_boot_nodtb_gzip.dts')
+	self.assertEqual(U_BOOT_NODTB_GZ_DATA, data)
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/282_u_boot_nodtb_gzip.dts b/tools/binman/test/282_u_boot_nodtb_gzip.dts
new file mode 100644
index 0000000000..79eecea202
--- /dev/null
+++ b/tools/binman/test/282_u_boot_nodtb_gzip.dts
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-nodtb-bin-gz {
+		};
+	};
+};
-- 
2.25.1



More information about the U-Boot mailing list