[PATCH v2 1/3] rockchip: binman: template idbloader.img for MMC and SPI images

Quentin Schulz foss+uboot at 0leil.net
Tue Dec 16 12:26:29 CET 2025


From: Quentin Schulz <quentin.schulz at cherry.de>

We may generate two different "simple-bin", one for MMC and one for SPI
flashes, respectively named u-boot-rockchip.bin and
u-boot-rockchip-spi.bin.

There aren't many differences between the two, namely:
- the TPL+SPL called "idbloader" has (for some SoCs) a different type
  to pass to mkimage arguments, namely rksd vs rkspi,
- the FIT can be stored at different offsets for MMC and SPI, the former
  is typically controlled by CONFIG_SPL_PAD_TO but for the latter it
  typically is from CONFIG_SYS_SPI_U_BOOT_OFFS,
- because of the above, two images are generated, idbloader.img for MMC
  and idbloader-spi.img for SPI,

binman templating allows to override or supplement templates from the
inserter side, so let's just do that to remove even more duplication.

Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
 arch/arm/dts/rockchip-u-boot.dtsi | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index 71d7623fe2c..79d0dfd8351 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -163,12 +163,10 @@
 	};
 #endif /* HAS_FIT */
 
-	simple-bin {
-		filename = "u-boot-rockchip.bin";
+	simple_bin_template: template-2 {
 		pad-byte = <0xff>;
 
 		mkimage {
-			filename = "idbloader.img";
 			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
 			multiple-data-files;
 
@@ -182,6 +180,15 @@
 			u-boot-spl {
 			};
 		};
+	};
+
+	simple-bin {
+		insert-template = <&simple_bin_template>;
+		filename = "u-boot-rockchip.bin";
+
+		mkimage {
+			filename = "idbloader.img";
+		};
 
 #ifdef HAS_FIT
 		fit {
@@ -196,23 +203,12 @@
 
 #ifdef CONFIG_ROCKCHIP_SPI_IMAGE
 	simple-bin-spi {
+		insert-template = <&simple_bin_template>;
 		filename = "u-boot-rockchip-spi.bin";
-		pad-byte = <0xff>;
 
 		mkimage {
 			filename = "idbloader-spi.img";
 			args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
-			multiple-data-files;
-
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-			rockchip-tpl {
-			};
-#elif defined(CONFIG_TPL)
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
-			};
 		};
 
 #ifdef HAS_FIT

-- 
2.52.0



More information about the U-Boot mailing list