public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew Abbott <andrew@mirx.dev>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Johan Jonker <jbx6244@gmail.com>, Simon Glass <sjg@chromium.org>,
	Samuel Dionne-Riel <samuel@dionne-riel.com>,
	Peter Robinson <pbrobinson@gmail.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Andrew Abbott <andrew@mirx.dev>,
	Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Subject: [RFC PATCH v2 2/8] rockchip: Add binman definitions for final images
Date: Mon, 16 May 2022 21:07:06 +1000	[thread overview]
Message-ID: <20220516110712.178958-3-andrew@mirx.dev> (raw)
In-Reply-To: <20220516110712.178958-1-andrew@mirx.dev>

Currently, building for Rockchip targets produces:

- idbloader.img
    - rksd-formatted TPL with SPL appended; or
    - rksd-formatted SPL
- u-boot.itb
    - U-Boot Proper FIT image
- u-boot-rockchip.bin
    - idbloader.img + u-boot.itb, padded the correct amount for SD/MMC
      usage.

For RK3399 targets:

- u-boot.rom
    - SPI image specific to the bob Chromebook target (see
      c4cea2bbf995764f325a907061c22ecd6768cf7b).

This commit adds binman definitions to produce these images:

- idbloader.img
    - rksd-formatted [TPL + ] SPL, as before.
- u-boot-rockchip.bin
    - [TPL + ] SPL all rksd-formatted + u-boot.itb padded for SD/MMC
      usage, as before.
- u-boot-rockchip-spi.bin
    - [TPL + ] SPL all rkspi-formatted + u-boot.itb padded for SPI
      usage.

This commit also generalizes the CONFIG_ROCKCHIP_SPI_IMAGE config
setting - it now means to generate a generic SPI flash image, in
addition to the generic SD/MMC image.

Signed-off-by: Andrew Abbott <andrew@mirx.dev>
---
Question: Does this break/not play nicely with rockchip-optee
generation? It creates u-boot.itb for rk3288 targets. That would need to
run before what I've implemented here?

Changes in v2:
- Revert u-boot-rockchip-sdmmc.bin name to u-boot-rockchip.bin, to
  keep the name the same as before.
- Fix whitespace issues.

 arch/arm/dts/rockchip-u-boot.dtsi | 53 +++++++++++++++++++++++++++++--
 arch/arm/mach-rockchip/Kconfig    |  7 ++--
 2 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index eae3ee715d..9354b0f5a7 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -13,17 +13,64 @@
 
 #ifdef CONFIG_SPL
 &binman {
-	simple-bin {
+	sdmmc-idbloader {
+		filename = "idbloader.img";
+
+		mkimage {
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+
+#ifdef CONFIG_TPL
+			u-boot-tpl {};
+#endif
+			u-boot-spl {};
+		};
+	};
+
+	sdmmc-image {
 		filename = "u-boot-rockchip.bin";
 		pad-byte = <0xff>;
 
-		blob {
+		idbloader {
 			filename = "idbloader.img";
+			type = "blob";
 		};
 
-		u-boot-img {
+#ifdef CONFIG_ARM64
+		u-boot-fit {
+			filename = "u-boot.itb";
+			type = "blob";
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
+#else
+		u-boot-img {};
+#endif
 	};
 };
+
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+&binman {
+	spi-image {
+		filename = "u-boot-rockchip-spi.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
+
+#ifdef CONFIG_TPL
+			u-boot-tpl {};
+#endif
+			u-boot-spl {};
+		};
+
+#ifdef CONFIG_ARM64
+		blob {
+			filename = "u-boot.itb";
+			offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
+		};
+#else
+		u-boot-img {};
 #endif
+	};
+};
+#endif // CONFIG_ROCKCHIP_SPI_IMAGE
+#endif // CONFIG_SPL
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 18aff5480b..7149b9a530 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -415,12 +415,11 @@ config SPL_MMC
 
 config ROCKCHIP_SPI_IMAGE
 	bool "Build a SPI image for rockchip"
-	depends on HAS_ROM
 	help
 	  Some Rockchip SoCs support booting from SPI flash. Enable this
-	  option to produce a 4MB SPI-flash image (called u-boot.rom)
-	  containing U-Boot. The image is built by binman. U-Boot sits near
-	  the start of the image.
+	  option to produce an SPI-flash image (called u-boot-rockchip-spi.bin)
+	  containing TPL (if enabled) and SPL, and U-Boot proper at the offset
+	  CONFIG_SYS_SPI_U_BOOT_OFFS. The image is built by binman.
 
 config LNX_KRNL_IMG_TEXT_OFFSET_BASE
 	default SYS_TEXT_BASE
-- 
2.36.0


  parent reply	other threads:[~2022-05-16 11:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 11:07 [RFC PATCH v2 0/8] Build Rockchip final images using binman Andrew Abbott
2022-05-16 11:07 ` [RFC PATCH v2 1/8] binman: mkimage: Support ':'-separated inputs Andrew Abbott
2022-05-19 11:36   ` Alper Nebi Yasak
2022-05-22  0:03     ` Andrew Abbott
2022-05-16 11:07 ` Andrew Abbott [this message]
2022-05-19 11:36   ` [RFC PATCH v2 2/8] rockchip: Add binman definitions for final images Alper Nebi Yasak
2022-05-22  0:55     ` Andrew Abbott
2022-05-29 16:31       ` Alper Nebi Yasak
2022-05-16 11:07 ` [RFC PATCH v2 3/8] soc: rockchip: Include common U-Boot dtsi file Andrew Abbott
2022-05-19 11:36   ` Alper Nebi Yasak
2022-05-16 11:07 ` [RFC PATCH v2 4/8] board: rockchip: Move SPI U-Boot offset to config Andrew Abbott
2022-05-19 11:36   ` Alper Nebi Yasak
2022-05-16 11:07 ` [RFC PATCH v2 5/8] rockchip: Remove obsolete Makefile targets Andrew Abbott
2022-05-16 11:07 ` [RFC PATCH v2 6/8] rockchip: Enable binman for ARM64 Andrew Abbott
2022-05-19 11:37   ` Alper Nebi Yasak
2022-05-22  1:27     ` Andrew Abbott
2022-05-16 11:07 ` [RFC PATCH v2 7/8] doc: rockchip: Update for new binman image generation Andrew Abbott
2022-05-16 11:07 ` [RFC PATCH v2 8/8] board: rockpro64: Enable building SPI image Andrew Abbott
2022-05-16 15:13 ` [RFC PATCH v2 0/8] Build Rockchip final images using binman Jerome Forissier
2022-05-19  9:59   ` Andrew Abbott
2022-05-19 11:35 ` Alper Nebi Yasak
2022-05-21 23:47   ` Andrew Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516110712.178958-3-andrew@mirx.dev \
    --to=andrew@mirx.dev \
    --cc=jagan@amarulasolutions.com \
    --cc=jbx6244@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=pbrobinson@gmail.com \
    --cc=philipp.tomsich@theobroma-systems.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=samuel@dionne-riel.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox