Skip to contentSkip to conversation

binman: Fill in most of the imx8mimage and imx8mcst tests

PATCH Applied Marek Vasut 5 participants 31 messages Jan 5, 2025 – May 5, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 binman: Fill in most of the imx8mimage and imx8mcst tests

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%.

---
Cc: Brian Ruley <[email protected]>
Cc: Paul HENRYS <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 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
tools/binman/etype/nxp_imx8mcst.py +0 -4
index dd9f226b751..c36a8f68971 100644
@@ -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)
tools/binman/etype/nxp_imx8mimage.py +0 -4
index 8ad177b3b65..8d14e16154a 100644
@@ -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)
tools/binman/ftest.py +39 -3

48 lines not on this page · raw message

tools/binman/test/339_nxp_imx8m.dts renamed from tools/binman/test/339_nxp_imx8.dts +3 -0
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
@@ -12,6 +12,9 @@
 			nxp,boot-from = "sd";
 			nxp,rom-version = <1>;
 			nxp,loader-address = <0x10>;
+
+			section {
+			};
 		};
 	};
 };
tools/binman/test/343_nxp_imx8m.dts new file +26 -0
new file mode 100644
index 00000000000..5e76a97641b
@@ -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 {
+				};
+			};
+		};
+	};
+};
tools/binman/test/344_nxp_imx8m.dts new file +28 -0
new file mode 100644
index 00000000000..c38267bb815
@@ -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 {
+				};
+			};
+		};
+	};
+};
tools/binman/test/345_nxp_imx8m.dts new file +19 -0
new file mode 100644
index 00000000000..0ed6e3ca9d0
@@ -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 {
+			};
+		};
+	};
+};
Signature · 1 line
2.45.2
#1 lore raw

Hi Marek,

Quoted 20 lines · Marek Vasut

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%.

---
Cc: Brian Ruley <[email protected]>
Cc: Paul HENRYS <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

Quoted 14 lines
---
 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

Thanks for looking at this! For me I get an error when applying to -next:

$binman test
======================== Running binman tests ======================== ............................................................................................................................................................................................................................................................................E................................E.................................E.....................................................................................................................E...............................................................................................................................
======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTSPL (subunit.RemotedTestCase)
binman.ftest.TestFunctional.testNxpImx8MCSTSPL
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
ValueError: Error 1 running 'cst -i
/tmp/binman.kv3d4uif/nxp.csf-config-txt.nxp-imx8mcst -o
/tmp/binman.kv3d4uif/nxp.csf-output-blob.nxp-imx8mcst': Install SRK
File not present SRK_1_2_3_4_table.bin

======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTFIT (subunit.RemotedTestCase) binman.ftest.TestFunctional.testNxpImx8MCSTFIT
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
ValueError: Error 1 running 'cst -i /tmp/binman.jh5hnl3s/nxp.csf-config-txt.nxp-imx8mcst -o /tmp/binman.jh5hnl3s/nxp.csf-output-blob.nxp-imx8mcst': Install SRK File not present SRK_1_2_3_4_table.bin

======================================================================
ERROR: binman.ftest.TestFunctional.testSimpleFitEncryptedData (subunit.RemotedTestCase) binman.ftest.TestFunctional.testSimpleFitEncryptedData
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
KeyError: 'iv'

======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing (subunit.RemotedTestCase) binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
struct.error: unpack requires a buffer of 4 bytes

----------------------------------------------------------------------
Ran 581 tests in 1.784s

FAILED (errors=4)

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Regards,
SImon

#2 lore raw

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Perhaps. Can you suggest a fix ?

I am also unsure how to get the CST test to 100%.

I still don't fully understand what exactly are these tests testing or whether they are even valid.

#3 lore raw

Hi Marek,

Quoted 16 lines · Marek Vasut

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform
Quoted 6 lines

Perhaps. Can you suggest a fix ?

I am also unsure how to get the CST test to 100%.

I still don't fully understand what exactly are these tests testing or whether they are even valid.

Well, if I could run the test and have it pass (like presumably you do) then I could suggest something. Could you point me to a cst binary which works for you and makes your tests pass?

Regards,
Simon

#4 lore raw
Quoted 21 lines · Simon Glass

Hi Marek,

Quoted 18 lines · Marek Vasut

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Perhaps. Can you suggest a fix ?

Quoted 8 lines
Quoted 4 lines

I am also unsure how to get the CST test to 100%.

I still don't fully understand what exactly are these tests testing or whether they are even valid.

Well, if I could run the test and have it pass (like presumably you do) then I could suggest something. Could you point me to a cst binary which works for you and makes your tests pass?

CST 3.4.0 from debian/testing works with real hardware.

#5 lore raw

Hi Marek,

Quoted 25 lines · Marek Vasut
Quoted 23 lines · Simon Glass

Hi Marek,

Quoted 20 lines · Marek Vasut

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Perhaps. Can you suggest a fix ?

I am also unsure how to get the CST test to 100%.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

I still don't fully understand what exactly are these tests testing or whether they are even valid.

Well, if I could run the test and have it pass (like presumably you do) then I could suggest something. Could you point me to a cst binary which works for you and makes your tests pass?

CST 3.4.0 from debian/testing works with real hardware.

Unfortunately after much messing around I cannot install this on my machine (jammy). I do plan to upgrade to Noble at some point. But we cannot rely on people having a particular distro to build U-Boot images. That is what 'binman tool' is supposed to fix.

I got the package source and tried that. The build instructions use docker, which I have not mastered. The container needs curl but does not have it.

I was able to build it from source code without docker. Is there a public source-code repo somewhere, so Binman could build it?

Anyway, with this patch applied and the new cst:

$ binman test testNxpImx8MCSTSPL
======================== Running binman tests ========================
E
======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTSPL (subunit.RemotedTestCase)
binman.ftest.TestFunctional.testNxpImx8MCSTSPL
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
ValueError: Error 1 running 'cst -i
/tmp/binman.t45m9_fv/nxp.csf-config-txt.nxp-imx8mcst -o
/tmp/binman.t45m9_fv/nxp.csf-output-blob.nxp-imx8mcst': File not
present SRK_1_2_3_4_table.bin

----------------------------------------------------------------------
Ran 1 test in 0.151s

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

Regards,
Simon

#7 lore raw
In reply to Simon Glass
Quoted 64 lines · Simon Glass

Hi Marek,

Quoted 25 lines · Marek Vasut
Quoted 23 lines · Simon Glass

Hi Marek,

Quoted 20 lines · Marek Vasut

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Perhaps. Can you suggest a fix ?

I am also unsure how to get the CST test to 100%.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

I still don't fully understand what exactly are these tests testing or whether they are even valid.

Well, if I could run the test and have it pass (like presumably you do) then I could suggest something. Could you point me to a cst binary which works for you and makes your tests pass?

CST 3.4.0 from debian/testing works with real hardware.

Unfortunately after much messing around I cannot install this on my machine (jammy). I do plan to upgrade to Noble at some point. But we cannot rely on people having a particular distro to build U-Boot images. That is what 'binman tool' is supposed to fix.

I got the package source and tried that. The build instructions use docker, which I have not mastered. The container needs curl but does not have it.

I was able to build it from source code without docker. Is there a public source-code repo somewhere, so Binman could build it?

Anyway, with this patch applied and the new cst:

$ binman test testNxpImx8MCSTSPL
======================== Running binman tests ========================
E
======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTSPL (subunit.RemotedTestCase)
binman.ftest.TestFunctional.testNxpImx8MCSTSPL
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
ValueError: Error 1 running 'cst -i
/tmp/binman.t45m9_fv/nxp.csf-config-txt.nxp-imx8mcst -o
/tmp/binman.t45m9_fv/nxp.csf-output-blob.nxp-imx8mcst': File not
present SRK_1_2_3_4_table.bin
Quoted 6 lines

----------------------------------------------------------------------
Ran 1 test in 0.151s

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

#8 lore raw

Hi,

Quoted 72 lines · Marek Vasut
Quoted 64 lines · Simon Glass

Hi Marek,

Quoted 25 lines · Marek Vasut
Quoted 23 lines · Simon Glass

Hi Marek,

Quoted 20 lines · Marek Vasut

On 1/6/25 3:38 PM, Simon Glass wrote:

[...]

Quoted 11 lines

I wonder if the cst needs to be updated (binman tool -f cst)? At present it is using apt-get and has:

$ dpkg -l imx-code-signing-tool
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version             Architecture Description
+++-=====================-===================-============-===================================
ii  imx-code-signing-tool 3.3.1+dfsg-2ubuntu1 amd64        code
signing tool for i.MX platform

Perhaps. Can you suggest a fix ?

I am also unsure how to get the CST test to 100%.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

I still don't fully understand what exactly are these tests testing or whether they are even valid.

Well, if I could run the test and have it pass (like presumably you do) then I could suggest something. Could you point me to a cst binary which works for you and makes your tests pass?

CST 3.4.0 from debian/testing works with real hardware.

Unfortunately after much messing around I cannot install this on my machine (jammy). I do plan to upgrade to Noble at some point. But we cannot rely on people having a particular distro to build U-Boot images. That is what 'binman tool' is supposed to fix.

I got the package source and tried that. The build instructions use docker, which I have not mastered. The container needs curl but does not have it.

I was able to build it from source code without docker. Is there a public source-code repo somewhere, so Binman could build it?

Anyway, with this patch applied and the new cst:

$ binman test testNxpImx8MCSTSPL
======================== Running binman tests ========================
E
======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTSPL (subunit.RemotedTestCase)
binman.ftest.TestFunctional.testNxpImx8MCSTSPL
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
ValueError: Error 1 running 'cst -i
/tmp/binman.t45m9_fv/nxp.csf-config-txt.nxp-imx8mcst -o
/tmp/binman.t45m9_fv/nxp.csf-output-blob.nxp-imx8mcst': File not
present SRK_1_2_3_4_table.bin
Quoted 6 lines

----------------------------------------------------------------------
Ran 1 test in 0.151s

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

Quoted 8 lines

See the tool documentation:

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Regards,
SImon

#9 lore raw

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

Quoted 8 lines
Quoted 6 lines

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Is this relevant to finalizing this patch ?

#10 lore raw

Hi Marek,

Quoted 17 lines · Marek Vasut

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 12 lines
Quoted 11 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

Quoted 8 lines
Quoted 1 line

But with binman we want to avoid vendor scripts, etc.

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Is this relevant to finalizing this patch ?

Well, I don't see how the tests can pass if we can't build/run the tools needed.

Regards,
Simon

#11 lore raw
Quoted 22 lines · Simon Glass

Hi Marek,

Quoted 19 lines · Marek Vasut

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 13 lines
Quoted 11 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

Quoted 8 lines
Quoted 6 lines

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Is this relevant to finalizing this patch ?

Well, I don't see how the tests can pass if we can't build/run the tools needed.

Maybe you can try to use the shell scripts to generate the missing bin file ? I suspect the script does some openssl invocation, which can be reproduced in binman ?

#12 lore raw

Hi Marek,

Quoted 29 lines · Marek Vasut
Quoted 27 lines · Simon Glass

Hi Marek,

Quoted 24 lines · Marek Vasut

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

Quoted 8 lines
Quoted 6 lines

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Is this relevant to finalizing this patch ?

Well, I don't see how the tests can pass if we can't build/run the tools needed.

Maybe you can try to use the shell scripts to generate the missing bin file ? I suspect the script does some openssl invocation, which can be reproduced in binman ?

But 'binman tool -f <toolname>' is supposed to build/fetch the tool. So any such building should happen in that bintool.

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

Regards,
Simon

#13 lore raw
Quoted 39 lines · Simon Glass

Hi Marek,

Quoted 29 lines · Marek Vasut
Quoted 27 lines · Simon Glass

Hi Marek,

Quoted 24 lines · Marek Vasut

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

Quoted 8 lines
Quoted 6 lines

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Is this relevant to finalizing this patch ?

Well, I don't see how the tests can pass if we can't build/run the tools needed.

Maybe you can try to use the shell scripts to generate the missing bin file ? I suspect the script does some openssl invocation, which can be reproduced in binman ?

Quoted 6 lines

But 'binman tool -f <toolname>' is supposed to build/fetch the tool. So any such building should happen in that bintool.

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

What you are asking me for is not the tool itself, but key material, which is generated by these scripts.

Applied
#14 lore raw

Hi Marek,

Quoted 41 lines · Marek Vasut
Quoted 39 lines · Simon Glass

Hi Marek,

Quoted 35 lines · Marek Vasut
Quoted 22 lines · Simon Glass

Hi Marek,

Quoted 19 lines · Marek Vasut

On 2/6/25 1:42 PM, Simon Glass wrote:

Hi,

Quoted 13 lines
Quoted 11 lines
Quoted 3 lines

FAILED (errors=1)

So where is the SRK_1_2_3_4_table.bin file?

See the tool documentation:

https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/debian/3.4.0+dfsg-2/docs/CST_UG.pdf?ref_type=tags

3.1.2 Running the hab4_pki_tree script Example 3.1.2.1 Running the hab4_pki_tree script in interactive mode

The hab4_pki_tree.sh script should generate all those files.

But with binman we want to avoid vendor scripts, etc.

Quoted 8 lines
Quoted 6 lines

I believe the script internally runs openssl to generate that file.

Quoted 3 lines

Could someone take a look at updating tools/binman/btool/cst.py or similar to build the tool from source? There are examples of others that do this, e.g. bootgen.py

Is this relevant to finalizing this patch ?

Well, I don't see how the tests can pass if we can't build/run the tools needed.

Maybe you can try to use the shell scripts to generate the missing bin file ? I suspect the script does some openssl invocation, which can be reproduced in binman ?

Quoted 8 lines
Quoted 6 lines

But 'binman tool -f <toolname>' is supposed to build/fetch the tool. So any such building should happen in that bintool.

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

What you are asking me for is not the tool itself, but key material, which is generated by these scripts.

It looks like someone has done this here:

https://patchwork.ozlabs.org/project/uboot/list/?series=446218

so I think we are OK now.

I've applied that series to my tree.

Regards,
Simon

#15 lore raw

On 3/7/25 12:30 AM, Simon Glass wrote:

Hi,

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

What you are asking me for is not the tool itself, but key material, which is generated by these scripts.

Quoted 7 lines

It looks like someone has done this here:

https://patchwork.ozlabs.org/project/uboot/list/?series=446218

so I think we are OK now.

I've applied that series to my tree.

OK, does anything need to be done about this patch ?

#16 lore raw

Hi Marek,

Quoted 11 lines · Marek Vasut

On 3/7/25 12:30 AM, Simon Glass wrote:

Hi,

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

What you are asking me for is not the tool itself, but key material, which is generated by these scripts.

Quoted 8 lines
Quoted 7 lines

It looks like someone has done this here:

https://patchwork.ozlabs.org/project/uboot/list/?series=446218

so I think we are OK now.

I've applied that series to my tree.

OK, does anything need to be done about this patch ?

I'm not sure, but we should apply it anyway as it is a big step forward.

I did send a series to turn on code-coverage checks:

https://patchwork.ozlabs.org/project/uboot/list/?series=446956

Regards,
Simon

#17 lore raw

On 3/7/25 3:18 AM, Simon Glass wrote:

Hi,

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
Quoted 3 lines

One of the main goals of binman is to reduce the work needed to create a working image. If people have to go spelunking around the Internet, build it themselves, etc. that is not good.

What you are asking me for is not the tool itself, but key material, which is generated by these scripts.

It looks like someone has done this here:

https://patchwork.ozlabs.org/project/uboot/list/?series=446218

so I think we are OK now.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

I've applied that series to my tree.

OK, does anything need to be done about this patch ?

I'm not sure, but we should apply it anyway as it is a big step forward.

I did send a series to turn on code-coverage checks:

https://patchwork.ozlabs.org/project/uboot/list/?series=446956

So what should we do about this particular patch ?

Should this be applied ? Rebased ? Updated somehow ?

#20 lore raw

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Fabio Estevam

Hi Marek,

Quoted 2 lines · Marek Vasut

So what should we do about this particular patch ?

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Should this be applied ? Rebased ? Updated somehow ?

This patch causes a CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1057151

I think this might be what Simon was pointing out, but I never got any suggestion how to solve that.

There was a patch for this...and it looks like Tom has applied it:

19a342f9122 Merge patch series "binman: build_from_git: Add argument specifying branch"

Regards,
Simon

#21 lore raw
Quoted 17 lines · Simon Glass

Hi Marek,

Quoted 14 lines · Marek Vasut
Quoted 11 lines · Fabio Estevam

Hi Marek,

Quoted 3 lines · Marek Vasut

So what should we do about this particular patch ?

Should this be applied ? Rebased ? Updated somehow ?

This patch causes a CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1057151

Quoted 7 lines
Quoted 2 lines

I think this might be what Simon was pointing out, but I never got any suggestion how to solve that.

There was a patch for this...and it looks like Tom has applied it:

19a342f9122 Merge patch series "binman: build_from_git: Add argument specifying branch"

It is in u-boot/next , but it does not seem to help ?

#22 lore raw

Hi Marek,

Quoted 19 lines · Marek Vasut
Quoted 17 lines · Simon Glass

Hi Marek,

Quoted 14 lines · Marek Vasut
Quoted 11 lines · Fabio Estevam

Hi Marek,

Quoted 3 lines · Marek Vasut

So what should we do about this particular patch ?

Should this be applied ? Rebased ? Updated somehow ?

This patch causes a CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1057151

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think this might be what Simon was pointing out, but I never got any suggestion how to solve that.

There was a patch for this...and it looks like Tom has applied it:

19a342f9122 Merge patch series "binman: build_from_git: Add argument specifying branch"

It is in u-boot/next , but it does not seem to help ?

Did you figure it out?

I'm not really sure. It works fine in my tree and I just tested it now. Perhaps there are some other patches missing from Tom's tree?

Regards,
SImon

reviewer
#23 lore raw

Hi Simon,

Quoted 4 lines · Simon Glass

Did you figure it out?

I'm not really sure. It works fine in my tree and I just tested it now. Perhaps there are some other patches missing from Tom's tree?

Applying this patch causes the following CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1079236

======================== Running binman tests ======================== 142.........................................................................................................................................................................................................................................................................Image 'image' has missing bintools and is non-functional: cst
143Some images are invalid
144......................................Image 'image' has missing
bintools and is non-functional: cst
145Some images are invalid 146.........................................E................................................................................................................................................................................................s........................................... 147======================================================================
148ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing
(subunit.RemotedTestCase)
149binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing
150----------------------------------------------------------------------
151testtools.testresult.real._StringException: struct.error: unpack
requires a buffer of 4 bytes
152======================================================================
153SKIP: binman.cbfs_util_test.TestCbfs.test_cbfstool_failure
(subunit.RemotedTestCase)
154binman.cbfs_util_test.TestCbfs.test_cbfstool_failure
155----------------------------------------------------------------------
156No cbfstool available
157----------------------------------------------------------------------
158Ran 581 tests in 5.012s
159FAILED (errors=1, skipped=1)

What needs to be done to fix this error?

#24 lore raw

Hi,

Am Freitag, dem 28.03.2025 um 10:23 -0300 schrieb Fabio Estevam:

Quoted 51 lines

Hi Simon,

Quoted 4 lines · Simon Glass

Did you figure it out?

I'm not really sure. It works fine in my tree and I just tested it now. Perhaps there are some other patches missing from Tom's tree?

Applying this patch causes the following CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1079236

======================== Running binman tests
========================
142..................................................................
.....................................................................
.....................................................................
.............................................................Image 'image' has missing bintools and is non-functional: cst 143Some images are invalid 144......................................Image 'image' has missing bintools and is non-functional: cst
145Some images are invalid 146.........................................E........................
.....................................................................
.....................................................................
..............................s......................................
.....
147==================================================================
====
148ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing (subunit.RemotedTestCase) 149binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing 150------------------------------------------------------------------
----
151testtools.testresult.real._StringException: struct.error: unpack requires a buffer of 4 bytes 152==================================================================
====
153SKIP: binman.cbfs_util_test.TestCbfs.test_cbfstool_failure (subunit.RemotedTestCase) 154binman.cbfs_util_test.TestCbfs.test_cbfstool_failure 155------------------------------------------------------------------
----
156No cbfstool available 157------------------------------------------------------------------
----
158Ran 581 tests in 5.012s
159FAILED (errors=1, skipped=1)

Quoted 1 line

What needs to be done to fix this error?

The error looks like binman is never building the missing tools. Run something like:
./tools/binman/binman tool -f missing
before the binman tests.

This test setup uses .gitlab-ci.yml, right?

Leonard

reviewer
#25 lore raw

Hi Leonard,

Quoted 6 lines · Leonard Anderweit

The error looks like binman is never building the missing tools. Run something like:
./tools/binman/binman tool -f missing
before the binman tests.

This test setup uses .gitlab-ci.yml, right?

Yes, I think so.

Care to submit a patch that fixes this CI problem?

Thanks

#26 lore raw
Quoted 10 lines · Fabio Estevam

Hi Leonard,

Quoted 5 lines · Leonard Anderweit

The error looks like binman is never building the missing tools. Run something like:
./tools/binman/binman tool -f missing
before the binman tests.

Quoted 5 lines
Quoted 1 line

This test setup uses .gitlab-ci.yml, right?

Yes, I think so.

Care to submit a patch that fixes this CI problem?

And make similar changes to .azure-pipelines.yml as well please.

Signature · 1 line
Tom
reviewer
#27 lore raw

Hi Marek and Tom,

Quoted 1 line · Tom Rini

And make similar changes to .azure-pipelines.yml as well please.

I made another attempt and still get CI errors when applying this patch. zstd is not found in CI:

Starting build...

0 0 0 /1 -1 (starting)

1 0 0 /1 tools-only
Completed: 1 total built, 1 newly), duration 0:00:15, rate 0.07
Fetching tools: bootgen bzip2 cbfstool cst fdt_add_pubkey fdtgrep
fiptool futility gzip ifwitool lz4 lzma_alone lzop mkeficapsule mkimage openssl xz zstd
Fetch: cst
- trying method: binary download
- trying method: build from source
- clone git repo 'https://gitlab.apertis.org/pkg/imx-code-signing-tool' to '/tmp/binmanf.rgn_6enh'
- build target 'all'
- writing to '/home/uboot/.binman-tools/cst'
Fetch: zstd
- trying method: binary download
- sudo apt install -y zstd
Exception: Error 100 running 'sudo apt install -y zstd':
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

E: Unable to locate package zstd

- trying method: build from source
- failed to fetch with all methods
Already present: 16: bootgen bzip2 cbfstool fdt_add_pubkey fdtgrep fiptool futility gzip ifwitool lz4 lzma_alone lzop mkeficapsule mkimage openssl xz

Tools fetched:    1: cst
Failures:         1: zstd

/usr/lib/python3.10/os.py:1030: RuntimeWarning: line buffering
(buffering=1) isn't supported in binary mode, the default buffer size
will be used
return io.open(fd, mode, buffering, encoding, *args, **kwargs)
/usr/lib/python3.10/os.py:1030: RuntimeWarning: line buffering
(buffering=1) isn't supported in binary mode, the default buffer size
will be used
return io.open(fd, mode, buffering, encoding, *args, **kwargs)
======================== Running binman tests ======================== .....................................................s....s...................................................................................................................................................E...........................Image 'file2' has missing bintools and is non-functional: openssl

...Some images are invalid ...............E....................................E.....................................................................................................................................................................................................................................................................................................
======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTFIT (subunit.RemotedTestCase)
binman.ftest.TestFunctional.testNxpImx8MCSTFIT
----------------------------------------------------------------------
testtools.testresult.real._StringException: ValueError: Error 1
running 'cst -i /tmp/binman.ykmpnh27/nxp.csf-config-txt.nxp-imx8mcst
-o /tmp/binman.ykmpnh27/nxp.csf-output-blob.nxp-imx8mcst': File not
present SRK_1_2_3_4_table.bin

======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing (subunit.RemotedTestCase) binman.ftest.TestFunctional.testNxpImx8MCSTMkimageMissing
----------------------------------------------------------------------
testtools.testresult.real._StringException: struct.error: unpack requires a buffer of 4 bytes

======================================================================
ERROR: binman.ftest.TestFunctional.testNxpImx8MCSTSPL (subunit.RemotedTestCase) binman.ftest.TestFunctional.testNxpImx8MCSTSPL
----------------------------------------------------------------------
testtools.testresult.real._StringException: ValueError: Error 1 running 'cst -i /tmp/binman.nv01cfcu/nxp.csf-config-txt.nxp-imx8mcst -o /tmp/binman.nv01cfcu/nxp.csf-output-blob.nxp-imx8mcst': File not present SRK_1_2_3_4_table.bin

======================================================================
SKIP: binman.ftest.TestFunctional.testCompUtilVersions (subunit.RemotedTestCase) binman.ftest.TestFunctional.testCompUtilVersions
----------------------------------------------------------------------
zstd not available

======================================================================
SKIP: binman.ftest.TestFunctional.testCompUtilCompressions (subunit.RemotedTestCase) binman.ftest.TestFunctional.testCompUtilCompressions
----------------------------------------------------------------------
zstd not available

----------------------------------------------------------------------
Ran 583 tests in 11.931s

FAILED (errors=3, skipped=2)

Full log: https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1126772/raw

#28 lore raw
Quoted 8 lines · Fabio Estevam

Hi Marek and Tom,

Quoted 1 line · Tom Rini

And make similar changes to .azure-pipelines.yml as well please.

I made another attempt and still get CI errors when applying this patch. zstd is not found in CI:

The Dockerfile needs to install zstd then it seems. You can't install it like binman is trying to do, in CI at least, because there's no apt archive cache (it's not included in the container, as a normal best practice).

Signature · 1 line
Tom
#29 lore raw
In reply to Simon Glass
Quoted 1 line · Simon Glass

Hi Marek,

Hello Simon,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

This patch causes a CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1057151

I think this might be what Simon was pointing out, but I never got any suggestion how to solve that.

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

There was a patch for this...and it looks like Tom has applied it:

19a342f9122 Merge patch series "binman: build_from_git: Add argument specifying branch"

It is in u-boot/next , but it does not seem to help ?

Did you figure it out?

No

Quoted 2 lines

I'm not really sure. It works fine in my tree and I just tested it now. Perhaps there are some other patches missing from Tom's tree?

Can you push this tree somewhere ?

#30 lore raw

Hi Marek,

Quoted 19 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hello Simon,

Quoted 13 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

This patch causes a CI error:

https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/1057151

I think this might be what Simon was pointing out, but I never got any suggestion how to solve that.

There was a patch for this...and it looks like Tom has applied it:

19a342f9122 Merge patch series "binman: build_from_git: Add argument specifying branch"

It is in u-boot/next , but it does not seem to help ?

Quoted 7 lines
Quoted 1 line

Did you figure it out?

No

Quoted 2 lines

I'm not really sure. It works fine in my tree and I just tested it now. Perhaps there are some other patches missing from Tom's tree?

Can you push this tree somewhere ?

Yes it is at https://sjg.u-boot.org/u-boot/u-boot

Regards,
Simon