[PATCH v2 1/2] binman: add a new entry type for generating a data file which is passed to mkimage with -n
Alice Guo (OSS)
alice.guo at oss.nxp.com
Mon Jul 28 01:35:00 CEST 2025
From: Alice Guo <alice.guo at nxp.com>
i.MX95 needs to pass some commands defined in enum imx8image_cmd to
imx8image_copy_image() function, so add a new entry type nxp-config to
generate a data file includes theses commands in plain text format.
Signed-off-by: Alice Guo <alice.guo at nxp.com>
---
tools/binman/entries.rst | 11 +++++++++
tools/binman/etype/nxp_config.py | 21 +++++++++++++++++
tools/binman/ftest.py | 4 ++++
tools/binman/test/350_nxp_config_imx95.dts | 37 ++++++++++++++++++++++++++++++
4 files changed, 73 insertions(+)
diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 12a39d070e4..85e041f34ac 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1689,6 +1689,17 @@ together. See imx95_evk.rst for how to get DDR PHY Firmware Images.
+.. _etype_nxp_config:
+
+Entry: nxp-config: generate a data file which is passed to mkimage with -n
+--------------------------------------------------------------------------
+
+This entry is used to generate a data file. Each line of this data file is a
+command defined in enum imx8image_cmd. imx8image_copy_image() function parses
+all commands and builds a .bin based on them.
+
+
+
.. _etype_opensbi:
Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
diff --git a/tools/binman/etype/nxp_config.py b/tools/binman/etype/nxp_config.py
new file mode 100644
index 00000000000..1ac071cbadd
--- /dev/null
+++ b/tools/binman/etype/nxp_config.py
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2025 NXP
+
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+
+class Entry_nxp_config(Entry_section):
+ """Generate a data file which is passed to mkimage with -n"""
+
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node)
+
+ def ReadNode(self):
+ super().ReadNode()
+ path = fdt_util.GetString(self._node, 'cfg-path')
+ content = fdt_util.GetStringList(self._node, 'cfg-content')
+
+ with open(path, 'w', encoding='utf-8') as f:
+ for l in content:
+ f.write(l + '\n')
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a90db3c9351..6b04ea11621 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -7906,6 +7906,10 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
len(IMX_LPDDR_DMEM_DATA).to_bytes(4, 'little') +
IMX_LPDDR_IMEM_DATA + IMX_LPDDR_DMEM_DATA, data)
+ def testNxpConfig(self):
+ """Test binman can generate a file in plain text format"""
+ self._DoTestFile('350_nxp_config_imx95.dts')
+
def testFitSignSimple(self):
"""Test that image with FIT and signature nodes can be signed"""
if not elf.ELF_TOOLS:
diff --git a/tools/binman/test/350_nxp_config_imx95.dts b/tools/binman/test/350_nxp_config_imx95.dts
new file mode 100644
index 00000000000..d4f62b2b3bb
--- /dev/null
+++ b/tools/binman/test/350_nxp_config_imx95.dts
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ imximage-cfg {
+ type = "nxp-config";
+ cfg-path = "spl/u-boot-spl.cfgout";
+ cfg-content = "CNTR_VERSION 2",
+ "BOOT_FROM SD",
+ "SOC_TYPE IMX9",
+ "APPEND mx95b0-ahab-container.img",
+ "CONTAINER",
+ "DUMMY_DDR",
+ "IMAGE OEI m33-oei-ddrfw.bin 0x1ffc0000",
+ "HOLD 0x10000",
+ "IMAGE M33 m33_image.bin 0x1ffc0000",
+ "IMAGE A55 spl/u-boot-spl.bin 0x20480000",
+ "DUMMY_V2X 0x8b000000";
+ };
+
+ container-cfg {
+ type = "nxp-config";
+ cfg-path = "u-boot-container.cfgout";
+ cfg-content = "CNTR_VERSION 2",
+ "BOOT_FROM SD",
+ "SOC_TYPE IMX9",
+ "CONTAINER",
+ "IMAGE A55 bl31.bin 0x8a200000",
+ "IMAGE A55 u-boot.bin 0x90200000";
+ };
+ };
+};
--
2.43.0
More information about the U-Boot
mailing list