[RFC PATCH 2/8] rockchip: Add binman definitions for final images

Johan Jonker jbx6244 at gmail.com
Wed Apr 27 11:22:14 CEST 2022



On 4/25/22 02:03, Andrew Abbott wrote:
> 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
> - u-boot-rockchip-sdmmc.bin
>     - [TPL + ] SPL all rksd-formatted + u-boot.itb padded for SD/MMC
>       usage.
> - 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 at 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?
> 
> ---
>  arch/arm/dts/rockchip-u-boot.dtsi | 59 +++++++++++++++++++++++++++----
>  arch/arm/mach-rockchip/Kconfig    |  7 ++--
>  2 files changed, 56 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
> index eae3ee715d..05d79e6c55 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 {

> -		filename = "u-boot-rockchip.bin";

Hi,

This name "u-boot-rockchip.bin"is in use in user space scripts and shows
up in examples on the web. No desire for yet another naming variant.
What you change must give exact the same result as we had in the
existing situation.

"git am <patch>" gives these warnings:

warning: 3 lines add whitespace errors.

Resulting dtsi is full of TAB and alignment issues.
Use an editor with TAB highlighter.

There's a trend to solve everything in python.
Don't have knowledge about python, but there's a 3rd image format for
NAND [1]. Could someone advise how to fit the extra XXX padding option
in the mkimage.py file? (Simon ?)

Could someone from Rockchip give info on whether the SD or SPI image
format has similarity to the NAND image format to reuse code? (Kever ?)

Missing are u-boot documents on Rockchip file formats itself other then
reading the /tools/rkxxx.c code.

Currently there's a small section about rkimage, rksd and rkspi in
README.rockchip. Move that to rockchip.rst as well when busy with image
formats in this serie?

Johan

===

[1]
[PATCH v4 11/19] rockchip: mkimage: add support for rockchip nand boot image
https://lore.kernel.org/u-boot/45576df80a77657cb2245ea1d1fc2e69908a909d.1502974488.git.paweljarosz3691@gmail.com/

> -		pad-byte = <0xff>;
> +    sdmmc-idbloader {
> +		filename = "idbloader.img";
>  
> -		blob {
> -			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-sdmmc.bin";
> +		pad-byte = <0xff>;
> +
> +        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


More information about the U-Boot mailing list