[PATCH] binman: Fill in most of the imx8mimage and imx8mcst tests

Marek Vasut marex at denx.de
Sun Jan 5 21:36:42 CET 2025


Rename the test .dts and tests and include the M suffix to indicate
those tests are for i.MX8M, not for i.MX8, which is a different SoC.

Update 339_nxp_imx8m.dts, add testNxpImx8MImageMkimageMissing and
update nxp_imx8mimage.py test to bring nxp_imx8mimage test to 100% .

Add 343..345_nxp_imx8m.dts, add matching tests and update nxp_imx8mcst.py
to bring CST tests to 97% . It is not clear how to test the CST output
file to reach 100%.

Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: Brian Ruley <brian.ruley at gehealthcare.com>
Cc: Paul HENRYS <paul.henrys_ext at softathome.com>
Cc: Rasmus Villemoes <ravi at prevas.dk>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tim Harvey <tharvey at gateworks.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 tools/binman/etype/nxp_imx8mcst.py            |  4 --
 tools/binman/etype/nxp_imx8mimage.py          |  4 --
 tools/binman/ftest.py                         | 42 +++++++++++++++++--
 .../{339_nxp_imx8.dts => 339_nxp_imx8m.dts}   |  3 ++
 tools/binman/test/343_nxp_imx8m.dts           | 26 ++++++++++++
 tools/binman/test/344_nxp_imx8m.dts           | 28 +++++++++++++
 tools/binman/test/345_nxp_imx8m.dts           | 19 +++++++++
 7 files changed, 115 insertions(+), 11 deletions(-)
 rename tools/binman/test/{339_nxp_imx8.dts => 339_nxp_imx8m.dts} (93%)
 create mode 100644 tools/binman/test/343_nxp_imx8m.dts
 create mode 100644 tools/binman/test/344_nxp_imx8m.dts
 create mode 100644 tools/binman/test/345_nxp_imx8m.dts

diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py
index dd9f226b751..c36a8f68971 100644
--- a/tools/binman/etype/nxp_imx8mcst.py
+++ b/tools/binman/etype/nxp_imx8mcst.py
@@ -181,10 +181,6 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
         upto = 0x00
         for entry in super().GetEntries().values():
             entry.SetOffsetSize(upto, None)
-
-            # Give up if any entries lack a size
-            if entry.size is None:
-                return
             upto += entry.size
 
         Entry_section.SetImagePos(self, image_pos)
diff --git a/tools/binman/etype/nxp_imx8mimage.py b/tools/binman/etype/nxp_imx8mimage.py
index 8ad177b3b65..8d14e16154a 100644
--- a/tools/binman/etype/nxp_imx8mimage.py
+++ b/tools/binman/etype/nxp_imx8mimage.py
@@ -66,10 +66,6 @@ class Entry_nxp_imx8mimage(Entry_mkimage):
         upto = 0x00
         for entry in super().GetEntries().values():
             entry.SetOffsetSize(upto, None)
-
-            # Give up if any entries lack a size
-            if entry.size is None:
-                return
             upto += entry.size
 
         Entry_section.SetImagePos(self, image_pos)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a553ca9e564..467f24a85d5 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -7822,9 +7822,45 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         self.assertIn('Symbol-writing: no value for /binman/section/u-boot',
                       out)
 
-    def testNxpImx8Image(self):
-        """Test that binman can produce an iMX8 image"""
-        self._DoTestFile('339_nxp_imx8.dts')
+    def testNxpImx8MImage(self):
+        """Test that binman can produce an iMX8M image"""
+        self._DoTestFile('339_nxp_imx8m.dts')
+
+    def testNxpImx8MImageMkimageMissing(self):
+        """Test that binman can produce an iMX8M image"""
+        with test_util.capture_sys_output() as (_, stderr):
+            self._DoTestFile('339_nxp_imx8m.dts',
+                             force_missing_bintools='mkimage')
+        err = stderr.getvalue()
+        self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage")
+
+    def testNxpImx8MCSTSPL(self):
+        """Test that binman can sign an iMX8M SPL image"""
+        self._DoTestFile('343_nxp_imx8m.dts')
+
+    def testNxpImx8MCSTFIT(self):
+        """Test that binman can sign an iMX8M FIT image"""
+        self._DoTestFile('344_nxp_imx8m.dts')
+
+    def testNxpImx8MCSTUnknown(self):
+        """Test that binman can sign an iMX8M Unknown image"""
+        self._DoTestFile('345_nxp_imx8m.dts')
+
+    def testNxpImx8MCSTMkimageMissing(self):
+        """Test that binman can sign an iMX8M image"""
+        with test_util.capture_sys_output() as (_, stderr):
+            self._DoTestFile('343_nxp_imx8m.dts',
+                             force_missing_bintools='mkimage')
+        err = stderr.getvalue()
+        self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage")
+
+    def testNxpImx8MCSTtoolMissing(self):
+        """Test that binman can sign an iMX8M image"""
+        with test_util.capture_sys_output() as (_, stderr):
+            self._DoTestFile('343_nxp_imx8m.dts',
+                             force_missing_bintools='cst')
+        err = stderr.getvalue()
+        self.assertRegex(err, "Image 'image'.*missing bintools.*: cst")
 
     def testFitSignSimple(self):
         """Test that image with FIT and signature nodes can be signed"""
diff --git a/tools/binman/test/339_nxp_imx8.dts b/tools/binman/test/339_nxp_imx8m.dts
similarity index 93%
rename from tools/binman/test/339_nxp_imx8.dts
rename to tools/binman/test/339_nxp_imx8m.dts
index cb512ae9aa2..2c8f4bee5b7 100644
--- a/tools/binman/test/339_nxp_imx8.dts
+++ b/tools/binman/test/339_nxp_imx8m.dts
@@ -12,6 +12,9 @@
 			nxp,boot-from = "sd";
 			nxp,rom-version = <1>;
 			nxp,loader-address = <0x10>;
+
+			section {
+			};
 		};
 	};
 };
diff --git a/tools/binman/test/343_nxp_imx8m.dts b/tools/binman/test/343_nxp_imx8m.dts
new file mode 100644
index 00000000000..5e76a97641b
--- /dev/null
+++ b/tools/binman/test/343_nxp_imx8m.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		nxp-imx8mcst {
+			args;	/* TODO: Needed by mkimage etype superclass */
+			nxp,loader-address = <0x12340000>;
+			nxp,unlock;
+
+			nxp-imx8mimage {
+				args;	/* TODO: Needed by mkimage etype superclass */
+				nxp,boot-from = "sd";
+				nxp,rom-version = <1>;
+				nxp,loader-address = <0x10>;
+
+				section {
+				};
+			};
+		};
+	};
+};
diff --git a/tools/binman/test/344_nxp_imx8m.dts b/tools/binman/test/344_nxp_imx8m.dts
new file mode 100644
index 00000000000..c38267bb815
--- /dev/null
+++ b/tools/binman/test/344_nxp_imx8m.dts
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		nxp-imx8mcst {
+			nxp,loader-address = <0x12340000>;
+			nxp,fast-auth;
+			offset = <0x58000>;
+			args;	/* Needed by mkimage etype superclass */
+
+			fit {
+				description = "test desc";
+				#address-cells = <1>;
+
+				images {
+				};
+
+				configurations {
+				};
+			};
+		};
+	};
+};
diff --git a/tools/binman/test/345_nxp_imx8m.dts b/tools/binman/test/345_nxp_imx8m.dts
new file mode 100644
index 00000000000..0ed6e3ca9d0
--- /dev/null
+++ b/tools/binman/test/345_nxp_imx8m.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		nxp-imx8mcst {
+			nxp,loader-address = <0x12340000>;
+			offset = <0x58000>;
+			args;	/* Needed by mkimage etype superclass */
+
+			u-boot {
+			};
+		};
+	};
+};
-- 
2.45.2



More information about the U-Boot mailing list