From 03d5ef3063febbd316cce06a19d5650707b02941 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2026 11:12:30 -0700 Subject: binman: test: Move pack/layout test files to test/pack/ Move about 50 test files related to basic layout, packing, alignment, sections, and image structure into a pack/ subdirectory. Drop the numeric prefixes from the filenames and update all references in ftest.py, entry_test.py, and binman_tests.rst Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz --- doc/develop/binman_tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/develop') diff --git a/doc/develop/binman_tests.rst b/doc/develop/binman_tests.rst index 5e44686b8ad..745ca259d44 100644 --- a/doc/develop/binman_tests.rst +++ b/doc/develop/binman_tests.rst @@ -331,7 +331,7 @@ Here is a simple test: def testSimple(self): """Test a simple binman with a single file""" - data = self._DoReadFile('005_simple.dts') + data = self._DoReadFile('pack/simple.dts') self.assertEqual(U_BOOT_DATA, data) This test tells Binman to build an image using the description. Then it checks -- cgit v1.3.1 From b405930c8b7de15b55fe9a843a85606506222f67 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2026 11:12:38 -0700 Subject: binman: test: Move ChromeOS test files to test/cros/ Move about 10 test files for ChromeOS entries (GBB, vblock, FMAP) into a cros/ subdirectory. Drop the numeric prefixes and update all references. Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz --- doc/develop/binman_tests.rst | 2 +- tools/binman/ftest.py | 22 +++++++++---------- tools/binman/test/067_fmap.dts | 30 -------------------------- tools/binman/test/071_gbb.dts | 31 --------------------------- tools/binman/test/072_gbb_too_small.dts | 10 --------- tools/binman/test/073_gbb_no_size.dts | 9 -------- tools/binman/test/074_vblock.dts | 28 ------------------------ tools/binman/test/075_vblock_no_content.dts | 23 -------------------- tools/binman/test/076_vblock_bad_phandle.dts | 24 --------------------- tools/binman/test/077_vblock_bad_entry.dts | 27 ----------------------- tools/binman/test/189_vblock_content.dts | 31 --------------------------- tools/binman/test/cros/fmap.dts | 30 ++++++++++++++++++++++++++ tools/binman/test/cros/gbb.dts | 31 +++++++++++++++++++++++++++ tools/binman/test/cros/gbb_no_size.dts | 9 ++++++++ tools/binman/test/cros/gbb_too_small.dts | 10 +++++++++ tools/binman/test/cros/vblock.dts | 28 ++++++++++++++++++++++++ tools/binman/test/cros/vblock_bad_entry.dts | 27 +++++++++++++++++++++++ tools/binman/test/cros/vblock_bad_phandle.dts | 24 +++++++++++++++++++++ tools/binman/test/cros/vblock_content.dts | 31 +++++++++++++++++++++++++++ tools/binman/test/cros/vblock_no_content.dts | 23 ++++++++++++++++++++ 20 files changed, 225 insertions(+), 225 deletions(-) delete mode 100644 tools/binman/test/067_fmap.dts delete mode 100644 tools/binman/test/071_gbb.dts delete mode 100644 tools/binman/test/072_gbb_too_small.dts delete mode 100644 tools/binman/test/073_gbb_no_size.dts delete mode 100644 tools/binman/test/074_vblock.dts delete mode 100644 tools/binman/test/075_vblock_no_content.dts delete mode 100644 tools/binman/test/076_vblock_bad_phandle.dts delete mode 100644 tools/binman/test/077_vblock_bad_entry.dts delete mode 100644 tools/binman/test/189_vblock_content.dts create mode 100644 tools/binman/test/cros/fmap.dts create mode 100644 tools/binman/test/cros/gbb.dts create mode 100644 tools/binman/test/cros/gbb_no_size.dts create mode 100644 tools/binman/test/cros/gbb_too_small.dts create mode 100644 tools/binman/test/cros/vblock.dts create mode 100644 tools/binman/test/cros/vblock_bad_entry.dts create mode 100644 tools/binman/test/cros/vblock_bad_phandle.dts create mode 100644 tools/binman/test/cros/vblock_content.dts create mode 100644 tools/binman/test/cros/vblock_no_content.dts (limited to 'doc/develop') diff --git a/doc/develop/binman_tests.rst b/doc/develop/binman_tests.rst index 745ca259d44..c7fa9ae6199 100644 --- a/doc/develop/binman_tests.rst +++ b/doc/develop/binman_tests.rst @@ -436,7 +436,7 @@ correct. You can to this with ``terminal.capture()``, for example: .. code-block:: python with terminal.capture() as (_, stderr): - self._DoTestFile('071_gbb.dts', force_missing_bintools='futility', + self._DoTestFile('cros/gbb.dts', force_missing_bintools='futility', entry_args=entry_args) err = stderr.getvalue() self.assertRegex(err, "Image 'image'.*missing bintools.*: futility") diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index d43bb9183bb..87055a53bdf 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1816,7 +1816,7 @@ class TestFunctional(unittest.TestCase): def testFmap(self): """Basic test of generation of a flashrom fmap""" - data = self._DoReadFile('067_fmap.dts') + data = self._DoReadFile('cros/fmap.dts') fhdr, fentries = fmap_util.DecodeFmap(data[32:]) expected = (U_BOOT_DATA + tools.get_bytes(ord('!'), 12) + U_BOOT_DATA + tools.get_bytes(ord('a'), 12)) @@ -1898,7 +1898,7 @@ class TestFunctional(unittest.TestCase): 'keydir': 'devkeys', 'bmpblk': 'bmpblk.bin', } - data, _, _, _ = self._DoReadFileDtb('071_gbb.dts', entry_args=entry_args) + data, _, _, _ = self._DoReadFileDtb('cros/gbb.dts', entry_args=entry_args) # Since futility expected = (GBB_DATA + GBB_DATA + tools.get_bytes(0, 8) + @@ -1908,14 +1908,14 @@ class TestFunctional(unittest.TestCase): def testGbbTooSmall(self): """Test for the Chromium OS Google Binary Block being large enough""" with self.assertRaises(ValueError) as e: - self._DoReadFileDtb('072_gbb_too_small.dts') + self._DoReadFileDtb('cros/gbb_too_small.dts') self.assertIn("Node '/binman/gbb': GBB is too small", str(e.exception)) def testGbbNoSize(self): """Test for the Chromium OS Google Binary Block having a size""" with self.assertRaises(ValueError) as e: - self._DoReadFileDtb('073_gbb_no_size.dts') + self._DoReadFileDtb('cros/gbb_no_size.dts') self.assertIn("Node '/binman/gbb': GBB must have a fixed size", str(e.exception)) @@ -1925,7 +1925,7 @@ class TestFunctional(unittest.TestCase): 'keydir': 'devkeys', } with terminal.capture() as (_, stderr): - self._DoTestFile('071_gbb.dts', force_missing_bintools='futility', + self._DoTestFile('cros/gbb.dts', force_missing_bintools='futility', entry_args=entry_args) err = stderr.getvalue() self.assertRegex(err, "Image 'image'.*missing bintools.*: futility") @@ -1966,7 +1966,7 @@ class TestFunctional(unittest.TestCase): entry_args = { 'keydir': 'devkeys', } - data, _, _, _ = self._DoReadFileDtb('074_vblock.dts', + data, _, _, _ = self._DoReadFileDtb('cros/vblock.dts', entry_args=entry_args) expected = U_BOOT_DATA + VBLOCK_DATA + U_BOOT_DTB_DATA self.assertEqual(expected, data) @@ -1974,21 +1974,21 @@ class TestFunctional(unittest.TestCase): def testVblockNoContent(self): """Test we detect a vblock which has no content to sign""" with self.assertRaises(ValueError) as e: - self._DoReadFile('075_vblock_no_content.dts') + self._DoReadFile('cros/vblock_no_content.dts') self.assertIn("Node '/binman/vblock': Collection must have a 'content' " 'property', str(e.exception)) def testVblockBadPhandle(self): """Test that we detect a vblock with an invalid phandle in contents""" with self.assertRaises(ValueError) as e: - self._DoReadFile('076_vblock_bad_phandle.dts') + self._DoReadFile('cros/vblock_bad_phandle.dts') self.assertIn("Node '/binman/vblock': Cannot find node for phandle " '1000', str(e.exception)) def testVblockBadEntry(self): """Test that we detect an entry that points to a non-entry""" with self.assertRaises(ValueError) as e: - self._DoReadFile('077_vblock_bad_entry.dts') + self._DoReadFile('cros/vblock_bad_entry.dts') self.assertIn("Node '/binman/vblock': Cannot find entry for node " "'other'", str(e.exception)) @@ -2000,7 +2000,7 @@ class TestFunctional(unittest.TestCase): 'keydir': 'devkeys', } data = self._DoReadFileDtb( - '189_vblock_content.dts', use_real_dtb=True, update_dtb=True, + 'cros/vblock_content.dts', use_real_dtb=True, update_dtb=True, entry_args=entry_args)[0] hashlen = 32 # SHA256 hash is 32 bytes self.assertEqual(U_BOOT_DATA, data[:len(U_BOOT_DATA)]) @@ -2021,7 +2021,7 @@ class TestFunctional(unittest.TestCase): 'keydir': 'devkeys', } with terminal.capture() as (_, stderr): - self._DoTestFile('074_vblock.dts', + self._DoTestFile('cros/vblock.dts', force_missing_bintools='futility', entry_args=entry_args) err = stderr.getvalue() diff --git a/tools/binman/test/067_fmap.dts b/tools/binman/test/067_fmap.dts deleted file mode 100644 index 24fa6351ec3..00000000000 --- a/tools/binman/test/067_fmap.dts +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - section@0 { - read-only; - name-prefix = "ro-"; - size = <0x10>; - pad-byte = <0x21>; - preserve; - - u-boot { - }; - }; - section@1 { - name-prefix = "rw-"; - size = <0x10>; - pad-byte = <0x61>; - - u-boot { - }; - }; - fmap { - }; - }; -}; diff --git a/tools/binman/test/071_gbb.dts b/tools/binman/test/071_gbb.dts deleted file mode 100644 index 551756372af..00000000000 --- a/tools/binman/test/071_gbb.dts +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - gbb { - size = <0x2180>; - flags { - dev-screen-short-delay; - load-option-roms; - enable-alternate-os; - force-dev-switch-on; - force-dev-boot-usb; - disable-fw-rollback-check; - enter-triggers-tonorm; - force-dev-boot-legacy; - faft-key-override; - disable-ec-software-sync; - default-dev-boot-legacy; - disable-pd-software-sync; - disable-lid-shutdown; - force-dev-boot-fastboot-full-cap; - enable-serial; - disable-dwmp; - }; - }; - }; -}; diff --git a/tools/binman/test/072_gbb_too_small.dts b/tools/binman/test/072_gbb_too_small.dts deleted file mode 100644 index c088f36a1d0..00000000000 --- a/tools/binman/test/072_gbb_too_small.dts +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - gbb { - size = <0x200>; - }; - }; -}; diff --git a/tools/binman/test/073_gbb_no_size.dts b/tools/binman/test/073_gbb_no_size.dts deleted file mode 100644 index 83be4037852..00000000000 --- a/tools/binman/test/073_gbb_no_size.dts +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - gbb { - }; - }; -}; diff --git a/tools/binman/test/074_vblock.dts b/tools/binman/test/074_vblock.dts deleted file mode 100644 index f0c21bfe9fc..00000000000 --- a/tools/binman/test/074_vblock.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u_boot: u-boot { - }; - - vblock { - content = <&u_boot &dtb>; - keyblock = "firmware.keyblock"; - signprivate = "firmware_data_key.vbprivk"; - version = <1>; - kernelkey = "kernel_subkey.vbpubk"; - preamble-flags = <1>; - }; - - /* - * Put this after the vblock so that its contents are not - * available when the vblock first tries to obtain its contents - */ - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/075_vblock_no_content.dts b/tools/binman/test/075_vblock_no_content.dts deleted file mode 100644 index 676d9474b31..00000000000 --- a/tools/binman/test/075_vblock_no_content.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u_boot: u-boot { - }; - - vblock { - keyblock = "firmware.keyblock"; - signprivate = "firmware_data_key.vbprivk"; - version = <1>; - kernelkey = "kernel_subkey.vbpubk"; - preamble-flags = <1>; - }; - - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/076_vblock_bad_phandle.dts b/tools/binman/test/076_vblock_bad_phandle.dts deleted file mode 100644 index ffbd0c335c3..00000000000 --- a/tools/binman/test/076_vblock_bad_phandle.dts +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u_boot: u-boot { - }; - - vblock { - content = <1000>; - keyblock = "firmware.keyblock"; - signprivate = "firmware_data_key.vbprivk"; - version = <1>; - kernelkey = "kernel_subkey.vbpubk"; - preamble-flags = <1>; - }; - - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/077_vblock_bad_entry.dts b/tools/binman/test/077_vblock_bad_entry.dts deleted file mode 100644 index 764c42a56e1..00000000000 --- a/tools/binman/test/077_vblock_bad_entry.dts +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u_boot: u-boot { - }; - - vblock { - content = <&u_boot &other>; - keyblock = "firmware.keyblock"; - signprivate = "firmware_data_key.vbprivk"; - version = <1>; - kernelkey = "kernel_subkey.vbpubk"; - preamble-flags = <1>; - }; - - dtb: u-boot-dtb { - }; - }; - - other: other { - }; -}; diff --git a/tools/binman/test/189_vblock_content.dts b/tools/binman/test/189_vblock_content.dts deleted file mode 100644 index dcc74449c17..00000000000 --- a/tools/binman/test/189_vblock_content.dts +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u_boot: u-boot { - }; - - dtb: u-boot-dtb { - }; - - /* - * Put the vblock after the dtb so that the dtb is updated - * before the vblock reads its data. At present binman does not - * understand dependencies between entries, but simply - * iterates again when it thinks something needs to be - * recalculated. - */ - vblock { - content = <&u_boot &dtb>; - keyblock = "firmware.keyblock"; - signprivate = "firmware_data_key.vbprivk"; - version = <1>; - kernelkey = "kernel_subkey.vbpubk"; - preamble-flags = <1>; - }; - }; -}; diff --git a/tools/binman/test/cros/fmap.dts b/tools/binman/test/cros/fmap.dts new file mode 100644 index 00000000000..24fa6351ec3 --- /dev/null +++ b/tools/binman/test/cros/fmap.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + section@0 { + read-only; + name-prefix = "ro-"; + size = <0x10>; + pad-byte = <0x21>; + preserve; + + u-boot { + }; + }; + section@1 { + name-prefix = "rw-"; + size = <0x10>; + pad-byte = <0x61>; + + u-boot { + }; + }; + fmap { + }; + }; +}; diff --git a/tools/binman/test/cros/gbb.dts b/tools/binman/test/cros/gbb.dts new file mode 100644 index 00000000000..551756372af --- /dev/null +++ b/tools/binman/test/cros/gbb.dts @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + gbb { + size = <0x2180>; + flags { + dev-screen-short-delay; + load-option-roms; + enable-alternate-os; + force-dev-switch-on; + force-dev-boot-usb; + disable-fw-rollback-check; + enter-triggers-tonorm; + force-dev-boot-legacy; + faft-key-override; + disable-ec-software-sync; + default-dev-boot-legacy; + disable-pd-software-sync; + disable-lid-shutdown; + force-dev-boot-fastboot-full-cap; + enable-serial; + disable-dwmp; + }; + }; + }; +}; diff --git a/tools/binman/test/cros/gbb_no_size.dts b/tools/binman/test/cros/gbb_no_size.dts new file mode 100644 index 00000000000..83be4037852 --- /dev/null +++ b/tools/binman/test/cros/gbb_no_size.dts @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + gbb { + }; + }; +}; diff --git a/tools/binman/test/cros/gbb_too_small.dts b/tools/binman/test/cros/gbb_too_small.dts new file mode 100644 index 00000000000..c088f36a1d0 --- /dev/null +++ b/tools/binman/test/cros/gbb_too_small.dts @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + gbb { + size = <0x200>; + }; + }; +}; diff --git a/tools/binman/test/cros/vblock.dts b/tools/binman/test/cros/vblock.dts new file mode 100644 index 00000000000..f0c21bfe9fc --- /dev/null +++ b/tools/binman/test/cros/vblock.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u_boot: u-boot { + }; + + vblock { + content = <&u_boot &dtb>; + keyblock = "firmware.keyblock"; + signprivate = "firmware_data_key.vbprivk"; + version = <1>; + kernelkey = "kernel_subkey.vbpubk"; + preamble-flags = <1>; + }; + + /* + * Put this after the vblock so that its contents are not + * available when the vblock first tries to obtain its contents + */ + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/cros/vblock_bad_entry.dts b/tools/binman/test/cros/vblock_bad_entry.dts new file mode 100644 index 00000000000..764c42a56e1 --- /dev/null +++ b/tools/binman/test/cros/vblock_bad_entry.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u_boot: u-boot { + }; + + vblock { + content = <&u_boot &other>; + keyblock = "firmware.keyblock"; + signprivate = "firmware_data_key.vbprivk"; + version = <1>; + kernelkey = "kernel_subkey.vbpubk"; + preamble-flags = <1>; + }; + + dtb: u-boot-dtb { + }; + }; + + other: other { + }; +}; diff --git a/tools/binman/test/cros/vblock_bad_phandle.dts b/tools/binman/test/cros/vblock_bad_phandle.dts new file mode 100644 index 00000000000..ffbd0c335c3 --- /dev/null +++ b/tools/binman/test/cros/vblock_bad_phandle.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u_boot: u-boot { + }; + + vblock { + content = <1000>; + keyblock = "firmware.keyblock"; + signprivate = "firmware_data_key.vbprivk"; + version = <1>; + kernelkey = "kernel_subkey.vbpubk"; + preamble-flags = <1>; + }; + + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/cros/vblock_content.dts b/tools/binman/test/cros/vblock_content.dts new file mode 100644 index 00000000000..dcc74449c17 --- /dev/null +++ b/tools/binman/test/cros/vblock_content.dts @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u_boot: u-boot { + }; + + dtb: u-boot-dtb { + }; + + /* + * Put the vblock after the dtb so that the dtb is updated + * before the vblock reads its data. At present binman does not + * understand dependencies between entries, but simply + * iterates again when it thinks something needs to be + * recalculated. + */ + vblock { + content = <&u_boot &dtb>; + keyblock = "firmware.keyblock"; + signprivate = "firmware_data_key.vbprivk"; + version = <1>; + kernelkey = "kernel_subkey.vbpubk"; + preamble-flags = <1>; + }; + }; +}; diff --git a/tools/binman/test/cros/vblock_no_content.dts b/tools/binman/test/cros/vblock_no_content.dts new file mode 100644 index 00000000000..676d9474b31 --- /dev/null +++ b/tools/binman/test/cros/vblock_no_content.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u_boot: u-boot { + }; + + vblock { + keyblock = "firmware.keyblock"; + signprivate = "firmware_data_key.vbprivk"; + version = <1>; + kernelkey = "kernel_subkey.vbpubk"; + preamble-flags = <1>; + }; + + dtb: u-boot-dtb { + }; + }; +}; -- cgit v1.3.1 From 9c17d547c46866a168b2df38a2aa24d0f28e971e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2026 11:12:42 -0700 Subject: binman: test: Move vendor-specific test files to test/vendor/ Move about 20 test files for vendor-specific platform support (TI, NXP i.MX, Renesas R-Car, Rockchip, PowerPC MPC85xx) into a vendor/ subdirectory. Drop the numeric prefixes and update all references. Signed-off-by: Simon Glass --- doc/develop/binman_tests.rst | 12 +++--- tools/binman/ftest.py | 44 +++++++++++----------- .../test/150_powerpc_mpc85xx_bootpg_resetvec.dts | 16 -------- tools/binman/test/225_ti_dm.dts | 13 ------- tools/binman/test/291_rockchip_tpl.dts | 16 -------- tools/binman/test/293_ti_board_cfg.dts | 14 ------- tools/binman/test/294_ti_board_cfg_combined.dts | 25 ------------ tools/binman/test/295_ti_board_cfg_no_type.dts | 11 ------ tools/binman/test/296_ti_secure.dts | 17 --------- tools/binman/test/297_ti_secure_rom.dts | 18 --------- tools/binman/test/298_ti_secure_rom_combined.dts | 25 ------------ tools/binman/test/299_ti_secure_rom_a.dts | 19 ---------- tools/binman/test/300_ti_secure_rom_b.dts | 18 --------- tools/binman/test/323_ti_board_cfg_phony.dts | 14 ------- tools/binman/test/324_ti_secure_firewall.dts | 28 -------------- .../325_ti_secure_firewall_missing_property.dts | 28 -------------- tools/binman/test/339_nxp_imx8.dts | 17 --------- tools/binman/test/346_nxp_ddrfw_imx95.dts | 24 ------------ tools/binman/test/348_renesas_rcar4_sa0.dts | 15 -------- tools/binman/test/349_renesas_rcar4_sa0_size.dts | 20 ---------- tools/binman/test/350_nxp_imx95.dts | 25 ------------ tools/binman/test/vendor/nxp_ddrfw_imx95.dts | 24 ++++++++++++ tools/binman/test/vendor/nxp_imx8.dts | 17 +++++++++ tools/binman/test/vendor/nxp_imx95.dts | 25 ++++++++++++ .../vendor/powerpc_mpc85xx_bootpg_resetvec.dts | 16 ++++++++ tools/binman/test/vendor/renesas_rcar4_sa0.dts | 15 ++++++++ .../binman/test/vendor/renesas_rcar4_sa0_size.dts | 20 ++++++++++ tools/binman/test/vendor/rockchip_tpl.dts | 16 ++++++++ tools/binman/test/vendor/ti_board_cfg.dts | 14 +++++++ tools/binman/test/vendor/ti_board_cfg_combined.dts | 25 ++++++++++++ tools/binman/test/vendor/ti_board_cfg_no_type.dts | 11 ++++++ tools/binman/test/vendor/ti_board_cfg_phony.dts | 14 +++++++ tools/binman/test/vendor/ti_dm.dts | 13 +++++++ tools/binman/test/vendor/ti_secure.dts | 17 +++++++++ tools/binman/test/vendor/ti_secure_firewall.dts | 28 ++++++++++++++ .../vendor/ti_secure_firewall_missing_property.dts | 28 ++++++++++++++ tools/binman/test/vendor/ti_secure_rom.dts | 18 +++++++++ tools/binman/test/vendor/ti_secure_rom_a.dts | 19 ++++++++++ tools/binman/test/vendor/ti_secure_rom_b.dts | 18 +++++++++ .../binman/test/vendor/ti_secure_rom_combined.dts | 25 ++++++++++++ 40 files changed, 391 insertions(+), 391 deletions(-) delete mode 100644 tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts delete mode 100644 tools/binman/test/225_ti_dm.dts delete mode 100644 tools/binman/test/291_rockchip_tpl.dts delete mode 100644 tools/binman/test/293_ti_board_cfg.dts delete mode 100644 tools/binman/test/294_ti_board_cfg_combined.dts delete mode 100644 tools/binman/test/295_ti_board_cfg_no_type.dts delete mode 100644 tools/binman/test/296_ti_secure.dts delete mode 100644 tools/binman/test/297_ti_secure_rom.dts delete mode 100644 tools/binman/test/298_ti_secure_rom_combined.dts delete mode 100644 tools/binman/test/299_ti_secure_rom_a.dts delete mode 100644 tools/binman/test/300_ti_secure_rom_b.dts delete mode 100644 tools/binman/test/323_ti_board_cfg_phony.dts delete mode 100644 tools/binman/test/324_ti_secure_firewall.dts delete mode 100644 tools/binman/test/325_ti_secure_firewall_missing_property.dts delete mode 100644 tools/binman/test/339_nxp_imx8.dts delete mode 100644 tools/binman/test/346_nxp_ddrfw_imx95.dts delete mode 100644 tools/binman/test/348_renesas_rcar4_sa0.dts delete mode 100644 tools/binman/test/349_renesas_rcar4_sa0_size.dts delete mode 100644 tools/binman/test/350_nxp_imx95.dts create mode 100644 tools/binman/test/vendor/nxp_ddrfw_imx95.dts create mode 100644 tools/binman/test/vendor/nxp_imx8.dts create mode 100644 tools/binman/test/vendor/nxp_imx95.dts create mode 100644 tools/binman/test/vendor/powerpc_mpc85xx_bootpg_resetvec.dts create mode 100644 tools/binman/test/vendor/renesas_rcar4_sa0.dts create mode 100644 tools/binman/test/vendor/renesas_rcar4_sa0_size.dts create mode 100644 tools/binman/test/vendor/rockchip_tpl.dts create mode 100644 tools/binman/test/vendor/ti_board_cfg.dts create mode 100644 tools/binman/test/vendor/ti_board_cfg_combined.dts create mode 100644 tools/binman/test/vendor/ti_board_cfg_no_type.dts create mode 100644 tools/binman/test/vendor/ti_board_cfg_phony.dts create mode 100644 tools/binman/test/vendor/ti_dm.dts create mode 100644 tools/binman/test/vendor/ti_secure.dts create mode 100644 tools/binman/test/vendor/ti_secure_firewall.dts create mode 100644 tools/binman/test/vendor/ti_secure_firewall_missing_property.dts create mode 100644 tools/binman/test/vendor/ti_secure_rom.dts create mode 100644 tools/binman/test/vendor/ti_secure_rom_a.dts create mode 100644 tools/binman/test/vendor/ti_secure_rom_b.dts create mode 100644 tools/binman/test/vendor/ti_secure_rom_combined.dts (limited to 'doc/develop') diff --git a/doc/develop/binman_tests.rst b/doc/develop/binman_tests.rst index c7fa9ae6199..3be7d43cd3f 100644 --- a/doc/develop/binman_tests.rst +++ b/doc/develop/binman_tests.rst @@ -457,7 +457,7 @@ can, which contains the new etype. Put it in a numbered file in ``tool/binman/test`` so that it comes last. All the numbers are unique and there are no gaps. -Example from ``tools/binman/test/339_nxp_imx8.dts``: +Example from ``tools/binman/test/vendor/nxp_imx8.dts``: .. code-block:: devicetree @@ -493,7 +493,7 @@ Then create your test by adding a new function at the end of ``ftest.py``: def testNxpImx8Image(self): """Test that binman can produce an iMX8 image""" - self._DoTestFile('339_nxp_imx8.dts') + self._DoTestFile('vendor/nxp_imx8.dts') This uses the test file that you created. It doesn't check anything, it just runs the image description through binman. @@ -517,7 +517,7 @@ The next step is to update it to actually check the output: def testNxpImx8Image(self): """Test that binman can produce an iMX8 image""" - data = self._DoReadFile('339_nxp_imx8.dts') + data = self._DoReadFile('vendor/nxp_imx8.dts') print('data', len(data)) The ``_DoReadFile()`` function is documented in the code. It returns the image @@ -573,7 +573,7 @@ In the above example, here are some possible steps: def testNxpImx8ImageMkimageMissing(self): """Test that binman can produce an iMX8 image""" with terminal.capture() as (_, stderr): - self._DoTestFile('339_nxp_imx8.dts', + self._DoTestFile('vendor/nxp_imx8.dts', force_missing_bintools='mkimage') err = stderr.getvalue() self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage") @@ -610,7 +610,7 @@ In the above example, here are some possible steps: Entry_section.SetImagePos(self, image_pos) - The solution is to add an entry, e.g. in ``340_nxp_imx8_non_empty.dts``: + The solution is to add an entry, e.g. in ``vendor/nxp_imx8_non_empty.dts``: .. code-block:: devicetree @@ -641,7 +641,7 @@ In the above example, here are some possible steps: def testNxpImx8ImageNonEmpty(self): """Test that binman can produce an iMX8 image with something in it""" - data = self._DoReadFile('340_nxp_imx8_non_empty.dts') + data = self._DoReadFile('vendor/nxp_imx8_non_empty.dts') # check data here With that, the second red bit goes away, because the for() loop is now used. diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 43292941576..3743071eb85 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1255,7 +1255,7 @@ class TestFunctional(unittest.TestCase): def testPackPowerpcMpc85xxBootpgResetvec(self): """Test that an image with powerpc-mpc85xx-bootpg-resetvec can be created""" - data = self._DoReadFile('150_powerpc_mpc85xx_bootpg_resetvec.dts') + data = self._DoReadFile('vendor/powerpc_mpc85xx_bootpg_resetvec.dts') self.assertEqual(PPC_MPC85XX_BR_DATA, data[:len(PPC_MPC85XX_BR_DATA)]) def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False): @@ -2130,7 +2130,7 @@ class TestFunctional(unittest.TestCase): # Unfortunately, compiling a source file always results in a file # called source.dtb (see fdt_util.EnsureCompiled()). The test - # source file (e.g. test/075_fdt_update_all.dts) thus does not enter + # source file (e.g. test/fdt/fdt_update_all.dts) thus does not enter # binman as a file called u-boot.dtb. To fix this, copy the file # over to the expected place. start = 0 @@ -5578,7 +5578,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testPackTiDm(self): """Test that an image with a TI DM binary can be created""" - data = self._DoReadFile('225_ti_dm.dts') + data = self._DoReadFile('vendor/ti_dm.dts') self.assertEqual(TI_DM_DATA, data[:len(TI_DM_DATA)]) def testPackBl1(self): @@ -5588,12 +5588,12 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testRenesasRCarGen4SA0Image(self): """Test that binman can produce an Renesas R-Car Gen4 SA0 image""" - self._DoTestFile('348_renesas_rcar4_sa0.dts') + self._DoTestFile('vendor/renesas_rcar4_sa0.dts') def testRenesasRCarGen4SA0ImageSize(self): """Test that binman can not produce large Renesas R-Car Gen4 SA0 image""" with self.assertRaises(ValueError) as exc: - self._DoTestFile('349_renesas_rcar4_sa0_size.dts') + self._DoTestFile('vendor/renesas_rcar4_sa0_size.dts') self.assertIn("Node '/binman/renesas-rcar4-sa0': SRAM data longer than 966656 Bytes", str(exc.exception)) @@ -6885,7 +6885,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testPackRockchipTpl(self): """Test that an image with a Rockchip TPL binary can be created""" - data = self._DoReadFile('291_rockchip_tpl.dts') + data = self._DoReadFile('vendor/rockchip_tpl.dts') self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)]) def testMkimageMissingBlobMultiple(self): @@ -7175,25 +7175,25 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testTIBoardConfig(self): """Test that a schema validated board config file can be generated""" - data = self._DoReadFile('293_ti_board_cfg.dts') + data = self._DoReadFile('vendor/ti_board_cfg.dts') self.assertEqual(TI_BOARD_CONFIG_DATA, data) def testTIBoardConfigLint(self): """Test that an incorrectly linted config file would generate error""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('323_ti_board_cfg_phony.dts') + data = self._DoReadFile('vendor/ti_board_cfg_phony.dts') self.assertIn("Yamllint error", str(e.exception)) def testTIBoardConfigCombined(self): """Test that a schema validated combined board config file can be generated""" - data = self._DoReadFile('294_ti_board_cfg_combined.dts') + data = self._DoReadFile('vendor/ti_board_cfg_combined.dts') configlen_noheader = TI_BOARD_CONFIG_DATA * 4 self.assertGreater(data, configlen_noheader) def testTIBoardConfigNoDataType(self): """Test that error is thrown when data type is not supported""" with self.assertRaises(ValueError) as e: - data = self._DoReadFile('295_ti_board_cfg_no_type.dts') + data = self._DoReadFile('vendor/ti_board_cfg_no_type.dts') self.assertIn("Schema validation error", str(e.exception)) def testPackTiSecure(self): @@ -7202,7 +7202,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('296_ti_secure.dts', + data = self._DoReadFileDtb('vendor/ti_secure.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) @@ -7212,9 +7212,9 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data_no_firewall = self._DoReadFileDtb('296_ti_secure.dts', + data_no_firewall = self._DoReadFileDtb('vendor/ti_secure.dts', entry_args=entry_args)[0] - data_firewall = self._DoReadFileDtb('324_ti_secure_firewall.dts', + data_firewall = self._DoReadFileDtb('vendor/ti_secure_firewall.dts', entry_args=entry_args)[0] self.assertGreater(len(data_firewall),len(data_no_firewall)) @@ -7225,7 +7225,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap 'keyfile': keyfile, } with self.assertRaises(ValueError) as e: - data_firewall = self._DoReadFileDtb('325_ti_secure_firewall_missing_property.dts', + data_firewall = self._DoReadFileDtb('vendor/ti_secure_firewall_missing_property.dts', entry_args=entry_args)[0] self.assertRegex(str(e.exception), "Node '/binman/ti-secure': Subnode 'firewall-0-2' is missing properties: id,region") @@ -7237,7 +7237,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap 'keyfile': keyfile, } with terminal.capture() as (_, stderr): - self._DoTestFile('296_ti_secure.dts', + self._DoTestFile('vendor/ti_secure.dts', force_missing_bintools='openssl', entry_args=entry_args) err = stderr.getvalue() @@ -7249,11 +7249,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('297_ti_secure_rom.dts', + data = self._DoReadFileDtb('vendor/ti_secure_rom.dts', entry_args=entry_args)[0] - data_a = self._DoReadFileDtb('299_ti_secure_rom_a.dts', + data_a = self._DoReadFileDtb('vendor/ti_secure_rom_a.dts', entry_args=entry_args)[0] - data_b = self._DoReadFileDtb('300_ti_secure_rom_b.dts', + data_b = self._DoReadFileDtb('vendor/ti_secure_rom_b.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) self.assertGreater(len(data_a), len(TI_UNSECURE_DATA)) @@ -7265,7 +7265,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args = { 'keyfile': keyfile, } - data = self._DoReadFileDtb('298_ti_secure_rom_combined.dts', + data = self._DoReadFileDtb('vendor/ti_secure_rom_combined.dts', entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) @@ -7897,11 +7897,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testNxpImx8Image(self): """Test that binman can produce an iMX8 image""" - self._DoTestFile('339_nxp_imx8.dts') + self._DoTestFile('vendor/nxp_imx8.dts') def testNxpHeaderDdrfw(self): """Test that binman can add a header to DDR PHY firmware images""" - data = self._DoReadFile('346_nxp_ddrfw_imx95.dts') + data = self._DoReadFile('vendor/nxp_ddrfw_imx95.dts') self.assertEqual(len(IMX_LPDDR_IMEM_DATA).to_bytes(4, 'little') + len(IMX_LPDDR_DMEM_DATA).to_bytes(4, 'little') + IMX_LPDDR_IMEM_DATA + IMX_LPDDR_DMEM_DATA, data) @@ -7916,7 +7916,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap with open(container_path, 'w') as f: f.write(bytes([0x87]).decode('latin1') * 32768) with terminal.capture(): - self._DoTestFile('350_nxp_imx95.dts', output_dir=testdir) + self._DoTestFile('vendor/nxp_imx95.dts', output_dir=testdir) def testFitSignSimple(self): """Test that image with FIT and signature nodes can be signed""" diff --git a/tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts b/tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts deleted file mode 100644 index 8f4b16c399c..00000000000 --- a/tools/binman/test/150_powerpc_mpc85xx_bootpg_resetvec.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2018 NXP - */ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - powerpc-mpc85xx-bootpg-resetvec { - }; - }; -}; diff --git a/tools/binman/test/225_ti_dm.dts b/tools/binman/test/225_ti_dm.dts deleted file mode 100644 index 3ab754131e9..00000000000 --- a/tools/binman/test/225_ti_dm.dts +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - binman { - ti-dm { - filename = "dm.bin"; - }; - }; -}; diff --git a/tools/binman/test/291_rockchip_tpl.dts b/tools/binman/test/291_rockchip_tpl.dts deleted file mode 100644 index 269f56e2545..00000000000 --- a/tools/binman/test/291_rockchip_tpl.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <16>; - - rockchip-tpl { - filename = "rockchip-tpl.bin"; - }; - }; -}; diff --git a/tools/binman/test/293_ti_board_cfg.dts b/tools/binman/test/293_ti_board_cfg.dts deleted file mode 100644 index cda024c1b8c..00000000000 --- a/tools/binman/test/293_ti_board_cfg.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-board-config { - config = "yaml/config.yaml"; - schema = "yaml/schema.yaml"; - }; - }; -}; diff --git a/tools/binman/test/294_ti_board_cfg_combined.dts b/tools/binman/test/294_ti_board_cfg_combined.dts deleted file mode 100644 index 95ef449cbf4..00000000000 --- a/tools/binman/test/294_ti_board_cfg_combined.dts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - ti-board-config { - board-cfg { - config = "yaml/config.yaml"; - schema = "yaml/schema.yaml"; - }; - sec-cfg { - config = "yaml/config.yaml"; - schema = "yaml/schema.yaml"; - }; - rm-cfg { - config = "yaml/config.yaml"; - schema = "yaml/schema.yaml"; - }; - pm-cfg { - config = "yaml/config.yaml"; - schema = "yaml/schema.yaml"; - }; - }; - }; -}; diff --git a/tools/binman/test/295_ti_board_cfg_no_type.dts b/tools/binman/test/295_ti_board_cfg_no_type.dts deleted file mode 100644 index 584b7acc5a4..00000000000 --- a/tools/binman/test/295_ti_board_cfg_no_type.dts +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - ti-board-config { - config = "yaml/config.yaml"; - schema = "yaml/schema_notype.yaml"; - }; - }; -}; diff --git a/tools/binman/test/296_ti_secure.dts b/tools/binman/test/296_ti_secure.dts deleted file mode 100644 index 941d0ab4ca3..00000000000 --- a/tools/binman/test/296_ti_secure.dts +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure { - content = <&unsecure_binary>; - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/297_ti_secure_rom.dts b/tools/binman/test/297_ti_secure_rom.dts deleted file mode 100644 index 1a3eca94255..00000000000 --- a/tools/binman/test/297_ti_secure_rom.dts +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure-rom { - content = <&unsecure_binary>; - core-opts = <2>; - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/298_ti_secure_rom_combined.dts b/tools/binman/test/298_ti_secure_rom_combined.dts deleted file mode 100644 index bf872739bc1..00000000000 --- a/tools/binman/test/298_ti_secure_rom_combined.dts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure-rom { - content = <&unsecure_binary>; - content-sbl = <&unsecure_binary>; - content-sysfw = <&unsecure_binary>; - content-sysfw-data = <&unsecure_binary>; - content-sysfw-inner-cert = <&unsecure_binary>; - content-dm-data = <&unsecure_binary>; - combined; - sysfw-inner-cert; - dm-data; - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/299_ti_secure_rom_a.dts b/tools/binman/test/299_ti_secure_rom_a.dts deleted file mode 100644 index 887138f0e4b..00000000000 --- a/tools/binman/test/299_ti_secure_rom_a.dts +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure-rom { - content = <&unsecure_binary>; - core = "secure"; - countersign; - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/300_ti_secure_rom_b.dts b/tools/binman/test/300_ti_secure_rom_b.dts deleted file mode 100644 index c6d6182158c..00000000000 --- a/tools/binman/test/300_ti_secure_rom_b.dts +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure-rom { - content = <&unsecure_binary>; - core = "public"; - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/323_ti_board_cfg_phony.dts b/tools/binman/test/323_ti_board_cfg_phony.dts deleted file mode 100644 index 441296de4fd..00000000000 --- a/tools/binman/test/323_ti_board_cfg_phony.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-board-config { - config = "yaml/config_phony.yaml"; - schema = "yaml/schema.yaml"; - }; - }; -}; diff --git a/tools/binman/test/324_ti_secure_firewall.dts b/tools/binman/test/324_ti_secure_firewall.dts deleted file mode 100644 index 7ec407fa67b..00000000000 --- a/tools/binman/test/324_ti_secure_firewall.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure { - content = <&unsecure_binary>; - auth-in-place = <0xa02>; - - firewall-0-2 { - id = <0>; - region = <2>; - control = <0x31a>; - permissions = <0xc3ffff>; - start_address = <0x0 0x9e800000>; - end_address = <0x0 0x9fffffff>; - }; - - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/325_ti_secure_firewall_missing_property.dts b/tools/binman/test/325_ti_secure_firewall_missing_property.dts deleted file mode 100644 index 24a0a996250..00000000000 --- a/tools/binman/test/325_ti_secure_firewall_missing_property.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - ti-secure { - content = <&unsecure_binary>; - auth-in-place = <0xa02>; - - firewall-0-2 { - // id = <0>; - // region = <2>; - control = <0x31a>; - permissions = <0xc3ffff>; - start_address = <0x0 0x9e800000>; - end_address = <0x0 0x9fffffff>; - }; - - }; - unsecure_binary: blob-ext { - filename = "ti_unsecure.bin"; - }; - }; -}; diff --git a/tools/binman/test/339_nxp_imx8.dts b/tools/binman/test/339_nxp_imx8.dts deleted file mode 100644 index cb512ae9aa2..00000000000 --- a/tools/binman/test/339_nxp_imx8.dts +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - nxp-imx8mimage { - args; /* TODO: Needed by mkimage etype superclass */ - nxp,boot-from = "sd"; - nxp,rom-version = <1>; - nxp,loader-address = <0x10>; - }; - }; -}; diff --git a/tools/binman/test/346_nxp_ddrfw_imx95.dts b/tools/binman/test/346_nxp_ddrfw_imx95.dts deleted file mode 100644 index 889f6f29860..00000000000 --- a/tools/binman/test/346_nxp_ddrfw_imx95.dts +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - imx-lpddr { - type = "nxp-header-ddrfw"; - - imx-lpddr-imem { - filename = "lpddr5_imem.bin"; - type = "blob-ext"; - }; - - imx-lpddr-dmem { - filename = "lpddr5_dmem.bin"; - type = "blob-ext"; - }; - }; - }; -}; diff --git a/tools/binman/test/348_renesas_rcar4_sa0.dts b/tools/binman/test/348_renesas_rcar4_sa0.dts deleted file mode 100644 index 4a8717520f2..00000000000 --- a/tools/binman/test/348_renesas_rcar4_sa0.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - renesas-rcar4-sa0 { - filename = "sa0.bin"; - renesas,loader-address = <0x10>; - }; - }; -}; diff --git a/tools/binman/test/349_renesas_rcar4_sa0_size.dts b/tools/binman/test/349_renesas_rcar4_sa0_size.dts deleted file mode 100644 index eaf4507260b..00000000000 --- a/tools/binman/test/349_renesas_rcar4_sa0_size.dts +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - renesas-rcar4-sa0 { - filename = "sa0.bin"; - renesas,loader-address = <0x10>; - - fill { /* Oversize fill to cover size check */ - size = <0x140000>; - fill-byte = [ff]; - }; - }; - }; -}; diff --git a/tools/binman/test/350_nxp_imx95.dts b/tools/binman/test/350_nxp_imx95.dts deleted file mode 100644 index 3fc2de44b4a..00000000000 --- a/tools/binman/test/350_nxp_imx95.dts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - type = "nxp-imx9image"; - cfg-path = "u-boot-container.cfgout"; - args; - - cntr-version = <2>; - boot-from = "sd"; - soc-type = "IMX9"; - append0 = "mx95b0-ahab-container.img"; - append1 = "container.img"; - container; - image0 = "a55", "bl31.bin", "0x8a200000"; - image1 = "a55", "image.bin", "0x90200000"; - }; - }; -}; diff --git a/tools/binman/test/vendor/nxp_ddrfw_imx95.dts b/tools/binman/test/vendor/nxp_ddrfw_imx95.dts new file mode 100644 index 00000000000..889f6f29860 --- /dev/null +++ b/tools/binman/test/vendor/nxp_ddrfw_imx95.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + imx-lpddr { + type = "nxp-header-ddrfw"; + + imx-lpddr-imem { + filename = "lpddr5_imem.bin"; + type = "blob-ext"; + }; + + imx-lpddr-dmem { + filename = "lpddr5_dmem.bin"; + type = "blob-ext"; + }; + }; + }; +}; diff --git a/tools/binman/test/vendor/nxp_imx8.dts b/tools/binman/test/vendor/nxp_imx8.dts new file mode 100644 index 00000000000..cb512ae9aa2 --- /dev/null +++ b/tools/binman/test/vendor/nxp_imx8.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + nxp-imx8mimage { + args; /* TODO: Needed by mkimage etype superclass */ + nxp,boot-from = "sd"; + nxp,rom-version = <1>; + nxp,loader-address = <0x10>; + }; + }; +}; diff --git a/tools/binman/test/vendor/nxp_imx95.dts b/tools/binman/test/vendor/nxp_imx95.dts new file mode 100644 index 00000000000..3fc2de44b4a --- /dev/null +++ b/tools/binman/test/vendor/nxp_imx95.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + type = "nxp-imx9image"; + cfg-path = "u-boot-container.cfgout"; + args; + + cntr-version = <2>; + boot-from = "sd"; + soc-type = "IMX9"; + append0 = "mx95b0-ahab-container.img"; + append1 = "container.img"; + container; + image0 = "a55", "bl31.bin", "0x8a200000"; + image1 = "a55", "image.bin", "0x90200000"; + }; + }; +}; diff --git a/tools/binman/test/vendor/powerpc_mpc85xx_bootpg_resetvec.dts b/tools/binman/test/vendor/powerpc_mpc85xx_bootpg_resetvec.dts new file mode 100644 index 00000000000..8f4b16c399c --- /dev/null +++ b/tools/binman/test/vendor/powerpc_mpc85xx_bootpg_resetvec.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 NXP + */ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + powerpc-mpc85xx-bootpg-resetvec { + }; + }; +}; diff --git a/tools/binman/test/vendor/renesas_rcar4_sa0.dts b/tools/binman/test/vendor/renesas_rcar4_sa0.dts new file mode 100644 index 00000000000..4a8717520f2 --- /dev/null +++ b/tools/binman/test/vendor/renesas_rcar4_sa0.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + renesas-rcar4-sa0 { + filename = "sa0.bin"; + renesas,loader-address = <0x10>; + }; + }; +}; diff --git a/tools/binman/test/vendor/renesas_rcar4_sa0_size.dts b/tools/binman/test/vendor/renesas_rcar4_sa0_size.dts new file mode 100644 index 00000000000..eaf4507260b --- /dev/null +++ b/tools/binman/test/vendor/renesas_rcar4_sa0_size.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + renesas-rcar4-sa0 { + filename = "sa0.bin"; + renesas,loader-address = <0x10>; + + fill { /* Oversize fill to cover size check */ + size = <0x140000>; + fill-byte = [ff]; + }; + }; + }; +}; diff --git a/tools/binman/test/vendor/rockchip_tpl.dts b/tools/binman/test/vendor/rockchip_tpl.dts new file mode 100644 index 00000000000..269f56e2545 --- /dev/null +++ b/tools/binman/test/vendor/rockchip_tpl.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + rockchip-tpl { + filename = "rockchip-tpl.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_board_cfg.dts b/tools/binman/test/vendor/ti_board_cfg.dts new file mode 100644 index 00000000000..cda024c1b8c --- /dev/null +++ b/tools/binman/test/vendor/ti_board_cfg.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-board-config { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_board_cfg_combined.dts b/tools/binman/test/vendor/ti_board_cfg_combined.dts new file mode 100644 index 00000000000..95ef449cbf4 --- /dev/null +++ b/tools/binman/test/vendor/ti_board_cfg_combined.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + ti-board-config { + board-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + sec-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + rm-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + pm-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_board_cfg_no_type.dts b/tools/binman/test/vendor/ti_board_cfg_no_type.dts new file mode 100644 index 00000000000..584b7acc5a4 --- /dev/null +++ b/tools/binman/test/vendor/ti_board_cfg_no_type.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + ti-board-config { + config = "yaml/config.yaml"; + schema = "yaml/schema_notype.yaml"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_board_cfg_phony.dts b/tools/binman/test/vendor/ti_board_cfg_phony.dts new file mode 100644 index 00000000000..441296de4fd --- /dev/null +++ b/tools/binman/test/vendor/ti_board_cfg_phony.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-board-config { + config = "yaml/config_phony.yaml"; + schema = "yaml/schema.yaml"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_dm.dts b/tools/binman/test/vendor/ti_dm.dts new file mode 100644 index 00000000000..3ab754131e9 --- /dev/null +++ b/tools/binman/test/vendor/ti_dm.dts @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + binman { + ti-dm { + filename = "dm.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure.dts b/tools/binman/test/vendor/ti_secure.dts new file mode 100644 index 00000000000..941d0ab4ca3 --- /dev/null +++ b/tools/binman/test/vendor/ti_secure.dts @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure { + content = <&unsecure_binary>; + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_firewall.dts b/tools/binman/test/vendor/ti_secure_firewall.dts new file mode 100644 index 00000000000..7ec407fa67b --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_firewall.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure { + content = <&unsecure_binary>; + auth-in-place = <0xa02>; + + firewall-0-2 { + id = <0>; + region = <2>; + control = <0x31a>; + permissions = <0xc3ffff>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_firewall_missing_property.dts b/tools/binman/test/vendor/ti_secure_firewall_missing_property.dts new file mode 100644 index 00000000000..24a0a996250 --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_firewall_missing_property.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure { + content = <&unsecure_binary>; + auth-in-place = <0xa02>; + + firewall-0-2 { + // id = <0>; + // region = <2>; + control = <0x31a>; + permissions = <0xc3ffff>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_rom.dts b/tools/binman/test/vendor/ti_secure_rom.dts new file mode 100644 index 00000000000..1a3eca94255 --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_rom.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure-rom { + content = <&unsecure_binary>; + core-opts = <2>; + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_rom_a.dts b/tools/binman/test/vendor/ti_secure_rom_a.dts new file mode 100644 index 00000000000..887138f0e4b --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_rom_a.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure-rom { + content = <&unsecure_binary>; + core = "secure"; + countersign; + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_rom_b.dts b/tools/binman/test/vendor/ti_secure_rom_b.dts new file mode 100644 index 00000000000..c6d6182158c --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_rom_b.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure-rom { + content = <&unsecure_binary>; + core = "public"; + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; diff --git a/tools/binman/test/vendor/ti_secure_rom_combined.dts b/tools/binman/test/vendor/ti_secure_rom_combined.dts new file mode 100644 index 00000000000..bf872739bc1 --- /dev/null +++ b/tools/binman/test/vendor/ti_secure_rom_combined.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure-rom { + content = <&unsecure_binary>; + content-sbl = <&unsecure_binary>; + content-sysfw = <&unsecure_binary>; + content-sysfw-data = <&unsecure_binary>; + content-sysfw-inner-cert = <&unsecure_binary>; + content-dm-data = <&unsecure_binary>; + combined; + sysfw-inner-cert; + dm-data; + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +}; -- cgit v1.3.1 From 1b044493e5d90c07ea2a3158c0e0e6a966a27890 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2026 11:12:44 -0700 Subject: binman: test: Move remaining test files to test/entry/ Move the remaining 60 or so test files into an entry/ subdirectory. These cover general entry types and features: entry args, fill, text, env, compress, replace, template, collection, ELF, overlap, listing, sections, symlink, TEE OS, and other miscellaneous entries. Drop the numeric prefixes and update all references. Signed-off-by: Simon Glass Reviewed-by: Quentin Schulz --- doc/develop/binman_tests.rst | 2 +- tools/binman/fdt_test.py | 2 +- tools/binman/ftest.py | 160 ++++++++++----------- tools/binman/test/041_unknown_pos_size.dts | 12 -- tools/binman/test/045_prop_test.dts | 23 --- tools/binman/test/055_sections.dts | 32 ----- tools/binman/test/056_name_prefix.dts | 30 ---- tools/binman/test/057_unknown_contents.dts | 14 -- tools/binman/test/062_entry_args.dts | 14 -- tools/binman/test/063_entry_args_missing.dts | 13 -- tools/binman/test/064_entry_args_required.dts | 14 -- .../test/065_entry_args_unknown_datatype.dts | 15 -- tools/binman/test/066_text.dts | 33 ----- tools/binman/test/069_fill.dts | 15 -- tools/binman/test/070_fill_no_size.dts | 14 -- tools/binman/test/080_fill_empty.dts | 15 -- tools/binman/test/083_compress.dts | 11 -- tools/binman/test/084_files.dts | 11 -- tools/binman/test/085_files_compress.dts | 11 -- tools/binman/test/086_files_none.dts | 12 -- tools/binman/test/087_files_no_pattern.dts | 11 -- tools/binman/test/096_elf.dts | 16 --- tools/binman/test/097_elf_strip.dts | 15 -- tools/binman/test/127_list.dts | 33 ----- tools/binman/test/132_replace.dts | 21 --- tools/binman/test/133_replace_multi.dts | 33 ----- tools/binman/test/139_replace_repack.dts | 22 --- tools/binman/test/143_replace_all.dts | 28 ---- tools/binman/test/174_env.dts | 20 --- tools/binman/test/175_env_no_size.dts | 19 --- tools/binman/test/176_env_too_small.dts | 20 --- tools/binman/test/182_compress_image.dts | 14 -- tools/binman/test/183_compress_image_less.dts | 14 -- tools/binman/test/184_compress_section_size.dts | 18 --- tools/binman/test/185_compress_section.dts | 16 --- tools/binman/test/186_compress_extra.dts | 37 ----- tools/binman/test/188_image_entryarg.dts | 21 --- tools/binman/test/190_files_align.dts | 12 -- tools/binman/test/191_read_image_skip.dts | 23 --- tools/binman/test/198_collection.dts | 27 ---- tools/binman/test/199_collection_section.dts | 32 ----- tools/binman/test/202_section_timeout.dts | 21 --- tools/binman/test/222_tee_os.dts | 14 -- tools/binman/test/237_unique_names.dts | 34 ----- tools/binman/test/238_unique_names_multi.dts | 38 ----- tools/binman/test/239_replace_with_bintool.dts | 39 ----- tools/binman/test/241_replace_section_simple.dts | 23 --- tools/binman/test/246_collection_other.dts | 29 ---- tools/binman/test/259_symlink.dts | 16 --- tools/binman/test/261_section_fname.dts | 29 ---- tools/binman/test/262_absent.dts | 20 --- tools/binman/test/263_tee_os_opt.dts | 22 --- tools/binman/test/268_null.dts | 19 --- tools/binman/test/269_overlap.dts | 21 --- tools/binman/test/270_overlap_null.dts | 24 ---- tools/binman/test/271_overlap_bad.dts | 21 --- tools/binman/test/272_overlap_no_size.dts | 19 --- tools/binman/test/274_offset_from_elf.dts | 30 ---- tools/binman/test/278_replace_section_deep.dts | 25 ---- tools/binman/test/286_template.dts | 42 ------ tools/binman/test/287_template_multi.dts | 27 ---- tools/binman/test/289_template_section.dts | 52 ------- tools/binman/test/309_template_phandle.dts | 51 ------- tools/binman/test/310_template_phandle_dup.dts | 65 --------- tools/binman/test/346_remove_template.dts | 49 ------- tools/binman/test/entry/absent.dts | 20 +++ tools/binman/test/entry/collection.dts | 27 ++++ tools/binman/test/entry/collection_other.dts | 29 ++++ tools/binman/test/entry/collection_section.dts | 32 +++++ tools/binman/test/entry/compress.dts | 11 ++ tools/binman/test/entry/compress_extra.dts | 37 +++++ tools/binman/test/entry/compress_image.dts | 14 ++ tools/binman/test/entry/compress_image_less.dts | 14 ++ tools/binman/test/entry/compress_section.dts | 16 +++ tools/binman/test/entry/compress_section_size.dts | 18 +++ tools/binman/test/entry/elf.dts | 16 +++ tools/binman/test/entry/elf_strip.dts | 15 ++ tools/binman/test/entry/entry_args.dts | 14 ++ tools/binman/test/entry/entry_args_missing.dts | 13 ++ tools/binman/test/entry/entry_args_required.dts | 14 ++ .../test/entry/entry_args_unknown_datatype.dts | 15 ++ tools/binman/test/entry/env.dts | 20 +++ tools/binman/test/entry/env_no_size.dts | 19 +++ tools/binman/test/entry/env_too_small.dts | 20 +++ tools/binman/test/entry/files.dts | 11 ++ tools/binman/test/entry/files_align.dts | 12 ++ tools/binman/test/entry/files_compress.dts | 11 ++ tools/binman/test/entry/files_no_pattern.dts | 11 ++ tools/binman/test/entry/files_none.dts | 12 ++ tools/binman/test/entry/fill.dts | 15 ++ tools/binman/test/entry/fill_empty.dts | 15 ++ tools/binman/test/entry/fill_no_size.dts | 14 ++ tools/binman/test/entry/image_entryarg.dts | 21 +++ tools/binman/test/entry/list.dts | 33 +++++ tools/binman/test/entry/name_prefix.dts | 30 ++++ tools/binman/test/entry/null.dts | 19 +++ tools/binman/test/entry/offset_from_elf.dts | 30 ++++ tools/binman/test/entry/overlap.dts | 21 +++ tools/binman/test/entry/overlap_bad.dts | 21 +++ tools/binman/test/entry/overlap_no_size.dts | 19 +++ tools/binman/test/entry/overlap_null.dts | 24 ++++ tools/binman/test/entry/prop_test.dts | 23 +++ tools/binman/test/entry/read_image_skip.dts | 23 +++ tools/binman/test/entry/remove_template.dts | 49 +++++++ tools/binman/test/entry/replace.dts | 21 +++ tools/binman/test/entry/replace_all.dts | 28 ++++ tools/binman/test/entry/replace_multi.dts | 33 +++++ tools/binman/test/entry/replace_repack.dts | 22 +++ tools/binman/test/entry/replace_section_deep.dts | 25 ++++ tools/binman/test/entry/replace_section_simple.dts | 23 +++ tools/binman/test/entry/replace_with_bintool.dts | 39 +++++ tools/binman/test/entry/section_fname.dts | 29 ++++ tools/binman/test/entry/section_timeout.dts | 21 +++ tools/binman/test/entry/sections.dts | 32 +++++ tools/binman/test/entry/symlink.dts | 16 +++ tools/binman/test/entry/tee_os.dts | 14 ++ tools/binman/test/entry/tee_os_opt.dts | 22 +++ tools/binman/test/entry/template.dts | 42 ++++++ tools/binman/test/entry/template_multi.dts | 27 ++++ tools/binman/test/entry/template_phandle.dts | 51 +++++++ tools/binman/test/entry/template_phandle_dup.dts | 65 +++++++++ tools/binman/test/entry/template_section.dts | 52 +++++++ tools/binman/test/entry/text.dts | 33 +++++ tools/binman/test/entry/unique_names.dts | 34 +++++ tools/binman/test/entry/unique_names_multi.dts | 38 +++++ tools/binman/test/entry/unknown_contents.dts | 14 ++ tools/binman/test/entry/unknown_pos_size.dts | 12 ++ 127 files changed, 1553 insertions(+), 1553 deletions(-) delete mode 100644 tools/binman/test/041_unknown_pos_size.dts delete mode 100644 tools/binman/test/045_prop_test.dts delete mode 100644 tools/binman/test/055_sections.dts delete mode 100644 tools/binman/test/056_name_prefix.dts delete mode 100644 tools/binman/test/057_unknown_contents.dts delete mode 100644 tools/binman/test/062_entry_args.dts delete mode 100644 tools/binman/test/063_entry_args_missing.dts delete mode 100644 tools/binman/test/064_entry_args_required.dts delete mode 100644 tools/binman/test/065_entry_args_unknown_datatype.dts delete mode 100644 tools/binman/test/066_text.dts delete mode 100644 tools/binman/test/069_fill.dts delete mode 100644 tools/binman/test/070_fill_no_size.dts delete mode 100644 tools/binman/test/080_fill_empty.dts delete mode 100644 tools/binman/test/083_compress.dts delete mode 100644 tools/binman/test/084_files.dts delete mode 100644 tools/binman/test/085_files_compress.dts delete mode 100644 tools/binman/test/086_files_none.dts delete mode 100644 tools/binman/test/087_files_no_pattern.dts delete mode 100644 tools/binman/test/096_elf.dts delete mode 100644 tools/binman/test/097_elf_strip.dts delete mode 100644 tools/binman/test/127_list.dts delete mode 100644 tools/binman/test/132_replace.dts delete mode 100644 tools/binman/test/133_replace_multi.dts delete mode 100644 tools/binman/test/139_replace_repack.dts delete mode 100644 tools/binman/test/143_replace_all.dts delete mode 100644 tools/binman/test/174_env.dts delete mode 100644 tools/binman/test/175_env_no_size.dts delete mode 100644 tools/binman/test/176_env_too_small.dts delete mode 100644 tools/binman/test/182_compress_image.dts delete mode 100644 tools/binman/test/183_compress_image_less.dts delete mode 100644 tools/binman/test/184_compress_section_size.dts delete mode 100644 tools/binman/test/185_compress_section.dts delete mode 100644 tools/binman/test/186_compress_extra.dts delete mode 100644 tools/binman/test/188_image_entryarg.dts delete mode 100644 tools/binman/test/190_files_align.dts delete mode 100644 tools/binman/test/191_read_image_skip.dts delete mode 100644 tools/binman/test/198_collection.dts delete mode 100644 tools/binman/test/199_collection_section.dts delete mode 100644 tools/binman/test/202_section_timeout.dts delete mode 100644 tools/binman/test/222_tee_os.dts delete mode 100644 tools/binman/test/237_unique_names.dts delete mode 100644 tools/binman/test/238_unique_names_multi.dts delete mode 100644 tools/binman/test/239_replace_with_bintool.dts delete mode 100644 tools/binman/test/241_replace_section_simple.dts delete mode 100644 tools/binman/test/246_collection_other.dts delete mode 100644 tools/binman/test/259_symlink.dts delete mode 100644 tools/binman/test/261_section_fname.dts delete mode 100644 tools/binman/test/262_absent.dts delete mode 100644 tools/binman/test/263_tee_os_opt.dts delete mode 100644 tools/binman/test/268_null.dts delete mode 100644 tools/binman/test/269_overlap.dts delete mode 100644 tools/binman/test/270_overlap_null.dts delete mode 100644 tools/binman/test/271_overlap_bad.dts delete mode 100644 tools/binman/test/272_overlap_no_size.dts delete mode 100644 tools/binman/test/274_offset_from_elf.dts delete mode 100644 tools/binman/test/278_replace_section_deep.dts delete mode 100644 tools/binman/test/286_template.dts delete mode 100644 tools/binman/test/287_template_multi.dts delete mode 100644 tools/binman/test/289_template_section.dts delete mode 100644 tools/binman/test/309_template_phandle.dts delete mode 100644 tools/binman/test/310_template_phandle_dup.dts delete mode 100644 tools/binman/test/346_remove_template.dts create mode 100644 tools/binman/test/entry/absent.dts create mode 100644 tools/binman/test/entry/collection.dts create mode 100644 tools/binman/test/entry/collection_other.dts create mode 100644 tools/binman/test/entry/collection_section.dts create mode 100644 tools/binman/test/entry/compress.dts create mode 100644 tools/binman/test/entry/compress_extra.dts create mode 100644 tools/binman/test/entry/compress_image.dts create mode 100644 tools/binman/test/entry/compress_image_less.dts create mode 100644 tools/binman/test/entry/compress_section.dts create mode 100644 tools/binman/test/entry/compress_section_size.dts create mode 100644 tools/binman/test/entry/elf.dts create mode 100644 tools/binman/test/entry/elf_strip.dts create mode 100644 tools/binman/test/entry/entry_args.dts create mode 100644 tools/binman/test/entry/entry_args_missing.dts create mode 100644 tools/binman/test/entry/entry_args_required.dts create mode 100644 tools/binman/test/entry/entry_args_unknown_datatype.dts create mode 100644 tools/binman/test/entry/env.dts create mode 100644 tools/binman/test/entry/env_no_size.dts create mode 100644 tools/binman/test/entry/env_too_small.dts create mode 100644 tools/binman/test/entry/files.dts create mode 100644 tools/binman/test/entry/files_align.dts create mode 100644 tools/binman/test/entry/files_compress.dts create mode 100644 tools/binman/test/entry/files_no_pattern.dts create mode 100644 tools/binman/test/entry/files_none.dts create mode 100644 tools/binman/test/entry/fill.dts create mode 100644 tools/binman/test/entry/fill_empty.dts create mode 100644 tools/binman/test/entry/fill_no_size.dts create mode 100644 tools/binman/test/entry/image_entryarg.dts create mode 100644 tools/binman/test/entry/list.dts create mode 100644 tools/binman/test/entry/name_prefix.dts create mode 100644 tools/binman/test/entry/null.dts create mode 100644 tools/binman/test/entry/offset_from_elf.dts create mode 100644 tools/binman/test/entry/overlap.dts create mode 100644 tools/binman/test/entry/overlap_bad.dts create mode 100644 tools/binman/test/entry/overlap_no_size.dts create mode 100644 tools/binman/test/entry/overlap_null.dts create mode 100644 tools/binman/test/entry/prop_test.dts create mode 100644 tools/binman/test/entry/read_image_skip.dts create mode 100644 tools/binman/test/entry/remove_template.dts create mode 100644 tools/binman/test/entry/replace.dts create mode 100644 tools/binman/test/entry/replace_all.dts create mode 100644 tools/binman/test/entry/replace_multi.dts create mode 100644 tools/binman/test/entry/replace_repack.dts create mode 100644 tools/binman/test/entry/replace_section_deep.dts create mode 100644 tools/binman/test/entry/replace_section_simple.dts create mode 100644 tools/binman/test/entry/replace_with_bintool.dts create mode 100644 tools/binman/test/entry/section_fname.dts create mode 100644 tools/binman/test/entry/section_timeout.dts create mode 100644 tools/binman/test/entry/sections.dts create mode 100644 tools/binman/test/entry/symlink.dts create mode 100644 tools/binman/test/entry/tee_os.dts create mode 100644 tools/binman/test/entry/tee_os_opt.dts create mode 100644 tools/binman/test/entry/template.dts create mode 100644 tools/binman/test/entry/template_multi.dts create mode 100644 tools/binman/test/entry/template_phandle.dts create mode 100644 tools/binman/test/entry/template_phandle_dup.dts create mode 100644 tools/binman/test/entry/template_section.dts create mode 100644 tools/binman/test/entry/text.dts create mode 100644 tools/binman/test/entry/unique_names.dts create mode 100644 tools/binman/test/entry/unique_names_multi.dts create mode 100644 tools/binman/test/entry/unknown_contents.dts create mode 100644 tools/binman/test/entry/unknown_pos_size.dts (limited to 'doc/develop') diff --git a/doc/develop/binman_tests.rst b/doc/develop/binman_tests.rst index 3be7d43cd3f..74a2d0e8ef2 100644 --- a/doc/develop/binman_tests.rst +++ b/doc/develop/binman_tests.rst @@ -402,7 +402,7 @@ Another type of test is one which checks error-handling, for example: def testFillNoSize(self): """Test for an fill entry type with no size""" with self.assertRaises(ValueError) as e: - self._DoReadFile('070_fill_no_size.dts') + self._DoReadFile('entry/fill_no_size.dts') self.assertIn("'fill' entry is missing properties: size", str(e.exception)) diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index ef659c0f276..ef81a3262d2 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -41,7 +41,7 @@ class TestFdt(unittest.TestCase): self._DeleteProp(dt) def testFdtNormalProp(self): - fname = self.GetCompiled('045_prop_test.dts') + fname = self.GetCompiled('entry/prop_test.dts') dt = FdtScan(fname) node = dt.GetNode('/binman/intel-me') self.assertEqual('intel-me', node.name) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 0e4f349aae9..3f57ef05ead 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1431,7 +1431,7 @@ class TestFunctional(unittest.TestCase): def testUnknownPosSize(self): """Test that microcode must be placed within the image""" with self.assertRaises(ValueError) as e: - self._DoReadFile('041_unknown_pos_size.dts', True) + self._DoReadFile('entry/unknown_pos_size.dts', True) self.assertIn("Section '/binman': Unable to set offset/size for unknown " "entry 'invalid-entry'", str(e.exception)) @@ -1626,7 +1626,7 @@ class TestFunctional(unittest.TestCase): def testSections(self): """Basic test of sections""" - data = self._DoReadFile('055_sections.dts') + data = self._DoReadFile('entry/sections.dts') expected = (U_BOOT_DATA + tools.get_bytes(ord('!'), 12) + U_BOOT_DATA + tools.get_bytes(ord('a'), 12) + U_BOOT_DATA + tools.get_bytes(ord('&'), 4)) @@ -1634,7 +1634,7 @@ class TestFunctional(unittest.TestCase): def testMap(self): """Tests outputting a map of the images""" - _, _, map_data, _ = self._DoReadFileDtb('055_sections.dts', map=True) + _, _, map_data, _ = self._DoReadFileDtb('entry/sections.dts', map=True) self.assertEqual('''ImagePos Offset Size Name 00000000 00000000 00000028 image 00000000 00000000 00000010 section@0 @@ -1647,7 +1647,7 @@ class TestFunctional(unittest.TestCase): def testNamePrefix(self): """Tests that name prefixes are used""" - _, _, map_data, _ = self._DoReadFileDtb('056_name_prefix.dts', map=True) + _, _, map_data, _ = self._DoReadFileDtb('entry/name_prefix.dts', map=True) self.assertEqual('''ImagePos Offset Size Name 00000000 00000000 00000028 image 00000000 00000000 00000010 section@0 @@ -1659,7 +1659,7 @@ class TestFunctional(unittest.TestCase): def testUnknownContents(self): """Test that obtaining the contents works as expected""" with self.assertRaises(ValueError) as e: - self._DoReadFile('057_unknown_contents.dts', True) + self._DoReadFile('entry/unknown_contents.dts', True) self.assertIn("Image '/binman': Internal error: Could not complete " "processing of contents: remaining [" "; - #size-cells = <1>; - - binman { - _testing { - return-invalid-entry; - }; - }; -}; diff --git a/tools/binman/test/045_prop_test.dts b/tools/binman/test/045_prop_test.dts deleted file mode 100644 index 064de2b3167..00000000000 --- a/tools/binman/test/045_prop_test.dts +++ /dev/null @@ -1,23 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - sort-by-offset; - end-at-4gb; - size = <16>; - intel-me { - filename = "me.bin"; - offset-unset; - intval = <3>; - intarray = <5 6>; - byteval = [08]; - bytearray = [01 23 34]; - longbytearray = [09 0a 0b 0c]; - stringval = "message2"; - stringarray = "another", "multi-word", "message"; - }; - }; -}; diff --git a/tools/binman/test/055_sections.dts b/tools/binman/test/055_sections.dts deleted file mode 100644 index 6b306aeda46..00000000000 --- a/tools/binman/test/055_sections.dts +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pad-byte = <0x26>; - size = <0x28>; - section@0 { - read-only; - size = <0x10>; - pad-byte = <0x21>; - - u-boot { - }; - }; - section@1 { - size = <0x10>; - pad-byte = <0x61>; - - u-boot { - }; - }; - section@2 { - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/056_name_prefix.dts b/tools/binman/test/056_name_prefix.dts deleted file mode 100644 index f38c80eb183..00000000000 --- a/tools/binman/test/056_name_prefix.dts +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pad-byte = <0x26>; - size = <0x28>; - section@0 { - read-only; - name-prefix = "ro-"; - size = <0x10>; - pad-byte = <0x21>; - - u-boot { - }; - }; - section@1 { - name-prefix = "rw-"; - size = <0x10>; - pad-byte = <0x61>; - - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/057_unknown_contents.dts b/tools/binman/test/057_unknown_contents.dts deleted file mode 100644 index 6ea98d7cab6..00000000000 --- a/tools/binman/test/057_unknown_contents.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - _testing { - return-unknown-contents; - }; - }; -}; diff --git a/tools/binman/test/062_entry_args.dts b/tools/binman/test/062_entry_args.dts deleted file mode 100644 index 4d4f102d60c..00000000000 --- a/tools/binman/test/062_entry_args.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - _testing { - test-str-fdt = "test0"; - test-int-fdt = <123>; - }; - }; -}; diff --git a/tools/binman/test/063_entry_args_missing.dts b/tools/binman/test/063_entry_args_missing.dts deleted file mode 100644 index 1644e2fef3a..00000000000 --- a/tools/binman/test/063_entry_args_missing.dts +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - _testing { - test-str-fdt = "test0"; - }; - }; -}; diff --git a/tools/binman/test/064_entry_args_required.dts b/tools/binman/test/064_entry_args_required.dts deleted file mode 100644 index 705be100691..00000000000 --- a/tools/binman/test/064_entry_args_required.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - _testing { - require-args; - test-str-fdt = "test0"; - }; - }; -}; diff --git a/tools/binman/test/065_entry_args_unknown_datatype.dts b/tools/binman/test/065_entry_args_unknown_datatype.dts deleted file mode 100644 index 3e4838f4fff..00000000000 --- a/tools/binman/test/065_entry_args_unknown_datatype.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - _testing { - test-str-fdt = "test0"; - test-int-fdt = <123>; - force-bad-datatype; - }; - }; -}; diff --git a/tools/binman/test/066_text.dts b/tools/binman/test/066_text.dts deleted file mode 100644 index f23a75ae929..00000000000 --- a/tools/binman/test/066_text.dts +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - text { - size = <8>; - text-label = "test-id"; - }; - text2 { - type = "text"; - text-label = "test-id2"; - }; - text3 { - type = "text"; - text-label = "test-id3"; - }; - /* This one does not use command-line args */ - text4 { - type = "text"; - text-label = "test-id4"; - test-id4 = "some text"; - }; - /* Put text directly in the node */ - text5 { - type = "text"; - text = "more text"; - }; - }; -}; diff --git a/tools/binman/test/069_fill.dts b/tools/binman/test/069_fill.dts deleted file mode 100644 index e372ea37aaa..00000000000 --- a/tools/binman/test/069_fill.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <16>; - fill { - size = <8>; - fill-byte = [ff]; - }; - }; -}; diff --git a/tools/binman/test/070_fill_no_size.dts b/tools/binman/test/070_fill_no_size.dts deleted file mode 100644 index 7b1fcf1b68b..00000000000 --- a/tools/binman/test/070_fill_no_size.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <16>; - fill { - fill-byte = [ff]; - }; - }; -}; diff --git a/tools/binman/test/080_fill_empty.dts b/tools/binman/test/080_fill_empty.dts deleted file mode 100644 index 2b78d3ae88d..00000000000 --- a/tools/binman/test/080_fill_empty.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <16>; - fill { - size = <0>; - fill-byte = [ff]; - }; - }; -}; diff --git a/tools/binman/test/083_compress.dts b/tools/binman/test/083_compress.dts deleted file mode 100644 index 07813bdeaa3..00000000000 --- a/tools/binman/test/083_compress.dts +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - blob { - filename = "compress"; - compress = "lz4"; - }; - }; -}; diff --git a/tools/binman/test/084_files.dts b/tools/binman/test/084_files.dts deleted file mode 100644 index 8f09afd24ea..00000000000 --- a/tools/binman/test/084_files.dts +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - files { - pattern = "files/*.dat"; - files-compress = "none"; - }; - }; -}; diff --git a/tools/binman/test/085_files_compress.dts b/tools/binman/test/085_files_compress.dts deleted file mode 100644 index 5aeead2e6e9..00000000000 --- a/tools/binman/test/085_files_compress.dts +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - files { - pattern = "files/*.dat"; - files-compress = "lz4"; - }; - }; -}; diff --git a/tools/binman/test/086_files_none.dts b/tools/binman/test/086_files_none.dts deleted file mode 100644 index 34bd92f224a..00000000000 --- a/tools/binman/test/086_files_none.dts +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - files { - pattern = "files/*.none"; - compress = "none"; - require-matches; - }; - }; -}; diff --git a/tools/binman/test/087_files_no_pattern.dts b/tools/binman/test/087_files_no_pattern.dts deleted file mode 100644 index 0cb5b469cb0..00000000000 --- a/tools/binman/test/087_files_no_pattern.dts +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - files { - compress = "none"; - require-matches; - }; - }; -}; diff --git a/tools/binman/test/096_elf.dts b/tools/binman/test/096_elf.dts deleted file mode 100644 index 8e3f3f15ef0..00000000000 --- a/tools/binman/test/096_elf.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot-elf { - }; - u-boot-spl-elf { - }; - u-boot-tpl-elf { - }; - }; -}; diff --git a/tools/binman/test/097_elf_strip.dts b/tools/binman/test/097_elf_strip.dts deleted file mode 100644 index 6f3c66fd705..00000000000 --- a/tools/binman/test/097_elf_strip.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot-elf { - strip; - }; - u-boot-spl-elf { - }; - }; -}; diff --git a/tools/binman/test/127_list.dts b/tools/binman/test/127_list.dts deleted file mode 100644 index c1d6fce3f9e..00000000000 --- a/tools/binman/test/127_list.dts +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - section { - align = <0x100>; - cbfs { - size = <0x400>; - u-boot { - cbfs-type = "raw"; - cbfs-offset = <0x38>; - }; - u-boot-dtb { - type = "text"; - text = "compress xxxxxxxxxxxxxxxxxxxxxx data"; - cbfs-type = "raw"; - cbfs-compress = "lzma"; - cbfs-offset = <0x78>; - }; - }; - u-boot-dtb { - compress = "lz4"; - }; - }; - }; -}; diff --git a/tools/binman/test/132_replace.dts b/tools/binman/test/132_replace.dts deleted file mode 100644 index 6ebdcda45c5..00000000000 --- a/tools/binman/test/132_replace.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - u-boot { - }; - fdtmap { - }; - u-boot-dtb { - }; - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/133_replace_multi.dts b/tools/binman/test/133_replace_multi.dts deleted file mode 100644 index 38b2f39d020..00000000000 --- a/tools/binman/test/133_replace_multi.dts +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - first-image { - size = <0xc00>; - u-boot { - }; - fdtmap { - }; - u-boot-dtb { - }; - image-header { - location = "end"; - }; - }; - - image { - fdtmap { - }; - u-boot { - }; - u-boot-dtb { - }; - }; - }; -}; diff --git a/tools/binman/test/139_replace_repack.dts b/tools/binman/test/139_replace_repack.dts deleted file mode 100644 index a3daf6f9b46..00000000000 --- a/tools/binman/test/139_replace_repack.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - u-boot { - }; - fdtmap { - }; - u-boot-dtb { - }; - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/143_replace_all.dts b/tools/binman/test/143_replace_all.dts deleted file mode 100644 index c5744a3c1c8..00000000000 --- a/tools/binman/test/143_replace_all.dts +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - u-boot { - }; - fdtmap { - }; - u-boot2 { - type = "u-boot"; - }; - text { - text = "some text"; - }; - u-boot-dtb { - }; - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/174_env.dts b/tools/binman/test/174_env.dts deleted file mode 100644 index d1393d2db93..00000000000 --- a/tools/binman/test/174_env.dts +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-env { - filename = "env.txt"; - size = <0x18>; - fill-byte = [ff]; - }; - u-boot-nodtb { - }; - }; -}; diff --git a/tools/binman/test/175_env_no_size.dts b/tools/binman/test/175_env_no_size.dts deleted file mode 100644 index 267acd15491..00000000000 --- a/tools/binman/test/175_env_no_size.dts +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-env { - filename = "env.txt"; - fill-byte = [ff]; - }; - u-boot-nodtb { - }; - }; -}; diff --git a/tools/binman/test/176_env_too_small.dts b/tools/binman/test/176_env_too_small.dts deleted file mode 100644 index 2db8d054639..00000000000 --- a/tools/binman/test/176_env_too_small.dts +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - u-boot-env { - filename = "env.txt"; - size = <0x8>; - fill-byte = [ff]; - }; - u-boot-nodtb { - }; - }; -}; diff --git a/tools/binman/test/182_compress_image.dts b/tools/binman/test/182_compress_image.dts deleted file mode 100644 index 4176b7f2e62..00000000000 --- a/tools/binman/test/182_compress_image.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - compress = "lz4"; - blob { - filename = "compress"; - }; - - u-boot { - }; - }; -}; diff --git a/tools/binman/test/183_compress_image_less.dts b/tools/binman/test/183_compress_image_less.dts deleted file mode 100644 index 1d9d57b78c9..00000000000 --- a/tools/binman/test/183_compress_image_less.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - compress = "lz4"; - blob { - filename = "compress_big"; - }; - - u-boot { - }; - }; -}; diff --git a/tools/binman/test/184_compress_section_size.dts b/tools/binman/test/184_compress_section_size.dts deleted file mode 100644 index 1c1dbd5f580..00000000000 --- a/tools/binman/test/184_compress_section_size.dts +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - section { - size = <0x30>; - compress = "lz4"; - pad-byte = <0xff>; - blob { - filename = "compress"; - }; - - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/185_compress_section.dts b/tools/binman/test/185_compress_section.dts deleted file mode 100644 index dc3e340c5d6..00000000000 --- a/tools/binman/test/185_compress_section.dts +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - section { - compress = "lz4"; - blob { - filename = "compress"; - }; - - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/186_compress_extra.dts b/tools/binman/test/186_compress_extra.dts deleted file mode 100644 index 59aae822638..00000000000 --- a/tools/binman/test/186_compress_extra.dts +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - u-boot { - }; - base { - type = "section"; - u-boot { - }; - section { - compress = "lz4"; - blob { - filename = "compress"; - }; - - u-boot { - }; - }; - section2 { - type = "section"; - compress = "lz4"; - blob { - filename = "compress"; - }; - blob2 { - type = "blob"; - filename = "compress"; - }; - }; - u-boot2 { - type = "u-boot"; - }; - }; - }; -}; diff --git a/tools/binman/test/188_image_entryarg.dts b/tools/binman/test/188_image_entryarg.dts deleted file mode 100644 index 29d81491623..00000000000 --- a/tools/binman/test/188_image_entryarg.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - u-boot { - }; - cros-ec-rw { - }; - fdtmap { - }; - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/190_files_align.dts b/tools/binman/test/190_files_align.dts deleted file mode 100644 index 213ba966d35..00000000000 --- a/tools/binman/test/190_files_align.dts +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - files { - pattern = "files/*.dat"; - files-compress = "none"; - files-align = <4>; - }; - }; -}; diff --git a/tools/binman/test/191_read_image_skip.dts b/tools/binman/test/191_read_image_skip.dts deleted file mode 100644 index 31df518fae6..00000000000 --- a/tools/binman/test/191_read_image_skip.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - end-at-4gb; - size = <0x400>; - section { - size = <0x10>; - u-boot { - }; - }; - fdtmap { - }; - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/198_collection.dts b/tools/binman/test/198_collection.dts deleted file mode 100644 index 484a1b0050d..00000000000 --- a/tools/binman/test/198_collection.dts +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - collection { - content = <&u_boot_nodtb &dtb>; - }; - fill { - size = <2>; - fill-byte = [ff]; - }; - u_boot_nodtb: u-boot-nodtb { - }; - fill2 { - type = "fill"; - size = <3>; - fill-byte = [fe]; - }; - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/199_collection_section.dts b/tools/binman/test/199_collection_section.dts deleted file mode 100644 index 03a73194c3f..00000000000 --- a/tools/binman/test/199_collection_section.dts +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - collection { - content = <§ion &u_boot>; - }; - fill { - size = <2>; - fill-byte = [ff]; - }; - section: section { - u-boot-nodtb { - }; - u-boot-dtb { - }; - }; - fill2 { - type = "fill"; - size = <3>; - fill-byte = [fe]; - }; - u_boot: u-boot { - no-expanded; - }; - }; -}; diff --git a/tools/binman/test/202_section_timeout.dts b/tools/binman/test/202_section_timeout.dts deleted file mode 100644 index 1481450367a..00000000000 --- a/tools/binman/test/202_section_timeout.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pad-byte = <0x26>; - size = <0x28>; - section@0 { - read-only; - size = <0x10>; - pad-byte = <0x21>; - - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/222_tee_os.dts b/tools/binman/test/222_tee_os.dts deleted file mode 100644 index 68854972942..00000000000 --- a/tools/binman/test/222_tee_os.dts +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - tee-os { - filename = "tee-pager.bin"; - }; - }; -}; diff --git a/tools/binman/test/237_unique_names.dts b/tools/binman/test/237_unique_names.dts deleted file mode 100644 index 6780d37f71f..00000000000 --- a/tools/binman/test/237_unique_names.dts +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/238_unique_names_multi.dts b/tools/binman/test/238_unique_names_multi.dts deleted file mode 100644 index db63afb445e..00000000000 --- a/tools/binman/test/238_unique_names_multi.dts +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - - image { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; - }; -}; diff --git a/tools/binman/test/239_replace_with_bintool.dts b/tools/binman/test/239_replace_with_bintool.dts deleted file mode 100644 index d7fabd2cd83..00000000000 --- a/tools/binman/test/239_replace_with_bintool.dts +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - size = <0xc00>; - allow-repack; - - u-boot { - }; - - _testing { - require-bintool-for-contents; - require-bintool-for-pack; - }; - - fdtmap { - }; - - u-boot2 { - type = "u-boot"; - }; - - text { - text = "some text"; - }; - - u-boot-dtb { - }; - - image-header { - location = "end"; - }; - }; -}; diff --git a/tools/binman/test/241_replace_section_simple.dts b/tools/binman/test/241_replace_section_simple.dts deleted file mode 100644 index c9d5c328561..00000000000 --- a/tools/binman/test/241_replace_section_simple.dts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - allow-repack; - - u-boot-dtb { - }; - - section { - blob { - filename = "compress"; - }; - - u-boot { - }; - }; - - fdtmap { - }; - }; -}; diff --git a/tools/binman/test/246_collection_other.dts b/tools/binman/test/246_collection_other.dts deleted file mode 100644 index 09de20e5bca..00000000000 --- a/tools/binman/test/246_collection_other.dts +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - collection { - content = <&u_boot_nodtb &dtb>; - }; - section { - fill { - size = <2>; - fill-byte = [ff]; - }; - u_boot_nodtb: u-boot-nodtb { - }; - fill2 { - type = "fill"; - size = <3>; - fill-byte = [fe]; - }; - }; - dtb: u-boot-dtb { - }; - }; -}; diff --git a/tools/binman/test/259_symlink.dts b/tools/binman/test/259_symlink.dts deleted file mode 100644 index 2ee1f7f05e2..00000000000 --- a/tools/binman/test/259_symlink.dts +++ /dev/null @@ -1,16 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - test_image { - filename = "test_image.bin"; - symlink = "symlink_to_test.bin"; - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/261_section_fname.dts b/tools/binman/test/261_section_fname.dts deleted file mode 100644 index 790381e7301..00000000000 --- a/tools/binman/test/261_section_fname.dts +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pad-byte = <0x26>; - size = <0x20>; - section@0 { - size = <0x10>; - pad-byte = <0x21>; - pad-before = <2>; - pad-after = <3>; - - section { - filename = "outfile.bin"; - u-boot { - }; - }; - }; - section@1 { - u-boot { - }; - }; - }; -}; diff --git a/tools/binman/test/262_absent.dts b/tools/binman/test/262_absent.dts deleted file mode 100644 index 2ab8766c878..00000000000 --- a/tools/binman/test/262_absent.dts +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - - _testing { - set-to-absent; - }; - - u-boot-img { - }; - }; -}; diff --git a/tools/binman/test/263_tee_os_opt.dts b/tools/binman/test/263_tee_os_opt.dts deleted file mode 100644 index 2e4ec24ac2c..00000000000 --- a/tools/binman/test/263_tee_os_opt.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - tee-os { - /* - * this results in nothing being added since only the - * .bin format is supported by this etype, unless it is - * part of a FIT - */ - }; - u-boot-img { - }; - }; -}; diff --git a/tools/binman/test/268_null.dts b/tools/binman/test/268_null.dts deleted file mode 100644 index 3824ba85090..00000000000 --- a/tools/binman/test/268_null.dts +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - pad-byte = <0xff>; - u-boot { - }; - null { - size = <4>; - }; - u-boot-img { - }; - }; -}; diff --git a/tools/binman/test/269_overlap.dts b/tools/binman/test/269_overlap.dts deleted file mode 100644 index f949b8b359f..00000000000 --- a/tools/binman/test/269_overlap.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - - inset { - type = "fill"; - fill-byte = [61]; - offset = <1>; - size = <2>; - overlap; - }; - }; -}; diff --git a/tools/binman/test/270_overlap_null.dts b/tools/binman/test/270_overlap_null.dts deleted file mode 100644 index feed9ec8920..00000000000 --- a/tools/binman/test/270_overlap_null.dts +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - section { - u-boot { - }; - - null { - offset = <1>; - size = <2>; - overlap; - }; - }; - - fmap { - }; - }; -}; diff --git a/tools/binman/test/271_overlap_bad.dts b/tools/binman/test/271_overlap_bad.dts deleted file mode 100644 index f2818021144..00000000000 --- a/tools/binman/test/271_overlap_bad.dts +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - - inset { - type = "fill"; - fill-byte = [61]; - offset = <0x10>; - size = <2>; - overlap; - }; - }; -}; diff --git a/tools/binman/test/272_overlap_no_size.dts b/tools/binman/test/272_overlap_no_size.dts deleted file mode 100644 index 4517536f2e6..00000000000 --- a/tools/binman/test/272_overlap_no_size.dts +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot { - }; - - inset { - type = "fill"; - fill-byte = [61]; - overlap; - }; - }; -}; diff --git a/tools/binman/test/274_offset_from_elf.dts b/tools/binman/test/274_offset_from_elf.dts deleted file mode 100644 index e3372fc7c3d..00000000000 --- a/tools/binman/test/274_offset_from_elf.dts +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - blob: blob { - filename = "blob_syms.bin"; - elf-filename = "blob_syms"; - elf-base-sym = "__my_start_sym"; - }; - - inset { - type = "null"; - offset-from-elf = <&blob>, "val3", <0>; - size = <4>; - overlap; - }; - - inset2 { - type = "null"; - offset-from-elf = <&blob>, "val3", <4>; - size = <4>; - overlap; - }; - }; -}; diff --git a/tools/binman/test/278_replace_section_deep.dts b/tools/binman/test/278_replace_section_deep.dts deleted file mode 100644 index fba2d7dcf28..00000000000 --- a/tools/binman/test/278_replace_section_deep.dts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/dts-v1/; - -/ { - binman { - allow-repack; - - u-boot-dtb { - }; - - section { - section { - blob { - filename = "compress"; - }; - }; - - u-boot { - }; - }; - - fdtmap { - }; - }; -}; diff --git a/tools/binman/test/286_template.dts b/tools/binman/test/286_template.dts deleted file mode 100644 index 6980dbfafcc..00000000000 --- a/tools/binman/test/286_template.dts +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot-img { - }; - - common_part: template { - u-boot { - }; - - intel-vga { - filename = "vga.bin"; - }; - }; - - first { - type = "section"; - insert-template = <&common_part>; - - u-boot-dtb { - }; - }; - - second { - type = "section"; - insert-template = <&common_part>; - - u-boot-dtb { - }; - - intel-vga { - filename = "vga2.bin"; - }; - }; - }; -}; diff --git a/tools/binman/test/287_template_multi.dts b/tools/binman/test/287_template_multi.dts deleted file mode 100644 index 122bfccd565..00000000000 --- a/tools/binman/test/287_template_multi.dts +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; -/ { - binman: binman { - multiple-images; - - my_template: template { - blob-ext@0 { - filename = "my-blob.bin"; - offset = <0>; - }; - blob-ext@8 { - offset = <8>; - }; - }; - - image { - pad-byte = <0x40>; - filename = "my-image.bin"; - insert-template = <&my_template>; - blob-ext@8 { - filename = "my-blob2.bin"; - }; - }; - }; -}; diff --git a/tools/binman/test/289_template_section.dts b/tools/binman/test/289_template_section.dts deleted file mode 100644 index 8a744a0cf68..00000000000 --- a/tools/binman/test/289_template_section.dts +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - u-boot-img { - }; - - common_part: template { - u-boot { - }; - - intel-vga { - filename = "vga.bin"; - }; - }; - - first { - type = "section"; - insert-template = <&common_part>; - - u-boot-dtb { - }; - }; - - section { - second { - type = "section"; - insert-template = <&common_part>; - - u-boot-dtb { - }; - - intel-vga { - filename = "vga2.bin"; - }; - }; - }; - - second { - type = "section"; - insert-template = <&common_part>; - - u-boot-dtb { - }; - }; - }; -}; diff --git a/tools/binman/test/309_template_phandle.dts b/tools/binman/test/309_template_phandle.dts deleted file mode 100644 index c4ec1dd41be..00000000000 --- a/tools/binman/test/309_template_phandle.dts +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - - ti_spl_template: template-1 { - fit { - description = "test-desc"; - #address-cells = <1>; - images { - atf { - description = "atf"; - ti-secure { - type = "collection"; - content = <&atf>; - keyfile = "key.pem"; - }; - atf: atf-bl31 { - description = "atf"; - }; - }; - }; - }; - }; - - image { - insert-template = <&ti_spl_template>; - fit { - images { - fdt-0 { - description = "fdt"; - ti-secure { - type = "collection"; - content = <&foo_dtb>; - keyfile = "key.pem"; - }; - foo_dtb: blob-ext { - filename = "vga.bin"; - }; - }; - }; - }; - }; - }; -}; diff --git a/tools/binman/test/310_template_phandle_dup.dts b/tools/binman/test/310_template_phandle_dup.dts deleted file mode 100644 index dc86f06463b..00000000000 --- a/tools/binman/test/310_template_phandle_dup.dts +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - - binman { - multiple-images; - - ti_spl_template: template-1 { - fit { - description = "test-desc"; - #address-cells = <1>; - images { - atf { - description = "atf"; - ti-secure { - type = "collection"; - content = <&atf>; - keyfile = "key.pem"; - }; - atf: atf-bl31 { - description = "atf"; - }; - }; - }; - }; - }; - - image { - insert-template = <&ti_spl_template>; - fit { - images { - fdt-0 { - description = "fdt"; - ti-secure { - type = "collection"; - content = <&foo_dtb>; - keyfile = "key.pem"; - }; - foo_dtb: blob-ext { - filename = "vga.bin"; - }; - }; - }; - }; - }; - - image-2 { - insert-template = <&ti_spl_template>; - fit { - images { - fdt-0 { - description = "fdt"; - blob-ext { - filename = "vga.bin"; - }; - }; - }; - }; - }; - }; -}; diff --git a/tools/binman/test/346_remove_template.dts b/tools/binman/test/346_remove_template.dts deleted file mode 100644 index e05229f3ebc..00000000000 --- a/tools/binman/test/346_remove_template.dts +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ - -/dts-v1/; -/ { - binman: binman { - multiple-images; - - template_1: template-1 { - section { - phandle1: my-blob.bin { - filename = "my-blob.bin"; - type = "blob-ext"; - }; - }; - }; - template_2: template-2 { - section { - ti-secure { - content = <&phandle2>; - keyfile = "key.pem"; - }; - phandle2: my-blob.bin { - filename = "my-blob.bin"; - type = "blob-ext"; - }; - }; - }; - template_3: template-3 { - section { - phandle3: my-blob.bin { - filename = "my-blob.bin"; - type = "blob-ext"; - }; - }; - }; - - file1 { - insert-template = <&template_1>; - }; - - file2 { - insert-template = <&template_2>; - }; - - file3 { - insert-template = <&template_3>; - }; - }; -}; diff --git a/tools/binman/test/entry/absent.dts b/tools/binman/test/entry/absent.dts new file mode 100644 index 00000000000..2ab8766c878 --- /dev/null +++ b/tools/binman/test/entry/absent.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + _testing { + set-to-absent; + }; + + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/entry/collection.dts b/tools/binman/test/entry/collection.dts new file mode 100644 index 00000000000..484a1b0050d --- /dev/null +++ b/tools/binman/test/entry/collection.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&u_boot_nodtb &dtb>; + }; + fill { + size = <2>; + fill-byte = [ff]; + }; + u_boot_nodtb: u-boot-nodtb { + }; + fill2 { + type = "fill"; + size = <3>; + fill-byte = [fe]; + }; + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/entry/collection_other.dts b/tools/binman/test/entry/collection_other.dts new file mode 100644 index 00000000000..09de20e5bca --- /dev/null +++ b/tools/binman/test/entry/collection_other.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <&u_boot_nodtb &dtb>; + }; + section { + fill { + size = <2>; + fill-byte = [ff]; + }; + u_boot_nodtb: u-boot-nodtb { + }; + fill2 { + type = "fill"; + size = <3>; + fill-byte = [fe]; + }; + }; + dtb: u-boot-dtb { + }; + }; +}; diff --git a/tools/binman/test/entry/collection_section.dts b/tools/binman/test/entry/collection_section.dts new file mode 100644 index 00000000000..03a73194c3f --- /dev/null +++ b/tools/binman/test/entry/collection_section.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + collection { + content = <§ion &u_boot>; + }; + fill { + size = <2>; + fill-byte = [ff]; + }; + section: section { + u-boot-nodtb { + }; + u-boot-dtb { + }; + }; + fill2 { + type = "fill"; + size = <3>; + fill-byte = [fe]; + }; + u_boot: u-boot { + no-expanded; + }; + }; +}; diff --git a/tools/binman/test/entry/compress.dts b/tools/binman/test/entry/compress.dts new file mode 100644 index 00000000000..07813bdeaa3 --- /dev/null +++ b/tools/binman/test/entry/compress.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + blob { + filename = "compress"; + compress = "lz4"; + }; + }; +}; diff --git a/tools/binman/test/entry/compress_extra.dts b/tools/binman/test/entry/compress_extra.dts new file mode 100644 index 00000000000..59aae822638 --- /dev/null +++ b/tools/binman/test/entry/compress_extra.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + u-boot { + }; + base { + type = "section"; + u-boot { + }; + section { + compress = "lz4"; + blob { + filename = "compress"; + }; + + u-boot { + }; + }; + section2 { + type = "section"; + compress = "lz4"; + blob { + filename = "compress"; + }; + blob2 { + type = "blob"; + filename = "compress"; + }; + }; + u-boot2 { + type = "u-boot"; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/compress_image.dts b/tools/binman/test/entry/compress_image.dts new file mode 100644 index 00000000000..4176b7f2e62 --- /dev/null +++ b/tools/binman/test/entry/compress_image.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + compress = "lz4"; + blob { + filename = "compress"; + }; + + u-boot { + }; + }; +}; diff --git a/tools/binman/test/entry/compress_image_less.dts b/tools/binman/test/entry/compress_image_less.dts new file mode 100644 index 00000000000..1d9d57b78c9 --- /dev/null +++ b/tools/binman/test/entry/compress_image_less.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + compress = "lz4"; + blob { + filename = "compress_big"; + }; + + u-boot { + }; + }; +}; diff --git a/tools/binman/test/entry/compress_section.dts b/tools/binman/test/entry/compress_section.dts new file mode 100644 index 00000000000..dc3e340c5d6 --- /dev/null +++ b/tools/binman/test/entry/compress_section.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + section { + compress = "lz4"; + blob { + filename = "compress"; + }; + + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/compress_section_size.dts b/tools/binman/test/entry/compress_section_size.dts new file mode 100644 index 00000000000..1c1dbd5f580 --- /dev/null +++ b/tools/binman/test/entry/compress_section_size.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + section { + size = <0x30>; + compress = "lz4"; + pad-byte = <0xff>; + blob { + filename = "compress"; + }; + + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/elf.dts b/tools/binman/test/entry/elf.dts new file mode 100644 index 00000000000..8e3f3f15ef0 --- /dev/null +++ b/tools/binman/test/entry/elf.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-elf { + }; + u-boot-spl-elf { + }; + u-boot-tpl-elf { + }; + }; +}; diff --git a/tools/binman/test/entry/elf_strip.dts b/tools/binman/test/entry/elf_strip.dts new file mode 100644 index 00000000000..6f3c66fd705 --- /dev/null +++ b/tools/binman/test/entry/elf_strip.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-elf { + strip; + }; + u-boot-spl-elf { + }; + }; +}; diff --git a/tools/binman/test/entry/entry_args.dts b/tools/binman/test/entry/entry_args.dts new file mode 100644 index 00000000000..4d4f102d60c --- /dev/null +++ b/tools/binman/test/entry/entry_args.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + test-str-fdt = "test0"; + test-int-fdt = <123>; + }; + }; +}; diff --git a/tools/binman/test/entry/entry_args_missing.dts b/tools/binman/test/entry/entry_args_missing.dts new file mode 100644 index 00000000000..1644e2fef3a --- /dev/null +++ b/tools/binman/test/entry/entry_args_missing.dts @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + test-str-fdt = "test0"; + }; + }; +}; diff --git a/tools/binman/test/entry/entry_args_required.dts b/tools/binman/test/entry/entry_args_required.dts new file mode 100644 index 00000000000..705be100691 --- /dev/null +++ b/tools/binman/test/entry/entry_args_required.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + require-args; + test-str-fdt = "test0"; + }; + }; +}; diff --git a/tools/binman/test/entry/entry_args_unknown_datatype.dts b/tools/binman/test/entry/entry_args_unknown_datatype.dts new file mode 100644 index 00000000000..3e4838f4fff --- /dev/null +++ b/tools/binman/test/entry/entry_args_unknown_datatype.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + test-str-fdt = "test0"; + test-int-fdt = <123>; + force-bad-datatype; + }; + }; +}; diff --git a/tools/binman/test/entry/env.dts b/tools/binman/test/entry/env.dts new file mode 100644 index 00000000000..d1393d2db93 --- /dev/null +++ b/tools/binman/test/entry/env.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-env { + filename = "env.txt"; + size = <0x18>; + fill-byte = [ff]; + }; + u-boot-nodtb { + }; + }; +}; diff --git a/tools/binman/test/entry/env_no_size.dts b/tools/binman/test/entry/env_no_size.dts new file mode 100644 index 00000000000..267acd15491 --- /dev/null +++ b/tools/binman/test/entry/env_no_size.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-env { + filename = "env.txt"; + fill-byte = [ff]; + }; + u-boot-nodtb { + }; + }; +}; diff --git a/tools/binman/test/entry/env_too_small.dts b/tools/binman/test/entry/env_too_small.dts new file mode 100644 index 00000000000..2db8d054639 --- /dev/null +++ b/tools/binman/test/entry/env_too_small.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + u-boot-env { + filename = "env.txt"; + size = <0x8>; + fill-byte = [ff]; + }; + u-boot-nodtb { + }; + }; +}; diff --git a/tools/binman/test/entry/files.dts b/tools/binman/test/entry/files.dts new file mode 100644 index 00000000000..8f09afd24ea --- /dev/null +++ b/tools/binman/test/entry/files.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + files { + pattern = "files/*.dat"; + files-compress = "none"; + }; + }; +}; diff --git a/tools/binman/test/entry/files_align.dts b/tools/binman/test/entry/files_align.dts new file mode 100644 index 00000000000..213ba966d35 --- /dev/null +++ b/tools/binman/test/entry/files_align.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + files { + pattern = "files/*.dat"; + files-compress = "none"; + files-align = <4>; + }; + }; +}; diff --git a/tools/binman/test/entry/files_compress.dts b/tools/binman/test/entry/files_compress.dts new file mode 100644 index 00000000000..5aeead2e6e9 --- /dev/null +++ b/tools/binman/test/entry/files_compress.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + files { + pattern = "files/*.dat"; + files-compress = "lz4"; + }; + }; +}; diff --git a/tools/binman/test/entry/files_no_pattern.dts b/tools/binman/test/entry/files_no_pattern.dts new file mode 100644 index 00000000000..0cb5b469cb0 --- /dev/null +++ b/tools/binman/test/entry/files_no_pattern.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + files { + compress = "none"; + require-matches; + }; + }; +}; diff --git a/tools/binman/test/entry/files_none.dts b/tools/binman/test/entry/files_none.dts new file mode 100644 index 00000000000..34bd92f224a --- /dev/null +++ b/tools/binman/test/entry/files_none.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + files { + pattern = "files/*.none"; + compress = "none"; + require-matches; + }; + }; +}; diff --git a/tools/binman/test/entry/fill.dts b/tools/binman/test/entry/fill.dts new file mode 100644 index 00000000000..e372ea37aaa --- /dev/null +++ b/tools/binman/test/entry/fill.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + fill { + size = <8>; + fill-byte = [ff]; + }; + }; +}; diff --git a/tools/binman/test/entry/fill_empty.dts b/tools/binman/test/entry/fill_empty.dts new file mode 100644 index 00000000000..2b78d3ae88d --- /dev/null +++ b/tools/binman/test/entry/fill_empty.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + fill { + size = <0>; + fill-byte = [ff]; + }; + }; +}; diff --git a/tools/binman/test/entry/fill_no_size.dts b/tools/binman/test/entry/fill_no_size.dts new file mode 100644 index 00000000000..7b1fcf1b68b --- /dev/null +++ b/tools/binman/test/entry/fill_no_size.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + fill { + fill-byte = [ff]; + }; + }; +}; diff --git a/tools/binman/test/entry/image_entryarg.dts b/tools/binman/test/entry/image_entryarg.dts new file mode 100644 index 00000000000..29d81491623 --- /dev/null +++ b/tools/binman/test/entry/image_entryarg.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + u-boot { + }; + cros-ec-rw { + }; + fdtmap { + }; + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/list.dts b/tools/binman/test/entry/list.dts new file mode 100644 index 00000000000..c1d6fce3f9e --- /dev/null +++ b/tools/binman/test/entry/list.dts @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + section { + align = <0x100>; + cbfs { + size = <0x400>; + u-boot { + cbfs-type = "raw"; + cbfs-offset = <0x38>; + }; + u-boot-dtb { + type = "text"; + text = "compress xxxxxxxxxxxxxxxxxxxxxx data"; + cbfs-type = "raw"; + cbfs-compress = "lzma"; + cbfs-offset = <0x78>; + }; + }; + u-boot-dtb { + compress = "lz4"; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/name_prefix.dts b/tools/binman/test/entry/name_prefix.dts new file mode 100644 index 00000000000..f38c80eb183 --- /dev/null +++ b/tools/binman/test/entry/name_prefix.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0x26>; + size = <0x28>; + section@0 { + read-only; + name-prefix = "ro-"; + size = <0x10>; + pad-byte = <0x21>; + + u-boot { + }; + }; + section@1 { + name-prefix = "rw-"; + size = <0x10>; + pad-byte = <0x61>; + + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/null.dts b/tools/binman/test/entry/null.dts new file mode 100644 index 00000000000..3824ba85090 --- /dev/null +++ b/tools/binman/test/entry/null.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0xff>; + u-boot { + }; + null { + size = <4>; + }; + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/entry/offset_from_elf.dts b/tools/binman/test/entry/offset_from_elf.dts new file mode 100644 index 00000000000..e3372fc7c3d --- /dev/null +++ b/tools/binman/test/entry/offset_from_elf.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + blob: blob { + filename = "blob_syms.bin"; + elf-filename = "blob_syms"; + elf-base-sym = "__my_start_sym"; + }; + + inset { + type = "null"; + offset-from-elf = <&blob>, "val3", <0>; + size = <4>; + overlap; + }; + + inset2 { + type = "null"; + offset-from-elf = <&blob>, "val3", <4>; + size = <4>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/entry/overlap.dts b/tools/binman/test/entry/overlap.dts new file mode 100644 index 00000000000..f949b8b359f --- /dev/null +++ b/tools/binman/test/entry/overlap.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + offset = <1>; + size = <2>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/entry/overlap_bad.dts b/tools/binman/test/entry/overlap_bad.dts new file mode 100644 index 00000000000..f2818021144 --- /dev/null +++ b/tools/binman/test/entry/overlap_bad.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + offset = <0x10>; + size = <2>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/entry/overlap_no_size.dts b/tools/binman/test/entry/overlap_no_size.dts new file mode 100644 index 00000000000..4517536f2e6 --- /dev/null +++ b/tools/binman/test/entry/overlap_no_size.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + overlap; + }; + }; +}; diff --git a/tools/binman/test/entry/overlap_null.dts b/tools/binman/test/entry/overlap_null.dts new file mode 100644 index 00000000000..feed9ec8920 --- /dev/null +++ b/tools/binman/test/entry/overlap_null.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + section { + u-boot { + }; + + null { + offset = <1>; + size = <2>; + overlap; + }; + }; + + fmap { + }; + }; +}; diff --git a/tools/binman/test/entry/prop_test.dts b/tools/binman/test/entry/prop_test.dts new file mode 100644 index 00000000000..064de2b3167 --- /dev/null +++ b/tools/binman/test/entry/prop_test.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-offset; + end-at-4gb; + size = <16>; + intel-me { + filename = "me.bin"; + offset-unset; + intval = <3>; + intarray = <5 6>; + byteval = [08]; + bytearray = [01 23 34]; + longbytearray = [09 0a 0b 0c]; + stringval = "message2"; + stringarray = "another", "multi-word", "message"; + }; + }; +}; diff --git a/tools/binman/test/entry/read_image_skip.dts b/tools/binman/test/entry/read_image_skip.dts new file mode 100644 index 00000000000..31df518fae6 --- /dev/null +++ b/tools/binman/test/entry/read_image_skip.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + end-at-4gb; + size = <0x400>; + section { + size = <0x10>; + u-boot { + }; + }; + fdtmap { + }; + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/remove_template.dts b/tools/binman/test/entry/remove_template.dts new file mode 100644 index 00000000000..e05229f3ebc --- /dev/null +++ b/tools/binman/test/entry/remove_template.dts @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; +/ { + binman: binman { + multiple-images; + + template_1: template-1 { + section { + phandle1: my-blob.bin { + filename = "my-blob.bin"; + type = "blob-ext"; + }; + }; + }; + template_2: template-2 { + section { + ti-secure { + content = <&phandle2>; + keyfile = "key.pem"; + }; + phandle2: my-blob.bin { + filename = "my-blob.bin"; + type = "blob-ext"; + }; + }; + }; + template_3: template-3 { + section { + phandle3: my-blob.bin { + filename = "my-blob.bin"; + type = "blob-ext"; + }; + }; + }; + + file1 { + insert-template = <&template_1>; + }; + + file2 { + insert-template = <&template_2>; + }; + + file3 { + insert-template = <&template_3>; + }; + }; +}; diff --git a/tools/binman/test/entry/replace.dts b/tools/binman/test/entry/replace.dts new file mode 100644 index 00000000000..6ebdcda45c5 --- /dev/null +++ b/tools/binman/test/entry/replace.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + u-boot { + }; + fdtmap { + }; + u-boot-dtb { + }; + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/replace_all.dts b/tools/binman/test/entry/replace_all.dts new file mode 100644 index 00000000000..c5744a3c1c8 --- /dev/null +++ b/tools/binman/test/entry/replace_all.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + u-boot { + }; + fdtmap { + }; + u-boot2 { + type = "u-boot"; + }; + text { + text = "some text"; + }; + u-boot-dtb { + }; + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/replace_multi.dts b/tools/binman/test/entry/replace_multi.dts new file mode 100644 index 00000000000..38b2f39d020 --- /dev/null +++ b/tools/binman/test/entry/replace_multi.dts @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + first-image { + size = <0xc00>; + u-boot { + }; + fdtmap { + }; + u-boot-dtb { + }; + image-header { + location = "end"; + }; + }; + + image { + fdtmap { + }; + u-boot { + }; + u-boot-dtb { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/replace_repack.dts b/tools/binman/test/entry/replace_repack.dts new file mode 100644 index 00000000000..a3daf6f9b46 --- /dev/null +++ b/tools/binman/test/entry/replace_repack.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + u-boot { + }; + fdtmap { + }; + u-boot-dtb { + }; + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/replace_section_deep.dts b/tools/binman/test/entry/replace_section_deep.dts new file mode 100644 index 00000000000..fba2d7dcf28 --- /dev/null +++ b/tools/binman/test/entry/replace_section_deep.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + allow-repack; + + u-boot-dtb { + }; + + section { + section { + blob { + filename = "compress"; + }; + }; + + u-boot { + }; + }; + + fdtmap { + }; + }; +}; diff --git a/tools/binman/test/entry/replace_section_simple.dts b/tools/binman/test/entry/replace_section_simple.dts new file mode 100644 index 00000000000..c9d5c328561 --- /dev/null +++ b/tools/binman/test/entry/replace_section_simple.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + allow-repack; + + u-boot-dtb { + }; + + section { + blob { + filename = "compress"; + }; + + u-boot { + }; + }; + + fdtmap { + }; + }; +}; diff --git a/tools/binman/test/entry/replace_with_bintool.dts b/tools/binman/test/entry/replace_with_bintool.dts new file mode 100644 index 00000000000..d7fabd2cd83 --- /dev/null +++ b/tools/binman/test/entry/replace_with_bintool.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + _testing { + require-bintool-for-contents; + require-bintool-for-pack; + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/section_fname.dts b/tools/binman/test/entry/section_fname.dts new file mode 100644 index 00000000000..790381e7301 --- /dev/null +++ b/tools/binman/test/entry/section_fname.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0x26>; + size = <0x20>; + section@0 { + size = <0x10>; + pad-byte = <0x21>; + pad-before = <2>; + pad-after = <3>; + + section { + filename = "outfile.bin"; + u-boot { + }; + }; + }; + section@1 { + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/section_timeout.dts b/tools/binman/test/entry/section_timeout.dts new file mode 100644 index 00000000000..1481450367a --- /dev/null +++ b/tools/binman/test/entry/section_timeout.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0x26>; + size = <0x28>; + section@0 { + read-only; + size = <0x10>; + pad-byte = <0x21>; + + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/sections.dts b/tools/binman/test/entry/sections.dts new file mode 100644 index 00000000000..6b306aeda46 --- /dev/null +++ b/tools/binman/test/entry/sections.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0x26>; + size = <0x28>; + section@0 { + read-only; + size = <0x10>; + pad-byte = <0x21>; + + u-boot { + }; + }; + section@1 { + size = <0x10>; + pad-byte = <0x61>; + + u-boot { + }; + }; + section@2 { + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/symlink.dts b/tools/binman/test/entry/symlink.dts new file mode 100644 index 00000000000..2ee1f7f05e2 --- /dev/null +++ b/tools/binman/test/entry/symlink.dts @@ -0,0 +1,16 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + test_image { + filename = "test_image.bin"; + symlink = "symlink_to_test.bin"; + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/tee_os.dts b/tools/binman/test/entry/tee_os.dts new file mode 100644 index 00000000000..68854972942 --- /dev/null +++ b/tools/binman/test/entry/tee_os.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + tee-os { + filename = "tee-pager.bin"; + }; + }; +}; diff --git a/tools/binman/test/entry/tee_os_opt.dts b/tools/binman/test/entry/tee_os_opt.dts new file mode 100644 index 00000000000..2e4ec24ac2c --- /dev/null +++ b/tools/binman/test/entry/tee_os_opt.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + tee-os { + /* + * this results in nothing being added since only the + * .bin format is supported by this etype, unless it is + * part of a FIT + */ + }; + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/entry/template.dts b/tools/binman/test/entry/template.dts new file mode 100644 index 00000000000..6980dbfafcc --- /dev/null +++ b/tools/binman/test/entry/template.dts @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-img { + }; + + common_part: template { + u-boot { + }; + + intel-vga { + filename = "vga.bin"; + }; + }; + + first { + type = "section"; + insert-template = <&common_part>; + + u-boot-dtb { + }; + }; + + second { + type = "section"; + insert-template = <&common_part>; + + u-boot-dtb { + }; + + intel-vga { + filename = "vga2.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/template_multi.dts b/tools/binman/test/entry/template_multi.dts new file mode 100644 index 00000000000..122bfccd565 --- /dev/null +++ b/tools/binman/test/entry/template_multi.dts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; +/ { + binman: binman { + multiple-images; + + my_template: template { + blob-ext@0 { + filename = "my-blob.bin"; + offset = <0>; + }; + blob-ext@8 { + offset = <8>; + }; + }; + + image { + pad-byte = <0x40>; + filename = "my-image.bin"; + insert-template = <&my_template>; + blob-ext@8 { + filename = "my-blob2.bin"; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/template_phandle.dts b/tools/binman/test/entry/template_phandle.dts new file mode 100644 index 00000000000..c4ec1dd41be --- /dev/null +++ b/tools/binman/test/entry/template_phandle.dts @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + + ti_spl_template: template-1 { + fit { + description = "test-desc"; + #address-cells = <1>; + images { + atf { + description = "atf"; + ti-secure { + type = "collection"; + content = <&atf>; + keyfile = "key.pem"; + }; + atf: atf-bl31 { + description = "atf"; + }; + }; + }; + }; + }; + + image { + insert-template = <&ti_spl_template>; + fit { + images { + fdt-0 { + description = "fdt"; + ti-secure { + type = "collection"; + content = <&foo_dtb>; + keyfile = "key.pem"; + }; + foo_dtb: blob-ext { + filename = "vga.bin"; + }; + }; + }; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/template_phandle_dup.dts b/tools/binman/test/entry/template_phandle_dup.dts new file mode 100644 index 00000000000..dc86f06463b --- /dev/null +++ b/tools/binman/test/entry/template_phandle_dup.dts @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + + ti_spl_template: template-1 { + fit { + description = "test-desc"; + #address-cells = <1>; + images { + atf { + description = "atf"; + ti-secure { + type = "collection"; + content = <&atf>; + keyfile = "key.pem"; + }; + atf: atf-bl31 { + description = "atf"; + }; + }; + }; + }; + }; + + image { + insert-template = <&ti_spl_template>; + fit { + images { + fdt-0 { + description = "fdt"; + ti-secure { + type = "collection"; + content = <&foo_dtb>; + keyfile = "key.pem"; + }; + foo_dtb: blob-ext { + filename = "vga.bin"; + }; + }; + }; + }; + }; + + image-2 { + insert-template = <&ti_spl_template>; + fit { + images { + fdt-0 { + description = "fdt"; + blob-ext { + filename = "vga.bin"; + }; + }; + }; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/template_section.dts b/tools/binman/test/entry/template_section.dts new file mode 100644 index 00000000000..8a744a0cf68 --- /dev/null +++ b/tools/binman/test/entry/template_section.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot-img { + }; + + common_part: template { + u-boot { + }; + + intel-vga { + filename = "vga.bin"; + }; + }; + + first { + type = "section"; + insert-template = <&common_part>; + + u-boot-dtb { + }; + }; + + section { + second { + type = "section"; + insert-template = <&common_part>; + + u-boot-dtb { + }; + + intel-vga { + filename = "vga2.bin"; + }; + }; + }; + + second { + type = "section"; + insert-template = <&common_part>; + + u-boot-dtb { + }; + }; + }; +}; diff --git a/tools/binman/test/entry/text.dts b/tools/binman/test/entry/text.dts new file mode 100644 index 00000000000..f23a75ae929 --- /dev/null +++ b/tools/binman/test/entry/text.dts @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + text { + size = <8>; + text-label = "test-id"; + }; + text2 { + type = "text"; + text-label = "test-id2"; + }; + text3 { + type = "text"; + text-label = "test-id3"; + }; + /* This one does not use command-line args */ + text4 { + type = "text"; + text-label = "test-id4"; + test-id4 = "some text"; + }; + /* Put text directly in the node */ + text5 { + type = "text"; + text = "more text"; + }; + }; +}; diff --git a/tools/binman/test/entry/unique_names.dts b/tools/binman/test/entry/unique_names.dts new file mode 100644 index 00000000000..6780d37f71f --- /dev/null +++ b/tools/binman/test/entry/unique_names.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; +}; diff --git a/tools/binman/test/entry/unique_names_multi.dts b/tools/binman/test/entry/unique_names_multi.dts new file mode 100644 index 00000000000..db63afb445e --- /dev/null +++ b/tools/binman/test/entry/unique_names_multi.dts @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + multiple-images; + + image { + size = <0xc00>; + allow-repack; + + u-boot { + }; + + fdtmap { + }; + + u-boot2 { + type = "u-boot"; + }; + + text { + text = "some text"; + }; + + u-boot-dtb { + }; + + image-header { + location = "end"; + }; + }; + }; +}; diff --git a/tools/binman/test/entry/unknown_contents.dts b/tools/binman/test/entry/unknown_contents.dts new file mode 100644 index 00000000000..6ea98d7cab6 --- /dev/null +++ b/tools/binman/test/entry/unknown_contents.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + return-unknown-contents; + }; + }; +}; diff --git a/tools/binman/test/entry/unknown_pos_size.dts b/tools/binman/test/entry/unknown_pos_size.dts new file mode 100644 index 00000000000..94fe821c470 --- /dev/null +++ b/tools/binman/test/entry/unknown_pos_size.dts @@ -0,0 +1,12 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + _testing { + return-invalid-entry; + }; + }; +}; -- cgit v1.3.1 From 4d17632b9a2866695a312e049f94aa386145bafa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Mar 2026 11:12:51 -0700 Subject: binman: doc: Update binman_tests.rst for subdirectory layout Update the guidance for adding new tests to describe the subdirectory structure instead of the numbering scheme. Signed-off-by: Simon Glass --- doc/develop/binman_tests.rst | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'doc/develop') diff --git a/doc/develop/binman_tests.rst b/doc/develop/binman_tests.rst index 74a2d0e8ef2..40865912911 100644 --- a/doc/develop/binman_tests.rst +++ b/doc/develop/binman_tests.rst @@ -453,31 +453,15 @@ help with this, but your code will be different. Generally you are adding a test because you are adding a new entry type ('etype'). So start by creating the shortest and simplest image-description you -can, which contains the new etype. Put it in a numbered file in -``tool/binman/test`` so that it comes last. All the numbers are unique and there -are no gaps. +can, which contains the new etype. Put it under ``tools/binman/test`` in the +appropriate subdirectory (e.g. ``fit/`` for FIT image tests, ``vendor/`` for +vendor-specific tests, ``entry/`` for general entry types) with a descriptive +filename. Example from ``tools/binman/test/vendor/nxp_imx8.dts``: -.. code-block:: devicetree - - // SPDX-License-Identifier: GPL-2.0+ - - /dts-v1/; - - / { - #address-cells = <1>; - #size-cells = <1>; - - binman { - nxp-imx8mimage { - args; /* TODO: Needed by mkimage etype superclass */ - nxp,boot-from = "sd"; - nxp,rom-version = <1>; - nxp,loader-address = <0x10>; - }; - }; - }; +.. literalinclude:: ../../tools/binman/test/vendor/nxp_imx8.dts + :language: devicetree Note that you should use tabs in the file, not spaces. You can see that this has been cut down to the bare minimum, just enough to include the etype and the -- cgit v1.3.1 From 02673659e81391729792ebc1b816d974de3c9abf Mon Sep 17 00:00:00 2001 From: Kory Maincent Date: Mon, 23 Feb 2026 14:18:39 +0100 Subject: tools: Add support for fwumdata tool Add a new fwumdata tool to allows users to read, display, and modify FWU (Firmware Update) metadata from Linux userspace. It provides functionality similar to fw_printenv/fw_setenv but for FWU metadata. Users can view metadata, change active/previous bank indices, modify bank states, and set image acceptance flags. Configuration is done via fwumdata.config file. Signed-off-by: Kory Maincent Tested-by: Dario Binacchi Signed-off-by: Ilias Apalodimas --- MAINTAINERS | 4 + doc/develop/uefi/fwu_updates.rst | 4 +- doc/fwumdata.1 | 222 ++++++++++ tools/.gitignore | 1 + tools/fwumdata_src/Kconfig | 11 + tools/fwumdata_src/fwumdata.c | 854 +++++++++++++++++++++++++++++++++++++ tools/fwumdata_src/fwumdata.config | 33 ++ tools/fwumdata_src/fwumdata.h | 138 ++++++ tools/fwumdata_src/fwumdata.mk | 3 + 9 files changed, 1269 insertions(+), 1 deletion(-) create mode 100644 doc/fwumdata.1 create mode 100644 tools/fwumdata_src/fwumdata.c create mode 100644 tools/fwumdata_src/fwumdata.config create mode 100644 tools/fwumdata_src/fwumdata.h (limited to 'doc/develop') diff --git a/MAINTAINERS b/MAINTAINERS index a925247b0cb..fb9c28c33ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1244,11 +1244,15 @@ F: drivers/watchdog/sbsa_gwdt.c FWU Multi Bank Update M: Sughosh Ganu +M: Kory Maincent S: Maintained T: git https://source.denx.de/u-boot/custodians/u-boot-efi.git +F: doc/fwumdata.1 F: doc/mkfwumdata.1 F: lib/fwu_updates/* F: drivers/fwu-mdata/* +F: tools/fwumdata_src/fwumdata.c +F: tools/fwumdata_src/fwumdata.h F: tools/fwumdata_src/mkfwumdata.c GATEWORKS_SC diff --git a/doc/develop/uefi/fwu_updates.rst b/doc/develop/uefi/fwu_updates.rst index 84713581459..c592106f8a8 100644 --- a/doc/develop/uefi/fwu_updates.rst +++ b/doc/develop/uefi/fwu_updates.rst @@ -66,7 +66,9 @@ FWU Metadata U-Boot supports both versions(1 and 2) of the FWU metadata defined in the two revisions of the specification. Support can be enabled for either of the two versions through a config flag. The mkfwumdata tool -can generate metadata for both the supported versions. +can generate metadata for both the supported versions. On the target side, +the fwumdata tool can read and update FWU metadata located in memory, +similarly to how fw_printenv/fw_setenv works. Setting up the device for GPT partitioned storage ------------------------------------------------- diff --git a/doc/fwumdata.1 b/doc/fwumdata.1 new file mode 100644 index 00000000000..66a53fc9403 --- /dev/null +++ b/doc/fwumdata.1 @@ -0,0 +1,222 @@ +.\" SPDX-License-Identifier: GPL-2.0-or-later +.\" Copyright (C) 2025 Kory Maincent +.TH FWUMDATA 1 2025 U-Boot +.SH NAME +fwumdata \- read, display, and modify FWU metadata +. +.SH SYNOPSIS +.SY fwumdata +.OP \-c config +.OP \-l +.OP \-u +.OP \-a bankid +.OP \-p bankid +.RB [ \-s +.IR bankid " " state ] +.OP \-i imageid +.OP \-b bankid +.OP \-A +.OP \-C +.OP \-B num_banks +.OP \-I num_images +.YS +.SY fwumdata +.B \-h +.YS +. +.SH DESCRIPTION +.B fwumdata +reads, displays, and modifies FWU (Firmware Update) metadata from Linux +userspace. +.PP +The tool operates on FWU metadata stored on block or MTD devices, allowing +userspace manipulation of firmware update state including active bank +selection, image acceptance, and bank state management. +. +.SH OPTIONS +.TP +.BR \-c ", " \-\-config " \fIfile\fR" +Use custom configuration file. By default, the tool searches for +.I ./fwumdata.config +then +.IR /etc/fwumdata.config . +. +.TP +.BR \-l ", " \-\-list +Display detailed metadata information including all GUIDs, image entries, +and bank information. Without this option, only a summary is shown. +. +.TP +.BR \-u ", " \-\-update +Update metadata if CRC validation fails. Useful for recovering from corrupted +metadata. +. +.TP +.BR \-a ", " \-\-active " \fIbankid\fR" +Set the active bank index to +.IR bank . +. +.TP +.BR \-p ", " \-\-previous " \fIbankid\fR" +Set the previous active bank index to +.IR bank . +. +.TP +.BR \-s ", " \-\-state " \fIbankid state\fR" +Set bank index +.I bankid +to the specified +.IR state . +Valid states are: +.BR accepted , +.BR valid , +or +.BR invalid . +Supported only with version 2 metadata. When setting a bank to accepted state, +all firmware images in that bank are automatically marked as accepted. +. +.TP +.BR \-i ", " \-\-image " \fIimageid\fR" +Specify image number (used with +.B \-A +or +.BR \-C ). +. +.TP +.BR \-b ", " \-\-bank " \fIbankid\fR" +Specify bank number (used with +.B \-A +or +.BR \-C ). +. +.TP +.BR \-A ", " \-\-accept +Accept the image specified by +.B \-i +in the bank specified by +.BR \-b . +Sets the FWU_IMAGE_ACCEPTED flag for the image. +. +.TP +.BR \-C ", " \-\-clear +Clear the acceptance flag for the image specified by +.B \-i +in the bank specified by +.BR \-b . +According to the FWU specification, the bank state is automatically set to +invalid before clearing the acceptance flag. +. +.TP +.BR \-B ", " \-\-nbanks " \fInum_banks\fR" +Specify total number of banks (required for V1 metadata). +. +.TP +.BR \-I ", " \-\-nimages " \fInum_images\fR" +Specify total number of images (required for V1 metadata). +. +.TP +.BR \-h ", " \-\-help +Print usage information and exit. +. +.SH CONFIGURATION FILE +The configuration file specifies the location of FWU metadata on storage +devices. The format is: +.PP +.EX +.in +4 +# Device Name Device Offset Metadata Size Erase Size +/dev/mtd0 0x0 0x78 0x1000 +/dev/mtd1 0x0 0x78 0x1000 +.in +.EE +.PP +Lines starting with +.B # +are comments. +.I Erase Size +is optional and only applies to MTD devices; if omitted, it defaults to the +metadata size. +.PP +Specifying two devices enables redundant metadata support. +. +.SH BUGS +Please report bugs to the +.UR https://\:source\:.denx\:.de/\:u-boot/\:u-boot/\:issues +U-Boot bug tracker +.UE . +. +.SH EXAMPLES +Display FWU metadata summary: +.PP +.EX +.in +4 +$ \c +.B fwumdata +.in +.EE +.PP +Display detailed metadata with all GUIDs: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-l +.in +.EE +.PP +Set active bank to 1: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-a 1 +.in +.EE +.PP +Set bank 1 to accepted state (automatically accepts all images in that bank): +.PP +.EX +.in +4 +$ \c +.B fwumdata \-s 1 accepted +.in +.EE +.PP +Accept image 0 in bank 0: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-i 0 \-b 0 \-A \-l +.in +.EE +.PP +Clear acceptance for image 0 in bank 1: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-i 0 \-b 1 \-C \-l +.in +.EE +.PP +Clear acceptance for image 1 in bank 1 with metadata V1: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-B 2 \-I 2 \-i 1 \-b 1 \-C \-l +.in +.EE +.PP +Use custom configuration file: +.PP +.EX +.in +4 +$ \c +.B fwumdata \-c /path/to/custom.config +.in +.EE +. +.SH SEE ALSO +.BR mkfwumdata (1) diff --git a/tools/.gitignore b/tools/.gitignore index e8daa24a52d..49943d2cf3a 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -11,6 +11,7 @@ /file2include /fit_check_sign /fit_info +/fwumdata /gdb/gdbcont /gdb/gdbsend /gen_eth_addr diff --git a/tools/fwumdata_src/Kconfig b/tools/fwumdata_src/Kconfig index c033c560e8d..af1f3bb3f57 100644 --- a/tools/fwumdata_src/Kconfig +++ b/tools/fwumdata_src/Kconfig @@ -6,3 +6,14 @@ config TOOLS_MKFWUMDATA metadata for initial installation of the FWU multi bank update on the board. The installation method depends on the platform. + +config TOOLS_FWUMDATA + bool "Build fwumdata command" + default y if FWU_MULTI_BANK_UPDATE + help + This command allows users to read, display, and modify FWU + (Firmware Update) metadata from Linux userspace. It provides + functionality similar to fw_printenv/fw_setenv but for FWU + metadata. Users can view metadata, change active/previous + bank indices, modify bank states, and set image acceptance + flags. Configuration is done via fwumdata.config file. diff --git a/tools/fwumdata_src/fwumdata.c b/tools/fwumdata_src/fwumdata.c new file mode 100644 index 00000000000..c5b0f56842d --- /dev/null +++ b/tools/fwumdata_src/fwumdata.c @@ -0,0 +1,854 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * FWU Metadata Read/Write Tool + * Copyright (c) 2025, Kory Maincent + * + * Tool to read, display, and modify FWU (Firmware Update) metadata + * from Linux userspace. Similar to fw_printenv/fw_setenv for U-Boot + * environment, but for FWU metadata. + * + * Usage: + * fwumdata - Print all metadata + * fwumdata -u - Print metadata and update it if CRC corrupted + * fwumdata -c - Use custom config file + * fwumdata -a - Set active bank + * fwumdata -p - Set previous bank + * fwumdata -s - Set bank state (V2 only) + * fwumdata -i -b -A - Accept image + * fwumdata -i -b -C - Clear image acceptance + * fwumdata -i -b + * -B + * -I -C - Clear image acceptance (V1 only) + * fwumdata -l - List detailed info with GUIDs + */ + +#include +#include +#include +#include +#include +#include +#include +#include "fwumdata.h" + +/* Device configuration */ +struct fwumdata_device { + const char *devname; + long long devoff; + unsigned long mdata_size; + unsigned long erase_size; + int fd; + bool is_mtd; +}; + +/* Global state */ +static struct fwumdata_device devices[2]; /* Primary and secondary */ +static struct fwu_mdata *mdata; +static int have_redundant; +static struct fwu_mdata *valid_mdata; +static bool mdata_mod; +static const char *config_file; +static int nbanks, nimages; /* For V1 only */ +static const char * const default_config_files[] = { + "./fwumdata.config", + "/etc/fwumdata.config", + NULL +}; + +/* GUID/UUID utilities */ +static void guid_to_string(const struct efi_guid *guid, char *str) +{ + sprintf(str, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + guid->time_high, guid->time_low, guid->reserved, + guid->family, guid->node[0], + guid->node[1], guid->node[2], guid->node[3], + guid->node[4], guid->node[5], guid->node[6]); +} + +/* Config file parsing */ +static int parse_config(const char *fname) +{ + size_t linesize = 0; + char *line = NULL; + char *devname; + int i = 0; + FILE *fp; + int rc; + + fp = fopen(fname, "r"); + if (!fp) + return -ENOENT; + + while (i < 2 && getline(&line, &linesize, fp) != -1) { + /* Skip comments and empty lines */ + if (line[0] == '#' || line[0] == '\n') + continue; + + rc = sscanf(line, "%ms %lli %lx %lx", + &devname, + &devices[i].devoff, + &devices[i].mdata_size, + &devices[i].erase_size); + + if (rc < 3) { + free(devname); + continue; + } + + if (rc < 4) + devices[i].erase_size = devices[i].mdata_size; + + devices[i].devname = devname; + i++; + } + + free(line); + fclose(fp); + + if (i == 2) { + have_redundant = true; + if (devices[0].mdata_size != devices[1].mdata_size) { + fprintf(stderr, + "Size mismatch between the two metadata\n"); + return -EINVAL; + } + } + + if (!i) { + fprintf(stderr, + "Can't read config %s content\n", fname); + return -EINVAL; + } + + return 0; +} + +static int find_parse_config(void) +{ + int i; + + if (config_file) + return parse_config(config_file); + + for (i = 0; default_config_files[i]; i++) { + int ret; + + ret = parse_config(default_config_files[i]); + if (ret == -ENOENT) + continue; + if (ret) + return ret; + + config_file = default_config_files[i]; + return 0; + } + + fprintf(stderr, "Error: Cannot find config file\n"); + return -ENOENT; +} + +static int open_device(struct fwumdata_device *dev) +{ + if (strstr(dev->devname, "/dev/mtd")) + dev->is_mtd = true; + + dev->fd = open(dev->devname, O_RDWR | O_SYNC); + if (dev->fd < 0) { + fprintf(stderr, "Cannot open %s: %s\n", dev->devname, + strerror(errno)); + return -ENODEV; + } + + return 0; +} + +static int mtd_erase(int fd, unsigned long offset, unsigned long size) +{ + struct erase_info_user erase; + int ret; + + erase.start = offset; + erase.length = size; + + ret = ioctl(fd, MEMERASE, &erase); + if (ret < 0) { + fprintf(stderr, "MTD erase failed: %s\n", strerror(errno)); + return -errno; + } + + return 0; +} + +static int read_device(struct fwumdata_device *dev, void *buf, size_t count) +{ + if (lseek(dev->fd, dev->devoff, SEEK_SET) < 0) { + fprintf(stderr, "Seek failed: %s\n", strerror(errno)); + return -errno; + } + + if (read(dev->fd, buf, count) < 0) { + fprintf(stderr, "Read failed: %s\n", strerror(errno)); + return -errno; + } + + return 0; +} + +static int write_device(struct fwumdata_device *dev, const void *buf, + size_t count) +{ + int ret; + + /* Erase if MTD device */ + if (dev->is_mtd) { + ret = mtd_erase(dev->fd, dev->devoff, dev->erase_size); + if (ret) + return ret; + } + + if (lseek(dev->fd, dev->devoff, SEEK_SET) < 0) { + fprintf(stderr, "Seek failed: %s\n", strerror(errno)); + return -errno; + } + + if (write(dev->fd, buf, count) < 0) { + fprintf(stderr, "Write failed: %s\n", strerror(errno)); + return -errno; + } + + return 0; +} + +/* Metadata operations */ +static int validate_crc(struct fwu_mdata *mdata, size_t size) +{ + u32 calc_crc, stored_crc; + + stored_crc = mdata->crc32; + calc_crc = crc32(0, (const u8 *)&mdata->version, size - sizeof(u32)); + + if (calc_crc != stored_crc) { + fprintf(stderr, + "CRC mismatch: calculated 0x%08x, stored 0x%08x\n", + calc_crc, stored_crc); + if (mdata->version == 1) + fprintf(stderr, + "Metadata is V1, this may be size description issue\n"); + return -1; + } + + return 0; +} + +static void update_crc(struct fwu_mdata *mdata, size_t size) +{ + mdata->crc32 = crc32(0, (const u8 *)&mdata->version, size - sizeof(u32)); +} + +static int read_one_metadata(int mdata_id, size_t size) +{ + int ret; + + ret = open_device(&devices[mdata_id]); + if (ret) + return ret; + + ret = read_device(&devices[mdata_id], &mdata[mdata_id], size); + if (ret) + return ret; + + if (mdata[mdata_id].version != 1 && mdata[mdata_id].version != 2) { + fprintf(stderr, "Invalid metadata %d version: %u\n", + mdata_id, mdata[mdata_id].version); + } + + return 0; +} + +static int read_metadata(bool update) +{ + size_t alloc_size; + int ret; + + /* Allocate initial buffer */ + alloc_size = devices[0].mdata_size; + mdata = calloc(have_redundant ? 2 : 1, alloc_size); + if (!mdata) { + fprintf(stderr, "Memory allocation failed\n"); + return -ENOMEM; + } + + ret = read_one_metadata(0, alloc_size); + if (ret) + return ret; + + if (validate_crc(&mdata[0], alloc_size) < 0) { + fprintf(stderr, + "Warning: Primary metadata CRC validation failed\n"); + mdata_mod = update; + } else { + valid_mdata = &mdata[0]; + } + + if (have_redundant) { + ret = read_one_metadata(1, alloc_size); + if (ret) + return ret; + + if (validate_crc(&mdata[1], alloc_size) < 0) { + fprintf(stderr, + "Warning: Secondary metadata CRC validation failed\n"); + mdata_mod = update; + } else if (valid_mdata && mdata[0].crc32 != mdata[1].crc32) { + fprintf(stderr, + "Metadatas valid but not equal, use first one as default\n"); + mdata_mod = update; + } else { + valid_mdata = &mdata[1]; + } + } + + if (!valid_mdata) { + fprintf(stderr, + "No metadata valid, use first one as default\n"); + mdata_mod = update; + valid_mdata = &mdata[0]; + } + + if (valid_mdata->version == 2) { + struct fwu_mdata_ext *mdata_ext; + + mdata_ext = fwu_get_fw_mdata_ext(valid_mdata); + if (mdata_ext->metadata_size != alloc_size) { + fprintf(stderr, + "Metadata real size 0x%x mismatch with the config 0x%zx\n", + mdata_ext->metadata_size, alloc_size); + return -EINVAL; + } + } + + return 0; +} + +static int write_metadata(void) +{ + size_t write_size = devices[0].mdata_size; + int ret; + + if (!mdata_mod) + return 0; + + /* Update CRC */ + update_crc(valid_mdata, write_size); + + /* Write primary */ + ret = write_device(&devices[0], valid_mdata, write_size); + if (ret < 0) { + fprintf(stderr, "Failed to write primary metadata\n"); + return ret; + } + + /* Write secondary if redundant */ + if (have_redundant) { + ret = write_device(&devices[1], valid_mdata, write_size); + if (ret < 0) { + fprintf(stderr, "Failed to write secondary metadata\n"); + return -1; + } + } + + printf("FWU metadata updated successfully\n"); + mdata_mod = 0; + + return 0; +} + +/* Display functions */ +static const char *bank_state_to_string(u8 state) +{ + switch (state) { + case FWU_BANK_ACCEPTED: + return "accepted"; + case FWU_BANK_VALID: + return "valid"; + case FWU_BANK_INVALID: + return "invalid"; + default: + return "unknown"; + } +} + +static void print_metadata_summary(void) +{ + int i; + + printf("FWU Metadata:\n"); + printf("\tVersion: %u\n", valid_mdata->version); + printf("\tActive Index: %u\n", valid_mdata->active_index); + printf("\tPrevious Index: %u\n", valid_mdata->previous_active_index); + printf("\tCRC32: 0x%08x\n", valid_mdata->crc32); + + if (valid_mdata->version == 2) { + struct fwu_fw_store_desc *fw_desc; + struct fwu_mdata_ext *mdata_ext; + + mdata_ext = fwu_get_fw_mdata_ext(valid_mdata); + printf("\tMetadata Size: %u bytes\n", mdata_ext->metadata_size); + printf("\tDescriptor Offset: %u\n", mdata_ext->desc_offset); + printf("\tBank States:\n"); + + fw_desc = fwu_get_fw_desc(valid_mdata); + for (i = 0; i < fw_desc->num_banks && i < MAX_BANKS_V2; i++) { + printf("\t\tBank %d: %s (0x%02x)\n", i, + bank_state_to_string(mdata_ext->bank_state[i]), + mdata_ext->bank_state[i]); + } + } +} + +static void print_metadata_detailed(void) +{ + struct fwu_fw_store_desc *fw_desc = NULL; + struct fwu_image_bank_info *bank_info; + struct fwu_image_entry *img_entry; + int num_images, num_banks; + char guid_str[64]; + int i, j; + + print_metadata_summary(); + + if (valid_mdata->version == 1) { + num_images = nimages; + num_banks = nbanks; + } else { + fw_desc = fwu_get_fw_desc(valid_mdata); + num_images = fw_desc->num_images; + num_banks = fw_desc->num_banks; + } + + if (fw_desc) { + printf("\n\tFirmware Store Descriptor:\n"); + printf("\t\tNumber of Banks: %u\n", num_banks); + printf("\t\tNumber of Images: %u\n", num_images); + printf("\t\tImage Entry Size: %u\n", fw_desc->img_entry_size); + printf("\t\tBank Info Entry Size: %u\n", fw_desc->bank_info_entry_size); + } + + printf("\n\tImages:\n"); + for (i = 0; i < num_images; i++) { + img_entry = fwu_get_image_entry(valid_mdata, valid_mdata->version, + num_banks, i); + + printf("\t\tImage %d:\n", i); + + guid_to_string(&img_entry->image_type_guid, guid_str); + printf("\t\t\tImage Type GUID: %s\n", guid_str); + + guid_to_string(&img_entry->location_guid, guid_str); + printf("\t\t\tLocation GUID: %s\n", guid_str); + + printf("\t\t\tBanks:\n"); + for (j = 0; j < num_banks; j++) { + bank_info = fwu_get_bank_info(valid_mdata, + valid_mdata->version, + num_banks, i, j); + + guid_to_string(&bank_info->image_guid, guid_str); + printf("\t\t\t\tBank %d:\n", j); + printf("\t\t\t\t\tImage GUID: %s\n", guid_str); + printf("\t\t\t\t\tAccepted: %s (%u)\n", + (bank_info->accepted & FWU_IMAGE_ACCEPTED) ? "yes" : "no", + bank_info->accepted); + } + } +} + +/* Modification functions */ +static int set_active_index(int bank) +{ + struct fwu_fw_store_desc *fw_desc; + int num_banks; + + if (valid_mdata->version == 2) { + fw_desc = fwu_get_fw_desc(valid_mdata); + num_banks = fw_desc->num_banks; + } else { + num_banks = nbanks; + } + + if (bank < 0 || bank >= num_banks) { + fprintf(stderr, "Error: Invalid bank %d (must be 0-%d)\n", + bank, num_banks - 1); + return -EINVAL; + } + + if (valid_mdata->active_index == bank) + return 0; + + valid_mdata->active_index = bank; + mdata_mod = 1; + + printf("Active bank set to %d\n", bank); + return 0; +} + +static int set_previous_index(int bank) +{ + struct fwu_fw_store_desc *fw_desc; + int num_banks; + + if (valid_mdata->version == 2) { + fw_desc = fwu_get_fw_desc(valid_mdata); + num_banks = fw_desc->num_banks; + } else { + num_banks = nbanks; + } + + if (bank < 0 || bank >= num_banks) { + fprintf(stderr, "Error: Invalid bank %d (must be 0-%d)\n", + bank, num_banks - 1); + return -EINVAL; + } + + if (valid_mdata->previous_active_index == bank) + return 0; + + valid_mdata->previous_active_index = bank; + mdata_mod = 1; + + printf("Previous bank set to %d\n", bank); + return 0; +} + +static int set_image_accepted(int image, int bank, int accept) +{ + struct fwu_image_bank_info *bank_info; + int num_images, num_banks; + + if (valid_mdata->version == 1) { + num_images = nimages; + num_banks = nbanks; + } else { + struct fwu_fw_store_desc *fw_desc; + + fw_desc = fwu_get_fw_desc(valid_mdata); + num_images = fw_desc->num_images; + num_banks = fw_desc->num_banks; + } + + if (bank < 0 || bank >= num_banks) { + fprintf(stderr, "Error: Invalid bank %d (must be 0-%d)\n", + bank, num_banks - 1); + return -EINVAL; + } + + if (image < 0 || image >= num_images) { + fprintf(stderr, "Error: Invalid image %d (must be 0-%d)\n", + image, num_images - 1); + return -EINVAL; + } + + bank_info = fwu_get_bank_info(valid_mdata, valid_mdata->version, + num_banks, image, bank); + if (accept == bank_info->accepted) + return 0; + + if (accept) { + bank_info->accepted = FWU_IMAGE_ACCEPTED; + } else { + bank_info->accepted = 0; + + /* According to the spec: bank_state[index] have to be set + * to invalid before any content in the img_bank_info[index] + * is overwritten. + */ + if (valid_mdata->version == 2) { + struct fwu_mdata_ext *mdata_ext; + + mdata_ext = fwu_get_fw_mdata_ext(valid_mdata); + mdata_ext->bank_state[bank] = FWU_BANK_INVALID; + } + } + + mdata_mod = 1; + printf("Image %d in bank %d: acceptance %s\n", + image, bank, accept ? "set" : "cleared"); + + return 0; +} + +static int set_bank_state(int bank, const char *state_str) +{ + struct fwu_fw_store_desc *fw_desc; + struct fwu_mdata_ext *mdata_ext; + u8 state; + int i; + + if (valid_mdata->version != 2) { + fprintf(stderr, + "Error: Bank state is only supported in V2 metadata\n"); + return -EINVAL; + } + + fw_desc = fwu_get_fw_desc(valid_mdata); + mdata_ext = fwu_get_fw_mdata_ext(valid_mdata); + + if (bank < 0 || bank >= fw_desc->num_banks || bank >= MAX_BANKS_V2) { + fprintf(stderr, "Error: Invalid bank %d (must be 0-%d)\n", + bank, fw_desc->num_banks - 1); + return -EINVAL; + } + + /* Parse state string */ + if (!strcmp(state_str, "accepted")) { + state = FWU_BANK_ACCEPTED; + } else if (!strcmp(state_str, "valid")) { + state = FWU_BANK_VALID; + } else if (!strcmp(state_str, "invalid")) { + state = FWU_BANK_INVALID; + } else { + fprintf(stderr, + "Error: Invalid state '%s' (must be accepted/valid/invalid)\n", + state_str); + return -EINVAL; + } + + if (mdata_ext->bank_state[bank] == state) + return 0; + + /* If a bank is set in a accepted state all firmware images in + * that bank must be marked as accepted as described in the spec. + */ + if (state == FWU_BANK_ACCEPTED) { + for (i = 0; i < fw_desc->num_images; i++) { + int ret; + + ret = set_image_accepted(i, bank, true); + if (ret) + return ret; + } + } + mdata_ext->bank_state[bank] = state; + mdata_mod = 1; + + printf("Bank %d state set to %s (0x%02x)\n", bank, state_str, state); + return 0; +} + +static int metadata_v1_validate_size(void) +{ + int calc_size; + + calc_size = sizeof(struct fwu_mdata) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * nbanks) * nimages; + + if (devices[0].mdata_size != calc_size) { + fprintf(stderr, + "Metadata calculate size (-B and -I options) 0x%x mismatch with the config 0x%zx\n", + calc_size, devices[0].mdata_size); + return -EINVAL; + } + + return 0; +} + +/* Command-line interface */ +static void print_usage(void) +{ + fprintf(stderr, "Usage: fwumdata [options]\n\n"); + fprintf(stderr, "Options:\n" + "\t-c, --config Use custom config file, defaults:\n" + "\t ./fwumdata.config or /etc/fwumdata.config\n" + "\t-l, --list List detailed metadata with GUIDs\n" + "\t-a, --active Set active bank index\n" + "\t-p, --previous Set previous bank index\n" + "\t-s, --state Set bank state (V2 only)\n" + "\t state: accepted|valid|invalid\n" + "\t-i, --image Image number (for -A/-C)\n" + "\t-b, --bank Bank number (for -A/-C)\n" + "\t-A, --accept Accept image (requires -i and -b)\n" + "\t-C, --clear Clear image acceptance (requires -i and -b)\n" + "\t-u, --update Update metadata if there is a checksum issue\n" + "\t-B, --nbanks Number of banks (required for V1 metadata)\n" + "\t-I, --nimages Number of images (required for V1 metadata)\n" + "\t-h, --help Print this help\n\n"); + fprintf(stderr, "Config file format (fwumdata.config):\n" + "\t# Device Name Device Offset Metadata Size Erase Size\n" + "\t/dev/mtd0 0x0 0x78 0x1000\n" + "\t/dev/mtd1 0x0 0x78 0x1000\n\n"); + fprintf(stderr, "Examples:\n" + "\tfwumdata # Print metadata summary\n" + "\tfwumdata -l # Print detailed metadata\n" + "\tfwumdata -a 1 # Set active bank to 1\n" + "\tfwumdata -s 1 accepted # Set bank 1 to accepted state\n" + "\tfwumdata -i 0 -b 0 -A # Accept image in bank 0\n" + "\tfwumdata -B 2 -I 2 -i 1 -b 1 -A -l # Accept image 1 in bank 1 with metadata V1\n"); +} + +int main(int argc, char *argv[]) +{ + char *bank_state_str = NULL; + bool list_detailed = false; + int bank_state_num = -1; + int active_index = -1; + int bank_id = -1; + int prev_index = -1; + bool do_accept = 0; + bool do_clear = 0; + bool do_update = 0; + int image_id = -1; + int ret = 0; + int opt; + + static struct option long_options[] = { + {"config", required_argument, 0, 'c'}, + {"list", no_argument, 0, 'l'}, + {"active", required_argument, 0, 'a'}, + {"previous", required_argument, 0, 'p'}, + {"state", required_argument, 0, 's'}, + {"image", required_argument, 0, 'i'}, + {"bank", required_argument, 0, 'b'}, + {"accept", no_argument, 0, 'A'}, + {"clear", no_argument, 0, 'C'}, + {"update", no_argument, 0, 'u'}, + {"nbanks", required_argument, 0, 'B'}, + {"nimages", required_argument, 0, 'I'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + + /* Parse arguments */ + while ((opt = getopt_long(argc, argv, "c:la:p:s:i:b:ACuB:I:h", long_options, NULL)) != -1) { + switch (opt) { + case 'c': + config_file = optarg; + break; + case 'l': + list_detailed = 1; + break; + case 'a': + active_index = atoi(optarg); + break; + case 'p': + prev_index = atoi(optarg); + break; + case 's': + bank_state_num = atoi(optarg); + if (optind < argc && argv[optind][0] != '-') { + bank_state_str = argv[optind++]; + } else { + fprintf(stderr, + "Error: -s requires bank number and state\n"); + return 1; + } + break; + case 'i': + image_id = atoi(optarg); + break; + case 'b': + bank_id = atoi(optarg); + break; + case 'A': + do_accept = 1; + break; + case 'C': + do_clear = 1; + break; + case 'u': + do_update = 1; + break; + case 'B': + nbanks = atoi(optarg); + break; + case 'I': + nimages = atoi(optarg); + break; + case 'h': + print_usage(); + return 0; + default: + print_usage(); + return 1; + } + } + + ret = find_parse_config(); + if (ret < 0) { + fprintf(stderr, "Error: Cannot read configuration\n"); + return ret; + } + + ret = read_metadata(do_update); + if (ret < 0) { + fprintf(stderr, "Error: Cannot read metadata\n"); + goto cleanup; + } + + if (valid_mdata->version == 1) { + ret = metadata_v1_validate_size(); + if (ret) + goto cleanup; + } + + /* Perform operations */ + if (active_index >= 0) { + ret = set_active_index(active_index); + if (ret < 0) + goto cleanup; + } + + if (prev_index >= 0) { + ret = set_previous_index(prev_index); + if (ret < 0) + goto cleanup; + } + + if (do_accept || do_clear) { + if (image_id < 0 || bank_id < 0) { + fprintf(stderr, + "Error: -A/-C requires both -i and -b \n"); + ret = -EINVAL; + goto cleanup; + } + + ret = set_image_accepted(image_id, bank_id, do_accept); + if (ret < 0) + goto cleanup; + } + + if (bank_state_num >= 0 && bank_state_str) { + ret = set_bank_state(bank_state_num, bank_state_str); + if (ret < 0) + goto cleanup; + } + + /* Write back if modified */ + if (mdata_mod) { + ret = write_metadata(); + if (ret) + goto cleanup; + } + + /* Display metadata if no modifications or list requested */ + if (list_detailed) + print_metadata_detailed(); + else + print_metadata_summary(); + +cleanup: + /* Close devices and free memory */ + if (devices[0].fd) + close(devices[0].fd); + if (devices[1].fd) + close(devices[1].fd); + + free(mdata); + + for (int i = 0; i < 2; i++) { + if (devices[i].devname) + free((void *)devices[i].devname); + } + + return ret; +} diff --git a/tools/fwumdata_src/fwumdata.config b/tools/fwumdata_src/fwumdata.config new file mode 100644 index 00000000000..7e83f7a5909 --- /dev/null +++ b/tools/fwumdata_src/fwumdata.config @@ -0,0 +1,33 @@ +# FWU Metadata Configuration File +# +# Format: +# +# This file describes where the FWU metadata is stored. You can specify +# up to two entries for redundant metadata copies. +# +# Device: MTD device (/dev/mtdX), block device (/dev/mmcblkX), or file path +# Offset: Byte offset from start of device (hex with 0x prefix) +# Metadata Size: Size of metadata structure in bytes (hex with 0x prefix) +# Erase Size: Sector/erase block size (hex with 0x prefix, defaults to +# metadata_size, required only for MTD device) +# +# Examples: +# +# MTD devices (NOR/NAND flash): +# /dev/mtd0 0x0 0x1000 0x1000 +# /dev/mtd1 0x0 0x1000 0x1000 +# +# Block device (eMMC/SD): +# /dev/mmcblk0 0x100000 0x78 +# /dev/mmcblk0 0x101000 0x78 +# +# or: +# /dev/disk/by-partlabel/metadata1 0 0x78 +# /dev/disk/by-partlabel/metadata2 0 0x78 +# +# Regular file: +# /boot/fwu-mdata.bin 0x0 0x78 +# +# Default configuration (update for your platform): +/dev/mtd0 0x0 0x78 0x1000 +/dev/mtd1 0x0 0x78 0x1000 diff --git a/tools/fwumdata_src/fwumdata.h b/tools/fwumdata_src/fwumdata.h new file mode 100644 index 00000000000..5e2c45d0fb0 --- /dev/null +++ b/tools/fwumdata_src/fwumdata.h @@ -0,0 +1,138 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2025, Kory Maincent + */ + +#ifndef _FWUMDATA_H_ +#define _FWUMDATA_H_ + +#include + +/* Type definitions for U-Boot compatibility */ +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +/* FWU Constants */ +#define FWU_IMAGE_ACCEPTED 0x1 +#define FWU_BANK_INVALID (uint8_t)0xFF +#define FWU_BANK_VALID (uint8_t)0xFE +#define FWU_BANK_ACCEPTED (uint8_t)0xFC +#define MAX_BANKS_V2 4 + +/* EFI GUID structure */ +struct efi_guid { + u32 time_high; + u16 time_low; + u16 reserved; + u8 family; + u8 node[7]; +} __packed; + +/* FWU Metadata structures */ +struct fwu_image_bank_info { + struct efi_guid image_guid; + u32 accepted; + u32 reserved; +} __packed; + +struct fwu_image_entry { + struct efi_guid image_type_guid; + struct efi_guid location_guid; + struct fwu_image_bank_info img_bank_info[0]; /* Variable length */ +} __packed; + +struct fwu_fw_store_desc { + u8 num_banks; + u8 reserved; + u16 num_images; + u16 img_entry_size; + u16 bank_info_entry_size; + struct fwu_image_entry img_entry[0]; /* Variable length */ +} __packed; + +struct fwu_mdata { + u32 crc32; + u32 version; + u32 active_index; + u32 previous_active_index; + /* Followed by image entries or fwu_mdata_ext */ +} __packed; + +struct fwu_mdata_ext { /* V2 only */ + u32 metadata_size; + u16 desc_offset; + u16 reserved1; + u8 bank_state[4]; + u32 reserved2; +} __packed; + +/* Metadata access helpers */ +struct fwu_image_entry *fwu_get_image_entry(struct fwu_mdata *mdata, + int version, int num_banks, + int img_id) +{ + size_t offset; + + if (version == 1) { + offset = sizeof(struct fwu_mdata) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * img_id; + } else { + /* V2: skip fwu_fw_store_desc header */ + offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_mdata_ext) + + sizeof(struct fwu_fw_store_desc) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * img_id; + } + + return (struct fwu_image_entry *)((char *)mdata + offset); +} + +struct fwu_image_bank_info *fwu_get_bank_info(struct fwu_mdata *mdata, + int version, int num_banks, + int img_id, int bank_id) +{ + size_t offset; + + if (version == 1) { + offset = sizeof(struct fwu_mdata) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * img_id + + sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * bank_id; + } else { + offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_mdata_ext) + + sizeof(struct fwu_fw_store_desc) + + (sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * num_banks) * img_id + + sizeof(struct fwu_image_entry) + + sizeof(struct fwu_image_bank_info) * bank_id; + } + + return (struct fwu_image_bank_info *)((char *)mdata + offset); +} + +struct fwu_fw_store_desc *fwu_get_fw_desc(struct fwu_mdata *mdata) +{ + size_t offset; + + offset = sizeof(struct fwu_mdata) + + sizeof(struct fwu_mdata_ext); + + return (struct fwu_fw_store_desc *)((char *)mdata + offset); +} + +struct fwu_mdata_ext *fwu_get_fw_mdata_ext(struct fwu_mdata *mdata) +{ + size_t offset; + + offset = sizeof(struct fwu_mdata); + + return (struct fwu_mdata_ext *)((char *)mdata + offset); +} + +#endif /* _FWUMDATA_H_ */ diff --git a/tools/fwumdata_src/fwumdata.mk b/tools/fwumdata_src/fwumdata.mk index 00f4ae50dbb..e91d72bf3e8 100644 --- a/tools/fwumdata_src/fwumdata.mk +++ b/tools/fwumdata_src/fwumdata.mk @@ -5,3 +5,6 @@ mkfwumdata-objs := fwumdata_src/mkfwumdata.o generated/lib/crc32.o HOSTLDLIBS_mkfwumdata += -luuid hostprogs-always-$(CONFIG_TOOLS_MKFWUMDATA) += mkfwumdata + +fwumdata-objs := fwumdata_src/fwumdata.o generated/lib/crc32.o +hostprogs-always-$(CONFIG_TOOLS_FWUMDATA) += fwumdata -- cgit v1.3.1