Skip to contentSkip to conversation

Cleanup K3 binman FIT images

PATCH In review Neha Malcom Francis 6 participants 15 messages Nov 15, 2023 – Nov 22, 2023 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover Cleanup K3 binman FIT images

Instead of duplicating the same FIT formats over and over again for different K3 devices, make use of the templating support to have FIT templates for the same.

Note: I purposely did not add the trial to template out the non-FIT bootloader image (tiboot3.bin) as it reduces the readibility and understandability of how the image is packaged because of the various different boot flows.

Boot logs:
https://gist.github.com/nehamalcom/9abe7955ebb4a251923e76412834c886

Neha Malcom Francis (2):
arm: dts: k3-binman: Add support for FIT templates
arm: dts: k3-*-binman: Move to using templated FITs

 arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
 .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
 arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
 arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
 arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
 arch/arm/dts/k3-binman.dtsi                   | 327 +++++++++++++++++
 arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
 arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
 arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
 9 files changed, 381 insertions(+), 1488 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 arm: dts: k3-binman: Add support for FIT templates

Add templates for FIT images used extensively across K3 boards with most of the code common. This includes the FIT portions of:
- tispl.bin
- u-boot.img
- sysfw.itb (in case of legacy boot flow)

---
 arch/arm/dts/k3-binman.dtsi | 327 ++++++++++++++++++++++++++++++++++++
 1 file changed, 327 insertions(+)
arch/arm/dts/k3-binman.dtsi +327 -0
index 2ea2dd18a1..677a017403 100644
@@ -113,4 +113,331 @@
 	};
 };
 
+&binman {
+	itb_template: template-5 {
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&board_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					board_cfg: board-cfg {
+						filename = "board-cfg.bin";
+						type = "blob-ext";
+					};
+
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&pm_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					pm_cfg: pm-cfg {
+						filename = "pm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&rm_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					rm_cfg: rm-cfg {
+						filename = "rm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&sec_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					sec_cfg: sec-cfg {
+						filename = "sec-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+			};
+		};
+	};
+
+	itb_unsigned_template: template-6 {
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin_fs";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					board-cfg {
+						filename = "board-cfg.bin";
+						type = "blob-ext";
+					};
+
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					pm-cfg {
+						filename = "pm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					rm-cfg {
+						filename = "rm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					sec-cfg {
+						filename = "sec-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+			};
+		};
+	};
+};
+
+#else
+
+&binman {
+	ti_spl_template: template-1 {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					ti-secure {
+						content = <&atf>;
+						keyfile = "custMpk.pem";
+					};
+					atf: atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OP-TEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					ti-secure {
+						content = <&tee>;
+						keyfile = "custMpk.pem";
+					};
+					tee: tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = "spl/u-boot-spl-nodtb.bin";
+					};
+				};
+
+			};
+		};
+	};
+	ti_spl_unsigned_template: template-2 {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OP-TEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-raw.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob-ext {
+						filename = "spl/u-boot-spl-nodtb.bin";
+					};
+				};
+			};
+		};
+	};
+	u_boot_template: template-3 {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+		};
+	};
+	u_boot_unsigned_template: template-4 {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = "u-boot-nodtb.bin";
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+		};
+	};
+
+};
+
 #endif
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] arm: dts: k3-binman: Add support for FIT templates

Hi Neha,

Quoted 7 lines · Neha Malcom Francis

Add templates for FIT images used extensively across K3 boards with most of the code common. This includes the FIT portions of:
- tispl.bin
- u-boot.img
- sysfw.itb (in case of legacy boot flow)

Quoted 5 lines
---
 arch/arm/dts/k3-binman.dtsi | 327 ++++++++++++++++++++++++++++++++++++
 1 file changed, 327 insertions(+)

What is the DM binary?

Regards,
Simon

#3 lore raw

Re: [PATCH 1/2] arm: dts: k3-binman: Add support for FIT templates

Hi Simon

Quoted 16 lines · Simon Glass

Hi Neha,

Quoted 7 lines · Neha Malcom Francis

Add templates for FIT images used extensively across K3 boards with most of the code common. This includes the FIT portions of:
        - tispl.bin
        - u-boot.img
        - sysfw.itb (in case of legacy boot flow)

Quoted 5 lines

---
 arch/arm/dts/k3-binman.dtsi | 327 ++++++++++++++++++++++++++++++++++++

 1 file changed, 327 insertions(+)
Quoted 3 lines

What is the DM binary?

From [1]:

DM - Device Management firmware also called TI System Control Interface server (TISCI Server) - This component purely plays the role of managing device resources such as power, clock, interrupts, dma etc. This firmware runs on a dedicated or multi-use microcontroller outside the security enclave.

[1] https://docs.u-boot.org/en/latest/board/ti/am62x_sk.html

Quoted 2 lines

Regards,
Simon

Cheers

Marcel

#4 lore raw

Re: [PATCH 1/2] arm: dts: k3-binman: Add support for FIT templates

Hi Marcel,

Quoted 29 lines · Marcel Ziswiler

Hi Simon

Quoted 16 lines · Simon Glass

Hi Neha,

Quoted 7 lines · Neha Malcom Francis

Add templates for FIT images used extensively across K3 boards with most of the code common. This includes the FIT portions of:
        - tispl.bin
        - u-boot.img
        - sysfw.itb (in case of legacy boot flow)

Quoted 5 lines
---
  arch/arm/dts/k3-binman.dtsi | 327 ++++++++++++++++++++++++++++++++++++
  1 file changed, 327 insertions(+)
Quoted 3 lines

What is the DM binary?

From [1]:

DM - Device Management firmware also called TI System Control Interface server (TISCI Server) - This component purely plays the role of managing device resources such as power, clock, interrupts, dma etc. This firmware runs on a dedicated or multi-use microcontroller outside the security enclave.

Quoted 8 lines

[1] https://docs.u-boot.org/en/latest/board/ti/am62x_sk.html

Quoted 2 lines

Regards,
Simon

Cheers

Marcel

Thanks for explaining!

Signature · 2 lines
Thanking You
Neha Malcom Francis
#5 lore raw

Re: [PATCH 1/2] arm: dts: k3-binman: Add support for FIT templates

In reply to Neha Malcom Francis
Quoted 8 lines · Neha Malcom Francis

Add templates for FIT images used extensively across K3 boards with most of the code common. This includes the FIT portions of:
- tispl.bin
- u-boot.img
- sysfw.itb (in case of legacy boot flow)

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
#6 lore raw

PATCH 2/2 arm: dts: k3-*-binman: Move to using templated FITs

In reply to Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

---
 arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
 .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
 arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
 arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
 arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
 arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
 arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
 arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
 8 files changed, 54 insertions(+), 1488 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +6 -151
index 41277bf4bf..b7b5368886 100644
@@ -141,10 +141,7 @@
 
 #ifdef CONFIG_TARGET_AM625_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_AM625_SK_DTB "spl/dts/k3-am625-sk.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define AM625_SK_DTB "u-boot.dtb"
 
 &binman {
@@ -155,55 +152,11 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -213,23 +166,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-sk";
 					type = "flat_dt";
@@ -263,29 +199,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM625 Board";
 				};
 
 				fdt-0 {
@@ -323,67 +242,17 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
 
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-sk";
 					type = "flat_dt";
@@ -411,26 +280,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM625 Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi +6 -149

214 lines not on this page · raw message

arch/arm/dts/k3-am62a-sk-binman.dtsi +6 -152

216 lines not on this page · raw message

arch/arm/dts/k3-am64x-binman.dtsi +6 -145

213 lines not on this page · raw message

arch/arm/dts/k3-am65x-binman.dtsi +8 -265

348 lines not on this page · raw message

arch/arm/dts/k3-j7200-binman.dtsi +6 -153

220 lines not on this page · raw message

arch/arm/dts/k3-j721e-binman.dtsi +10 -322

417 lines not on this page · raw message

arch/arm/dts/k3-j721s2-binman.dtsi +6 -151

217 lines not on this page · raw message

Signature · 1 line
2.34.1
Acked-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

Quoted 5 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

Quoted 10 lines
---
  arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
  .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
  arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
  arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
  arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
  arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
  arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
  arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
  8 files changed, 54 insertions(+), 1488 deletions(-)

1488 deletions, nice!

Minor question, why was ti-secure not factored out of dm nodes like it was for atf/tee nodes? Guessing it has to do with not all SoCs needing this blob and signing nothing results in something, which messes up the 0 size check when loading it, but it wasn't clear to me.

Anyway,

#8 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

Hi Andrew,

Quoted 17 lines · Andrew Davis
Quoted 9 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

---
  arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +-------- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +------- arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------

Quoted 6 lines
  arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
  arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
  arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
  arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
  arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
  8 files changed, 54 insertions(+), 1488 deletions(-)
Quoted 7 lines

1488 deletions, nice!

Minor question, why was ti-secure not factored out of dm nodes like it was for atf/tee nodes? Guessing it has to do with not all SoCs needing this blob and signing nothing results in something, which messes up the 0 size check when loading it, but it wasn't clear to me.

Yes that's right! It ends up being non-zero for devices that don't have DM and DM load fails.

Quoted 3 lines

Anyway,

Signature · 2 lines
Thanking You
Neha Malcom Francis
Reviewed-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

In reply to Neha Malcom Francis

Hi Neha,

Quoted 6 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

Quoted 11 lines
---
 arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
 .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
 arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
 arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
 arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
 arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
 arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
 arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
 8 files changed, 54 insertions(+), 1488 deletions(-)

Gosh that's a huge improvement!

Regards,
Simon

Reviewed-by on v1 2/2
#10 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

In reply to Neha Malcom Francis

Hi Neha,

Quoted 47 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

---
 arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
 .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
 arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
 arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
 arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
 arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
 arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
 arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
 8 files changed, 54 insertions(+), 1488 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +1 -11
index 41277bf4bf..b7b5368886 100644
@@ -141,10 +141,7 @@
 
 #ifdef CONFIG_TARGET_AM625_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_AM625_SK_DTB "spl/dts/k3-am625-sk.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define AM625_SK_DTB "u-boot.dtb"
 
 &binman {
@@ -155,55 +152,11 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";

arch/arm/dts/k3-am625-sk-binman.dtsi line 178

Quoted 10 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -10
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};

For ATF/OP-TEE Firewalling, can you keep these nodes intact? Just keep the ti-secure inside atf and tee nodes similar to how you have done that for DM as all the ATF/OPTEE nodes in the tispl.bin would be different for devices w.r.t certifications but we can still use templates for other common stuff.

With this change,

Regards,
Manorit

Quoted 2,103 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +5 -130
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -213,23 +166,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-sk";
 					type = "flat_dt";
@@ -263,29 +199,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM625 Board";
 				};
 
 				fdt-0 {
@@ -323,67 +242,17 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
 
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-sk";
 					type = "flat_dt";
@@ -411,26 +280,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM625 Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-am625-verdin-wifi-dev-binman.dtsi +6 -149
index 089b2a5f5c..eafd3310bb 100644
@@ -214,10 +214,7 @@
 
 #ifdef CONFIG_TARGET_VERDIN_AM62_A53
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_VERDIN_AM62_DTB "spl/dts/k3-am625-verdin-wifi-dev.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define VERDIN_AM62_DTB "u-boot.dtb"
 
 &binman {
@@ -228,54 +225,12 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
 
 			images {
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -285,23 +240,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-verdin-wifi-dev";
 					type = "flat_dt";
@@ -333,29 +271,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot fot AM625 Verdin Board";
 				};
 
 				fdt-0 {
@@ -392,66 +313,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am625-verdin-wifi-dev";
 					type = "flat_dt";
@@ -479,26 +350,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM625 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM625 Verdin Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-am62a-sk-binman.dtsi +6 -152
index de09430d93..c5e027d44d 100644
@@ -144,10 +144,7 @@
 
 #ifdef CONFIG_TARGET_AM62A7_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_AM62A7_SK_DTB "spl/dts/k3-am62a7-sk.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define AM62A7_SK_DTB "u-boot.dtb"
 
 &binman {
@@ -158,55 +155,11 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -216,23 +169,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am62a7-sk";
 					type = "flat_dt";
@@ -266,29 +202,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM62Ax board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM62Ax Board";
 				};
 
 				fdt-0 {
@@ -326,67 +245,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am62a7-sk";
 					type = "flat_dt";
@@ -414,26 +282,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM62Ax board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM62Ax Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-am64x-binman.dtsi +6 -145
index a5e54006b4..88df214954 100644
@@ -118,87 +118,27 @@
 
 #ifdef CONFIG_TARGET_AM642_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_AM642_EVM_DTB "spl/dts/k3-am642-evm.dtb"
 #define SPL_AM642_SK_DTB "spl/dts/k3-am642-sk.dtb"
 
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define AM642_EVM_DTB "u-boot.dtb"
 #define AM642_SK_DTB "arch/arm/dts/k3-am642-sk.dtb"
 
 &binman {
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
 			description = "Configuration to load ATF and SPL";
 			#address-cells = <1>;
 
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "/dev/null";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
 
 				fdt-0 {
 					description = "k3-am642-evm";
@@ -254,29 +194,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM64 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM64 Board";
 				};
 
 				fdt-0 {
@@ -340,65 +263,17 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
 
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "/dev/null";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am642-evm";
 					type = "flat_dt";
@@ -443,26 +318,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM64 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM64 Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-am65x-binman.dtsi +8 -265
index 59605ca597..8cc24da1f3 100644
@@ -42,77 +42,7 @@
 	};
 	itb {
 		filename = "sysfw-am65x_sr2-hs-evm.itb";
-		fit {
-			description = "SYSFW and Config fragments";
-			#address-cells = <1>;
-			images {
-				sysfw.bin {
-					description = "sysfw";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-					    filename = "sysfw.bin";
-					};
-				};
-				board-cfg.bin {
-					description = "board-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&board_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					board_cfg: board-cfg {
-						filename = "board-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				pm-cfg.bin {
-					description = "pm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&pm_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					pm_cfg: pm-cfg {
-						filename = "pm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				rm-cfg.bin {
-					description = "rm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&rm_cfg>;
-						keyfile = "custMpk.pem";\
-					};
-					rm_cfg: rm-cfg {
-						filename = "rm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				sec-cfg.bin {
-					description = "sec-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&sec_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					sec_cfg: sec-cfg {
-						filename = "sec-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-			};
-		};
+		insert-template = <&itb_template>;
 	};
 };
 
@@ -149,55 +79,14 @@
 	itb_gp {
 		filename = "sysfw-am65x_sr2-gp-evm.itb";
 		symlink = "sysfw.itb";
+		insert-template = <&itb_unsigned_template>;
 		fit {
-			description = "SYSFW and Config fragments";
-			#address-cells = <1>;
 			images {
 				sysfw.bin {
-					description = "sysfw";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
 					blob-ext {
 					    filename = "sysfw.bin_gp";
 					};
 				};
-				board-cfg.bin {
-					description = "board-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "board-cfg.bin";
-					};
-				};
-				pm-cfg.bin {
-					description = "pm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "pm-cfg.bin";
-					};
-				};
-				rm-cfg.bin {
-					description = "rm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "rm-cfg.bin";
-					};
-				};
-				sec-cfg.bin {
-					description = "sec-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "sec-cfg.bin";
-					};
-				};
 			};
 		};
 	};
@@ -206,86 +95,22 @@
 
 #ifdef CONFIG_TARGET_AM654_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_AM654_EVM_DTB "spl/dts/k3-am654-base-board.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define AM654_EVM_DTB "u-boot.dtb"
 
 &binman {
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
 
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "/dev/null";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-am654-base-board";
 					type = "flat_dt";
@@ -317,29 +142,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM65 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM65 Board";
 				};
 
 				fdt-0 {
@@ -378,67 +186,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "/dev/null";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j721e-common-proc-board";
 					type = "flat_dt";
@@ -466,26 +223,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for AM65 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for AM65 Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-j7200-binman.dtsi +6 -153
index 14f7dea65e..10c9d6cba7 100644
@@ -180,10 +180,7 @@
 
 #ifdef CONFIG_TARGET_J7200_A72_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_J7200_EVM_DTB "spl/dts/k3-j7200-common-proc-board.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define J7200_EVM_DTB "u-boot.dtb"
 
 &binman {
@@ -194,82 +191,20 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
 					};
-
 					dm: blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j7200-common-proc-board";
 					type = "flat_dt";
@@ -302,29 +237,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for J7200 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J7200 Board";
 				};
 
 				fdt-0 {
@@ -362,67 +280,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-1 {
 					description = "k3-j7200-common-proc-board";
 					type = "flat_dt";
@@ -450,26 +317,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for J7200 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J7200 Board";
 				};
 
 				fdt-1 {
arch/arm/dts/k3-j721e-binman.dtsi +10 -322
index 4f566c21a9..5ddb474e3a 100644
@@ -42,78 +42,7 @@
 	};
 	itb {
 		filename = "sysfw-j721e_sr1_1-hs-evm.itb";
-		fit {
-			description = "SYSFW and Config fragments";
-			#address-cells = <1>;
-			images {
-				sysfw.bin {
-					description = "sysfw";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-					    filename = "sysfw.bin";
-					};
-				};
-				board-cfg.bin {
-					description = "board-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&board_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					board_cfg: board-cfg {
-						filename = "board-cfg.bin";
-						type = "blob-ext";
-					};
-
-				};
-				pm-cfg.bin {
-					description = "pm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&pm_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					pm_cfg: pm-cfg {
-						filename = "pm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				rm-cfg.bin {
-					description = "rm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&rm_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					rm_cfg: rm-cfg {
-						filename = "rm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				sec-cfg.bin {
-					description = "sec-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					ti-secure {
-						content = <&sec_cfg>;
-						keyfile = "custMpk.pem";
-					};
-					sec_cfg: sec-cfg {
-						filename = "sec-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-			};
-		};
+		insert-template = <&itb_template>;
 	};
 };
 
@@ -145,62 +74,7 @@
 	};
 	itb_fs {
 		filename = "sysfw-j721e_sr2-hs-fs-evm.itb";
-		fit {
-			description = "SYSFW and Config fragments";
-			#address-cells = <1>;
-			images {
-				sysfw.bin {
-					description = "sysfw";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-					    filename = "sysfw.bin_fs";
-					};
-				};
-				board-cfg.bin {
-					description = "board-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					board-cfg {
-						filename = "board-cfg.bin";
-						type = "blob-ext";
-					};
-
-				};
-				pm-cfg.bin {
-					description = "pm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					pm-cfg {
-						filename = "pm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				rm-cfg.bin {
-					description = "rm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					rm-cfg {
-						filename = "rm-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-				sec-cfg.bin {
-					description = "sec-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					sec-cfg {
-						filename = "sec-cfg.bin";
-						type = "blob-ext";
-					};
-				};
-			};
-		};
+		insert-template = <&itb_unsigned_template>;
 	};
 };
 
@@ -237,55 +111,15 @@
 	itb_gp {
 		filename = "sysfw-j721e-gp-evm.itb";
 		symlink = "sysfw.itb";
+		insert-template = <&itb_unsigned_template>;
+
 		fit {
-			description = "SYSFW and Config fragments";
-			#address-cells = <1>;
 			images {
 				sysfw.bin {
-					description = "sysfw";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
 					blob-ext {
 					    filename = "sysfw.bin_gp";
 					};
 				};
-				board-cfg.bin {
-					description = "board-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "board-cfg.bin";
-					};
-				};
-				pm-cfg.bin {
-					description = "pm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "pm-cfg.bin";
-					};
-				};
-				rm-cfg.bin {
-					description = "rm-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "rm-cfg.bin";
-					};
-				};
-				sec-cfg.bin {
-					description = "sec-cfg";
-					type = "firmware";
-					arch = "arm";
-					compression = "none";
-					blob-ext {
-						filename = "sec-cfg.bin";
-					};
-				};
 			};
 		};
 	};
@@ -294,11 +128,9 @@
 
 #ifdef CONFIG_TARGET_J721E_A72_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_J721E_EVM_DTB "spl/dts/k3-j721e-common-proc-board.dtb"
 #define SPL_J721E_SK_DTB "spl/dts/k3-j721e-sk.dtb"
 
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define J721E_EVM_DTB "u-boot.dtb"
 #define J721E_SK_DTB "arch/arm/dts/k3-j721e-sk.dtb"
 
@@ -310,55 +142,11 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -368,24 +156,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j721e-common-proc-board";
 					type = "flat_dt";
@@ -439,29 +209,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
-
+		insert-template = <&u_boot_template>;
 		fit {
-			description = "FIT image with multiple configurations";
 
 			images {
 				uboot {
-					description = "U-Boot for j721e board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J721E Board";
 				};
 
 				fdt-0 {
@@ -524,67 +277,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j721e-common-proc-board";
 					type = "flat_dt";
@@ -629,26 +331,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for j721e board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J721E Board";
 				};
 
 				fdt-0 {
arch/arm/dts/k3-j721s2-binman.dtsi +6 -151
index 5bca4e94ec..3922007b3b 100644
@@ -141,11 +141,9 @@
 
 #ifdef CONFIG_TARGET_J721S2_A72_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
 #define SPL_J721S2_EVM_DTB "spl/dts/k3-j721s2-common-proc-board.dtb"
 #define SPL_AM68_SK_DTB "spl/dts/k3-am68-sk-base-board.dtb"
 
-#define UBOOT_NODTB "u-boot-nodtb.bin"
 #define J721S2_EVM_DTB "u-boot.dtb"
 #define AM68_SK_DTB "arch/arm/dts/k3-am68-sk-base-board.dtb"
 
@@ -157,55 +155,11 @@
 		};
 	};
 	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
-						keyfile = "custMpk.pem";
-					};
-					atf: atf-bl31 {
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					ti-secure {
-						content = <&tee>;
-						keyfile = "custMpk.pem";
-					};
-					tee: tee-os {
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					ti-secure {
 						content = <&dm>;
 						keyfile = "custMpk.pem";
@@ -215,23 +169,6 @@
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_spl_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_spl_nodtb: blob-ext {
-						filename = SPL_NODTB;
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j721s2-common-proc-board";
 					type = "flat_dt";
@@ -285,29 +222,12 @@
 
 &binman {
 	u-boot {
-		filename = "u-boot.img";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for J721S2 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					ti-secure {
-						content = <&u_boot_nodtb>;
-						keyfile = "custMpk.pem";
-					};
-					u_boot_nodtb: u-boot-nodtb {
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J721S2 Board";
 				};
 
 				fdt-0 {
@@ -371,67 +291,16 @@
 
 &binman {
 	ti-spl_unsigned {
-		filename = "tispl.bin_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_unsigned_template>;
 
 		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
 			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					atf-bl31 {
-						filename = "bl31.bin";
-					};
-				};
-
-				tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = "arm64";
-					compression = "none";
-					os = "tee";
-					load = <0x9e800000>;
-					entry = <0x9e800000>;
-					tee-os {
-						filename = "tee-raw.bin";
-					};
-				};
-
 				dm {
-					description = "DM binary";
-					type = "firmware";
-					arch = "arm32";
-					compression = "none";
-					os = "DM";
-					load = <0x89000000>;
-					entry = <0x89000000>;
 					blob-ext {
 						filename = "ti-dm.bin";
 					};
 				};
 
-				spl {
-					description = "SPL (64-bit)";
-					type = "standalone";
-					os = "U-Boot";
-					arch = "arm64";
-					compression = "none";
-					load = <CONFIG_SPL_TEXT_BASE>;
-					entry = <CONFIG_SPL_TEXT_BASE>;
-					blob {
-						filename = "spl/u-boot-spl-nodtb.bin";
-					};
-				};
-
 				fdt-0 {
 					description = "k3-j721s2-common-proc-board";
 					type = "flat_dt";
@@ -475,26 +344,12 @@
 
 &binman {
 	u-boot_unsigned {
-		filename = "u-boot.img_unsigned";
-		pad-byte = <0xff>;
+		insert-template = <&u_boot_unsigned_template>;
 
 		fit {
-			description = "FIT image with multiple configurations";
-
 			images {
 				uboot {
-					description = "U-Boot for J721S2 board";
-					type = "firmware";
-					os = "u-boot";
-					arch = "arm";
-					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
-					blob {
-						filename = UBOOT_NODTB;
-					};
-					hash {
-						algo = "crc32";
-					};
+					description = "U-Boot for J721S2 Board";
 				};
 
 				fdt-0 {
Signature · 1 line
2.34.1
#11 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

Hi Manorit

Quoted 58 lines · Manorit Chawdhry

Hi Neha,

Quoted 55 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

---
  arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
  .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
  arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
  arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
  arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
  arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
  arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
  arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
  8 files changed, 54 insertions(+), 1488 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +1 -19
index 41277bf4bf..b7b5368886 100644
@@ -141,10 +141,7 @@
 
  #ifdef CONFIG_TARGET_AM625_A53_EVM
 
-#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
  #define SPL_AM625_SK_DTB "spl/dts/k3-am625-sk.dtb"
-
-#define UBOOT_NODTB "u-boot-nodtb.bin"
  #define AM625_SK_DTB "u-boot.dtb"
 
  &binman {
@@ -155,55 +152,11 @@
  		};
  	};
  	ti-spl {
-		filename = "tispl.bin";
-		pad-byte = <0xff>;
+		insert-template = <&ti_spl_template>;
 
  		fit {
-			description = "Configuration to load ATF and SPL";
-			#address-cells = <1>;
-
  			images {
-
-				atf {
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = "arm64";
-					compression = "none";
-					os = "arm-trusted-firmware";
-					load = <CONFIG_K3_ATF_LOAD_ADDR>;
-					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
-					ti-secure {
-						content = <&atf>;
Quoted 9 lines

arch/arm/dts/k3-am625-sk-binman.dtsi line 178

Quoted 2 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -2
-						keyfile = "custMpk.pem";
-					};

For ATF/OP-TEE Firewalling, can you keep these nodes intact? Just keep the ti-secure inside atf and tee nodes similar to how you have done that for DM as all the ATF/OPTEE nodes in the tispl.bin would be different for devices w.r.t certifications but we can still use templates for other common stuff.

I believe you will still be able to process firewalling by adding the extra parameters in the board binman DTSI file. The reason for retaining DM was different. For example, for J721E:

arch/arm/dts/k3-j721e-binman.dtsi +21 -0
index 5ddb474e3a..647b5dc629 100644
@@ -146,6 +146,27 @@
 
 		fit {
 			images {
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-257-0 {
+						/* cpu_0_cpu_0_msmc Background Firewall */
+							id = <257>;
+							region = <0>;
+							control = <(FWCTRL_EN | FWCTRL_LOCK |
+										FWCTRL_BG | FWCTRL_CACHE)>;
+							permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) |
+											FWPERM_SECURE_PRIV_RWCD |
+											FWPERM_SECURE_USER_RWCD |
+											FWPERM_NON_SECURE_PRIV_RWCD |
+											FWPERM_NON_SECURE_USER_RWCD)>;
+							start_address = <0x0 0x0>;
+							end_address = <0xff 0xffffffff>;
+						};
+					};
+				};
+
 				dm {
 					ti-secure {
 						content = <&dm>;

I have only checked whether this builds fine without any errors. If you could check whether the intended functionality also works, we should be good.

Quoted 10 lines

With this change,

Regards,
Manorit

Quoted 4 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -4
-					atf: atf-bl31 {
-					};
-				};
-

[...]

Signature · 2 lines
Thanking You
Neha Malcom Francis
#12 lore raw

Re: [PATCH 2/2] arm: dts: k3-*-binman: Move to using templated FITs

In reply to Neha Malcom Francis
Quoted 8 lines · Neha Malcom Francis

Reduce redundancy in code by using templates to generate the A72 boot binaries (tispl.bin and u-boot.img) as well as R5 boot binary sysfw.itb (for legacy boot following devices J721E and AM65x).

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
Tested-by on the v1 series
#13 lore raw
In reply to Neha Malcom Francis

Hi Neha

Quoted 11 lines · Neha Malcom Francis

Instead of duplicating the same FIT formats over and over again for different K3 devices, make use of the templating support to have FIT templates for the same.

Note: I purposely did not add the trial to template out the non-FIT bootloader image (tiboot3.bin) as it reduces the readibility and understandability of how the image is packaged because of the various different boot flows.

Boot logs:
https://gist.github.com/nehamalcom/9abe7955ebb4a251923e76412834c886

For the whole series:

Quoted 13 lines

Neha Malcom Francis (2):
  arm: dts: k3-binman: Add support for FIT templates
  arm: dts: k3-*-binman: Move to using templated FITs

 arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +-------- .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +------- arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +-------- arch/arm/dts/k3-am64x-binman.dtsi             | 151 +------- arch/arm/dts/k3-am65x-binman.dtsi             | 273 +------------- arch/arm/dts/k3-binman.dtsi                   | 327 +++++++++++++++++ arch/arm/dts/k3-j7200-binman.dtsi             | 159 +-------- arch/arm/dts/k3-j721e-binman.dtsi             | 332 +----------------- arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------

Quoted 1 line
 9 files changed, 381 insertions(+), 1488 deletions(-)

Thanks!

Cheers

Marcel

#14 lore raw

Hi Marcel,

Quoted 12 lines · Marcel Ziswiler

Hi Neha

Quoted 9 lines · Neha Malcom Francis

Instead of duplicating the same FIT formats over and over again for different K3 devices, make use of the templating support to have FIT templates for the same.

Note: I purposely did not add the trial to template out the non-FIT bootloader image (tiboot3.bin) as it reduces the readibility and understandability of how the image is packaged because of the various different boot flows.

Quoted 7 lines
Quoted 2 lines

Boot logs:
https://gist.github.com/nehamalcom/9abe7955ebb4a251923e76412834c886

For the whole series:

Thanks for testing!

Quoted 20 lines
Quoted 4 lines

Neha Malcom Francis (2):
  arm: dts: k3-binman: Add support for FIT templates
  arm: dts: k3-*-binman: Move to using templated FITs

Quoted 10 lines
  arch/arm/dts/k3-am625-sk-binman.dtsi          | 157 +--------
  .../dts/k3-am625-verdin-wifi-dev-binman.dtsi  | 155 +-------
  arch/arm/dts/k3-am62a-sk-binman.dtsi          | 158 +--------
  arch/arm/dts/k3-am64x-binman.dtsi             | 151 +-------
  arch/arm/dts/k3-am65x-binman.dtsi             | 273 +-------------
  arch/arm/dts/k3-binman.dtsi                   | 327 +++++++++++++++++
  arch/arm/dts/k3-j7200-binman.dtsi             | 159 +--------
  arch/arm/dts/k3-j721e-binman.dtsi             | 332 +-----------------
  arch/arm/dts/k3-j721s2-binman.dtsi            | 157 +--------
  9 files changed, 381 insertions(+), 1488 deletions(-)

Thanks!

Cheers

Marcel

Signature · 2 lines
Thanking You
Neha Malcom Francis