Skip to contentSkip to conversation

binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script

PATCH Superseded Simon Glass 4 participants 33 messages Dec 21, 2022 – Jan 7, 2023

Subsystems (8)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script

At present rockchip 64-bit boards make use of a FIT-generator script written in Python. The script supports splitting an ELF file into several 'loadable' nodes in the FIT. Binman does not current support this feature.

This series adds binman support for ELF splitting. This works by adding a new 'fit,operation' property to the FIT subnodes, allowing this new way of generating nodes.

It also provides support for optional entries, by allowing them to be marked absent when the contents are obtained.

Some other fixes and improvements are needed along the way.

A new, common binman description is added for 64-bit boards which includes the required u-boot.itb file.

The existing script is removed, so that only a few zynq boards are now using a SPL_FIT_GENERATOR script:

avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0
xilinx_zynqmp_virt

Migration of those is hopefully in progress.

Note however that tools/k3_fit_atf.sh remains, used by a few boards that enable CONFIG_TI_SECURE_DEVICE so this series is copied there too:

    am335x_hs_evm
    am335x_hs_evm_uart
    am43xx_hs_evm
    am57xx_hs_evm
    am57xx_hs_evm_usb
    am65x_hs_evm_a53
    am65x_hs_evm_r5
    dra7xx_hs_evm
    dra7xx_hs_evm_usb
    j721e_hs_evm_a72
    j721e_hs_evm_r5
    k2e_hs_evm
    k2g_hs_evm
    k2hk_hs_evm
    k2l_hs_evm

Ivan Mikhaylov has sent a patch to help with these, but I need to take a look at the testing side. In any case they should really be using binman for the image generation.

This series is available at u-boot-dm/fit-working

Changes in v8:
- Move support for optional external blobs into this series
- Support optional FIT images
- Make OP-TEE image optional
- Specify an entry address for U-Boot

Changes in v7:
- Correct an rST formatting error
- Correct missing test coverage

Changes in v6:
- Add new patch to update entry docs
- Update op-tee to support new v1 binary header
- Add new patch to disable USE_SPL_FIT_GENERATOR by default
- Add new patch to allow a binman entry to be marked absent

Changes in v5:
- Update commit message to mention using parts of one image in another
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)
- Rename blob to fit for puma and also SPI image

Changes in v3:
- Add an offset to the FIT description
- Add support for writing sections in binman
- Rebase to master

Changes in v2:
- Rename op-tee to tee-os
- Drop use of .itb2
- Drop patches previously applied
- Add various suggestions from Alper Nebi Yasak
- Add patches to refactor binman's FIT support

Simon Glass (13):
binman: Allow writing section contents to a file
binman: Tidy up comment in fit _gen_node
binman: Update entry docs
binman: Support optional entries
binman: Add a way to check for a valid ELF file
binman: Support new op-tee binary format
binman: Support optional external blobs
rockchip: evb-rk3288: Drop raw-image support
rockchip: Use multiple-images for rk3399
rockchip: Support building the all output files in binman
rockchip: Convert all boards to use binman
rockchip: Drop the FIT generator script
treewide: Disable USE_SPL_FIT_GENERATOR by default

 Makefile                                      |  11 +-
 arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi   |   4 +-
 arch/arm/dts/rk3399-u-boot.dtsi               |   3 +-
 arch/arm/dts/rockchip-u-boot.dtsi             |  78 ++++-
 arch/arm/mach-rockchip/make_fit_atf.py        | 267 ------------------
 boot/Kconfig                                  |   6 +-
 configs/am335x_evm_defconfig                  |   1 -
 configs/am335x_hs_evm_defconfig               |   1 -
 configs/am335x_hs_evm_uart_defconfig          |   1 -
 configs/am43xx_evm_defconfig                  |   1 -
 configs/am43xx_evm_rtconly_defconfig          |   1 -
 configs/am43xx_evm_usbhost_boot_defconfig     |   1 -
 configs/am43xx_hs_evm_defconfig               |   1 -
 configs/am57xx_evm_defconfig                  |   1 -
 configs/am57xx_hs_evm_defconfig               |   1 -
 configs/am57xx_hs_evm_usb_defconfig           |   1 -
 configs/am65x_evm_a53_defconfig               |   1 -
 configs/am65x_evm_r5_defconfig                |   1 -
 configs/am65x_hs_evm_a53_defconfig            |   1 -
 configs/am65x_hs_evm_r5_defconfig             |   1 -
 ...edev_cc_v1_0_ultrazedev_som_v1_0_defconfig |   1 +
 configs/cgtqmx8_defconfig                     |   1 -
 configs/chromebook_link64_defconfig           |   1 -
 configs/dh_imx6_defconfig                     |   1 -
 configs/display5_defconfig                    |   1 -
 configs/display5_factory_defconfig            |   1 -
 configs/dra7xx_evm_defconfig                  |   1 -
 configs/dra7xx_hs_evm_defconfig               |   1 -
 configs/dra7xx_hs_evm_usb_defconfig           |   1 -
 configs/evb-ast2600_defconfig                 |   1 -
 configs/evb-rk3229_defconfig                  |   1 -
 configs/evb-rk3288_defconfig                  |   2 +-
 configs/gwventana_emmc_defconfig              |   1 -
 configs/gwventana_gw5904_defconfig            |   1 -
 configs/gwventana_nand_defconfig              |   1 -
 configs/imx6qdl_icore_mipi_defconfig          |   1 -
 configs/imx6qdl_icore_mmc_defconfig           |   1 -
 configs/imx6qdl_icore_rqs_defconfig           |   1 -
 configs/imx8mm-cl-iot-gate-optee_defconfig    |   1 -
 configs/imx8mm-cl-iot-gate_defconfig          |   1 -
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig  |   1 -
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig |   1 -
 configs/imx8mm-mx8menlo_defconfig             |   1 -
 configs/imx8mm_beacon_defconfig               |   1 -
 configs/imx8mm_data_modul_edm_sbc_defconfig   |   1 -
 configs/imx8mm_evk_defconfig                  |   1 -
 configs/imx8mm_evk_fspi_defconfig             |   1 -
 configs/imx8mm_venice_defconfig               |   1 -
 configs/imx8mn_beacon_2g_defconfig            |   1 -
 configs/imx8mn_beacon_defconfig               |   1 -
 configs/imx8mn_bsh_smm_s2_defconfig           |   1 -
 configs/imx8mn_bsh_smm_s2pro_defconfig        |   1 -
 configs/imx8mn_ddr4_evk_defconfig             |   1 -
 configs/imx8mn_evk_defconfig                  |   1 -
 configs/imx8mn_var_som_defconfig              |   1 -
 configs/imx8mn_venice_defconfig               |   1 -
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig |   1 -
 configs/imx8mp_dhcom_pdk2_defconfig           |   1 -
 configs/imx8mp_evk_defconfig                  |   1 -
 configs/imx8mp_rsb3720a1_4G_defconfig         |   1 -
 configs/imx8mp_rsb3720a1_6G_defconfig         |   1 -
 configs/imx8mp_venice_defconfig               |   1 -
 configs/imx8mq_cm_defconfig                   |   1 -
 configs/imx8mq_evk_defconfig                  |   1 -
 configs/imx8mq_phanbell_defconfig             |   1 -
 configs/imx8qm_rom7720_a1_4G_defconfig        |   1 -
 configs/iot2050_defconfig                     |   1 -
 configs/j7200_evm_a72_defconfig               |   1 -
 configs/j7200_evm_r5_defconfig                |   1 -
 configs/j7200_hs_evm_a72_defconfig            |   1 -
 configs/j7200_hs_evm_r5_defconfig             |   1 -
 configs/j721e_evm_a72_defconfig               |   1 -
 configs/j721e_evm_r5_defconfig                |   1 -
 configs/j721e_hs_evm_a72_defconfig            |   1 -
 configs/j721e_hs_evm_r5_defconfig             |   1 -
 configs/j721s2_evm_a72_defconfig              |   1 -
 configs/j721s2_evm_r5_defconfig               |   1 -
 configs/j721s2_hs_evm_a72_defconfig           |   1 -
 configs/j721s2_hs_evm_r5_defconfig            |   1 -
 configs/kontron-sl-mx6ul_defconfig            |   1 -
 configs/kontron-sl-mx8mm_defconfig            |   1 -
 configs/kontron_pitx_imx8m_defconfig          |   1 -
 configs/kontron_sl28_defconfig                |   1 -
 configs/librem5_defconfig                     |   1 -
 configs/ls1046ardb_qspi_spl_defconfig         |   1 -
 configs/mccmon6_nor_defconfig                 |   1 -
 configs/mccmon6_sd_defconfig                  |   1 -
 configs/mx6sabreauto_defconfig                |   1 -
 configs/mx6sabresd_defconfig                  |   1 -
 configs/phycore-imx8mm_defconfig              |   1 -
 configs/phycore-imx8mp_defconfig              |   1 -
 configs/pico-imx6_defconfig                   |   1 -
 configs/pico-imx8mq_defconfig                 |   1 -
 configs/qemu-x86_64_defconfig                 |   1 -
 configs/sandbox_noinst_defconfig              |   1 -
 configs/sandbox_spl_defconfig                 |   1 -
 configs/sandbox_vpl_defconfig                 |   1 -
 configs/socfpga_agilex_atf_defconfig          |   1 -
 configs/socfpga_agilex_vab_defconfig          |   1 -
 configs/socfpga_arria10_defconfig             |   1 -
 configs/socfpga_chameleonv3_defconfig         |   1 -
 configs/socfpga_n5x_atf_defconfig             |   1 -
 configs/socfpga_n5x_vab_defconfig             |   1 -
 configs/socfpga_stratix10_atf_defconfig       |   1 -
 configs/stm32mp15_dhcom_basic_defconfig       |   1 -
 configs/stm32mp15_dhcor_basic_defconfig       |   1 -
 configs/verdin-imx8mm_defconfig               |   1 -
 configs/verdin-imx8mp_defconfig               |   1 -
 configs/wandboard_defconfig                   |   1 -
 configs/xilinx_zynq_virt_defconfig            |   1 -
 configs/xilinx_zynqmp_virt_defconfig          |   1 +
 tools/binman/binman.rst                       |  36 +++
 tools/binman/control.py                       |  12 +
 tools/binman/elf.py                           |  16 ++
 tools/binman/elf_test.py                      |  10 +
 tools/binman/entries.rst                      | 206 ++++++++++++--
 tools/binman/entry.py                         |  47 ++-
 tools/binman/etype/_testing.py                |   3 +
 tools/binman/etype/blob.py                    |   2 +-
 tools/binman/etype/fit.py                     |  96 ++++---
 tools/binman/etype/mkimage.py                 |  28 +-
 tools/binman/etype/section.py                 |  42 ++-
 tools/binman/etype/tee_os.py                  |  68 ++++-
 tools/binman/ftest.py                         | 112 ++++++++
 tools/binman/image.py                         |   3 -
 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/264_tee_os_opt_fit.dts      |  33 +++
 tools/binman/test/265_tee_os_opt_fit_bad.dts  |  40 +++
 tools/binman/test/266_blob_ext_opt.dts        |  21 ++
 131 files changed, 847 insertions(+), 474 deletions(-)
 delete mode 100755 arch/arm/mach-rockchip/make_fit_atf.py
 create mode 100644 tools/binman/test/261_section_fname.dts
 create mode 100644 tools/binman/test/262_absent.dts
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
 create mode 100644 tools/binman/test/266_blob_ext_opt.dts
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#1 lore raw

PATCH v8 1/13 binman: Allow writing section contents to a file

At present only the image (which is a section) has a filename. Move this implementation to the entry_Section class so that any section can have a filename. With this, the section data is written to a file.

This allows parts of an image to be written, along with the entire image.

Make a note that this can be used to include the contents of a section in one image in another (later) image.

---

(no changes since v5)

Changes in v5:
- Update commit message to mention using parts of one image in another

 tools/binman/binman.rst                 |  5 +++++
 tools/binman/etype/section.py           | 12 +++++++++-
 tools/binman/ftest.py                   | 14 ++++++++++++
 tools/binman/image.py                   |  3 ---
 tools/binman/test/261_section_fname.dts | 29 +++++++++++++++++++++++++
 5 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/261_section_fname.dts
tools/binman/binman.rst +5 -0
index e7b231e0712..b091114fb91 100644
@@ -836,6 +836,11 @@ name-prefix:
     renamed to 'ro-u-boot' and 'rw-u-boot'. This can be useful to
     distinguish binaries with otherwise identical names.
 
+filename:
+    This allows the contents of the section to be written to a file in the
+    output directory. This can sometimes be useful to use the data in one
+    section in different image, since there is currently no way to share data
+    beteen images other than through files.
 
 Image Properties
 ----------------
tools/binman/etype/section.py +11 -1
index da561e2bcc7..305155c8461 100644
@@ -144,6 +144,10 @@ class Entry_section(Entry):
         be written at offset 4 in the image file, since the first 16 bytes are
         skipped when writing.
 
+    filename
+        filename to write the unpadded section contents to within the output
+        directory (None to skip this).
+
     Since a section is also an entry, it inherits all the properies of entries
     too.
 
@@ -163,6 +167,7 @@ class Entry_section(Entry):
         self._skip_at_start = None
         self._end_4gb = False
         self._ignore_missing = False
+        self._filename = None
 
     def ReadNode(self):
         """Read properties from the section node"""
@@ -183,6 +188,8 @@ class Entry_section(Entry):
                 self._skip_at_start = 0
         self._name_prefix = fdt_util.GetString(self._node, 'name-prefix')
         self.align_default = fdt_util.GetInt(self._node, 'align-default', 0)
+        self._filename = fdt_util.GetString(self._node, 'filename',
+                                            self._filename)
 
         self.ReadEntries()
 
@@ -348,7 +355,8 @@ class Entry_section(Entry):
         """Get the contents of an entry
 
         This builds the contents of the section, stores this as the contents of
-        the section and returns it
+        the section and returns it. If the section has a filename, the data is
+        written there also.
 
         Args:
             required: True if the data must be present, False if it is OK to
@@ -363,6 +371,8 @@ class Entry_section(Entry):
         if data is None:
             return None
         self.SetContents(data)
+        if self._filename:
+            tools.write_file(tools.get_output_filename(self._filename), data)
         return data
 
     def GetOffsets(self):
tools/binman/ftest.py +14 -0
index 62ee86b9b75..c3cb32dca26 100644
@@ -6077,5 +6077,19 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
             'Cannot write symbols to an ELF file without Python elftools',
             str(exc.exception))
 
+    def testSectionFilename(self):
+        """Check writing of section contents to a file"""
+        data = self._DoReadFile('261_section_fname.dts')
+        expected = (b'&&' + U_BOOT_DATA + b'&&&' +
+                    tools.get_bytes(ord('!'), 7) +
+                    U_BOOT_DATA + tools.get_bytes(ord('&'), 12))
+        self.assertEqual(expected, data)
+
+        sect_fname = tools.get_output_filename('outfile.bin')
+        self.assertTrue(os.path.exists(sect_fname))
+        sect_data = tools.read_file(sect_fname)
+        self.assertEqual(U_BOOT_DATA, sect_data)
+
+
 if __name__ == "__main__":
     unittest.main()
tools/binman/image.py +0 -3
index 6d4bff58436..b84dd21e22a 100644
@@ -94,9 +94,6 @@ class Image(section.Entry_section):
 
     def ReadNode(self):
         super().ReadNode()
-        filename = fdt_util.GetString(self._node, 'filename')
-        if filename:
-            self._filename = filename
         self.allow_repack = fdt_util.GetBool(self._node, 'allow-repack')
         self._symlink = fdt_util.GetString(self._node, 'symlink')
 
tools/binman/test/261_section_fname.dts new file +29 -0
new file mode 100644
index 00000000000..790381e7301
@@ -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 {
+			};
+		};
+	};
+};
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#2 lore raw

PATCH v8 2/13 binman: Tidy up comment in fit _gen_node

In reply to Simon Glass

Expand this comment to cover both cases that are supported.

---

(no changes since v1)

 tools/binman/etype/fit.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
tools/binman/etype/fit.py +11 -5
index 7860e2aeea3..8ad4f3a8a83 100644
@@ -579,11 +579,17 @@ class Entry_fit(Entry_section):
         def _gen_node(base_node, node, depth, in_images, entry):
             """Generate nodes from a template
 
-            This creates one node for each member of self._fdts using the
-            provided template. If a property value contains 'NAME' it is
-            replaced with the filename of the FDT. If a property value contains
-            SEQ it is replaced with the node sequence number, where 1 is the
-            first.
+            This creates one or more nodes depending on the fit,operation being
+            used.
+
+            For OP_GEN_FDT_NODES it creates one node for each member of
+            self._fdts using the provided template. If a property value contains
+            'NAME' it is replaced with the filename of the FDT. If a property
+            value contains SEQ it is replaced with the node sequence number,
+            where 1 is the first.
+
+            For OP_SPLIT_ELF it emits one node for each section in the ELF file.
+            If the file is missing, nothing is generated.
 
             Args:
                 base_node (Node): Base Node of the FIT (with 'description'
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#3 lore raw

PATCH v8 3/13 binman: Update entry docs

In reply to Simon Glass

These have got out of data recently. Regenerate them.

---

(no changes since v7)

Changes in v7:
- Correct an rST formatting error

Changes in v6:
- Add new patch to update entry docs

 tools/binman/entries.rst      | 171 ++++++++++++++++++++++++++++++----
 tools/binman/etype/mkimage.py |  28 +++---
 2 files changed, 169 insertions(+), 30 deletions(-)
tools/binman/entries.rst +155 -16
index 3dc32db8a54..b2ce7960d3b 100644
@@ -216,9 +216,9 @@ This is a blob containing a device tree. The contents of the blob are
 obtained from the list of available device-tree files, managed by the
 'state' module.
 
-Additional Properties / Entry arguments:
-    - prepend: Header type to use:
-        length: 32-bit length header
+Additional attributes:
+    prepend: Header used (e.g. 'length')
+
 
 
 .. _etype_blob_ext:
@@ -1178,11 +1178,13 @@ Properties / Entry arguments:
     - multiple-data-files: boolean to tell binman to pass all files as
       datafiles to mkimage instead of creating a temporary file the result
       of datafiles concatenation
+    - filename: filename of output binary generated by mkimage
 
 The data passed to mkimage via the -d flag is collected from subnodes of the
 mkimage node, e.g.::
 
     mkimage {
+        filename = "imximage.bin";
         args = "-n test -T imximage";
 
         u-boot-spl {
@@ -1190,13 +1192,14 @@ mkimage node, e.g.::
     };
 
 This calls mkimage to create an imximage with `u-boot-spl.bin` as the data
-file, which mkimage being called like this::
+file, with mkimage being called like this::
 
     mkimage -d <data_file> -n test -T imximage <output_file>
 
 The output from mkimage then becomes part of the image produced by
-binman. If you need to put mulitple things in the data file, you can use
-a section, or just multiple subnodes like this::
+binman but also is written into `imximage.bin` file. If you need to put
+multiple things in the data file, you can use a section, or just multiple
+subnodes like this::
 
     mkimage {
         args = "-n test -T imximage";
@@ -1208,17 +1211,20 @@ a section, or just multiple subnodes like this::
         };
     };
 
+Note that binman places the contents (here SPL and TPL) into a single file
+and passes that to mkimage using the -d option.
+
 To pass all datafiles untouched to mkimage::
 
     mkimage {
-        args = "-n rk3399 -T rkspi";
-        multiple-data-files;
+            args = "-n rk3399 -T rkspi";
+            multiple-data-files;
 
-        u-boot-tpl {
-        };
+            u-boot-tpl {
+            };
 
-        u-boot-spl {
-        };
+            u-boot-spl {
+            };
     };
 
 This calls mkimage to create a Rockchip RK3399-specific first stage
@@ -1242,17 +1248,17 @@ the 'data-to-imagename' property::
 
     mkimage {
         args = "-T imximage";
-        data-to-imagename';
+        data-to-imagename;
 
         u-boot-spl {
         };
     };
 
 That will pass the data to mkimage both as the data file (with -d) and as
-the image name (with -n).
-
+the image name (with -n). In both cases, a filename is passed as the
+argument, with the actual data being in that file.
 
-If need to pass different data in with -n, then use an imagename subnode::
+If need to pass different data in with -n, then use an `imagename` subnode::
 
     mkimage {
         args = "-T imximage";
@@ -1271,6 +1277,7 @@ This will pass in u-boot-spl as the input data and the .cfgout file as the
 -n data.
 
 
+
 .. _etype_opensbi:
 
 Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
@@ -1478,6 +1485,10 @@ skip-at-start
     be written at offset 4 in the image file, since the first 16 bytes are
     skipped when writing.
 
+filename
+    filename to write the unpadded section contents to within the output
+    directory (None to skip this).
+
 Since a section is also an entry, it inherits all the properies of entries
 too.
 
@@ -2034,6 +2045,134 @@ Entry types that have a part to play in handling microcode:
 
 
 
+.. _etype_u_boot_vpl:
+
+Entry: u-boot-vpl: U-Boot VPL binary
+------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename of u-boot-vpl.bin (default 'vpl/u-boot-vpl.bin')
+
+This is the U-Boot VPL (Verifying Program Loader) binary. This is a small
+binary which loads before SPL, typically into on-chip SRAM. It is
+responsible for locating, loading and jumping to SPL, the next-stage
+loader. Note that VPL is not relocatable so must be loaded to the correct
+address in SRAM, or written to run from the correct address if direct
+flash execution is possible (e.g. on x86 devices).
+
+SPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+
+in the binman README for more information.
+
+The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+binman uses that to look up symbols to write into the VPL binary.
+
+
+
+.. _etype_u_boot_vpl_bss_pad:
+
+Entry: u-boot-vpl-bss-pad: U-Boot VPL binary padded with a BSS region
+---------------------------------------------------------------------
+
+Properties / Entry arguments:
+    None
+
+This holds the padding added after the VPL binary to cover the BSS (Block
+Started by Symbol) region. This region holds the various variables used by
+VPL. It is set to 0 by VPL when it starts up. If you want to append data to
+the VPL image (such as a device tree file), you must pad out the BSS region
+to avoid the data overlapping with U-Boot variables. This entry is useful in
+that case. It automatically pads out the entry size to cover both the code,
+data and BSS.
+
+The contents of this entry will a certain number of zero bytes, determined
+by __bss_size
+
+The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+binman uses that to look up the BSS address.
+
+
+
+.. _etype_u_boot_vpl_dtb:
+
+Entry: u-boot-vpl-dtb: U-Boot VPL device tree
+---------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename of u-boot.dtb (default 'vpl/u-boot-vpl.dtb')
+
+This is the VPL device tree, containing configuration information for
+VPL. VPL needs this to know what devices are present and which drivers
+to activate.
+
+
+
+.. _etype_u_boot_vpl_elf:
+
+Entry: u-boot-vpl-elf: U-Boot VPL ELF image
+-------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename of VPL u-boot (default 'vpl/u-boot-vpl')
+
+This is the U-Boot VPL ELF image. It does not include a device tree but can
+be relocated to any address for execution.
+
+
+
+.. _etype_u_boot_vpl_expanded:
+
+Entry: u-boot-vpl-expanded: U-Boot VPL flat binary broken out into its component parts
+--------------------------------------------------------------------------------------
+
+Properties / Entry arguments:
+    - vpl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+        select)
+
+This is a section containing the U-Boot binary, BSS padding if needed and a
+devicetree. Using this entry type automatically creates this section, with
+the following entries in it:
+
+   u-boot-vpl-nodtb
+   u-boot-vpl-bss-pad
+   u-boot-dtb
+
+Having the devicetree separate allows binman to update it in the final
+image, so that the entries positions are provided to the running U-Boot.
+
+This entry is selected based on the value of the 'vpl-dtb' entryarg. If
+this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+
+
+
+.. _etype_u_boot_vpl_nodtb:
+
+Entry: u-boot-vpl-nodtb: VPL binary without device tree appended
+----------------------------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename to include (default 'vpl/u-boot-vpl-nodtb.bin')
+
+This is the U-Boot VPL binary, It does not include a device tree blob at
+the end of it so may not be able to work without it, assuming VPL needs
+a device tree to operate on your platform. You can add a u_boot_vpl_dtb
+entry after this one, or use a u_boot_vpl entry instead, which normally
+expands to a section containing u-boot-vpl-dtb, u-boot-vpl-bss-pad and
+u-boot-vpl-dtb
+
+VPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+
+in the binman README for more information.
+
+The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+binman uses that to look up symbols to write into the VPL binary.
+
+
+
 .. _etype_u_boot_with_ucode_ptr:
 
 Entry: u-boot-with-ucode-ptr: U-Boot with embedded microcode pointer
tools/binman/etype/mkimage.py +14 -14
index c2288c48eef..cb264c3cad0 100644
@@ -57,24 +57,24 @@ class Entry_mkimage(Entry):
     Note that binman places the contents (here SPL and TPL) into a single file
     and passes that to mkimage using the -d option.
 
-	To pass all datafiles untouched to mkimage::
+    To pass all datafiles untouched to mkimage::
 
-		mkimage {
-			args = "-n rk3399 -T rkspi";
-			multiple-data-files;
+        mkimage {
+                args = "-n rk3399 -T rkspi";
+                multiple-data-files;
 
-			u-boot-tpl {
-			};
+                u-boot-tpl {
+                };
 
-			u-boot-spl {
-			};
-		};
+                u-boot-spl {
+                };
+        };
 
-	This calls mkimage to create a Rockchip RK3399-specific first stage
-	bootloader, made of TPL+SPL. Since this first stage bootloader requires to
-	align the TPL and SPL but also some weird hacks that is handled by mkimage
-	directly, binman is told to not perform the concatenation of datafiles prior
-	to passing the data to mkimage.
+    This calls mkimage to create a Rockchip RK3399-specific first stage
+    bootloader, made of TPL+SPL. Since this first stage bootloader requires to
+    align the TPL and SPL but also some weird hacks that is handled by mkimage
+    directly, binman is told to not perform the concatenation of datafiles prior
+    to passing the data to mkimage.
 
     To use CONFIG options in the arguments, use a string list instead, as in
     this example which also produces four arguments::
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#4 lore raw

Re: [PATCH v8 03/13] binman: Update entry docs

Hi Simon,

Quoted 4 lines · Simon Glass

These have got out of data recently. Regenerate them.

---

[...]

Quoted 9 lines

+.. _etype_u_boot_vpl:

tools/binman/entries.rst +8 -0
+
+Entry: u-boot-vpl: U-Boot VPL binary
+------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename of u-boot-vpl.bin (default 'vpl/u-boot-vpl.bin')
+
+This is the U-Boot VPL (Verifying Program Loader) binary. This is a small

tools/binman/entries.rst Entry types that have a part to play in handling microcode: · line 2066

Quoted 10 lines
tools/binman/entries.rst +10 -0
+binary which loads before SPL, typically into on-chip SRAM. It is
+responsible for locating, loading and jumping to SPL, the next-stage
+loader. Note that VPL is not relocatable so must be loaded to the correct
+address in SRAM, or written to run from the correct address if direct
+flash execution is possible (e.g. on x86 devices).
+
+SPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+

You can use a ref here since there exists a _binman_syms target in the README.rst.

Quoted 2 lines
(quoted diff) +2 -0
+in the binman README for more information.
+

[...]

Quoted 9 lines

+.. _etype_u_boot_vpl_nodtb:

tools/binman/entries.rst +8 -0
+
+Entry: u-boot-vpl-nodtb: VPL binary without device tree appended
+----------------------------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename to include (default 'vpl/u-boot-vpl-nodtb.bin')
+
+This is the U-Boot VPL binary, It does not include a device tree blob at

tools/binman/entries.rst Entry types that have a part to play in handling microcode: · line 2168

Quoted 10 lines
tools/binman/entries.rst +10 -0
+the end of it so may not be able to work without it, assuming VPL needs
+a device tree to operate on your platform. You can add a u_boot_vpl_dtb
+entry after this one, or use a u_boot_vpl entry instead, which normally
+expands to a section containing u-boot-vpl-dtb, u-boot-vpl-bss-pad and
+u-boot-vpl-dtb
+
+VPL can access binman symbols at runtime. See:
+
+    'Access to binman entry offsets at run time (symbols)'
+

Ditto.

Cheers,
Quentin

#5 lore raw

PATCH v8 4/13 binman: Support optional entries

In reply to Simon Glass

Support entries which can be optional depending on their contents. This allows special entry types which appear in the image only when needed.

---

(no changes since v1)

 tools/binman/binman.rst          | 22 ++++++++++++++++++++++
 tools/binman/control.py          |  1 +
 tools/binman/entry.py            |  9 +++++++++
 tools/binman/etype/_testing.py   |  3 +++
 tools/binman/etype/section.py    |  7 +++++++
 tools/binman/ftest.py            |  5 +++++
 tools/binman/test/262_absent.dts | 20 ++++++++++++++++++++
 7 files changed, 67 insertions(+)
 create mode 100644 tools/binman/test/262_absent.dts
tools/binman/binman.rst +22 -0
index b091114fb91..1ab6d012b83 100644
@@ -1012,6 +1012,28 @@ For the BSS case, a 'spl-bss-pad' entry arg controls whether it is present. All
 entry args are provided by the U-Boot Makefile.
 
 
+Optional entries
+----------------
+
+Some entries need to exist only if certain conditions are met. For example, an
+entry may want to appear in the image only if a file has a particular format.
+Obviously the entry must exist in the image description for it to be processed
+at all, so a way needs to be found to have the entry remove itself.
+
+To handle this, when entry.ObtainContents() is called, the entry can call
+entry.mark_absent() to mark itself as absent, passing a suitable message as the
+reason.
+
+Any absent entries are dropped immediately after ObtainContents() has been
+called on all entries.
+
+It is not possible for an entry to mark itself absent at any other point in the
+processing. It must happen in the ObtainContents() method.
+
+The effect is as if the entry had never been present at all, since the image
+is packed without it and it disappears from the list of entries.
+
+
 Compression
 -----------
 
tools/binman/control.py +1 -0
index 964c6984f9b..07225381146 100644
@@ -552,6 +552,7 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
         image.SetAllowMissing(allow_missing)
         image.SetAllowFakeBlob(allow_fake_blobs)
         image.GetEntryContents()
+        image.drop_absent()
     image.GetEntryOffsets()
 
     # We need to pack the entries to figure out where everything
tools/binman/entry.py +9 -0
index 1be31a05e00..637aece3705 100644
@@ -91,6 +91,10 @@ class Entry(object):
             file, or is a binary file produced from an ELF file
         auto_write_symbols (bool): True to write ELF symbols into this entry's
             contents
+        absent (bool): True if this entry is absent. This can be controlled by
+            the entry itself, allowing it to vanish in certain circumstances.
+            An absent entry is removed during processing so that it does not
+            appear in the map
     """
     fake_dir = None
 
@@ -133,6 +137,7 @@ class Entry(object):
         self.comp_bintool = None
         self.elf_fname = None
         self.auto_write_symbols = auto_write_symbols
+        self.absent = False
 
     @staticmethod
     def FindEntryClass(etype, expanded):
@@ -1281,3 +1286,7 @@ features to produce new behaviours.
                 not_present.append(prop)
         if not_present:
             self.Raise(f"'{self.etype}' entry is missing properties: {' '.join(not_present)}")
+
+    def mark_absent(self, msg):
+        tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
+        self.absent = True
tools/binman/etype/_testing.py +3 -0
index 69600487814..1c1efb21a44 100644
@@ -63,6 +63,7 @@ class Entry__testing(Entry):
                                                     'bad-update-contents-twice')
         self.return_contents_later = fdt_util.GetBool(self._node,
                                                      'return-contents-later')
+        self.set_to_absent = fdt_util.GetBool(self._node, 'set-to-absent')
 
         # Set to True when the entry is ready to process the FDT.
         self.process_fdt_ready = False
@@ -119,6 +120,8 @@ class Entry__testing(Entry):
         if self.require_bintool_for_contents:
             if self.bintool_for_contents is None:
                 self.Raise("Required bintool unusable in ObtainContents()")
+        if self.set_to_absent:
+            self.mark_absent('for testing purposes')
         return True
 
     def GetOffsets(self):
tools/binman/etype/section.py +7 -0
index 305155c8461..dcb7a062047 100644
@@ -672,6 +672,9 @@ class Entry_section(Entry):
 
     def GetEntryContents(self, skip_entry=None):
         """Call ObtainContents() for each entry in the section
+
+        Note that this may set entry.absent to True if the entry is not
+        actually needed
         """
         def _CheckDone(entry):
             if entry != skip_entry:
@@ -716,6 +719,10 @@ class Entry_section(Entry):
                        todo)
         return True
 
+    def drop_absent(self):
+        """Drop entries which are absent"""
+        self._entries = {n: e for n, e in self._entries.items() if not e.absent}
+
     def _SetEntryOffsetSize(self, name, offset, size):
         """Set the offset and size of an entry
 
tools/binman/ftest.py +5 -0
index c3cb32dca26..f47a745f1e1 100644
@@ -6090,6 +6090,11 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         sect_data = tools.read_file(sect_fname)
         self.assertEqual(U_BOOT_DATA, sect_data)
 
+    def testAbsent(self):
+        """Check handling of absent entries"""
+        data = self._DoReadFile('262_absent.dts')
+        self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/262_absent.dts new file +20 -0
new file mode 100644
index 00000000000..2ab8766c878
@@ -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 {
+		};
+	};
+};
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#6 lore raw

PATCH v8 5/13 binman: Add a way to check for a valid ELF file

In reply to Simon Glass

Add a function which checks whether data is in ELF format or not. This will be used by binman to check this for entries.

---

(no changes since v1)

 tools/binman/elf.py      | 16 ++++++++++++++++
 tools/binman/elf_test.py | 10 ++++++++++
 2 files changed, 26 insertions(+)
tools/binman/elf.py +16 -0
index fe50bf542c3..2f4b7d1a08e 100644
@@ -21,6 +21,7 @@ ELF_TOOLS = True
 try:
     from elftools.elf.elffile import ELFFile
     from elftools.elf.elffile import ELFError
+    import elftools
     from elftools.elf.sections import SymbolTableSection
 except:  # pragma: no cover
     ELF_TOOLS = False
@@ -518,3 +519,18 @@ def read_loadable_segments(data):
             rend = start + segment['p_filesz']
             segments.append((i, segment['p_paddr'], data[start:rend]))
     return segments, entry
+
+def is_valid(data):
+    """Check if some binary data is a valid ELF file
+
+    Args:
+        data (bytes): Bytes to check
+
+    Returns:
+        bool: True if a valid Elf file, False if not
+    """
+    try:
+        DecodeElf(data, 0)
+        return True
+    except elftools.common.exceptions.ELFError:
+        return False
tools/binman/elf_test.py +10 -0
index 75b867c2be8..082a3e1d28c 100644
@@ -348,6 +348,16 @@ class TestElf(unittest.TestCase):
         finally:
             elf.ELF_TOOLS = old_val
 
+    def test_is_valid(self):
+        """Test is_valid()"""
+        self.assertEqual(False, elf.is_valid(b''))
+        self.assertEqual(False, elf.is_valid(b'1234'))
+
+        fname = self.ElfTestFile('elf_sections')
+        data = tools.read_file(fname)
+        self.assertEqual(True, elf.is_valid(data))
+        self.assertEqual(False, elf.is_valid(data[4:]))
+
 
 if __name__ == '__main__':
     unittest.main()
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#7 lore raw

Re: [PATCH v8 05/13] binman: Add a way to check for a valid ELF file

Hi Simon,

Quoted 17 lines · Simon Glass

Add a function which checks whether data is in ELF format or not. This will be used by binman to check this for entries.

---

(no changes since v1)

  tools/binman/elf.py      | 16 ++++++++++++++++
  tools/binman/elf_test.py | 10 ++++++++++
  2 files changed, 26 insertions(+)
tools/binman/elf.py +0 -0
index fe50bf542c3..2f4b7d1a08e 100644

tools/binman/elf.py ELF_TOOLS = True · line 24

Quoted 4 lines
tools/binman/elf.py +1 -0
@@ -21,6 +21,7 @@ ELF_TOOLS = True
  try:
      from elftools.elf.elffile import ELFFile
      from elftools.elf.elffile import ELFError
+    import elftools

I believe this is not needed?

Quoted 11 lines
tools/binman/elf.py +4 -0
      from elftools.elf.sections import SymbolTableSection
  except:  # pragma: no cover
      ELF_TOOLS = False
@@ -518,3 +519,18 @@ def read_loadable_segments(data):
              rend = start + segment['p_filesz']
              segments.append((i, segment['p_paddr'], data[start:rend]))
      return segments, entry
+
+def is_valid(data):
+    """Check if some binary data is a valid ELF file
+

tools/binman/elf.py def read_loadable_segments(data): · line 535

Quoted 10 lines
tools/binman/elf.py +10 -0
+    Args:
+        data (bytes): Bytes to check
+
+    Returns:
+        bool: True if a valid Elf file, False if not
+    """
+    try:
+        DecodeElf(data, 0)
+        return True
+    except elftools.common.exceptions.ELFError:

You can directly use ELFError here because of
from elftools.elf.elffile import ELFError
line above the one I suggested to remove?

Cheers,
Quentin

#8 lore raw

PATCH v8 6/13 binman: Support new op-tee binary format

In reply to Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

 tools/binman/entries.rst                     | 35 ++++++++-
 tools/binman/entry.py                        | 13 +++
 tools/binman/etype/fit.py                    | 69 +++++++++-------
 tools/binman/etype/section.py                |  9 +++
 tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
 tools/binman/ftest.py                        | 83 ++++++++++++++++++++
 tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
 tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
 tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
 9 files changed, 340 insertions(+), 32 deletions(-)
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
tools/binman/entries.rst +34 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
 Properties / Entry arguments:
     - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 
 This entry holds the run-time firmware, typically started by U-Boot SPL.
 See the U-Boot README for your architecture or board for how to use it. See
 https://github.com/OP-TEE/optee_os for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if
+the binary v1 format is provided.
+
 
 
 .. _etype_text:
tools/binman/entry.py +13 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
     def mark_absent(self, msg):
         tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
         self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None
tools/binman/etype/fit.py +39 -30

96 lines not on this page · raw message

tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
         super().AddBintools(btools)
         for entry in self._entries.values():
             entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +67 -1

86 lines not on this page · raw message

tools/binman/ftest.py +83 -0

107 lines not on this page · raw message

tools/binman/test/263_tee_os_opt.dts new file +22 -0
new file mode 100644
index 00000000000..2e4ec24ac2c
@@ -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 {
+		};
+	};
+};
tools/binman/test/264_tee_os_opt_fit.dts new file +33 -0
new file mode 100644
index 00000000000..ae44b433edf
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+
+			images {
+				@tee-SEQ {
+					fit,operation = "split-elf";
+					description = "TEE";
+					type = "tee";
+					arch = "arm64";
+					os = "tee";
+					compression = "none";
+					fit,load;
+					fit,entry;
+					fit,data;
+
+					tee-os {
+					};
+				};
+			};
+		};
+	};
+};
tools/binman/test/265_tee_os_opt_fit_bad.dts new file +40 -0
new file mode 100644
index 00000000000..7fa363cc199
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+
+			images {
+				@tee-SEQ {
+					fit,operation = "split-elf";
+					description = "TEE";
+					type = "tee";
+					arch = "arm64";
+					os = "tee";
+					compression = "none";
+					fit,load;
+					fit,entry;
+					fit,data;
+
+					tee-os {
+					};
+
+					/*
+					 * mess up the ELF data by adding
+					 * another bit of data at the end
+					 */
+					u-boot {
+					};
+				};
+			};
+		};
+	};
+};
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#9 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

...I get:

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

More complete log at https://pastebin.com/UZzZeicQ

Thanks,

Signature · 1 line
Jerome
Quoted 536 lines

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

 tools/binman/entries.rst                     | 35 ++++++++-
 tools/binman/entry.py                        | 13 +++
 tools/binman/etype/fit.py                    | 69 +++++++++-------
 tools/binman/etype/section.py                |  9 +++
 tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
 tools/binman/ftest.py                        | 83 ++++++++++++++++++++
 tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
 tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
 tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
 9 files changed, 340 insertions(+), 32 deletions(-)
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
tools/binman/entries.rst +34 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
 Properties / Entry arguments:
     - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 
 This entry holds the run-time firmware, typically started by U-Boot SPL.
 See the U-Boot README for your architecture or board for how to use it. See
 https://github.com/OP-TEE/optee_os for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if
+the binary v1 format is provided.
+
 
 
 .. _etype_text:
tools/binman/entry.py +13 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
     def mark_absent(self, msg):
         tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
         self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None
tools/binman/etype/fit.py +39 -30
index 8ad4f3a8a83..21c769a1cbe 100644
@@ -540,41 +540,34 @@ class Entry_fit(Entry_section):
                     else:
                         self.Raise("Generator node requires 'fit,fdt-list' property")
 
-        def _gen_split_elf(base_node, node, elf_data, missing):
+        def _gen_split_elf(base_node, node, segments, entry_addr):
             """Add nodes for the ELF file, one per group of contiguous segments
 
             Args:
                 base_node (Node): Template node from the binman definition
                 node (Node): Node to replace (in the FIT being built)
-                data (bytes): ELF-format data to process (may be empty)
-                missing (bool): True if any of the data is missing
 
+                segments, entry_addr
+
+                data (bytes): ELF-format data to process (may be empty)
             """
-            # If any pieces are missing, skip this. The missing entries will
-            # show an error
-            if not missing:
-                try:
-                    segments, entry = elf.read_loadable_segments(elf_data)
-                except ValueError as exc:
-                    self._raise_subnode(node,
-                                        f'Failed to read ELF file: {str(exc)}')
-                for (seq, start, data) in segments:
-                    node_name = node.name[1:].replace('SEQ', str(seq + 1))
-                    with fsw.add_node(node_name):
-                        loadables.append(node_name)
-                        for pname, prop in node.props.items():
-                            if not pname.startswith('fit,'):
-                                fsw.property(pname, prop.bytes)
-                            elif pname == 'fit,load':
-                                fsw.property_u32('load', start)
-                            elif pname == 'fit,entry':
-                                if seq == 0:
-                                    fsw.property_u32('entry', entry)
-                            elif pname == 'fit,data':
-                                fsw.property('data', bytes(data))
-                            elif pname != 'fit,operation':
-                                self._raise_subnode(
-                                    node, f"Unknown directive '{pname}'")
+            for (seq, start, data) in segments:
+                node_name = node.name[1:].replace('SEQ', str(seq + 1))
+                with fsw.add_node(node_name):
+                    loadables.append(node_name)
+                    for pname, prop in node.props.items():
+                        if not pname.startswith('fit,'):
+                            fsw.property(pname, prop.bytes)
+                        elif pname == 'fit,load':
+                            fsw.property_u32('load', start)
+                        elif pname == 'fit,entry':
+                            if seq == 0:
+                                fsw.property_u32('entry', entry_addr)
+                        elif pname == 'fit,data':
+                            fsw.property('data', bytes(data))
+                        elif pname != 'fit,operation':
+                            self._raise_subnode(
+                                node, f"Unknown directive '{pname}'")
 
         def _gen_node(base_node, node, depth, in_images, entry):
             """Generate nodes from a template
@@ -598,6 +591,8 @@ class Entry_fit(Entry_section):
                 depth (int): Current node depth (0 is the base 'fit' node)
                 in_images (bool): True if this is inside the 'images' node, so
                     that 'data' properties should be generated
+                entry (entry_Section): Entry for the second containing the
+                    contents of this node
             """
             oper = self._get_operation(base_node, node)
             if oper == OP_GEN_FDT_NODES:
@@ -609,10 +604,24 @@ class Entry_fit(Entry_section):
                 missing_list = []
                 entry.ObtainContents()
                 entry.Pack(0)
-                data = entry.GetData()
                 entry.CheckMissing(missing_list)
 
-                _gen_split_elf(base_node, node, data, bool(missing_list))
+                # If any pieces are missing, skip this. The missing entries will
+                # show an error
+                if not missing_list:
+                    segs = entry.read_elf_segments()
+                    if segs:
+                        segments, entry_addr = segs
+                    else:
+                        elf_data = entry.GetData()
+                        try:
+                            segments, entry_addr = (
+                                    elf.read_loadable_segments(elf_data))
+                        except ValueError as exc:
+                            self._raise_subnode(
+                                node, f'Failed to read ELF file: {str(exc)}')
+
+                    _gen_split_elf(base_node, node, segments, entry_addr)
 
         def _add_node(base_node, depth, node):
             """Add nodes to the output FIT
tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
         super().AddBintools(btools)
         for entry in self._entries.values():
             entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +67 -1
index 6ce4b672de4..687acd4689f 100644
@@ -4,19 +4,85 @@
 # Entry-type module for OP-TEE Trusted OS firmware blob
 #
 
+import struct
+
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+from binman import elf
 
 class Entry_tee_os(Entry_blob_named_by_arg):
     """Entry containing an OP-TEE Trusted OS (TEE) blob
 
     Properties / Entry arguments:
         - tee-os-path: Filename of file to read into entry. This is typically
-            called tee-pager.bin
+            called tee.bin or tee.elf
 
     This entry holds the run-time firmware, typically started by U-Boot SPL.
     See the U-Boot README for your architecture or board for how to use it. See
     https://github.com/OP-TEE/optee_os for more information about OP-TEE.
+
+    Note that if the file is in ELF format, it must go in a FIT. In that case,
+    this entry will mark itself as absent, providing the data only through the
+    read_elf_segments() method.
+
+    Marking this entry as absent means that it if is used in the wrong context
+    it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+    like this::
+
+        binman {
+            tee-os {
+            };
+        };
+
+    and pass either an ELF or plain binary in with -a tee-os-path <filename>
+    and have binman do the right thing:
+
+       - include the entry if tee.bin is provided and it doesn't have the v1
+         header
+       - drop it otherwise
+
+    When used within a FIT, we can do::
+
+        binman {
+            fit {
+                tee-os {
+                };
+            };
+        };
+
+    which will split the ELF into separate nodes for each segment, if an ELF
+    file is provide (see Flat Image Tree / FIT), or produce a single node if
+    the binary v1 format is provided.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node, 'tee-os')
         self.external = True
+
+    @staticmethod
+    def is_optee_bin(data):
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')
+        return True
+
+    def read_elf_segments(self):
+        data = self.GetData()
+        if self.is_optee_bin(data):
+            # OP-TEE v1 format (tee.bin)
+            init_sz, start_hi, start_lo, _, paged_sz = (
+                struct.unpack_from('<5I', data, 0x8))
+            if paged_sz != 0:
+                self.Raise("OP-TEE paged mode not supported")
+            e_entry = (start_hi << 32) + start_lo
+            p_addr = e_entry
+            p_data = data[0x1c:]
+            if len(p_data) != init_sz:
+                self.Raise("Invalid OP-TEE file: size mismatch (expected %#x, have %#x)" %
+                           (init_sz, len(p_data)))
+            return [[0, p_addr, p_data]], e_entry
+        return None
tools/binman/ftest.py +83 -0
index f47a745f1e1..f893050e706 100644
@@ -112,6 +112,8 @@ REPACK_DTB_PROPS = ['orig-offset', 'orig-size']
 # Supported compression bintools
 COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
 
+TEE_ADDR = 0x5678
+
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
 
@@ -219,6 +221,9 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('tee.elf',
             tools.read_file(cls.ElfTestFile('elf_sections')))
 
+        # Newer OP_TEE file in v1 binary format
+        cls.make_tee_bin('tee.bin')
+
         cls.comp_bintools = {}
         for name in COMP_BINTOOLS:
             cls.comp_bintools[name] = bintool.Bintool.create(name)
@@ -644,6 +649,14 @@ class TestFunctional(unittest.TestCase):
     def ElfTestFile(cls, fname):
         return os.path.join(cls._elf_testdir, fname)
 
+    @classmethod
+    def make_tee_bin(cls, fname, paged_sz=0, extra_data=b''):
+        init_sz, start_hi, start_lo, dummy = (len(U_BOOT_DATA), 0, TEE_ADDR, 0)
+        data = b'OPTE\x01xxx' + struct.pack('<5I', init_sz, start_hi, start_lo,
+                                            dummy, paged_sz) + U_BOOT_DATA
+        data += extra_data
+        TestFunctional._MakeInputFile(fname, data)
+
     def AssertInList(self, grep_list, target):
         """Assert that at least one of a list of things is in a target
 
@@ -6095,6 +6108,76 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         data = self._DoReadFile('262_absent.dts')
         self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
 
+    def testPackTeeOsOptional(self):
+        """Test that an image with an optional TEE binary can be created"""
+        entry_args = {
+            'tee-os-path': 'tee.elf',
+        }
+        data = self._DoReadFileDtb('263_tee_os_opt.dts',
+                                   entry_args=entry_args)[0]
+        self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
+
+    def checkFitTee(self, dts, tee_fname):
+        """Check that a tee-os entry works and returns data
+
+        Args:
+            dts (str): Device tree filename to use
+            tee_fname (str): filename containing tee-os
+
+        Returns:
+            bytes: Image contents
+        """
+        if not elf.ELF_TOOLS:
+            self.skipTest('Python elftools not available')
+        entry_args = {
+            'of-list': 'test-fdt1 test-fdt2',
+            'default-dt': 'test-fdt2',
+            'tee-os-path': tee_fname,
+        }
+        test_subdir = os.path.join(self._indir, TEST_FDT_SUBDIR)
+        data = self._DoReadFileDtb(dts, entry_args=entry_args,
+                                   extra_indirs=[test_subdir])[0]
+        return data
+
+    def testFitTeeOsOptionalFit(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        data = self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bin')
+
+        # There should be only one node, holding the data set up in SetUpClass()
+        # for tee.bin
+        dtb = fdt.Fdt.FromData(data)
+        dtb.Scan()
+        node = dtb.GetNode('/images/tee-1')
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['load'].value))
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['entry'].value))
+        self.assertEqual(U_BOOT_DATA, node.props['data'].bytes)
+
+    def testFitTeeOsOptionalFitBad(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('265_tee_os_opt_fit_bad.dts', 'tee.bin')
+        self.assertIn(
+            "Node '/binman/fit': subnode 'images/@tee-SEQ': Failed to read ELF file: Magic number does not match",
+            str(exc.exception))
+
+    def testFitTeeOsBad(self):
+        """Test an OP-TEE binary with wrong formats"""
+        self.make_tee_bin('tee.bad1', 123)
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad1')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': OP-TEE paged mode not supported",
+            str(exc.exception))
+
+        self.make_tee_bin('tee.bad2', 0, b'extra data')
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad2')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)",
+            str(exc.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/263_tee_os_opt.dts new file +22 -0
new file mode 100644
index 00000000000..2e4ec24ac2c
@@ -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 {
+		};
+	};
+};
tools/binman/test/264_tee_os_opt_fit.dts new file +33 -0
new file mode 100644
index 00000000000..ae44b433edf
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+
+			images {
+				@tee-SEQ {
+					fit,operation = "split-elf";
+					description = "TEE";
+					type = "tee";
+					arch = "arm64";
+					os = "tee";
+					compression = "none";
+					fit,load;
+					fit,entry;
+					fit,data;
+
+					tee-os {
+					};
+				};
+			};
+		};
+	};
+};
tools/binman/test/265_tee_os_opt_fit_bad.dts new file +40 -0
new file mode 100644
index 00000000000..7fa363cc199
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		fit {
+			description = "test-desc";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+
+			images {
+				@tee-SEQ {
+					fit,operation = "split-elf";
+					description = "TEE";
+					type = "tee";
+					arch = "arm64";
+					os = "tee";
+					compression = "none";
+					fit,load;
+					fit,entry;
+					fit,data;
+
+					tee-os {
+					};
+
+					/*
+					 * mess up the ELF data by adding
+					 * another bit of data at the end
+					 */
+					u-boot {
+					};
+				};
+			};
+		};
+	};
+};
#10 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Hi Jerome,

Quoted 20 lines · Jerome Forissier
Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

Quoted 6 lines

...I get:

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

More complete log at https://pastebin.com/UZzZeicQ

Thanks.

Is this file in the v1 binary format (with the custom header), or is is a plain binary file? At present only the former is supported, as I thought that it can only be the elf or the v1 binary format these days? Actually can you please send me the tee.bin ?

Regards,
Simon

Quoted 541 lines

Thanks,
--
Jerome

Quoted 536 lines

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

 tools/binman/entries.rst                     | 35 ++++++++-
 tools/binman/entry.py                        | 13 +++
 tools/binman/etype/fit.py                    | 69 +++++++++-------
 tools/binman/etype/section.py                |  9 +++
 tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
 tools/binman/ftest.py                        | 83 ++++++++++++++++++++
 tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
 tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
 tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
 9 files changed, 340 insertions(+), 32 deletions(-)
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
tools/binman/entries.rst +34 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
 Properties / Entry arguments:
     - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 
 This entry holds the run-time firmware, typically started by U-Boot SPL.
 See the U-Boot README for your architecture or board for how to use it. See
 https://github.com/OP-TEE/optee_os for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if
+the binary v1 format is provided.
+
 
 
 .. _etype_text:
tools/binman/entry.py +13 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
     def mark_absent(self, msg):
         tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
         self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None
tools/binman/etype/fit.py +39 -30
index 8ad4f3a8a83..21c769a1cbe 100644
@@ -540,41 +540,34 @@ class Entry_fit(Entry_section):
                     else:
                         self.Raise("Generator node requires 'fit,fdt-list' property")
 
-        def _gen_split_elf(base_node, node, elf_data, missing):
+        def _gen_split_elf(base_node, node, segments, entry_addr):
             """Add nodes for the ELF file, one per group of contiguous segments
 
             Args:
                 base_node (Node): Template node from the binman definition
                 node (Node): Node to replace (in the FIT being built)
-                data (bytes): ELF-format data to process (may be empty)
-                missing (bool): True if any of the data is missing
 
+                segments, entry_addr
+
+                data (bytes): ELF-format data to process (may be empty)
             """
-            # If any pieces are missing, skip this. The missing entries will
-            # show an error
-            if not missing:
-                try:
-                    segments, entry = elf.read_loadable_segments(elf_data)
-                except ValueError as exc:
-                    self._raise_subnode(node,
-                                        f'Failed to read ELF file: {str(exc)}')
-                for (seq, start, data) in segments:
-                    node_name = node.name[1:].replace('SEQ', str(seq + 1))
-                    with fsw.add_node(node_name):
-                        loadables.append(node_name)
-                        for pname, prop in node.props.items():
-                            if not pname.startswith('fit,'):
-                                fsw.property(pname, prop.bytes)
-                            elif pname == 'fit,load':
-                                fsw.property_u32('load', start)
-                            elif pname == 'fit,entry':
-                                if seq == 0:
-                                    fsw.property_u32('entry', entry)
-                            elif pname == 'fit,data':
-                                fsw.property('data', bytes(data))
-                            elif pname != 'fit,operation':
-                                self._raise_subnode(
-                                    node, f"Unknown directive '{pname}'")
+            for (seq, start, data) in segments:
+                node_name = node.name[1:].replace('SEQ', str(seq + 1))
+                with fsw.add_node(node_name):
+                    loadables.append(node_name)
+                    for pname, prop in node.props.items():
+                        if not pname.startswith('fit,'):
+                            fsw.property(pname, prop.bytes)
+                        elif pname == 'fit,load':
+                            fsw.property_u32('load', start)
+                        elif pname == 'fit,entry':
+                            if seq == 0:
+                                fsw.property_u32('entry', entry_addr)
+                        elif pname == 'fit,data':
+                            fsw.property('data', bytes(data))
+                        elif pname != 'fit,operation':
+                            self._raise_subnode(
+                                node, f"Unknown directive '{pname}'")
 
         def _gen_node(base_node, node, depth, in_images, entry):
             """Generate nodes from a template
@@ -598,6 +591,8 @@ class Entry_fit(Entry_section):
                 depth (int): Current node depth (0 is the base 'fit' node)
                 in_images (bool): True if this is inside the 'images' node, so
                     that 'data' properties should be generated
+                entry (entry_Section): Entry for the second containing the
+                    contents of this node
             """
             oper = self._get_operation(base_node, node)
             if oper == OP_GEN_FDT_NODES:
@@ -609,10 +604,24 @@ class Entry_fit(Entry_section):
                 missing_list = []
                 entry.ObtainContents()
                 entry.Pack(0)
-                data = entry.GetData()
                 entry.CheckMissing(missing_list)
 
-                _gen_split_elf(base_node, node, data, bool(missing_list))
+                # If any pieces are missing, skip this. The missing entries will
+                # show an error
+                if not missing_list:
+                    segs = entry.read_elf_segments()
+                    if segs:
+                        segments, entry_addr = segs
+                    else:
+                        elf_data = entry.GetData()
+                        try:
+                            segments, entry_addr = (
+                                    elf.read_loadable_segments(elf_data))
+                        except ValueError as exc:
+                            self._raise_subnode(
+                                node, f'Failed to read ELF file: {str(exc)}')
+
+                    _gen_split_elf(base_node, node, segments, entry_addr)
 
         def _add_node(base_node, depth, node):
             """Add nodes to the output FIT
tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
         super().AddBintools(btools)
         for entry in self._entries.values():
             entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +67 -1
index 6ce4b672de4..687acd4689f 100644
@@ -4,19 +4,85 @@
 # Entry-type module for OP-TEE Trusted OS firmware blob
 #
 
+import struct
+
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+from binman import elf
 
 class Entry_tee_os(Entry_blob_named_by_arg):
     """Entry containing an OP-TEE Trusted OS (TEE) blob
 
     Properties / Entry arguments:
         - tee-os-path: Filename of file to read into entry. This is typically
-            called tee-pager.bin
+            called tee.bin or tee.elf
 
     This entry holds the run-time firmware, typically started by U-Boot SPL.
     See the U-Boot README for your architecture or board for how to use it. See
     https://github.com/OP-TEE/optee_os for more information about OP-TEE.
+
+    Note that if the file is in ELF format, it must go in a FIT. In that case,
+    this entry will mark itself as absent, providing the data only through the
+    read_elf_segments() method.
+
+    Marking this entry as absent means that it if is used in the wrong context
+    it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+    like this::
+
+        binman {
+            tee-os {
+            };
+        };
+
+    and pass either an ELF or plain binary in with -a tee-os-path <filename>
+    and have binman do the right thing:
+
+       - include the entry if tee.bin is provided and it doesn't have the v1
+         header
+       - drop it otherwise
+
+    When used within a FIT, we can do::
+
+        binman {
+            fit {
+                tee-os {
+                };
+            };
+        };
+
+    which will split the ELF into separate nodes for each segment, if an ELF
+    file is provide (see Flat Image Tree / FIT), or produce a single node if
+    the binary v1 format is provided.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node, 'tee-os')
         self.external = True
+
+    @staticmethod
+    def is_optee_bin(data):
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')
+        return True
+
+    def read_elf_segments(self):
+        data = self.GetData()
+        if self.is_optee_bin(data):
+            # OP-TEE v1 format (tee.bin)
+            init_sz, start_hi, start_lo, _, paged_sz = (
+                struct.unpack_from('<5I', data, 0x8))
+            if paged_sz != 0:
+                self.Raise("OP-TEE paged mode not supported")
+            e_entry = (start_hi << 32) + start_lo
+            p_addr = e_entry
+            p_data = data[0x1c:]
+            if len(p_data) != init_sz:
+                self.Raise("Invalid OP-TEE file: size mismatch (expected %#x, have %#x)" %
+                           (init_sz, len(p_data)))
+            return [[0, p_addr, p_data]], e_entry
+        return None
tools/binman/ftest.py +83 -0
index f47a745f1e1..f893050e706 100644
@@ -112,6 +112,8 @@ REPACK_DTB_PROPS = ['orig-offset', 'orig-size']
 # Supported compression bintools
 COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
 
+TEE_ADDR = 0x5678
+
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
 
@@ -219,6 +221,9 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('tee.elf',
             tools.read_file(cls.ElfTestFile('elf_sections')))
 
+        # Newer OP_TEE file in v1 binary format
+        cls.make_tee_bin('tee.bin')
+
         cls.comp_bintools = {}
         for name in COMP_BINTOOLS:
             cls.comp_bintools[name] = bintool.Bintool.create(name)
@@ -644,6 +649,14 @@ class TestFunctional(unittest.TestCase):
     def ElfTestFile(cls, fname):
         return os.path.join(cls._elf_testdir, fname)
 
+    @classmethod
+    def make_tee_bin(cls, fname, paged_sz=0, extra_data=b''):
+        init_sz, start_hi, start_lo, dummy = (len(U_BOOT_DATA), 0, TEE_ADDR, 0)
+        data = b'OPTE\x01xxx' + struct.pack('<5I', init_sz, start_hi, start_lo,
+                                            dummy, paged_sz) + U_BOOT_DATA
+        data += extra_data
+        TestFunctional._MakeInputFile(fname, data)
+
     def AssertInList(self, grep_list, target):
         """Assert that at least one of a list of things is in a target
 
@@ -6095,6 +6108,76 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         data = self._DoReadFile('262_absent.dts')
         self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
 
+    def testPackTeeOsOptional(self):
+        """Test that an image with an optional TEE binary can be created"""
+        entry_args = {
+            'tee-os-path': 'tee.elf',
+        }
+        data = self._DoReadFileDtb('263_tee_os_opt.dts',
+                                   entry_args=entry_args)[0]
+        self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
+
+    def checkFitTee(self, dts, tee_fname):
+        """Check that a tee-os entry works and returns data
+
+        Args:
+            dts (str): Device tree filename to use
+            tee_fname (str): filename containing tee-os
+
+        Returns:
+            bytes: Image contents
+        """
+        if not elf.ELF_TOOLS:
+            self.skipTest('Python elftools not available')
+        entry_args = {
+            'of-list': 'test-fdt1 test-fdt2',
+            'default-dt': 'test-fdt2',
+            'tee-os-path': tee_fname,
+        }
+        test_subdir = os.path.join(self._indir, TEST_FDT_SUBDIR)
+        data = self._DoReadFileDtb(dts, entry_args=entry_args,
+                                   extra_indirs=[test_subdir])[0]
+        return data
+
+    def testFitTeeOsOptionalFit(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        data = self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bin')
+
+        # There should be only one node, holding the data set up in SetUpClass()
+        # for tee.bin
+        dtb = fdt.Fdt.FromData(data)
+        dtb.Scan()
+        node = dtb.GetNode('/images/tee-1')
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['load'].value))
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['entry'].value))
+        self.assertEqual(U_BOOT_DATA, node.props['data'].bytes)
+
+    def testFitTeeOsOptionalFitBad(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('265_tee_os_opt_fit_bad.dts', 'tee.bin')
+        self.assertIn(
+            "Node '/binman/fit': subnode 'images/@tee-SEQ': Failed to read ELF file: Magic number does not match",
+            str(exc.exception))
+
+    def testFitTeeOsBad(self):
+        """Test an OP-TEE binary with wrong formats"""
+        self.make_tee_bin('tee.bad1', 123)
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad1')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': OP-TEE paged mode not supported",
+            str(exc.exception))
+
+        self.make_tee_bin('tee.bad2', 0, b'extra data')
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad2')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)",
+            str(exc.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/263_tee_os_opt.dts new file +22 -0
new file mode 100644
index 00000000000..2e4ec24ac2c
@@ -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 {
+             };
+     };
+};
tools/binman/test/264_tee_os_opt_fit.dts new file +33 -0
new file mode 100644
index 00000000000..ae44b433edf
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+                             };
+                     };
+             };
+     };
+};
tools/binman/test/265_tee_os_opt_fit_bad.dts new file +40 -0
new file mode 100644
index 00000000000..7fa363cc199
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+
+                                     /*
+                                      * mess up the ELF data by adding
+                                      * another bit of data at the end
+                                      */
+                                     u-boot {
+                                     };
+                             };
+                     };
+             };
+     };
+};
#11 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

(dropping the two bounces from cc)

Quoted 584 lines · Simon Glass

Hi Jerome,

Quoted 20 lines · Jerome Forissier
Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

Quoted 6 lines

...I get:

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

More complete log at https://pastebin.com/UZzZeicQ

Thanks.

Is this file in the v1 binary format (with the custom header), or is is a plain binary file? At present only the former is supported, as I thought that it can only be the elf or the v1 binary format these days? Actually can you please send me the tee.bin ?

Regards,
Simon

Quoted 541 lines

Thanks,
--
Jerome

Quoted 536 lines

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

 tools/binman/entries.rst                     | 35 ++++++++-
 tools/binman/entry.py                        | 13 +++
 tools/binman/etype/fit.py                    | 69 +++++++++-------
 tools/binman/etype/section.py                |  9 +++
 tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
 tools/binman/ftest.py                        | 83 ++++++++++++++++++++
 tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
 tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
 tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
 9 files changed, 340 insertions(+), 32 deletions(-)
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
tools/binman/entries.rst +34 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
 Properties / Entry arguments:
     - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 
 This entry holds the run-time firmware, typically started by U-Boot SPL.
 See the U-Boot README for your architecture or board for how to use it. See
 https://github.com/OP-TEE/optee_os for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if
+the binary v1 format is provided.
+
 
 
 .. _etype_text:
tools/binman/entry.py +13 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
     def mark_absent(self, msg):
         tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
         self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None
tools/binman/etype/fit.py +39 -30
index 8ad4f3a8a83..21c769a1cbe 100644
@@ -540,41 +540,34 @@ class Entry_fit(Entry_section):
                     else:
                         self.Raise("Generator node requires 'fit,fdt-list' property")
 
-        def _gen_split_elf(base_node, node, elf_data, missing):
+        def _gen_split_elf(base_node, node, segments, entry_addr):
             """Add nodes for the ELF file, one per group of contiguous segments
 
             Args:
                 base_node (Node): Template node from the binman definition
                 node (Node): Node to replace (in the FIT being built)
-                data (bytes): ELF-format data to process (may be empty)
-                missing (bool): True if any of the data is missing
 
+                segments, entry_addr
+
+                data (bytes): ELF-format data to process (may be empty)
             """
-            # If any pieces are missing, skip this. The missing entries will
-            # show an error
-            if not missing:
-                try:
-                    segments, entry = elf.read_loadable_segments(elf_data)
-                except ValueError as exc:
-                    self._raise_subnode(node,
-                                        f'Failed to read ELF file: {str(exc)}')
-                for (seq, start, data) in segments:
-                    node_name = node.name[1:].replace('SEQ', str(seq + 1))
-                    with fsw.add_node(node_name):
-                        loadables.append(node_name)
-                        for pname, prop in node.props.items():
-                            if not pname.startswith('fit,'):
-                                fsw.property(pname, prop.bytes)
-                            elif pname == 'fit,load':
-                                fsw.property_u32('load', start)
-                            elif pname == 'fit,entry':
-                                if seq == 0:
-                                    fsw.property_u32('entry', entry)
-                            elif pname == 'fit,data':
-                                fsw.property('data', bytes(data))
-                            elif pname != 'fit,operation':
-                                self._raise_subnode(
-                                    node, f"Unknown directive '{pname}'")
+            for (seq, start, data) in segments:
+                node_name = node.name[1:].replace('SEQ', str(seq + 1))
+                with fsw.add_node(node_name):
+                    loadables.append(node_name)
+                    for pname, prop in node.props.items():
+                        if not pname.startswith('fit,'):
+                            fsw.property(pname, prop.bytes)
+                        elif pname == 'fit,load':
+                            fsw.property_u32('load', start)
+                        elif pname == 'fit,entry':
+                            if seq == 0:
+                                fsw.property_u32('entry', entry_addr)
+                        elif pname == 'fit,data':
+                            fsw.property('data', bytes(data))
+                        elif pname != 'fit,operation':
+                            self._raise_subnode(
+                                node, f"Unknown directive '{pname}'")
 
         def _gen_node(base_node, node, depth, in_images, entry):
             """Generate nodes from a template
@@ -598,6 +591,8 @@ class Entry_fit(Entry_section):
                 depth (int): Current node depth (0 is the base 'fit' node)
                 in_images (bool): True if this is inside the 'images' node, so
                     that 'data' properties should be generated
+                entry (entry_Section): Entry for the second containing the
+                    contents of this node
             """
             oper = self._get_operation(base_node, node)
             if oper == OP_GEN_FDT_NODES:
@@ -609,10 +604,24 @@ class Entry_fit(Entry_section):
                 missing_list = []
                 entry.ObtainContents()
                 entry.Pack(0)
-                data = entry.GetData()
                 entry.CheckMissing(missing_list)
 
-                _gen_split_elf(base_node, node, data, bool(missing_list))
+                # If any pieces are missing, skip this. The missing entries will
+                # show an error
+                if not missing_list:
+                    segs = entry.read_elf_segments()
+                    if segs:
+                        segments, entry_addr = segs
+                    else:
+                        elf_data = entry.GetData()
+                        try:
+                            segments, entry_addr = (
+                                    elf.read_loadable_segments(elf_data))
+                        except ValueError as exc:
+                            self._raise_subnode(
+                                node, f'Failed to read ELF file: {str(exc)}')
+
+                    _gen_split_elf(base_node, node, segments, entry_addr)
 
         def _add_node(base_node, depth, node):
             """Add nodes to the output FIT
tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
         super().AddBintools(btools)
         for entry in self._entries.values():
             entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +67 -1
index 6ce4b672de4..687acd4689f 100644
@@ -4,19 +4,85 @@
 # Entry-type module for OP-TEE Trusted OS firmware blob
 #
 
+import struct
+
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+from binman import elf
 
 class Entry_tee_os(Entry_blob_named_by_arg):
     """Entry containing an OP-TEE Trusted OS (TEE) blob
 
     Properties / Entry arguments:
         - tee-os-path: Filename of file to read into entry. This is typically
-            called tee-pager.bin
+            called tee.bin or tee.elf
 
     This entry holds the run-time firmware, typically started by U-Boot SPL.
     See the U-Boot README for your architecture or board for how to use it. See
     https://github.com/OP-TEE/optee_os for more information about OP-TEE.
+
+    Note that if the file is in ELF format, it must go in a FIT. In that case,
+    this entry will mark itself as absent, providing the data only through the
+    read_elf_segments() method.
+
+    Marking this entry as absent means that it if is used in the wrong context
+    it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+    like this::
+
+        binman {
+            tee-os {
+            };
+        };
+
+    and pass either an ELF or plain binary in with -a tee-os-path <filename>
+    and have binman do the right thing:
+
+       - include the entry if tee.bin is provided and it doesn't have the v1
+         header
+       - drop it otherwise
+
+    When used within a FIT, we can do::
+
+        binman {
+            fit {
+                tee-os {
+                };
+            };
+        };
+
+    which will split the ELF into separate nodes for each segment, if an ELF
+    file is provide (see Flat Image Tree / FIT), or produce a single node if
+    the binary v1 format is provided.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node, 'tee-os')
         self.external = True
+
+    @staticmethod
+    def is_optee_bin(data):
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')
+        return True
+
+    def read_elf_segments(self):
+        data = self.GetData()
+        if self.is_optee_bin(data):
+            # OP-TEE v1 format (tee.bin)
+            init_sz, start_hi, start_lo, _, paged_sz = (
+                struct.unpack_from('<5I', data, 0x8))
+            if paged_sz != 0:
+                self.Raise("OP-TEE paged mode not supported")
+            e_entry = (start_hi << 32) + start_lo
+            p_addr = e_entry
+            p_data = data[0x1c:]
+            if len(p_data) != init_sz:
+                self.Raise("Invalid OP-TEE file: size mismatch (expected %#x, have %#x)" %
+                           (init_sz, len(p_data)))
+            return [[0, p_addr, p_data]], e_entry
+        return None
tools/binman/ftest.py +83 -0
index f47a745f1e1..f893050e706 100644
@@ -112,6 +112,8 @@ REPACK_DTB_PROPS = ['orig-offset', 'orig-size']
 # Supported compression bintools
 COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
 
+TEE_ADDR = 0x5678
+
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
 
@@ -219,6 +221,9 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('tee.elf',
             tools.read_file(cls.ElfTestFile('elf_sections')))
 
+        # Newer OP_TEE file in v1 binary format
+        cls.make_tee_bin('tee.bin')
+
         cls.comp_bintools = {}
         for name in COMP_BINTOOLS:
             cls.comp_bintools[name] = bintool.Bintool.create(name)
@@ -644,6 +649,14 @@ class TestFunctional(unittest.TestCase):
     def ElfTestFile(cls, fname):
         return os.path.join(cls._elf_testdir, fname)
 
+    @classmethod
+    def make_tee_bin(cls, fname, paged_sz=0, extra_data=b''):
+        init_sz, start_hi, start_lo, dummy = (len(U_BOOT_DATA), 0, TEE_ADDR, 0)
+        data = b'OPTE\x01xxx' + struct.pack('<5I', init_sz, start_hi, start_lo,
+                                            dummy, paged_sz) + U_BOOT_DATA
+        data += extra_data
+        TestFunctional._MakeInputFile(fname, data)
+
     def AssertInList(self, grep_list, target):
         """Assert that at least one of a list of things is in a target
 
@@ -6095,6 +6108,76 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         data = self._DoReadFile('262_absent.dts')
         self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
 
+    def testPackTeeOsOptional(self):
+        """Test that an image with an optional TEE binary can be created"""
+        entry_args = {
+            'tee-os-path': 'tee.elf',
+        }
+        data = self._DoReadFileDtb('263_tee_os_opt.dts',
+                                   entry_args=entry_args)[0]
+        self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
+
+    def checkFitTee(self, dts, tee_fname):
+        """Check that a tee-os entry works and returns data
+
+        Args:
+            dts (str): Device tree filename to use
+            tee_fname (str): filename containing tee-os
+
+        Returns:
+            bytes: Image contents
+        """
+        if not elf.ELF_TOOLS:
+            self.skipTest('Python elftools not available')
+        entry_args = {
+            'of-list': 'test-fdt1 test-fdt2',
+            'default-dt': 'test-fdt2',
+            'tee-os-path': tee_fname,
+        }
+        test_subdir = os.path.join(self._indir, TEST_FDT_SUBDIR)
+        data = self._DoReadFileDtb(dts, entry_args=entry_args,
+                                   extra_indirs=[test_subdir])[0]
+        return data
+
+    def testFitTeeOsOptionalFit(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        data = self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bin')
+
+        # There should be only one node, holding the data set up in SetUpClass()
+        # for tee.bin
+        dtb = fdt.Fdt.FromData(data)
+        dtb.Scan()
+        node = dtb.GetNode('/images/tee-1')
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['load'].value))
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['entry'].value))
+        self.assertEqual(U_BOOT_DATA, node.props['data'].bytes)
+
+    def testFitTeeOsOptionalFitBad(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('265_tee_os_opt_fit_bad.dts', 'tee.bin')
+        self.assertIn(
+            "Node '/binman/fit': subnode 'images/@tee-SEQ': Failed to read ELF file: Magic number does not match",
+            str(exc.exception))
+
+    def testFitTeeOsBad(self):
+        """Test an OP-TEE binary with wrong formats"""
+        self.make_tee_bin('tee.bad1', 123)
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad1')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': OP-TEE paged mode not supported",
+            str(exc.exception))
+
+        self.make_tee_bin('tee.bad2', 0, b'extra data')
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad2')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)",
+            str(exc.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/263_tee_os_opt.dts new file +22 -0
new file mode 100644
index 00000000000..2e4ec24ac2c
@@ -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 {
+             };
+     };
+};
tools/binman/test/264_tee_os_opt_fit.dts new file +33 -0
new file mode 100644
index 00000000000..ae44b433edf
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+                             };
+                     };
+             };
+     };
+};
tools/binman/test/265_tee_os_opt_fit_bad.dts new file +40 -0
new file mode 100644
index 00000000000..7fa363cc199
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+
+                                     /*
+                                      * mess up the ELF data by adding
+                                      * another bit of data at the end
+                                      */
+                                     u-boot {
+                                     };
+                             };
+                     };
+             };
+     };
+};
#12 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Quoted 38 lines · Simon Glass

(dropping the two bounces from cc)

Quoted 35 lines · Simon Glass

Hi Jerome,

Quoted 20 lines · Jerome Forissier
Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

Quoted 6 lines

...I get:

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

More complete log at https://pastebin.com/UZzZeicQ

Thanks.

Is this file in the v1 binary format (with the custom header),

Yes

Quoted 4 lines
Quoted 4 lines

or is
is a plain binary file? At present only the former is supported, as I thought that it can only be the elf or the v1 binary format these days?

Correct

Quoted 1 line
Quoted 1 line

Actually can you please send me the tee.bin ?

Sure, here you go: https://ufile.io/f/ex5oy

I have added bl31.elf too, although I suppose it is handled properly being an ELF file.

Thanks,

Signature · 1 line
Jerome
Quoted 545 lines
Quoted 545 lines

Regards,
Simon

Quoted 541 lines

Thanks,
--
Jerome

Quoted 536 lines

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

 tools/binman/entries.rst                     | 35 ++++++++-
 tools/binman/entry.py                        | 13 +++
 tools/binman/etype/fit.py                    | 69 +++++++++-------
 tools/binman/etype/section.py                |  9 +++
 tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
 tools/binman/ftest.py                        | 83 ++++++++++++++++++++
 tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
 tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
 tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
 9 files changed, 340 insertions(+), 32 deletions(-)
 create mode 100644 tools/binman/test/263_tee_os_opt.dts
 create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts
 create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts
tools/binman/entries.rst +34 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
 Properties / Entry arguments:
     - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 
 This entry holds the run-time firmware, typically started by U-Boot SPL.
 See the U-Boot README for your architecture or board for how to use it. See
 https://github.com/OP-TEE/optee_os for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if
+the binary v1 format is provided.
+
 
 
 .. _etype_text:
tools/binman/entry.py +13 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
     def mark_absent(self, msg):
         tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
         self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None
tools/binman/etype/fit.py +39 -30
index 8ad4f3a8a83..21c769a1cbe 100644
@@ -540,41 +540,34 @@ class Entry_fit(Entry_section):
                     else:
                         self.Raise("Generator node requires 'fit,fdt-list' property")
 
-        def _gen_split_elf(base_node, node, elf_data, missing):
+        def _gen_split_elf(base_node, node, segments, entry_addr):
             """Add nodes for the ELF file, one per group of contiguous segments
 
             Args:
                 base_node (Node): Template node from the binman definition
                 node (Node): Node to replace (in the FIT being built)
-                data (bytes): ELF-format data to process (may be empty)
-                missing (bool): True if any of the data is missing
 
+                segments, entry_addr
+
+                data (bytes): ELF-format data to process (may be empty)
             """
-            # If any pieces are missing, skip this. The missing entries will
-            # show an error
-            if not missing:
-                try:
-                    segments, entry = elf.read_loadable_segments(elf_data)
-                except ValueError as exc:
-                    self._raise_subnode(node,
-                                        f'Failed to read ELF file: {str(exc)}')
-                for (seq, start, data) in segments:
-                    node_name = node.name[1:].replace('SEQ', str(seq + 1))
-                    with fsw.add_node(node_name):
-                        loadables.append(node_name)
-                        for pname, prop in node.props.items():
-                            if not pname.startswith('fit,'):
-                                fsw.property(pname, prop.bytes)
-                            elif pname == 'fit,load':
-                                fsw.property_u32('load', start)
-                            elif pname == 'fit,entry':
-                                if seq == 0:
-                                    fsw.property_u32('entry', entry)
-                            elif pname == 'fit,data':
-                                fsw.property('data', bytes(data))
-                            elif pname != 'fit,operation':
-                                self._raise_subnode(
-                                    node, f"Unknown directive '{pname}'")
+            for (seq, start, data) in segments:
+                node_name = node.name[1:].replace('SEQ', str(seq + 1))
+                with fsw.add_node(node_name):
+                    loadables.append(node_name)
+                    for pname, prop in node.props.items():
+                        if not pname.startswith('fit,'):
+                            fsw.property(pname, prop.bytes)
+                        elif pname == 'fit,load':
+                            fsw.property_u32('load', start)
+                        elif pname == 'fit,entry':
+                            if seq == 0:
+                                fsw.property_u32('entry', entry_addr)
+                        elif pname == 'fit,data':
+                            fsw.property('data', bytes(data))
+                        elif pname != 'fit,operation':
+                            self._raise_subnode(
+                                node, f"Unknown directive '{pname}'")
 
         def _gen_node(base_node, node, depth, in_images, entry):
             """Generate nodes from a template
@@ -598,6 +591,8 @@ class Entry_fit(Entry_section):
                 depth (int): Current node depth (0 is the base 'fit' node)
                 in_images (bool): True if this is inside the 'images' node, so
                     that 'data' properties should be generated
+                entry (entry_Section): Entry for the second containing the
+                    contents of this node
             """
             oper = self._get_operation(base_node, node)
             if oper == OP_GEN_FDT_NODES:
@@ -609,10 +604,24 @@ class Entry_fit(Entry_section):
                 missing_list = []
                 entry.ObtainContents()
                 entry.Pack(0)
-                data = entry.GetData()
                 entry.CheckMissing(missing_list)
 
-                _gen_split_elf(base_node, node, data, bool(missing_list))
+                # If any pieces are missing, skip this. The missing entries will
+                # show an error
+                if not missing_list:
+                    segs = entry.read_elf_segments()
+                    if segs:
+                        segments, entry_addr = segs
+                    else:
+                        elf_data = entry.GetData()
+                        try:
+                            segments, entry_addr = (
+                                    elf.read_loadable_segments(elf_data))
+                        except ValueError as exc:
+                            self._raise_subnode(
+                                node, f'Failed to read ELF file: {str(exc)}')
+
+                    _gen_split_elf(base_node, node, segments, entry_addr)
 
         def _add_node(base_node, depth, node):
             """Add nodes to the output FIT
tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
         super().AddBintools(btools)
         for entry in self._entries.values():
             entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +67 -1
index 6ce4b672de4..687acd4689f 100644
@@ -4,19 +4,85 @@
 # Entry-type module for OP-TEE Trusted OS firmware blob
 #
 
+import struct
+
 from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+from binman import elf
 
 class Entry_tee_os(Entry_blob_named_by_arg):
     """Entry containing an OP-TEE Trusted OS (TEE) blob
 
     Properties / Entry arguments:
         - tee-os-path: Filename of file to read into entry. This is typically
-            called tee-pager.bin
+            called tee.bin or tee.elf
 
     This entry holds the run-time firmware, typically started by U-Boot SPL.
     See the U-Boot README for your architecture or board for how to use it. See
     https://github.com/OP-TEE/optee_os for more information about OP-TEE.
+
+    Note that if the file is in ELF format, it must go in a FIT. In that case,
+    this entry will mark itself as absent, providing the data only through the
+    read_elf_segments() method.
+
+    Marking this entry as absent means that it if is used in the wrong context
+    it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+    like this::
+
+        binman {
+            tee-os {
+            };
+        };
+
+    and pass either an ELF or plain binary in with -a tee-os-path <filename>
+    and have binman do the right thing:
+
+       - include the entry if tee.bin is provided and it doesn't have the v1
+         header
+       - drop it otherwise
+
+    When used within a FIT, we can do::
+
+        binman {
+            fit {
+                tee-os {
+                };
+            };
+        };
+
+    which will split the ELF into separate nodes for each segment, if an ELF
+    file is provide (see Flat Image Tree / FIT), or produce a single node if
+    the binary v1 format is provided.
     """
     def __init__(self, section, etype, node):
         super().__init__(section, etype, node, 'tee-os')
         self.external = True
+
+    @staticmethod
+    def is_optee_bin(data):
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')
+        return True
+
+    def read_elf_segments(self):
+        data = self.GetData()
+        if self.is_optee_bin(data):
+            # OP-TEE v1 format (tee.bin)
+            init_sz, start_hi, start_lo, _, paged_sz = (
+                struct.unpack_from('<5I', data, 0x8))
+            if paged_sz != 0:
+                self.Raise("OP-TEE paged mode not supported")
+            e_entry = (start_hi << 32) + start_lo
+            p_addr = e_entry
+            p_data = data[0x1c:]
+            if len(p_data) != init_sz:
+                self.Raise("Invalid OP-TEE file: size mismatch (expected %#x, have %#x)" %
+                           (init_sz, len(p_data)))
+            return [[0, p_addr, p_data]], e_entry
+        return None
tools/binman/ftest.py +83 -0
index f47a745f1e1..f893050e706 100644
@@ -112,6 +112,8 @@ REPACK_DTB_PROPS = ['orig-offset', 'orig-size']
 # Supported compression bintools
 COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
 
+TEE_ADDR = 0x5678
+
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
 
@@ -219,6 +221,9 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('tee.elf',
             tools.read_file(cls.ElfTestFile('elf_sections')))
 
+        # Newer OP_TEE file in v1 binary format
+        cls.make_tee_bin('tee.bin')
+
         cls.comp_bintools = {}
         for name in COMP_BINTOOLS:
             cls.comp_bintools[name] = bintool.Bintool.create(name)
@@ -644,6 +649,14 @@ class TestFunctional(unittest.TestCase):
     def ElfTestFile(cls, fname):
         return os.path.join(cls._elf_testdir, fname)
 
+    @classmethod
+    def make_tee_bin(cls, fname, paged_sz=0, extra_data=b''):
+        init_sz, start_hi, start_lo, dummy = (len(U_BOOT_DATA), 0, TEE_ADDR, 0)
+        data = b'OPTE\x01xxx' + struct.pack('<5I', init_sz, start_hi, start_lo,
+                                            dummy, paged_sz) + U_BOOT_DATA
+        data += extra_data
+        TestFunctional._MakeInputFile(fname, data)
+
     def AssertInList(self, grep_list, target):
         """Assert that at least one of a list of things is in a target
 
@@ -6095,6 +6108,76 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         data = self._DoReadFile('262_absent.dts')
         self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
 
+    def testPackTeeOsOptional(self):
+        """Test that an image with an optional TEE binary can be created"""
+        entry_args = {
+            'tee-os-path': 'tee.elf',
+        }
+        data = self._DoReadFileDtb('263_tee_os_opt.dts',
+                                   entry_args=entry_args)[0]
+        self.assertEqual(U_BOOT_DATA + U_BOOT_IMG_DATA, data)
+
+    def checkFitTee(self, dts, tee_fname):
+        """Check that a tee-os entry works and returns data
+
+        Args:
+            dts (str): Device tree filename to use
+            tee_fname (str): filename containing tee-os
+
+        Returns:
+            bytes: Image contents
+        """
+        if not elf.ELF_TOOLS:
+            self.skipTest('Python elftools not available')
+        entry_args = {
+            'of-list': 'test-fdt1 test-fdt2',
+            'default-dt': 'test-fdt2',
+            'tee-os-path': tee_fname,
+        }
+        test_subdir = os.path.join(self._indir, TEST_FDT_SUBDIR)
+        data = self._DoReadFileDtb(dts, entry_args=entry_args,
+                                   extra_indirs=[test_subdir])[0]
+        return data
+
+    def testFitTeeOsOptionalFit(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        data = self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bin')
+
+        # There should be only one node, holding the data set up in SetUpClass()
+        # for tee.bin
+        dtb = fdt.Fdt.FromData(data)
+        dtb.Scan()
+        node = dtb.GetNode('/images/tee-1')
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['load'].value))
+        self.assertEqual(TEE_ADDR,
+                         fdt_util.fdt32_to_cpu(node.props['entry'].value))
+        self.assertEqual(U_BOOT_DATA, node.props['data'].bytes)
+
+    def testFitTeeOsOptionalFitBad(self):
+        """Test an image with a FIT with an optional OP-TEE binary"""
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('265_tee_os_opt_fit_bad.dts', 'tee.bin')
+        self.assertIn(
+            "Node '/binman/fit': subnode 'images/@tee-SEQ': Failed to read ELF file: Magic number does not match",
+            str(exc.exception))
+
+    def testFitTeeOsBad(self):
+        """Test an OP-TEE binary with wrong formats"""
+        self.make_tee_bin('tee.bad1', 123)
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad1')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': OP-TEE paged mode not supported",
+            str(exc.exception))
+
+        self.make_tee_bin('tee.bad2', 0, b'extra data')
+        with self.assertRaises(ValueError) as exc:
+            self.checkFitTee('264_tee_os_opt_fit.dts', 'tee.bad2')
+        self.assertIn(
+            "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)",
+            str(exc.exception))
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/263_tee_os_opt.dts new file +22 -0
new file mode 100644
index 00000000000..2e4ec24ac2c
@@ -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 {
+             };
+     };
+};
tools/binman/test/264_tee_os_opt_fit.dts new file +33 -0
new file mode 100644
index 00000000000..ae44b433edf
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+                             };
+                     };
+             };
+     };
+};
tools/binman/test/265_tee_os_opt_fit_bad.dts new file +40 -0
new file mode 100644
index 00000000000..7fa363cc199
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+     #address-cells = <1>;
+     #size-cells = <1>;
+
+     binman {
+             fit {
+                     description = "test-desc";
+                     #address-cells = <1>;
+                     fit,fdt-list = "of-list";
+
+                     images {
+                             @tee-SEQ {
+                                     fit,operation = "split-elf";
+                                     description = "TEE";
+                                     type = "tee";
+                                     arch = "arm64";
+                                     os = "tee";
+                                     compression = "none";
+                                     fit,load;
+                                     fit,entry;
+                                     fit,data;
+
+                                     tee-os {
+                                     };
+
+                                     /*
+                                      * mess up the ELF data by adding
+                                      * another bit of data at the end
+                                      */
+                                     u-boot {
+                                     };
+                             };
+                     };
+             };
+     };
+};
#13 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Hi Jerome,

Quoted 27 lines · Jerome Forissier
Quoted 23 lines · Simon Glass

(dropping the two bounces from cc)

Quoted 20 lines · Simon Glass

Hi Jerome,

Quoted 15 lines · Jerome Forissier
Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

...I get:

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

OK, this is expected. It means that the contents are not provided. I will add some more comments.

We can refine this later, but we are a year into this conversion of rk3399 to binman and I really want to land this right away before I lose interest and it sits here for another year.

Do you have an influence on OP-TEE? I think the way they are adding a header here is a really back idea. We should look at packaging these blobs in a FIT complete with all the metadata that is needed, with a standard schema.

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

More complete log at https://pastebin.com/UZzZeicQ

Thanks.

Is this file in the v1 binary format (with the custom header),

Yes

Quoted 4 lines
Quoted 4 lines

or is
is a plain binary file? At present only the former is supported, as I thought that it can only be the elf or the v1 binary format these days?

Quoted 8 lines

Correct

Quoted 1 line
Quoted 1 line

Actually can you please send me the tee.bin ?

Sure, here you go: https://ufile.io/f/ex5oy

I have added bl31.elf too, although I suppose it is handled properly being an ELF file.

It seems to work for me.

[..]

Regards,
Simon

#14 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Quoted 38 lines · Simon Glass

Hi Jerome,

Quoted 34 lines · Jerome Forissier
Quoted 30 lines · Simon Glass

(dropping the two bounces from cc)

Quoted 27 lines · Simon Glass

Hi Jerome,

Quoted 22 lines · Jerome Forissier
Quoted 8 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

So, with:

BL31=/path/to/bl31.elf TEE=/path/to/tee.bin make -C u-boot \
CROSS_COMPILE=aarch64-linux-gnu- CC=aarch64-linux-gnu-gcc \
HOSTCC=gcc BINMAN_DEBUG=1 BINMAN_VERBOSE=4

...I get:

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Entry '/binman/simple-bin/fit/images/@tee-SEQ/tee-os' marked absent: uses v1 format which must be in a FIT

OK, this is expected. It means that the contents are not provided. I will add some more comments.

We can refine this later, but we are a year into this conversion of rk3399 to binman and I really want to land this right away before I lose interest and it sits here for another year.

I commented that in my other reply. That would break my use case.

Quoted 1 line

Do you have an influence on OP-TEE?

I am one of the core maintainers ;)

Quoted 4 lines

I think the way they are adding a
header here is a really back idea. We should look at packaging these blobs in a FIT complete with all the metadata that is needed, with a standard schema.

Isn't that what this patch series is trying to accomplish? Using a different tool (binman instead of a custom python script) to package a blob into a FIT? As I said in my other reply, tee.bin is the output of the OP-TEE build, it has to be loaded in memory at a specific address, that you can discover be reading the binary itself -- no need for metadata... How infrequent is such a use case for a bootloader? to deal with? :O

Thanks,

Signature · 1 line
Jerome
Quoted 29 lines
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

More complete log at https://pastebin.com/UZzZeicQ

Thanks.

Is this file in the v1 binary format (with the custom header),

Yes

Quoted 4 lines
Quoted 4 lines

or is
is a plain binary file? At present only the former is supported, as I thought that it can only be the elf or the v1 binary format these days?

Quoted 8 lines

Correct

Quoted 1 line
Quoted 1 line

Actually can you please send me the tee.bin ?

Sure, here you go: https://ufile.io/f/ex5oy

I have added bl31.elf too, although I suppose it is handled properly being an ELF file.

It seems to work for me.

[..]

Regards,
Simon

#15 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

In reply to Simon Glass

Hi Simon,

Quoted 45 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

  tools/binman/entries.rst                     | 35 ++++++++-
  tools/binman/entry.py                        | 13 +++
  tools/binman/etype/fit.py                    | 69 +++++++++-------
  tools/binman/etype/section.py                |  9 +++
  tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
  tools/binman/ftest.py                        | 83 ++++++++++++++++++++
  tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
  tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
  tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
  9 files changed, 340 insertions(+), 32 deletions(-)

create mode 100644 tools/binman/test/263_tee_os_opt.dts create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts

tools/binman/entries.rst +1 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
  Properties / Entry arguments:
      - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1522

Quoted 10 lines
tools/binman/entries.rst +6 -0
  This entry holds the run-time firmware, typically started by U-Boot SPL.
  See the U-Boot README for your architecture or board for how to use it. See
  https://urldefense.com/v3/__https://github.com/OP-TEE/optee_os__;!!OOPJP91ZZw!kx6SLv4sPusmg1TyYMw-Ho5G9jxeVMf9HOYx_4yq3ZNl_TpoGJoUyICZMgEiv0Zd6l_Bl8f5OAFYyJxm8wDUevhARIs$  for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry

s/anb/an/

Quoted 4 lines
tools/binman/entries.rst +4 -0
+like this::
+
+    binman {
+        tee-os {

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1536

Quoted 10 lines
tools/binman/entries.rst +10 -0
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
+     header
+   - drop it otherwise
+

Is there an actual usecase for this? (sorry if this was mentioned in the earlier versions of the patch) Are we expecting to be able to append the content of tee-os to some raw binary instead of putting OP-TEE OS in a u-boot.itb image?

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1547

Quoted 11 lines
tools/binman/entries.rst +11 -0
+When used within a FIT, we can do::
+
+    binman {
+        fit {
+            tee-os {
+            };
+        };
+    };
+
+which will split the ELF into separate nodes for each segment, if an ELF
+file is provide (see Flat Image Tree / FIT), or produce a single node if

s/provide/provided/

You can use a reference here since we have a _etype_fit target for "Flat Image Tree / FIT".

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1550

Quoted 3 lines
tools/binman/entries.rst +2 -0
+the binary v1 format is provided.
+
 

I'm a bit worried this is OP-TEE OS specific? We could also point to the documentation here: https://optee.readthedocs.io/en/latest/architecture/core.html#partitioning-of-the-binary?

Quoted 13 lines
tools/binman/entries.rst +0 -0
  .. _etype_text:
tools/binman/entry.py +3 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
      def mark_absent(self, msg):
          tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
          self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file

tools/binman/entry.py features to produce new behaviours. · line 1305

Quoted 10 lines
tools/binman/entry.py +10 -0
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None

Does it really make sense to have this function available to all Entry objects?

Quoted 9 lines
tools/binman/etype/fit.py +0 -1
index 8ad4f3a8a83..21c769a1cbe 100644
@@ -540,41 +540,34 @@ class Entry_fit(Entry_section):
                      else:
                          self.Raise("Generator node requires 'fit,fdt-list' property")
 
-        def _gen_split_elf(base_node, node, elf_data, missing):

tools/binman/etype/fit.py class Entry_fit(Entry_section): · line 550

Quoted 10 lines
tools/binman/etype/fit.py +2 -2
+        def _gen_split_elf(base_node, node, segments, entry_addr):
              """Add nodes for the ELF file, one per group of contiguous segments
 
              Args:
                  base_node (Node): Template node from the binman definition
                  node (Node): Node to replace (in the FIT being built)
-                data (bytes): ELF-format data to process (may be empty)
-                missing (bool): True if any of the data is missing
 
+                segments, entry_addr

Please document.

Quoted 49 lines
tools/binman/etype/fit.py +19 -25
+
+                data (bytes): ELF-format data to process (may be empty)
              """
-            # If any pieces are missing, skip this. The missing entries will
-            # show an error
-            if not missing:
-                try:
-                    segments, entry = elf.read_loadable_segments(elf_data)
-                except ValueError as exc:
-                    self._raise_subnode(node,
-                                        f'Failed to read ELF file: {str(exc)}')
-                for (seq, start, data) in segments:
-                    node_name = node.name[1:].replace('SEQ', str(seq + 1))
-                    with fsw.add_node(node_name):
-                        loadables.append(node_name)
-                        for pname, prop in node.props.items():
-                            if not pname.startswith('fit,'):
-                                fsw.property(pname, prop.bytes)
-                            elif pname == 'fit,load':
-                                fsw.property_u32('load', start)
-                            elif pname == 'fit,entry':
-                                if seq == 0:
-                                    fsw.property_u32('entry', entry)
-                            elif pname == 'fit,data':
-                                fsw.property('data', bytes(data))
-                            elif pname != 'fit,operation':
-                                self._raise_subnode(
-                                    node, f"Unknown directive '{pname}'")
+            for (seq, start, data) in segments:
+                node_name = node.name[1:].replace('SEQ', str(seq + 1))
+                with fsw.add_node(node_name):
+                    loadables.append(node_name)
+                    for pname, prop in node.props.items():
+                        if not pname.startswith('fit,'):
+                            fsw.property(pname, prop.bytes)
+                        elif pname == 'fit,load':
+                            fsw.property_u32('load', start)
+                        elif pname == 'fit,entry':
+                            if seq == 0:
+                                fsw.property_u32('entry', entry_addr)
+                        elif pname == 'fit,data':
+                            fsw.property('data', bytes(data))
+                        elif pname != 'fit,operation':
+                            self._raise_subnode(
+                                node, f"Unknown directive '{pname}'")
 
          def _gen_node(base_node, node, depth, in_images, entry):
              """Generate nodes from a template

tools/binman/etype/fit.py class Entry_fit(Entry_section): · line 594

Quoted 4 lines
tools/binman/etype/fit.py +1 -0
@@ -598,6 +591,8 @@ class Entry_fit(Entry_section):
                  depth (int): Current node depth (0 is the base 'fit' node)
                  in_images (bool): True if this is inside the 'images' node, so
                      that 'data' properties should be generated
+                entry (entry_Section): Entry for the second containing the

s/second/section/ ?

Quoted 80 lines
tools/binman/etype/fit.py +17 -2
+                    contents of this node
              """
              oper = self._get_operation(base_node, node)
              if oper == OP_GEN_FDT_NODES:
@@ -609,10 +604,24 @@ class Entry_fit(Entry_section):
                  missing_list = []
                  entry.ObtainContents()
                  entry.Pack(0)
-                data = entry.GetData()
                  entry.CheckMissing(missing_list)
 
-                _gen_split_elf(base_node, node, data, bool(missing_list))
+                # If any pieces are missing, skip this. The missing entries will
+                # show an error
+                if not missing_list:
+                    segs = entry.read_elf_segments()
+                    if segs:
+                        segments, entry_addr = segs
+                    else:
+                        elf_data = entry.GetData()
+                        try:
+                            segments, entry_addr = (
+                                    elf.read_loadable_segments(elf_data))
+                        except ValueError as exc:
+                            self._raise_subnode(
+                                node, f'Failed to read ELF file: {str(exc)}')
+
+                    _gen_split_elf(base_node, node, segments, entry_addr)
 
          def _add_node(base_node, depth, node):
              """Add nodes to the output FIT
tools/binman/etype/section.py +9 -0
index dcb7a062047..57bfee0b286 100644
@@ -948,3 +948,12 @@ class Entry_section(Entry):
          super().AddBintools(btools)
          for entry in self._entries.values():
              entry.AddBintools(btools)
+
+    def read_elf_segments(self):
+        entries = self.GetEntries()
+
+        # If the section only has one entry, see if it can provide ELF segments
+        if len(entries) == 1:
+            for entry in entries.values():
+                return entry.read_elf_segments()
+        return None
tools/binman/etype/tee_os.py +12 -1
index 6ce4b672de4..687acd4689f 100644
@@ -4,19 +4,85 @@
  # Entry-type module for OP-TEE Trusted OS firmware blob
  #
 
+import struct
+
  from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+from binman import elf
 
  class Entry_tee_os(Entry_blob_named_by_arg):
      """Entry containing an OP-TEE Trusted OS (TEE) blob
 
      Properties / Entry arguments:
          - tee-os-path: Filename of file to read into entry. This is typically
-            called tee-pager.bin
+            called tee.bin or tee.elf
 
      This entry holds the run-time firmware, typically started by U-Boot SPL.
      See the U-Boot README for your architecture or board for how to use it. See
      https://urldefense.com/v3/__https://github.com/OP-TEE/optee_os__;!!OOPJP91ZZw!kx6SLv4sPusmg1TyYMw-Ho5G9jxeVMf9HOYx_4yq3ZNl_TpoGJoUyICZMgEiv0Zd6l_Bl8f5OAFYyJxm8wDUevhARIs$  for more information about OP-TEE.
+
+    Note that if the file is in ELF format, it must go in a FIT. In that case,
+    this entry will mark itself as absent, providing the data only through the
+    read_elf_segments() method.
+
+    Marking this entry as absent means that it if is used in the wrong context
+    it can be automatically dropped. Thus it is possible to add anb OP-TEE entry
+    like this::

tools/binman/etype/tee_os.py line 39

Quoted 10 lines
tools/binman/etype/tee_os.py +10 -0
+
+        binman {
+            tee-os {
+            };
+        };
+
+    and pass either an ELF or plain binary in with -a tee-os-path <filename>
+    and have binman do the right thing:
+
+       - include the entry if tee.bin is provided and it doesn't have the v1

"does NOT" ??

Quoted 12 lines
tools/binman/etype/tee_os.py +12 -0
+         header
+       - drop it otherwise
+
+    When used within a FIT, we can do::
+
+        binman {
+            fit {
+                tee-os {
+                };
+            };
+        };
+

tools/binman/etype/tee_os.py line 61

Quoted 10 lines
tools/binman/etype/tee_os.py +6 -0
+    which will split the ELF into separate nodes for each segment, if an ELF
+    file is provide (see Flat Image Tree / FIT), or produce a single node if
+    the binary v1 format is provided.
      """
      def __init__(self, section, etype, node):
          super().__init__(section, etype, node, 'tee-os')
          self.external = True
+
+    @staticmethod
+    def is_optee_bin(data):

Here you are checking it's a binary with v1 header, so please explicit in the function name. (there's already a v2 header available FWIW).

tools/binman/etype/tee_os.py line 65

Quoted 4 lines
tools/binman/etype/tee_os.py +4 -0
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)

Do not silence the return code of the parent class here? I know it's only returning True ATM but nothing guarantees it'll stay this way.

tools/binman/etype/tee_os.py line 70

Quoted 5 lines
tools/binman/etype/tee_os.py +5 -0
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')

What should this support then if neither ELF not binary with v1 header are supported? I don't see support for binary with v2 header anywhere so I'm quite confused by what this piece of code is supposed to handle?

I'm also very much against displaying a warning if the user has TEE set in their environment and the file exists but it won't be used in the final image. If it's not compatible based on the binman DT node, error out. If it's the wrong file or it's missing, error out. Is there some scenario where displaying a warning (and/or removing the entry with mark_absent like you did here) make sense?

In any case, thanks Simon and Jerome for looking into this, it's a bigger task than I had anticipated but am looking forward to this Rockchip-specific behavior to be dropped from mainline :)

Cheers,
Quentin

#16 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Hi Quentin,

Quoted 73 lines · Quentin Schulz

Hi Simon,

Quoted 45 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

  tools/binman/entries.rst                     | 35 ++++++++-
  tools/binman/entry.py                        | 13 +++
  tools/binman/etype/fit.py                    | 69 +++++++++-------
  tools/binman/etype/section.py                |  9 +++
  tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
  tools/binman/ftest.py                        | 83 ++++++++++++++++++++
  tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
  tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
  tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
  9 files changed, 340 insertions(+), 32 deletions(-)

create mode 100644 tools/binman/test/263_tee_os_opt.dts create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts

tools/binman/entries.rst +1 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
  Properties / Entry arguments:
      - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1522

Quoted 10 lines
tools/binman/entries.rst +6 -0
  This entry holds the run-time firmware, typically started by U-Boot SPL.
  See the U-Boot README for your architecture or board for how to use it. See
  https://urldefense.com/v3/__https://github.com/OP-TEE/optee_os__;!!OOPJP91ZZw!kx6SLv4sPusmg1TyYMw-Ho5G9jxeVMf9HOYx_4yq3ZNl_TpoGJoUyICZMgEiv0Zd6l_Bl8f5OAFYyJxm8wDUevhARIs$  for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry

s/anb/an/

Quoted 11 lines
tools/binman/entries.rst +11 -0
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
Quoted 8 lines

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1536

Quoted 3 lines
tools/binman/entries.rst +3 -0
+     header
+   - drop it otherwise
+

Is there an actual usecase for this? (sorry if this was mentioned in the earlier versions of the patch) Are we expecting to be able to append the content of tee-os to some raw binary instead of putting OP-TEE OS in a u-boot.itb image?

Yes, that is my understanding. Perhaps it is for some archs or some old versions. But in any case, we can always drop it later if not needed, refine the warnings, etc. etc. But please let's land this mess and move on. If I had pushed a little harder a year ago we would have be talking about how to do this properly in binman rather than me trying to retrofit everything.

[..]

Quoted 11 lines

You can use a reference here since we have a _etype_fit target for "Flat Image Tree / FIT".

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1550

Quoted 3 lines
tools/binman/entries.rst +2 -0
+the binary v1 format is provided.
+
 

I'm a bit worried this is OP-TEE OS specific? We could also point to the documentation here:
https://optee.readthedocs.io/en/latest/architecture/core.html#partitioning-of-the-binary?

Yes it is...I believe there will be other use cases for absent entries....in a way it is quite a big hold in binman's functionality. Will link to the docs.

Quoted 19 lines
Quoted 19 lines
tools/binman/entries.rst +0 -0
  .. _etype_text:
tools/binman/entry.py +8 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
      def mark_absent(self, msg):
          tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
          self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
Quoted 8 lines

tools/binman/entry.py features to produce new behaviours. · line 1305

Quoted 5 lines
tools/binman/entry.py +5 -0
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None

Does it really make sense to have this function available to all Entry objects?

Yes we must define functions in the base class to avoid confusion. Also it does actually get called from the FIT implementation, to see if this function can provide the segments...failing that it tries to parse an ELF blob.

[..]

Quoted 5 lines

tools/binman/entry.py

Quoted 2 lines
tools/binman/entry.py +2 -0
+    @staticmethod
+    def is_optee_bin(data):

Here you are checking it's a binary with v1 header, so please explicit in the function name. (there's already a v2 header available FWIW).

OMG

Quoted 19 lines

tools/binman/entry.py

Quoted 5 lines
tools/binman/entry.py +4 -0
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)

Do not silence the return code of the parent class here? I know it's only returning True ATM but nothing guarantees it'll stay this way.

tools/binman/entry.py

Quoted 5 lines
tools/binman/entry.py +5 -0
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')

What should this support then if neither ELF not binary with v1 header are supported? I don't see support for binary with v2 header anywhere so I'm quite confused by what this piece of code is supposed to handle?

Quoted 6 lines

I'm also very much against displaying a warning if the user has TEE set in their environment and the file exists but it won't be used in the final image. If it's not compatible based on the binman DT node, error out. If it's the wrong file or it's missing, error out. Is there some scenario where displaying a warning (and/or removing the entry with mark_absent like you did here) make sense?

We need to deal with this later, sorry. I have come to the end of the time I can bear to spend dealing with the strangeness of OP-TEE. If you are able to tidy this up after it lands, or have ideas on how to do better, please let me know.

Quoted 4 lines

In any case, thanks Simon and Jerome for looking into this, it's a bigger task than I had anticipated but am looking forward to this Rockchip-specific behavior to be dropped from mainline :)

Thanks. This has been beyond painful. We have to stop all these scripts and strange workflows...it is making firmware impossible to understand.

Regards,
Simon

#17 lore raw

Re: [PATCH v8 06/13] binman: Support new op-tee binary format

Quoted 180 lines · Simon Glass

Hi Quentin,

Quoted 73 lines · Quentin Schulz

Hi Simon,

Quoted 45 lines · Simon Glass

OP-TEE has a format with a binary header that can be used instead of the ELF file. With newer versions of OP-TEE this may be required on some platforms.

Add support for this in binman. First, add a method to obtain the ELF sections from an entry, then use that in the FIT support. We then end up with the ability to support both types of OP-TEE files, depending on which one is passed in with the entry argument (TEE=xxx in the U-Boot build).

---

(no changes since v7)

Changes in v7:
- Correct missing test coverage

Changes in v6:
- Update op-tee to support new v1 binary header

  tools/binman/entries.rst                     | 35 ++++++++-
  tools/binman/entry.py                        | 13 +++
  tools/binman/etype/fit.py                    | 69 +++++++++-------
  tools/binman/etype/section.py                |  9 +++
  tools/binman/etype/tee_os.py                 | 68 +++++++++++++++-
  tools/binman/ftest.py                        | 83 ++++++++++++++++++++
  tools/binman/test/263_tee_os_opt.dts         | 22 ++++++
  tools/binman/test/264_tee_os_opt_fit.dts     | 33 ++++++++
  tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 ++++++++++
  9 files changed, 340 insertions(+), 32 deletions(-)

create mode 100644 tools/binman/test/263_tee_os_opt.dts create mode 100644 tools/binman/test/264_tee_os_opt_fit.dts create mode 100644 tools/binman/test/265_tee_os_opt_fit_bad.dts

tools/binman/entries.rst +1 -1
index b2ce7960d3b..a3e4493a44f 100644
@@ -1508,12 +1508,45 @@ Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob
 
  Properties / Entry arguments:
      - tee-os-path: Filename of file to read into entry. This is typically
-        called tee-pager.bin
+        called tee.bin or tee.elf
 

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1522

Quoted 10 lines
tools/binman/entries.rst +6 -0
  This entry holds the run-time firmware, typically started by U-Boot SPL.
  See the U-Boot README for your architecture or board for how to use it. See
  https://urldefense.com/v3/__https://github.com/OP-TEE/optee_os__;!!OOPJP91ZZw!kx6SLv4sPusmg1TyYMw-Ho5G9jxeVMf9HOYx_4yq3ZNl_TpoGJoUyICZMgEiv0Zd6l_Bl8f5OAFYyJxm8wDUevhARIs$  for more information about OP-TEE.
 
+Note that if the file is in ELF format, it must go in a FIT. In that case,
+this entry will mark itself as absent, providing the data only through the
+read_elf_segments() method.
+
+Marking this entry as absent means that it if is used in the wrong context
+it can be automatically dropped. Thus it is possible to add anb OP-TEE entry

s/anb/an/

Quoted 11 lines
tools/binman/entries.rst +11 -0
+like this::
+
+    binman {
+        tee-os {
+        };
+    };
+
+and pass either an ELF or plain binary in with -a tee-os-path <filename>
+and have binman do the right thing:
+
+   - include the entry if tee.bin is provided and it doesn't have the v1
Quoted 8 lines

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1536

Quoted 3 lines
tools/binman/entries.rst +3 -0
+     header
+   - drop it otherwise
+

Is there an actual usecase for this? (sorry if this was mentioned in the earlier versions of the patch) Are we expecting to be able to append the content of tee-os to some raw binary instead of putting OP-TEE OS in a u-boot.itb image?

Yes, that is my understanding. Perhaps it is for some archs or some old versions. But in any case, we can always drop it later if not needed, refine the warnings, etc. etc. But please let's land this mess and move on. If I had pushed a little harder a year ago we would have be talking about how to do this properly in binman rather than me trying to retrofit everything.

[..]

Quoted 11 lines

You can use a reference here since we have a _etype_fit target for "Flat Image Tree / FIT".

tools/binman/entries.rst Entry: tee-os: Entry containing an OP-TEE Trusted OS (TEE) blob · line 1550

Quoted 3 lines
tools/binman/entries.rst +2 -0
+the binary v1 format is provided.
+
 

I'm a bit worried this is OP-TEE OS specific? We could also point to the documentation here:
https://optee.readthedocs.io/en/latest/architecture/core.html#partitioning-of-the-binary?

Yes it is...I believe there will be other use cases for absent entries....in a way it is quite a big hold in binman's functionality. Will link to the docs.

Quoted 19 lines
Quoted 19 lines
tools/binman/entries.rst +0 -0
  .. _etype_text:
tools/binman/entry.py +8 -0
index 637aece3705..de51d295891 100644
@@ -1290,3 +1290,16 @@ features to produce new behaviours.
      def mark_absent(self, msg):
          tout.info("Entry '%s' marked absent: %s" % (self._node.path, msg))
          self.absent = True
+
+    def read_elf_segments(self):
+        """Read segments from an entry that can generate an ELF file
+
+        Returns:
+            tuple:
+                list of segments, each:
+                    int: Segment number (0 = first)
Quoted 8 lines

tools/binman/entry.py features to produce new behaviours. · line 1305

Quoted 5 lines
tools/binman/entry.py +5 -0
+                    int: Start address of segment in memory
+                    bytes: Contents of segment
+                int: entry address of ELF file
+        """
+        return None

Does it really make sense to have this function available to all Entry objects?

Yes we must define functions in the base class to avoid confusion. Also it does actually get called from the FIT implementation, to see if this function can provide the segments...failing that it tries to parse an ELF blob.

[..]

Quoted 5 lines

tools/binman/entry.py

Quoted 2 lines
tools/binman/entry.py +2 -0
+    @staticmethod
+    def is_optee_bin(data):

Here you are checking it's a binary with v1 header, so please explicit in the function name. (there's already a v2 header available FWIW).

OMG

Quoted 19 lines

tools/binman/entry.py

Quoted 5 lines
tools/binman/entry.py +4 -0
+        return len(data) >= 8 and data[0:5] == b'OPTE\x01'
+
+    def ObtainContents(self, fake_size=0):
+        super().ObtainContents(fake_size)

Do not silence the return code of the parent class here? I know it's only returning True ATM but nothing guarantees it'll stay this way.

tools/binman/entry.py

Quoted 5 lines
tools/binman/entry.py +5 -0
+        if not self.missing:
+            if elf.is_valid(self.data):
+                self.mark_absent('uses Elf format which must be in a FIT')
+            elif self.is_optee_bin(self.data):
+                self.mark_absent('uses v1 format which must be in a FIT')

What should this support then if neither ELF not binary with v1 header are supported? I don't see support for binary with v2 header anywhere so I'm quite confused by what this piece of code is supposed to handle?

Quoted 6 lines

I'm also very much against displaying a warning if the user has TEE set in their environment and the file exists but it won't be used in the final image. If it's not compatible based on the binman DT node, error out. If it's the wrong file or it's missing, error out. Is there some scenario where displaying a warning (and/or removing the entry with mark_absent like you did here) make sense?

Quoted 4 lines

We need to deal with this later, sorry. I have come to the end of the time I can bear to spend dealing with the strangeness of OP-TEE. If you are able to tidy this up after it lands, or have ideas on how to do better, please let me know.

There is nothing strange in OP-TEE. There is a tee.bin file, it needs to be loaded into memory at a specific address that you can find by reading a header (yes those things exist in OS binaries, which are not all pure ELF files). As shown in make_atf_fit.py, it takes only a couple of lines of Python to get this address.

Since you are calling OP-TEE strange let me say I don't understand a thing about all the U-Boot specific tooling that you are putting in place (this whole binman thing in particular), so as a newbie in this project I should probably be allowed to call that weird, too ;-) But that's not the point.

The point is, with the current patch set I can't build a working FIT image for RockPi4 that includes OP-TEE. Note I have not tried v9 but I see nothing significant changed regarding the handling of tee.bin (please correct me if I'm wrong). Therefore merging this patch set in its current state would clearly be a regression and prevent us from upgrading U-Boot in the projects I'm working on...

Quoted 7 lines
Quoted 3 lines

In any case, thanks Simon and Jerome for looking into this, it's a bigger task than I had anticipated but am looking forward to this Rockchip-specific behavior to be dropped from mainline :)

Thanks. This has been beyond painful. We have to stop all these scripts and strange workflows...it is making firmware impossible to understand.

Refactoring is certainly good from time to time. But you have to make sure the feature set is the same, and ideally the usage is unchanged (or only marginally). Otherwise you're transferring the pain to your users...

Thanks,

Signature · 1 line
Jerome
Quoted 3 lines

Regards,
Simon

#18 lore raw

PATCH v8 7/13 binman: Support optional external blobs

In reply to Simon Glass

Some blobs are actually not necessary for the board to work correctly. Add a property to allow this to be indicated. Missing optional blobs do not cause a build failure.

---

Changes in v8:
- Move support for optional external blobs into this series
- Support optional FIT images

 tools/binman/binman.rst                |  9 +++++++++
 tools/binman/control.py                | 11 +++++++++++
 tools/binman/entry.py                  | 25 +++++++++++++++++++++----
 tools/binman/etype/blob.py             |  2 +-
 tools/binman/etype/fit.py              | 11 ++++++-----
 tools/binman/etype/section.py          | 14 +++++++++++++-
 tools/binman/ftest.py                  | 10 ++++++++++
 tools/binman/test/266_blob_ext_opt.dts | 21 +++++++++++++++++++++
 8 files changed, 92 insertions(+), 11 deletions(-)
 create mode 100644 tools/binman/test/266_blob_ext_opt.dts
tools/binman/binman.rst +9 -0
index 1ab6d012b83..391494907ab 100644
@@ -689,6 +689,15 @@ no-expanded:
     `no-expanded` property disables this just for a single entry. Put the
     `no-expanded` boolean property in the node to select this behaviour.
 
+optional:
+    External blobs are normally required to be present for the image to be
+    built (but see `External blobs`_). This properly allows an entry to be
+    optional, so that when it is cannot be found, this problem is ignored and
+    an empty file is used for this blob. This should be used only when the blob
+    is entirely optional and is not needed for correct operation of the image.
+    Note that missing, optional blobs do not produce a non-zero exit code from
+    binman, although it does show a warning about the missing external blob.
+
 The attributes supported for images and sections are described below. Several
 are similar to those for entries.
 
tools/binman/control.py +11 -0
index 07225381146..e64740094f6 100644
@@ -594,12 +594,14 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
     image.BuildImage()
     if write_map:
         image.WriteMap()
+
     missing_list = []
     image.CheckMissing(missing_list)
     if missing_list:
         tout.warning("Image '%s' is missing external blobs and is non-functional: %s" %
                      (image.name, ' '.join([e.name for e in missing_list])))
         _ShowHelpForMissingBlobs(missing_list)
+
     faked_list = []
     image.CheckFakedBlobs(faked_list)
     if faked_list:
@@ -607,6 +609,15 @@ def ProcessImage(image, update_fdt, write_map, get_contents=True,
             "Image '%s' has faked external blobs and is non-functional: %s" %
             (image.name, ' '.join([os.path.basename(e.GetDefaultFilename())
                                    for e in faked_list])))
+
+    optional_list = []
+    image.CheckOptional(optional_list)
+    if optional_list:
+        tout.warning(
+            "Image '%s' is missing external blobs but is still functional: %s" %
+            (image.name, ' '.join([e.name for e in optional_list])))
+        _ShowHelpForMissingBlobs(optional_list)
+
     missing_bintool_list = []
     image.check_missing_bintools(missing_bintool_list)
     if missing_bintool_list:
tools/binman/entry.py +21 -4
index de51d295891..d73f3013405 100644
@@ -73,7 +73,9 @@ class Entry(object):
         compress: Compression algoithm used (e.g. 'lz4'), 'none' if none
         orig_offset: Original offset value read from node
         orig_size: Original size value read from node
-        missing: True if this entry is missing its contents
+        missing: True if this entry is missing its contents. Note that if it is
+            optional, this entry will not appear in the list generated by
+            entry.CheckMissing() since it is considered OK for it to be missing.
         allow_missing: Allow children of this entry to be missing (used by
             subclasses such as Entry_section)
         allow_fake: Allow creating a dummy fake file if the blob file is not
@@ -95,6 +97,7 @@ class Entry(object):
             the entry itself, allowing it to vanish in certain circumstances.
             An absent entry is removed during processing so that it does not
             appear in the map
+        optional (bool): True if this entry contains an optional external blob
     """
     fake_dir = None
 
@@ -138,6 +141,7 @@ class Entry(object):
         self.elf_fname = None
         self.auto_write_symbols = auto_write_symbols
         self.absent = False
+        self.optional = False
 
     @staticmethod
     def FindEntryClass(etype, expanded):
@@ -289,6 +293,7 @@ class Entry(object):
         self.offset_unset = fdt_util.GetBool(self._node, 'offset-unset')
         self.extend_size = fdt_util.GetBool(self._node, 'extend-size')
         self.missing_msg = fdt_util.GetString(self._node, 'missing-msg')
+        self.optional = fdt_util.GetBool(self._node, 'optional')
 
         # This is only supported by blobs and sections at present
         self.compress = fdt_util.GetString(self._node, 'compress', 'none')
@@ -1039,14 +1044,15 @@ features to produce new behaviours.
         self.allow_fake = allow_fake
 
     def CheckMissing(self, missing_list):
-        """Check if any entries in this section have missing external blobs
+        """Check if the entry has missing external blobs
 
-        If there are missing blobs, the entries are added to the list
+        If there are missing (non-optional) blobs, the entries are added to the
+        list
 
         Args:
             missing_list: List of Entry objects to be added to
         """
-        if self.missing:
+        if self.missing and not self.optional:
             missing_list.append(self)
 
     def check_fake_fname(self, fname, size=0):
@@ -1085,6 +1091,17 @@ features to produce new behaviours.
         # This is meaningless for anything other than blobs
         pass
 
+    def CheckOptional(self, optional_list):
+        """Check if the entry has missing but optional external blobs
+
+        If there are missing (optional) blobs, the entries are added to the list
+
+        Args:
+            optional_list (list): List of Entry objects to be added to
+        """
+        if self.missing and self.optional:
+            optional_list.append(self)
+
     def GetAllowMissing(self):
         """Get whether a section allows missing external blobs
 
tools/binman/etype/blob.py +1 -1
index a50a8068901..70dea7158ee 100644
@@ -39,7 +39,7 @@ class Entry_blob(Entry):
     def ObtainContents(self, fake_size=0):
         self._filename = self.GetDefaultFilename()
         self._pathname = tools.get_input_filename(self._filename,
-            self.external and self.section.GetAllowMissing())
+            self.external and (self.optional or self.section.GetAllowMissing()))
         # Allow the file to be missing
         if not self._pathname:
             self._pathname, faked = self.check_fake_fname(self._filename,
tools/binman/etype/fit.py +6 -5
index 21c769a1cbe..acd0466be5a 100644
@@ -392,8 +392,8 @@ class Entry_fit(Entry_section):
 
         _add_entries(self._node, 0, self._node)
 
-        # Keep a copy of all entries, including generator entries, since these
-        # removed from self._entries later.
+        # Keep a copy of all entries, including generator entries, since those
+        # are removed from self._entries later.
         self._priv_entries = dict(self._entries)
 
     def BuildSectionData(self, required):
@@ -601,14 +601,15 @@ class Entry_fit(Entry_section):
                 # Entry_section.ObtainContents() either returns True or
                 # raises an exception.
                 data = None
-                missing_list = []
+                missing_opt_list = []
                 entry.ObtainContents()
                 entry.Pack(0)
-                entry.CheckMissing(missing_list)
+                entry.CheckMissing(missing_opt_list)
+                entry.CheckOptional(missing_opt_list)
 
                 # If any pieces are missing, skip this. The missing entries will
                 # show an error
-                if not missing_list:
+                if not missing_opt_list:
                     segs = entry.read_elf_segments()
                     if segs:
                         segments, entry_addr = segs
tools/binman/etype/section.py +13 -1
index 57bfee0b286..44dafaf7262 100644
@@ -863,7 +863,8 @@ class Entry_section(Entry):
     def CheckMissing(self, missing_list):
         """Check if any entries in this section have missing external blobs
 
-        If there are missing blobs, the entries are added to the list
+        If there are missing (non-optional) blobs, the entries are added to the
+        list
 
         Args:
             missing_list: List of Entry objects to be added to
@@ -882,6 +883,17 @@ class Entry_section(Entry):
         for entry in self._entries.values():
             entry.CheckFakedBlobs(faked_blobs_list)
 
+    def CheckOptional(self, optional_list):
+        """Check the section for missing but optional external blobs
+
+        If there are missing (optional) blobs, the entries are added to the list
+
+        Args:
+            optional_list (list): List of Entry objects to be added to
+        """
+        for entry in self._entries.values():
+            entry.CheckOptional(optional_list)
+
     def check_missing_bintools(self, missing_list):
         """Check if any entries in this section have missing bintools
 
tools/binman/ftest.py +10 -0
index f893050e706..330e8e1ccb4 100644
@@ -6178,6 +6178,16 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
             "Node '/binman/fit/images/@tee-SEQ/tee-os': Invalid OP-TEE file: size mismatch (expected 0x4, have 0xe)",
             str(exc.exception))
 
+    def testExtblobOptional(self):
+        """Test an image with an external blob that is optional"""
+        with test_util.capture_sys_output() as (stdout, stderr):
+            data = self._DoReadFile('266_blob_ext_opt.dts')
+        self.assertEqual(REFCODE_DATA, data)
+        err = stderr.getvalue()
+        self.assertRegex(
+            err,
+            "Image '.*' is missing external blobs but is still functional: missing")
+
 
 if __name__ == "__main__":
     unittest.main()
tools/binman/test/266_blob_ext_opt.dts new file +21 -0
new file mode 100644
index 00000000000..717153152ce
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		ok {
+			type = "blob-ext";
+			filename = "refcode.bin";
+		};
+
+		missing {
+			type = "blob-ext";
+			filename = "missing.bin";
+			optional;
+		};
+	};
+};
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#19 lore raw

PATCH v8 8/13 rockchip: evb-rk3288: Drop raw-image support

In reply to Simon Glass

This boards uses SPL_FIT so does not need to support loading a raw image. Drop it to avoid binman trying to insert a symbol which has no value.

---

(no changes since v1)

 configs/evb-rk3288_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/evb-rk3288_defconfig +1 -0
index 8f8d34c7038..6d3bb5a2944 100644
@@ -29,6 +29,7 @@ CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_NO_BSS_LIMIT=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK=0xff718000
 CONFIG_SPL_STACK_R=y
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#20 lore raw

PATCH v8 9/13 rockchip: Use multiple-images for rk3399

In reply to Simon Glass

Enable multiple-images so we can generate more than one image. Also add a comment for the end of the #if block.

---

(no changes since v5)

Changes in v5:
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)

 arch/arm/dts/rk3399-u-boot.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +2 -1
index 3c1a15fe51b..85a4f472d5d 100644
@@ -62,6 +62,7 @@
 
 #if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
 &binman {
+	multiple-images;
 	rom {
 		filename = "u-boot.rom";
 		size = <0x400000>;
@@ -82,7 +83,7 @@
 		};
 	};
 };
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
 
 &cru {
 	u-boot,dm-pre-reloc;
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#21 lore raw

Re: [PATCH v8 09/13] rockchip: Use multiple-images for rk3399

Hi Simon,

Quoted 31 lines · Simon Glass

Enable multiple-images so we can generate more than one image. Also add a comment for the end of the #if block.

---

(no changes since v5)

Changes in v5:
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)

  arch/arm/dts/rk3399-u-boot.dtsi | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51b..85a4f472d5d 100644
@@ -62,6 +62,7 @@
 
  #if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
  &binman {
+	multiple-images;
  	rom {
  		filename = "u-boot.rom";
  		size = <0x400000>;

arch/arm/dts/rk3399-u-boot.dtsi line 86

Quoted 5 lines
arch/arm/dts/rk3399-u-boot.dtsi +1 -1
@@ -82,7 +83,7 @@
  		};
  	};
  };
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */

&& CONFIG_HAS_ROM

On a different topic, I'm a bit confused by this u-boot.rom binary. is it not just for Chromebooks? We now have u-boot-rockchip-spi.bin for SPI images but they are different (same as u-boot-rockchip.bin, just formatted in a way it can be flashed on a SPI flash).

Cheers,
Quentin

#22 lore raw

Re: [PATCH v8 09/13] rockchip: Use multiple-images for rk3399

Hi Quentin,

Quoted 43 lines · Quentin Schulz

Hi Simon,

Quoted 31 lines · Simon Glass

Enable multiple-images so we can generate more than one image. Also add a comment for the end of the #if block.

---

(no changes since v5)

Changes in v5:
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)

  arch/arm/dts/rk3399-u-boot.dtsi | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51b..85a4f472d5d 100644
@@ -62,6 +62,7 @@
 
  #if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
  &binman {
+     multiple-images;
      rom {
              filename = "u-boot.rom";
              size = <0x400000>;

arch/arm/dts/rk3399-u-boot.dtsi line 86

Quoted 5 lines
arch/arm/dts/rk3399-u-boot.dtsi +1 -1
@@ -82,7 +83,7 @@
              };
      };
  };
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */

&& CONFIG_HAS_ROM

Quoted 4 lines

On a different topic, I'm a bit confused by this u-boot.rom binary. is it not just for Chromebooks? We now have u-boot-rockchip-spi.bin for SPI images but they are different (same as u-boot-rockchip.bin, just formatted in a way it can be flashed on a SPI flash).

The .rom is for SPI flash, not just Chromebooks. Perhaps we should unify the two of them?

Regards,
Simon

#23 lore raw

Re: [PATCH v8 09/13] rockchip: Use multiple-images for rk3399

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Quentin,

Quoted 43 lines · Quentin Schulz

Hi Simon,

Quoted 31 lines · Simon Glass

Enable multiple-images so we can generate more than one image. Also add a comment for the end of the #if block.

---

(no changes since v5)

Changes in v5:
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)

   arch/arm/dts/rk3399-u-boot.dtsi | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51b..85a4f472d5d 100644
@@ -62,6 +62,7 @@
 
   #if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
   &binman {
+     multiple-images;
       rom {
               filename = "u-boot.rom";
               size = <0x400000>;

arch/arm/dts/rk3399-u-boot.dtsi line 86

Quoted 5 lines
arch/arm/dts/rk3399-u-boot.dtsi +1 -1
@@ -82,7 +83,7 @@
               };
       };
   };
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */

&& CONFIG_HAS_ROM

Quoted 8 lines
Quoted 4 lines

On a different topic, I'm a bit confused by this u-boot.rom binary. is it not just for Chromebooks? We now have u-boot-rockchip-spi.bin for SPI images but they are different (same as u-boot-rockchip.bin, just formatted in a way it can be flashed on a SPI flash).

The .rom is for SPI flash, not just Chromebooks. Perhaps we should unify the two of them?

I was under the impression that this .rom was mostly used for Chromebooks which is the reason why I didn't change any of it when adding support for u-boot-rockchip-spi.bin back then since the images are different (-spi has the u-boot fit instead of legacy, -spi has support for tpl while .rom only has support for SPL).

I'm all for unifying them if we can find something that does not make the ifdef situation in rockchip-u-boot.dtsi more dire :)

HAS_ROM is enabled on:
TARGET_CHROMEBOOK_JERRY
TARGET_EVB_RK3288
TARGET_CHROMEBOOK_BOB
TARGET_CHROMEBOOK_KEVIN

so this binman entry will only be used for the last two (the first two are handled in arch/arm/dts/rk3288-u-boot.dtsi, but with the same content as in arch/arm/dts/rk3399-u-boot.dtsi). Hence why I thought it was Chromebook related :)

Are there any requirements for those devices that make them require something different than current u-boot-rockchip-spi.bin?

Cheers,
Quentin

#24 lore raw

Re: [PATCH v8 09/13] rockchip: Use multiple-images for rk3399

Hi Quentin,

Quoted 60 lines · Quentin Schulz

Hi Simon,

Quoted 47 lines · Simon Glass

Hi Quentin,

Quoted 43 lines · Quentin Schulz

Hi Simon,

Quoted 31 lines · Simon Glass

Enable multiple-images so we can generate more than one image. Also add a comment for the end of the #if block.

---

(no changes since v5)

Changes in v5:
- Rename from 'Include binman script in 64-bit boards'
- Drop duplicate #include in rk3368-u-boot.dtsi
- Keep the name as fit for puma
- Drop redundant check for CONFIG_ROCKCHIP_SPI_IMAGE
- Drop imply of BINMAN in Kconfig (rely on ARCH_ROCKCHIP instead)

   arch/arm/dts/rk3399-u-boot.dtsi | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51b..85a4f472d5d 100644
@@ -62,6 +62,7 @@
 
   #if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
   &binman {
+     multiple-images;
       rom {
               filename = "u-boot.rom";
               size = <0x400000>;

arch/arm/dts/rk3399-u-boot.dtsi line 86

Quoted 5 lines
arch/arm/dts/rk3399-u-boot.dtsi +1 -1
@@ -82,7 +83,7 @@
               };
       };
   };
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */

&& CONFIG_HAS_ROM

Quoted 8 lines
Quoted 4 lines

On a different topic, I'm a bit confused by this u-boot.rom binary. is it not just for Chromebooks? We now have u-boot-rockchip-spi.bin for SPI images but they are different (same as u-boot-rockchip.bin, just formatted in a way it can be flashed on a SPI flash).

The .rom is for SPI flash, not just Chromebooks. Perhaps we should unify the two of them?

Quoted 8 lines

I was under the impression that this .rom was mostly used for Chromebooks which is the reason why I didn't change any of it when adding support for u-boot-rockchip-spi.bin back then since the images are different (-spi has the u-boot fit instead of legacy, -spi has support for tpl while .rom only has support for SPL).

I'm all for unifying them if we can find something that does not make the ifdef situation in rockchip-u-boot.dtsi more dire :)

Great!

Quoted 7 lines

HAS_ROM is enabled on:
TARGET_CHROMEBOOK_JERRY
TARGET_EVB_RK3288
TARGET_CHROMEBOOK_BOB
TARGET_CHROMEBOOK_KEVIN

Quoted 7 lines

so this binman entry will only be used for the last two (the first two are handled in arch/arm/dts/rk3288-u-boot.dtsi, but with the same content as in arch/arm/dts/rk3399-u-boot.dtsi). Hence why I thought it was Chromebook related :)

Are there any requirements for those devices that make them require something different than current u-boot-rockchip-spi.bin?

Not that I know of. I can test something if it helps.

Regards,
Simon

#25 lore raw

PATCH v8 10/13 rockchip: Support building the all output files in binman

In reply to Simon Glass

Add the required binman images to replace the Makefile rules which are currently used. This includes subsuming:

- tpl/u-boot-tpl-rockchip.bin if TPL is enabled
- idbloader.img if either or both of SPL and TPL are enabled
- u-boot.itb if SPL_FIT is enabled
- u-boot-rockchip.bin if SPL is used, either using u-boot.itb when SPL_FIT is enabled or u-boot.img when it isn't

Note that the intermediate files are dropped with binman, since it producing everything in one pass. This means that tpl/u-boot-tpl-rockchip.bin is not created, for example.

Note that for some 32-bit rk3288 boards, rockchip-optee.dtsi is included.

---

Changes in v8:
- Make OP-TEE image optional
- Specify an entry address for U-Boot

Changes in v5:
- Rename blob to fit for puma and also SPI image

Changes in v3:
- Add an offset to the FIT description

Changes in v2:
- Rename op-tee to tee-os
- Drop use of .itb2

 arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi |  4 +-
 arch/arm/dts/rockchip-u-boot.dtsi           | 78 +++++++++++++++++++--
 2 files changed, 74 insertions(+), 8 deletions(-)
arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi +2 -2
index d2349ae90e2..088861dbf6d 100644
@@ -46,14 +46,14 @@
 
 &binman {
 	simple-bin {
-		blob {
+		fit {
 			offset = <((CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR - 64) * 512)>;
 		};
 	};
 
 #ifdef CONFIG_ROCKCHIP_SPI_IMAGE
 	simple-bin-spi {
-		blob {
+		fit {
 			/* same as u-boot,spl-payload-offset */
 			offset = <0x80000>;
 		};
arch/arm/dts/rockchip-u-boot.dtsi +72 -6

99 lines not on this page · raw message

Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#26 lore raw

PATCH v8 11/13 rockchip: Convert all boards to use binman

In reply to Simon Glass

Instead of the bash script, use binman to generate the FIT for arm64.

For 32-bit boards, use binman for all images, dropping the intermediate files.

With this change, only Zynq is now using SPL_FIT_GENERATOR so update the Kconfig rule accordingly.

Clean up the Makefile to the extent possible. Unfortunately, two boards do not use SPL_FRAMEWORK so don't enable the u-boot.img rule:

evb-rk3036
kylin-rk3036

So a small remnant remains.

---

(no changes since v1)

 Makefile     | 8 +-------
 boot/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)
Makefile +1 -7
index 8cd873fd5f4..4e7091779de 100644
@@ -1006,14 +1006,9 @@ ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
 INPUTS-y += init_sp_bss_offset_check
 endif
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
-# Binman image dependencies
-ifeq ($(CONFIG_ARM64),y)
-INPUTS-y += u-boot.itb
-else
+ifeq ($(CONFIG_ARCH_ROCKCHIP)_$(CONFIG_SPL_FRAMEWORK),y_)
 INPUTS-y += u-boot.img
 endif
-endif
 
 INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
 	$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
@@ -1485,7 +1480,6 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
 	$(call if_changed,pad_cat)
 
-
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
 
boot/Kconfig +1 -1
index 668270cc660..2fec861acd3 100644
@@ -277,7 +277,7 @@ config SPL_FIT_SOURCE
 
 config USE_SPL_FIT_GENERATOR
 	bool "Use a script to generate the .its script"
-	default y if SPL_FIT && (!ARCH_SUNXI && !RISCV)
+	default y if SPL_FIT && ARCH_ZYNQMP
 
 config SPL_FIT_GENERATOR
 	string ".its file generator script for U-Boot FIT image"
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#27 lore raw

PATCH v8 12/13 rockchip: Drop the FIT generator script

In reply to Simon Glass

This is not used anymore. Drop it.

---

(no changes since v1)

 Makefile                               |   3 -
 arch/arm/mach-rockchip/make_fit_atf.py | 267 -------------------------
 boot/Kconfig                           |   1 -
 3 files changed, 271 deletions(-)
 delete mode 100755 arch/arm/mach-rockchip/make_fit_atf.py
Makefile +0 -3
index 4e7091779de..b5eca383820 100644
@@ -1373,9 +1373,6 @@ $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
 else
 ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),)
 U_BOOT_ITS := u-boot.its
-ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py")
-U_BOOT_ITS_DEPS += u-boot
-endif
 $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
 	$(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \
 	$(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
arch/arm/mach-rockchip/make_fit_atf.py deleted +0 -267

267 lines not on this page · raw message

boot/Kconfig +0 -1
index 2fec861acd3..1bee68739ce 100644
@@ -282,7 +282,6 @@ config USE_SPL_FIT_GENERATOR
 config SPL_FIT_GENERATOR
 	string ".its file generator script for U-Boot FIT image"
 	depends on USE_SPL_FIT_GENERATOR
-	default "arch/arm/mach-rockchip/make_fit_atf.py" if SPL_LOAD_FIT && ARCH_ROCKCHIP
 	default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP
 	help
 	  Specifies a (platform specific) script file to generate the FIT
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#28 lore raw

PATCH v8 13/13 treewide: Disable USE_SPL_FIT_GENERATOR by default

In reply to Simon Glass

This option is deprecated and only used by two boards. Enable it for just those two boards, so others don't accidentally enable it.

---

(no changes since v6)

Changes in v6:
- Add new patch to disable USE_SPL_FIT_GENERATOR by default
- Add new patch to allow a binman entry to be marked absent

Changes in v3:
- Add support for writing sections in binman
- Rebase to master

Changes in v2:
- Drop patches previously applied
- Add various suggestions from Alper Nebi Yasak
- Add patches to refactor binman's FIT support

 boot/Kconfig                                                 | 5 +++--
 configs/am335x_evm_defconfig                                 | 1 -
 configs/am335x_hs_evm_defconfig                              | 1 -
 configs/am335x_hs_evm_uart_defconfig                         | 1 -
 configs/am43xx_evm_defconfig                                 | 1 -
 configs/am43xx_evm_rtconly_defconfig                         | 1 -
 configs/am43xx_evm_usbhost_boot_defconfig                    | 1 -
 configs/am43xx_hs_evm_defconfig                              | 1 -
 configs/am57xx_evm_defconfig                                 | 1 -
 configs/am57xx_hs_evm_defconfig                              | 1 -
 configs/am57xx_hs_evm_usb_defconfig                          | 1 -
 configs/am65x_evm_a53_defconfig                              | 1 -
 configs/am65x_evm_r5_defconfig                               | 1 -
 configs/am65x_hs_evm_a53_defconfig                           | 1 -
 configs/am65x_hs_evm_r5_defconfig                            | 1 -
 .../avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig   | 1 +
 configs/cgtqmx8_defconfig                                    | 1 -
 configs/chromebook_link64_defconfig                          | 1 -
 configs/dh_imx6_defconfig                                    | 1 -
 configs/display5_defconfig                                   | 1 -
 configs/display5_factory_defconfig                           | 1 -
 configs/dra7xx_evm_defconfig                                 | 1 -
 configs/dra7xx_hs_evm_defconfig                              | 1 -
 configs/dra7xx_hs_evm_usb_defconfig                          | 1 -
 configs/evb-ast2600_defconfig                                | 1 -
 configs/evb-rk3229_defconfig                                 | 1 -
 configs/evb-rk3288_defconfig                                 | 1 -
 configs/gwventana_emmc_defconfig                             | 1 -
 configs/gwventana_gw5904_defconfig                           | 1 -
 configs/gwventana_nand_defconfig                             | 1 -
 configs/imx6qdl_icore_mipi_defconfig                         | 1 -
 configs/imx6qdl_icore_mmc_defconfig                          | 1 -
 configs/imx6qdl_icore_rqs_defconfig                          | 1 -
 configs/imx8mm-cl-iot-gate-optee_defconfig                   | 1 -
 configs/imx8mm-cl-iot-gate_defconfig                         | 1 -
 configs/imx8mm-icore-mx8mm-ctouch2_defconfig                 | 1 -
 configs/imx8mm-icore-mx8mm-edimm2.2_defconfig                | 1 -
 configs/imx8mm-mx8menlo_defconfig                            | 1 -
 configs/imx8mm_beacon_defconfig                              | 1 -
 configs/imx8mm_data_modul_edm_sbc_defconfig                  | 1 -
 configs/imx8mm_evk_defconfig                                 | 1 -
 configs/imx8mm_evk_fspi_defconfig                            | 1 -
 configs/imx8mm_venice_defconfig                              | 1 -
 configs/imx8mn_beacon_2g_defconfig                           | 1 -
 configs/imx8mn_beacon_defconfig                              | 1 -
 configs/imx8mn_bsh_smm_s2_defconfig                          | 1 -
 configs/imx8mn_bsh_smm_s2pro_defconfig                       | 1 -
 configs/imx8mn_ddr4_evk_defconfig                            | 1 -
 configs/imx8mn_evk_defconfig                                 | 1 -
 configs/imx8mn_var_som_defconfig                             | 1 -
 configs/imx8mn_venice_defconfig                              | 1 -
 configs/imx8mp-icore-mx8mp-edimm2.2_defconfig                | 1 -
 configs/imx8mp_dhcom_pdk2_defconfig                          | 1 -
 configs/imx8mp_evk_defconfig                                 | 1 -
 configs/imx8mp_rsb3720a1_4G_defconfig                        | 1 -
 configs/imx8mp_rsb3720a1_6G_defconfig                        | 1 -
 configs/imx8mp_venice_defconfig                              | 1 -
 configs/imx8mq_cm_defconfig                                  | 1 -
 configs/imx8mq_evk_defconfig                                 | 1 -
 configs/imx8mq_phanbell_defconfig                            | 1 -
 configs/imx8qm_rom7720_a1_4G_defconfig                       | 1 -
 configs/iot2050_defconfig                                    | 1 -
 configs/j7200_evm_a72_defconfig                              | 1 -
 configs/j7200_evm_r5_defconfig                               | 1 -
 configs/j7200_hs_evm_a72_defconfig                           | 1 -
 configs/j7200_hs_evm_r5_defconfig                            | 1 -
 configs/j721e_evm_a72_defconfig                              | 1 -
 configs/j721e_evm_r5_defconfig                               | 1 -
 configs/j721e_hs_evm_a72_defconfig                           | 1 -
 configs/j721e_hs_evm_r5_defconfig                            | 1 -
 configs/j721s2_evm_a72_defconfig                             | 1 -
 configs/j721s2_evm_r5_defconfig                              | 1 -
 configs/j721s2_hs_evm_a72_defconfig                          | 1 -
 configs/j721s2_hs_evm_r5_defconfig                           | 1 -
 configs/kontron-sl-mx6ul_defconfig                           | 1 -
 configs/kontron-sl-mx8mm_defconfig                           | 1 -
 configs/kontron_pitx_imx8m_defconfig                         | 1 -
 configs/kontron_sl28_defconfig                               | 1 -
 configs/librem5_defconfig                                    | 1 -
 configs/ls1046ardb_qspi_spl_defconfig                        | 1 -
 configs/mccmon6_nor_defconfig                                | 1 -
 configs/mccmon6_sd_defconfig                                 | 1 -
 configs/mx6sabreauto_defconfig                               | 1 -
 configs/mx6sabresd_defconfig                                 | 1 -
 configs/phycore-imx8mm_defconfig                             | 1 -
 configs/phycore-imx8mp_defconfig                             | 1 -
 configs/pico-imx6_defconfig                                  | 1 -
 configs/pico-imx8mq_defconfig                                | 1 -
 configs/qemu-x86_64_defconfig                                | 1 -
 configs/sandbox_noinst_defconfig                             | 1 -
 configs/sandbox_spl_defconfig                                | 1 -
 configs/sandbox_vpl_defconfig                                | 1 -
 configs/socfpga_agilex_atf_defconfig                         | 1 -
 configs/socfpga_agilex_vab_defconfig                         | 1 -
 configs/socfpga_arria10_defconfig                            | 1 -
 configs/socfpga_chameleonv3_defconfig                        | 1 -
 configs/socfpga_n5x_atf_defconfig                            | 1 -
 configs/socfpga_n5x_vab_defconfig                            | 1 -
 configs/socfpga_stratix10_atf_defconfig                      | 1 -
 configs/stm32mp15_dhcom_basic_defconfig                      | 1 -
 configs/stm32mp15_dhcor_basic_defconfig                      | 1 -
 configs/verdin-imx8mm_defconfig                              | 1 -
 configs/verdin-imx8mp_defconfig                              | 1 -
 configs/wandboard_defconfig                                  | 1 -
 configs/xilinx_zynq_virt_defconfig                           | 1 -
 configs/xilinx_zynqmp_virt_defconfig                         | 1 +
 106 files changed, 5 insertions(+), 105 deletions(-)
boot/Kconfig +3 -2
index 1bee68739ce..dd40560bd43 100644
@@ -277,12 +277,13 @@ config SPL_FIT_SOURCE
 
 config USE_SPL_FIT_GENERATOR
 	bool "Use a script to generate the .its script"
-	default y if SPL_FIT && ARCH_ZYNQMP
+	help
+	  This is deprecated. Please do not use it. Use binman instead.
 
 config SPL_FIT_GENERATOR
 	string ".its file generator script for U-Boot FIT image"
 	depends on USE_SPL_FIT_GENERATOR
-	default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if SPL_LOAD_FIT && ARCH_ZYNQMP
+	default "arch/arm/mach-zynqmp/mkimage_fit_atf.sh" if ARCH_ZYNQMP
 	help
 	  Specifies a (platform specific) script file to generate the FIT
 	  source file used to build the U-Boot FIT image file. This gets
configs/am335x_evm_defconfig +0 -1
index 78e63c91750..f1995da8169 100644
@@ -14,7 +14,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00
 CONFIG_TIMESTAMP=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd"
 CONFIG_LOGLEVEL=3
configs/am335x_hs_evm_defconfig +0 -1
index 5dc9ba98fde..72609da3150 100644
@@ -13,7 +13,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00
 CONFIG_TIMESTAMP=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd"
 CONFIG_LOGLEVEL=3
configs/am335x_hs_evm_uart_defconfig +0 -1
index 68513c1b6a9..22562d4c63d 100644
@@ -16,7 +16,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4030ff00
 CONFIG_TIMESTAMP=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run init_console; run finduuid; run distro_bootcmd"
 CONFIG_LOGLEVEL=3
configs/am43xx_evm_defconfig +0 -1
index 2faf1322f9e..cb8a7e39ad3 100644
@@ -13,7 +13,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4033ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
configs/am43xx_evm_rtconly_defconfig +0 -1
index 4241070930f..ae82fe30686 100644
@@ -13,7 +13,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4033ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
configs/am43xx_evm_usbhost_boot_defconfig +0 -1
index 91270d032bf..6a08a1c792a 100644
@@ -12,7 +12,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4033ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
configs/am43xx_hs_evm_defconfig +0 -1
index b6b74af735e..1af4914faa4 100644
@@ -18,7 +18,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4033ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
configs/am57xx_evm_defconfig +0 -1
index 054e9747a8b..b3490dabaab 100644
@@ -18,7 +18,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board"
configs/am57xx_hs_evm_defconfig +0 -1
index 02a2543a3f0..c0d5a5893ec 100644
@@ -21,7 +21,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037ff00
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board"
configs/am57xx_hs_evm_usb_defconfig +0 -1
index 84eca42aac0..66dfb96f6a6 100644
@@ -23,7 +23,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037ff00
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80200000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS2,115200 androidboot.console=ttyS2 androidboot.hardware=beagle_x15board"
configs/am65x_evm_a53_defconfig +0 -1
index fe3346f2150..84ca386eafd 100644
@@ -30,7 +30,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
configs/am65x_evm_r5_defconfig +0 -1
index 45f50b6ae8e..64e1416162b 100644
@@ -28,7 +28,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c7effc
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
configs/am65x_hs_evm_a53_defconfig +0 -1
index 79182a77f30..94beb9ed67c 100644
@@ -30,7 +30,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
configs/am65x_hs_evm_r5_defconfig +0 -1
index cbd702c3eda..9b463044211 100644
@@ -27,7 +27,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c7effc
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x58000
configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig +1 -0
index 0a3d710a8b1..7cc2b3453f5 100644
@@ -20,6 +20,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000
+CONFIG_USE_SPL_FIT_GENERATOR=y
 CONFIG_BOOTDELAY=0
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_CLOCKS=y
configs/cgtqmx8_defconfig +0 -1
index 019701010ac..d5924b7f6d3 100644
@@ -22,7 +22,6 @@ CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
configs/chromebook_link64_defconfig +0 -1
index 570c4e82a47..bfb2b809f9b 100644
@@ -20,7 +20,6 @@ CONFIG_HAVE_VGA_BIOS=y
 CONFIG_X86_OFFSET_U_BOOT=0xffa00000
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_SHOW_BOOT_PROGRESS=y
configs/dh_imx6_defconfig +0 -1
index 04a5447e34d..62c446f86a9 100644
@@ -33,7 +33,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=3
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
configs/display5_defconfig +0 -1
index dbd917b4ddb..34696c03416 100644
@@ -32,7 +32,6 @@ CONFIG_SPL_SPI=y
 CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
configs/display5_factory_defconfig +0 -1
index 7508702eb95..5ed59cbb8e0 100644
@@ -29,7 +29,6 @@ CONFIG_SPL_SPI=y
 CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=3
configs/dra7xx_evm_defconfig +0 -1
index d91cf3e1301..ed47a396d5c 100644
@@ -20,7 +20,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037fef0
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80200000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard"
configs/dra7xx_hs_evm_defconfig +0 -1
index 195bc0e4ee0..ffff1116e7a 100644
@@ -23,7 +23,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037fef0
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80200000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard"
configs/dra7xx_hs_evm_usb_defconfig +0 -1
index 99cdbbc02f8..fd24cb0a23d 100644
@@ -24,7 +24,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4037fef0
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80200000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard"
configs/evb-ast2600_defconfig +0 -1
index 2fac79bbd72..11f3d57a8f4 100644
@@ -28,7 +28,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS4,115200n8 root=/dev/ram rw"
 CONFIG_USE_BOOTCOMMAND=y
configs/evb-rk3229_defconfig +0 -1
index 33202e48fe7..f8a95aed911 100644
@@ -23,7 +23,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x61100000
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
configs/evb-rk3288_defconfig +0 -1
index 6d3bb5a2944..e3f3225f6ff 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MONITOR_LEN=614400
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
 CONFIG_SILENT_CONSOLE=y
configs/gwventana_emmc_defconfig +0 -1
index f999b447755..e2f80e5b90c 100644
@@ -29,7 +29,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=3
configs/gwventana_gw5904_defconfig +0 -1
index 4c6291f0c51..6923018e9d7 100644
@@ -29,7 +29,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=3
configs/gwventana_nand_defconfig +0 -1
index 4e062e477e8..039a82cf9e0 100644
@@ -29,7 +29,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTDELAY=3
configs/imx6qdl_icore_mipi_defconfig +0 -1
index 90eb153c45f..5045f60400a 100644
@@ -28,7 +28,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
configs/imx6qdl_icore_mmc_defconfig +0 -1
index f5a7e969786..2831eb7d4e8 100644
@@ -31,7 +31,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
configs/imx6qdl_icore_rqs_defconfig +0 -1
index ee2c597bcb2..b9383ed55b4 100644
@@ -25,7 +25,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOOTDELAY=3
configs/imx8mm-cl-iot-gate-optee_defconfig +0 -1
index 80b801f9fed..586cb40f14b 100644
@@ -22,7 +22,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mm-cl-iot-gate_defconfig +0 -1
index e8e9d23c2eb..d26b083c6e9 100644
@@ -24,7 +24,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mm-icore-mx8mm-ctouch2_defconfig +0 -1
index 846efa52f8c..56e9038d296 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mm-icore-mx8mm-ctouch2.dtb"
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mm-icore-mx8mm-edimm2.2_defconfig +0 -1
index 2814d3b3cb9..b54c01f9acb 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mm-icore-mx8mm-edimm2.2.dtb"
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mm-mx8menlo_defconfig +0 -1
index f1e48bba965..da6c7add3f7 100644
@@ -28,7 +28,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTCOMMAND="mmc partconf 0 distro_bootpart && load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} boot/fitImage && source ${loadaddr}:bootscr-boot.cmd ; reset"
 CONFIG_DEFAULT_FDT_FILE="imx8mm-mx8menlo.dtb"
configs/imx8mm_beacon_defconfig +0 -1
index 93f66310975..178c62a40fc 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; fi;"
configs/imx8mm_data_modul_edm_sbc_defconfig +0 -1
index 3ccd26817ba..d9bd907761f 100644
@@ -30,7 +30,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x44000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTARGS=y
configs/imx8mm_evk_defconfig +0 -1
index 5d1f30a660b..bea790182bd 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
configs/imx8mm_evk_fspi_defconfig +0 -1
index 7c43dcf05cd..8e733df2955 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x25000
configs/imx8mm_venice_defconfig +0 -1
index 65031ab64db..2041cb47cd7 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_PREBOOT=y
configs/imx8mn_beacon_2g_defconfig +0 -1
index ba6856eafb0..5dd94e7423a 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"
configs/imx8mn_beacon_defconfig +0 -1
index c73f7d7082b..ee815767803 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"
configs/imx8mn_bsh_smm_s2_defconfig +0 -1
index 47f4e15e5d6..454ca46aec1 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2.dtb"
 CONFIG_ARCH_MISC_INIT=y
configs/imx8mn_bsh_smm_s2pro_defconfig +0 -1
index 5092ec1206d..0384e781e28 100644
@@ -24,7 +24,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-bsh-smm-s2pro.dtb"
 CONFIG_ARCH_MISC_INIT=y
configs/imx8mn_ddr4_evk_defconfig +0 -1
index e238122d25a..bc5a92c3a3e 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mn-ddr4-evk.dtb"
 CONFIG_ARCH_MISC_INIT=y
configs/imx8mn_evk_defconfig +0 -1
index 777b01a0f23..941d1666e46 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mn-evk.dtb"
 CONFIG_ARCH_MISC_INIT=y
configs/imx8mn_var_som_defconfig +0 -1
index 560b445a9cd..ac5ed963f60 100644
@@ -25,7 +25,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="freescale/imx8mn-var-som-symphony.dtb"
 CONFIG_ARCH_MISC_INIT=y
configs/imx8mn_venice_defconfig +0 -1
index d785915fa2e..86db0da2c1e 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_PREBOOT=y
configs/imx8mp-icore-mx8mp-edimm2.2_defconfig +0 -1
index f679fbe2514..01074ccfe9c 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mp-icore-mx8mp-edimm2.2.dtb"
 CONFIG_BOARD_LATE_INIT=y
configs/imx8mp_dhcom_pdk2_defconfig +0 -1
index ecc28c89ef7..af97ed4836d 100644
@@ -35,7 +35,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x44000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTARGS=y
configs/imx8mp_evk_defconfig +0 -1
index 91ec39d0237..7e1233707e9 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
 CONFIG_BOARD_LATE_INIT=y
configs/imx8mp_rsb3720a1_4G_defconfig +0 -1
index 5e29320b267..b23a74c45c3 100644
@@ -29,7 +29,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mp-rsb3720-a1.dtb"
configs/imx8mp_rsb3720a1_6G_defconfig +0 -1
index 11c3e1ffefd..40c28b43f11 100644
@@ -29,7 +29,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="imx8mp-rsb3720-a1.dtb"
configs/imx8mp_venice_defconfig +0 -1
index 220b2a2cff1..90c8164b618 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_PREBOOT=y
configs/imx8mq_cm_defconfig +0 -1
index ad42237a0cc..385a6b19bd4 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x1f000
configs/imx8mq_evk_defconfig +0 -1
index 79a27dedb37..b02aa6a49eb 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
configs/imx8mq_phanbell_defconfig +0 -1
index 7169e4d3f93..9e7cfabc413 100644
@@ -25,7 +25,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_SD_BOOT=y
 CONFIG_USE_BOOTCOMMAND=y
configs/imx8qm_rom7720_a1_4G_defconfig +0 -1
index 7819bef8638..e74e35f32e1 100644
@@ -22,7 +22,6 @@ CONFIG_REMAKE_ELF=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"
configs/iot2050_defconfig +0 -1
index 4ae85f391b7..f83283ec220 100644
@@ -27,7 +27,6 @@ CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80100000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTSTAGE=y
 CONFIG_SHOW_BOOT_PROGRESS=y
configs/j7200_evm_a72_defconfig +0 -1
index e7cdd84ecba..b3f7c4521ec 100644
@@ -30,7 +30,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
configs/j7200_evm_r5_defconfig +0 -1
index 87101cbf53e..291341cc761 100644
@@ -27,7 +27,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41cf5bfc
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0xc0000
configs/j7200_hs_evm_a72_defconfig +0 -1
index b9598ca1fe2..9d18aed6300 100644
@@ -31,7 +31,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
configs/j7200_hs_evm_r5_defconfig +0 -1
index 608778ade86..ab3461efe9c 100644
@@ -27,7 +27,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41cf5bfc
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0xc0000
configs/j721e_evm_a72_defconfig +0 -1
index 48a24446941..b0570d88ad9 100644
@@ -28,7 +28,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
configs/j721e_evm_r5_defconfig +0 -1
index d6da4c6ae2e..fa89fa45227 100644
@@ -27,7 +27,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41cf5bfc
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
configs/j721e_hs_evm_a72_defconfig +0 -1
index a1cc7da0bfb..8f009b49708 100644
@@ -29,7 +29,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run main_cpsw0_qsgmii_phyinit; run boot_rprocs; run get_fit_${boot}; run get_overlay_${boot}; run run_fit"
 CONFIG_LOGLEVEL=7
configs/j721e_hs_evm_r5_defconfig +0 -1
index eb9df365538..709127fb1d1 100644
@@ -27,7 +27,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41cf5bfc
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
configs/j721s2_evm_a72_defconfig +0 -1
index 2b2f80c4aaa..df63003736a 100644
@@ -30,7 +30,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern"
 CONFIG_LOGLEVEL=7
configs/j721s2_evm_r5_defconfig +0 -1
index 2de5d87bdb2..bdc6782ed6a 100644
@@ -29,7 +29,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c76000
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
 CONFIG_SPL_FIT_IMAGE_POST_PROCESS=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
configs/j721s2_hs_evm_a72_defconfig +0 -1
index 3e0ec40fb2e..8615aa1e202 100644
@@ -31,7 +31,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run boot_rprocs; run get_fit_${boot}; run get_overlaystring; run run_fit"
 CONFIG_LOGLEVEL=7
configs/j721s2_hs_evm_r5_defconfig +0 -1
index bc8672f7096..3dbec11c458 100644
@@ -29,7 +29,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41c76000
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x80080000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTCOMMAND=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD=y
configs/kontron-sl-mx6ul_defconfig +0 -1
index 7391e597642..015480d277c 100644
@@ -25,7 +25,6 @@ CONFIG_SYS_MEMTEST_END=0x90000000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_BOARD_TYPES=y
configs/kontron-sl-mx8mm_defconfig +0 -1
index 62fd984debd..b4a3a7b5f03 100644
@@ -28,7 +28,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_BOARD_TYPES=y
 CONFIG_BOARD_LATE_INIT=y
configs/kontron_pitx_imx8m_defconfig +0 -1
index 898a0b45e85..5976c292139 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
configs/kontron_sl28_defconfig +0 -1
index 9b90ed478cc..2aa36d6698e 100644
@@ -33,7 +33,6 @@ CONFIG_SYS_MONITOR_LEN=1048576
 CONFIG_MP=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_BOOTDELAY=10
configs/librem5_defconfig +0 -1
index 8be8421db3a..8bebd17e4bd 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTDELAY=0
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
configs/ls1046ardb_qspi_spl_defconfig +0 -1
index 560362695ff..a138f616746 100644
@@ -35,7 +35,6 @@ CONFIG_SYS_MONITOR_LEN=1048576
 CONFIG_MP=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_RAMBOOT_PBL=y
 CONFIG_SYS_FSL_PBL_PBI="board/freescale/ls1046ardb/ls1046ardb_qspi_pbi.cfg"
configs/mccmon6_nor_defconfig +0 -1
index 2566bdef168..b0787e12052 100644
@@ -20,7 +20,6 @@ CONFIG_ENV_ADDR=0x8040000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
configs/mccmon6_sd_defconfig +0 -1
index 43ffc3c6bc1..2f9cd13f225 100644
@@ -22,7 +22,6 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
configs/mx6sabreauto_defconfig +0 -1
index 8e94a84409d..5b2a3a2a397 100644
@@ -26,7 +26,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
configs/mx6sabresd_defconfig +0 -1
index 9472e032c81..cb2f34f00a0 100644
@@ -25,7 +25,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="run findfdt;mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
configs/phycore-imx8mm_defconfig +0 -1
index fab2550536f..5a60fb1530f 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; then run mmcboot; else run netboot; fi; fi;"
configs/phycore-imx8mp_defconfig +0 -1
index 248631b7a8f..8b0f3ca35f3 100644
@@ -23,7 +23,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; then run mmcboot; else run netboot; fi; fi;"
configs/pico-imx6_defconfig +0 -1
index a6ed013f8b6..3f1b07bf9e8 100644
@@ -24,7 +24,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run default_boot"
 CONFIG_DEFAULT_FDT_FILE="ask"
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
configs/pico-imx8mq_defconfig +0 -1
index 1b49eb2ed99..73c681b4e85 100644
@@ -25,7 +25,6 @@ CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"
configs/qemu-x86_64_defconfig +0 -1
index 0f4811e5d7a..fd4d500bf32 100644
@@ -19,7 +19,6 @@ CONFIG_X86_OFFSET_U_BOOT=0xfff00000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_SYS_MONITOR_BASE=0x01110000
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
configs/sandbox_noinst_defconfig +0 -1
index a12235559bf..b961fc82367 100644
@@ -20,7 +20,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
configs/sandbox_spl_defconfig +0 -1
index 4d70466fa9d..e583897a565 100644
@@ -20,7 +20,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
configs/sandbox_vpl_defconfig +0 -1
index c94b059a978..f3856c03638 100644
@@ -27,7 +27,6 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_FIT_BEST_MATCH=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
configs/socfpga_agilex_atf_defconfig +0 -1
index 9269eccf17a..52807bb1ac4 100644
@@ -22,7 +22,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
configs/socfpga_agilex_vab_defconfig +0 -1
index da4545effff..87fd1c5ccd7 100644
@@ -23,7 +23,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
configs/socfpga_arria10_defconfig +0 -1
index 4e2dc0c9857..d94d7f0188d 100644
@@ -17,7 +17,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xffe2b000
 CONFIG_FIT=y
 CONFIG_TIMESTAMP=y
 CONFIG_SPL_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
 # CONFIG_USE_BOOTCOMMAND is not set
configs/socfpga_chameleonv3_defconfig +0 -1
index 00c4cf30089..4bbce3591da 100644
@@ -11,7 +11,6 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SYS_SPL_MALLOC=y
configs/socfpga_n5x_atf_defconfig +0 -1
index 4d856d535a3..64aa5328538 100644
@@ -21,7 +21,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon panic=-1 earlyprintk=ttyS0,115200"
configs/socfpga_n5x_vab_defconfig +0 -1
index a6714b265e1..bc59a0f44bd 100644
@@ -22,7 +22,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon panic=-1 earlyprintk=ttyS0,115200"
configs/socfpga_stratix10_atf_defconfig +0 -1
index e0e6b2d0461..3c46fdfc997 100644
@@ -22,7 +22,6 @@ CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
configs/stm32mp15_dhcom_basic_defconfig +0 -1
index 26c2e73aa04..85ce4c95739 100644
@@ -29,7 +29,6 @@ CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
 CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its"
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_CONSOLE_MUX=y
configs/stm32mp15_dhcor_basic_defconfig +0 -1
index f76e13eafd7..deb4ea010af 100644
@@ -27,7 +27,6 @@ CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
 CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its"
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
 CONFIG_CONSOLE_MUX=y
configs/verdin-imx8mm_defconfig +0 -1
index 62f85883cb2..faaddad3ff3 100644
@@ -26,7 +26,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
configs/verdin-imx8mp_defconfig +0 -1
index bae8179bfde..481f57c5d4b 100644
@@ -32,7 +32,6 @@ CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_BOOTDELAY=1
 CONFIG_USE_PREBOOT=y
configs/wandboard_defconfig +0 -1
index a6baff1e24c..e418e4d2074 100644
@@ -27,7 +27,6 @@ CONFIG_SYS_MONITOR_LEN=409600
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
configs/xilinx_zynq_virt_defconfig +0 -1
index a4c555dac5c..28e78e365ff 100644
@@ -24,7 +24,6 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_FIT_PRINT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000
-# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_LEGACY_IMAGE_FORMAT=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_USE_PREBOOT=y
configs/xilinx_zynqmp_virt_defconfig +1 -0
index 4732c39bdbe..eeae9f34067 100644
@@ -25,6 +25,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000
+CONFIG_USE_SPL_FIT_GENERATOR=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="run scsi_init;usb start"
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#29 lore raw

Re: [PATCH v8 13/13] treewide: Disable USE_SPL_FIT_GENERATOR by default

Quoted 4 lines · Simon Glass

This option is deprecated and only used by two boards. Enable it for just those two boards, so others don't accidentally enable it.

Wait, is this right? I thought when I had looked at this before the outliers were two imx boards, which I believe have now been converted. Is it really still in use on two xilinx platforms ?

Signature · 1 line
Tom
#30 lore raw

Re: [PATCH v8 13/13] treewide: Disable USE_SPL_FIT_GENERATOR by default

Hi Tom,

Quoted 10 lines · Tom Rini
Quoted 4 lines · Simon Glass

This option is deprecated and only used by two boards. Enable it for just those two boards, so others don't accidentally enable it.

Wait, is this right? I thought when I had looked at this before the outliers were two imx boards, which I believe have now been converted. Is it really still in use on two xilinx platforms ?

Yes I think the imx ones have gone away.

For the penultimate commit:

$ ./tools/moveconfig.py -f USE_SPL_FIT_GENERATOR
2 matches
xilinx_zynqmp_virt avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0

So I believe this is still true.

Regards,
Simon

#31 lore raw

Re: [PATCH v8 13/13] treewide: Disable USE_SPL_FIT_GENERATOR by default

Quoted 16 lines · Simon Glass

Hi Tom,

Quoted 10 lines · Tom Rini
Quoted 4 lines · Simon Glass

This option is deprecated and only used by two boards. Enable it for just those two boards, so others don't accidentally enable it.

Wait, is this right? I thought when I had looked at this before the outliers were two imx boards, which I believe have now been converted. Is it really still in use on two xilinx platforms ?

Yes I think the imx ones have gone away.

Quoted 7 lines

For the penultimate commit:

$ ./tools/moveconfig.py -f USE_SPL_FIT_GENERATOR
2 matches
xilinx_zynqmp_virt avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0

So I believe this is still true.

Enabled, yes, but is that subtool it sets actually used? xilinx_zynqmp_virt is in qemu CI even, so that can be quickly tested. I do wonder if the avnet board was enabling it because it was default and not using it.

Signature · 1 line
Tom
#32 lore raw

Re: [PATCH v8 13/13] treewide: Disable USE_SPL_FIT_GENERATOR by default

Hi Tom,

Quoted 24 lines · Tom Rini
Quoted 22 lines · Simon Glass

Hi Tom,

Quoted 10 lines · Tom Rini
Quoted 4 lines · Simon Glass

This option is deprecated and only used by two boards. Enable it for just those two boards, so others don't accidentally enable it.

Wait, is this right? I thought when I had looked at this before the outliers were two imx boards, which I believe have now been converted. Is it really still in use on two xilinx platforms ?

Yes I think the imx ones have gone away.

For the penultimate commit:

$ ./tools/moveconfig.py -f USE_SPL_FIT_GENERATOR
2 matches
xilinx_zynqmp_virt avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0
Quoted 6 lines
Quoted 1 line

So I believe this is still true.

Enabled, yes, but is that subtool it sets actually used? xilinx_zynqmp_virt is in qemu CI even, so that can be quickly tested. I do wonder if the avnet board was enabling it because it was default and not using it.

When I try to disable it, I get:

make[1]: *** No rule to make target 'u-boot.itb', needed by '.binman_stamp'. Stop.

so I think it is needed by

Regards,
Simon