Build Rockchip final images using binman
Subsystems (4)
cover Build Rockchip final images using binman
My original goal was to produce SPI images for Rockchip platforms (specifically for me, ROCKPro64, and in the future ROCK64). Looking into it, it seemed nicer to just switch the SD/MMC image generation over to binman as well in the process.
This is my attempt to move Rockchip final full image generation to binman, adding the option to make full SPI images as well. I'm sending this as RFC patches because I'm not sure whether this is the ideal way to do this, whether this is even something we'd even want to do, and exactly what I might be breaking by doing this.
Other questions:
- I noticed that ATF generation for ARM64 Rockchip is done via a Python script instead of binman. I don't currently know how to change that over to binman, but is that something worth pursuing as part of this?
Please give me your feedback!
Andrew Abbott (8):
binman: mkimage: Support ':'-separated inputs
rockchip: Add binman definitions for final images
soc: rockchip: Include common U-Boot dtsi file
board: rockchip: Move SPI U-Boot offset to config
rockchip: Remove obsolete Makefile targets
rockchip: Enable binman for ARM64
doc: rockchip: Update for new binman image generation
board: rockpro64: Enable building SPI image
Kconfig | 4 +- Makefile | 31 +--------- arch/arm/Kconfig | 2 +- arch/arm/dts/rk3308-u-boot.dtsi | 2 + arch/arm/dts/rk3328-u-boot.dtsi | 2 + arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi | 1 - arch/arm/dts/rk3368-u-boot.dtsi | 1 + arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 -- arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 1 - arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 4 -- arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 4 -- arch/arm/dts/rk3568-u-boot.dtsi | 2 + arch/arm/dts/rockchip-u-boot.dtsi | 59 ++++++++++++++++++-- arch/arm/mach-rockchip/Kconfig | 7 +-- arch/arm/mach-rockchip/rk3399/Kconfig | 1 + configs/lion-rk3368_defconfig | 1 + configs/pinebook-pro-rk3399_defconfig | 1 + configs/puma-rk3399_defconfig | 2 +- configs/roc-pc-rk3399_defconfig | 1 + configs/rockpro64-rk3399_defconfig | 1 + doc/board/rockchip/rockchip.rst | 34 ++++------- tools/binman/etype/mkimage.py | 33 +++++++---- 22 files changed, 107 insertions(+), 91 deletions(-)
Signature · 1 line
2.35.3
RFC PATCH 1/8 binman: mkimage: Support ':'-separated inputs
mkimage supports combining multiple input binaries separating them with colons (':'). This is used at least for Rockchip platforms to encode payload offsets and sizes in the image header. It is required for Rockchip SPI boot since for the rkspi format, after the input binary combining, the entire image is spread across only the first 2K bytes of each 4K block.
Previous to this change, multiple inputs to a binman mkimage node would just be concatenated and the combined input would be passed as the -d argument to mkimage. Now, the inputs are instead passed colon-separated.
---
This is a bit of a messy implementation for now and would probably break existing uses of mkimage that rely on the concatenation behaviour.
Questions:
- Should this be a separate entry type, or an option to the mkimage entry type that enables this behaviour?
- What kind of test(s) should I add?
--- tools/binman/etype/mkimage.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
tools/binman/etype/mkimage.py +21 -12
@@ -51,21 +51,30 @@ class Entry_mkimage(Entry): self.ReadEntries() def ObtainContents(self): - # Use a non-zero size for any fake files to keep mkimage happy - data, input_fname, uniq = self.collect_contents_to_file( - self._mkimage_entries.values(), 'mkimage', 1024) - if data is None: - return False - output_fname = tools.get_output_filename('mkimage-out.%s' % uniq) - if self.mkimage.run_cmd('-d', input_fname, *self._args, - output_fname) is not None: + # For multiple inputs to mkimage, we want to separate them by colons. + # This is needed for eg. the rkspi format, which treats the first data + # file as the "init" and the second as "boot" and sets the image header + # accordingly, then makes the image so that only the first 2 KiB of each + # 4KiB block is used. + + data_filenames = [] + for entry in self._mkimage_entries.values(): + # First get the input data and put it in a file. If any entry is not + # available, try later. + if not entry.ObtainContents(): + return False + + input_fname = tools.get_output_filename('mkimage-in.%s' % entry.GetUniqueName()) + data_filenames.append(input_fname) + tools.write_file(input_fname, entry.GetData()) + + output_fname = tools.get_output_filename('mkimage-out.%s' % self.GetUniqueName()) + if self.mkimage.run_cmd('-d', ":".join(data_filenames), *self._args, output_fname): self.SetContents(tools.read_file(output_fname)) + return True else: - # Bintool is missing; just use the input data as the output self.record_missing_bintool(self.mkimage) - self.SetContents(data) - - return True + return False def ReadEntries(self): """Read the subnodes to find out what should go in this image"""
Signature · 1 line
2.35.3
RFC PATCH 2/8 rockchip: Add binman definitions for final images
In reply to Andrew AbbottCurrently, 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.
---
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(-)
arch/arm/dts/rockchip-u-boot.dtsi +53 -6
@@ -13,17 +13,64 @@ #ifdef CONFIG_SPL &binman { - simple-bin { - filename = "u-boot-rockchip.bin"; - 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
arch/arm/mach-rockchip/Kconfig +3 -4
@@ -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
Signature · 1 line
2.35.3
RFC PATCH 3/8 soc: rockchip: Include common U-Boot dtsi file
In reply to Andrew AbbottThis pulls in binman definitions so images can be built for all Rockchip platforms.
--- arch/arm/dts/rk3308-u-boot.dtsi | 2 ++ arch/arm/dts/rk3328-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-u-boot.dtsi | 1 + arch/arm/dts/rk3568-u-boot.dtsi | 2 ++ 4 files changed, 7 insertions(+)
arch/arm/dts/rk3308-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ *(C) Copyright 2019 Rockchip Electronics Co., Ltd */ +#include "rockchip-u-boot.dtsi" + / { aliases { mmc0 = &emmc;
arch/arm/dts/rk3328-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * (C) Copyright 2019 Rockchip Electronics Co., Ltd */ +#include "rockchip-u-boot.dtsi" + / { aliases { mmc0 = &emmc;
arch/arm/dts/rk3368-u-boot.dtsi +1 -0
@@ -3,6 +3,7 @@ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH */ +#include "rockchip-u-boot.dtsi" #include <dt-bindings/memory/rk3368-dmc.h> / {
arch/arm/dts/rk3568-u-boot.dtsi +2 -0
@@ -3,6 +3,8 @@ * (C) Copyright 2021 Rockchip Electronics Co., Ltd */ +#include "rockchip-u-boot.dtsi" + / { aliases { mmc0 = &sdhci;
Signature · 1 line
2.35.3
RFC PATCH 4/8 board: rockchip: Move SPI U-Boot offset to config
In reply to Andrew AbbottThis needs to be accessible to binman (via CONFIG_ preprocessor macros) so it can build SPI images using the correct offset.
The documentation at 'doc/device-tree-bindings/config.txt' says that the 'u-boot,spl-payload-offset' device tree option simply overrides 'CONFIG_SYS_SPI_U_BOOT_OFFS', so this change should not functionally change the offset for any of the affected boards.
--- arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi | 1 - arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 4 ---- arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 1 - arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 4 ---- arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 4 ---- configs/lion-rk3368_defconfig | 1 + configs/pinebook-pro-rk3399_defconfig | 1 + configs/puma-rk3399_defconfig | 2 +- configs/roc-pc-rk3399_defconfig | 1 + configs/rockpro64-rk3399_defconfig | 1 + 10 files changed, 5 insertions(+), 15 deletions(-)
arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi +0 -1
@@ -7,7 +7,6 @@ / { config { - u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */ u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */ };
arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi +0 -4
@@ -10,10 +10,6 @@ chosen { u-boot,spl-boot-order = "same-as-spl", &sdhci, &spiflash, &sdmmc; }; - - config { - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */ - }; }; &edp {
arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi +0 -1
@@ -14,7 +14,6 @@ / { config { - u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */ u-boot,mmc-env-offset = <0x4000>; /* @ 16KB */ u-boot,efi-partition-entries-offset = <0x200000>; /* 2MB */ u-boot,boot-led = "module_led";
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi +0 -4
@@ -11,10 +11,6 @@ u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdhci, &sdmmc; }; - config { - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */ - }; - vcc_hub_en: vcc_hub_en-regulator { compatible = "regulator-fixed"; enable-active-high;
arch/arm/dts/rk3399-rockpro64-u-boot.dtsi +0 -4
@@ -9,10 +9,6 @@ chosen { u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci; }; - - config { - u-boot,spl-payload-offset = <0x60000>; /* @ 384KB */ - }; }; &spi1 {
configs/lion-rk3368_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_DEBUG_UART_BASE=0xFF180000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART=y CONFIG_FIT=y
configs/pinebook-pro-rk3399_defconfig +1 -0
@@ -24,6 +24,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPIO=y
configs/puma-rk3399_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200 CONFIG_SPL_I2C=y CONFIG_SPL_POWER=y CONFIG_SPL_SPI_LOAD=y -CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000 +CONFIG_SYS_SPI_U_BOOT_OFFS=0x40000 CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y
configs/roc-pc-rk3399_defconfig +1 -0
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x20000 CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y
configs/rockpro64-rk3399_defconfig +1 -0
@@ -23,6 +23,7 @@ CONFIG_MISC_INIT_R=y CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 CONFIG_TPL=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_GPT=y
Signature · 1 line
2.35.3
RFC PATCH 5/8 rockchip: Remove obsolete Makefile targets
In reply to Andrew AbbottThese are obsoleted by a previous patch which added binman image definitions for Rockchip SD/MMC and SPI images.
--- Makefile | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-)
Makefile +3 -28
@@ -984,16 +984,15 @@ INPUTS-y += u-boot-with-dtb.bin endif ifeq ($(CONFIG_ARCH_ROCKCHIP),y) -# On ARM64 this target is produced by binman so we don't need this dep ifeq ($(CONFIG_ARM64),y) ifeq ($(CONFIG_SPL),y) # TODO: Get binman to generate this too -INPUTS-y += u-boot-rockchip.bin +INPUTS-y += u-boot.itb endif else ifeq ($(CONFIG_SPL),y) -# Generate these inputs for binman which will create the output files -INPUTS-y += idbloader.img u-boot.img +# Generate this input for binman which will create the output files +INPUTS-y += u-boot.img endif endif endif
@@ -1481,30 +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_ROCKCHIP),y) - -# TPL + SPL -ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy) -MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd -tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE - $(call if_changed,mkimage) -idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE - $(call if_changed,cat) -else -MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd -idbloader.img: spl/u-boot-spl.bin FORCE - $(call if_changed,mkimage) -endif - -ifeq ($(CONFIG_ARM64),y) -OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \ - --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff -u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE - $(call if_changed,pad_cat) -endif # CONFIG_ARM64 - -endif # CONFIG_ARCH_ROCKCHIP - ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
Signature · 1 line
2.35.3
RFC PATCH 7/8 doc: rockchip: Update for new binman image generation
In reply to Andrew Abbott--- doc/board/rockchip/rockchip.rst | 34 +++++++++++---------------------- 1 file changed, 11 insertions(+), 23 deletions(-)
doc/board/rockchip/rockchip.rst +11 -23
@@ -172,14 +172,14 @@ Flashing SD Card ^^^^^^^ -All Rockchip platforms (except rk3128 which doesn't use SPL) are now -supporting a single boot image using binman and pad_cat. +All Rockchip platforms, (except rk3128 which doesn't use SPL) generate a +SD/MMC full boot image using binman. To write an image that boots from a SD card (assumed to be /dev/sda): .. code-block:: bash - sudo dd if=u-boot-rockchip.bin of=/dev/sda seek=64 + sudo dd if=u-boot-rockchip-sdmmc.bin of=/dev/sda seek=64 sync eMMC
@@ -224,31 +224,19 @@ is u-boot-dtb.img SPI ^^^ -The SPI boot method requires the generation of idbloader.img with help of the mkimage tool. +Some platforms also generate a SPI flash full boot image, controlled by the +CONFIG_ROCKCHIP_SPI_IMAGE configuration option. -SPL-alone SPI boot image: +This image can be copied onto an SD card and written to SPI flash. Note that +the offset at which the image should be written to is different between SoCs. -.. code-block:: bash - - ./tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin idbloader.img - -TPL+SPL SPI boot image: - -.. code-block:: bash - - ./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img +* RK3399: 0x0 -Copy SPI boot images into SD card and boot from SD: - -.. code-block:: bash +Replace <offset> with the offset for your SoC:: sf probe - load mmc 1:1 $kernel_addr_r idbloader.img - sf erase 0 +$filesize - sf write $kernel_addr_r 0 ${filesize} - load mmc 1:1 ${kernel_addr_r} u-boot.itb - sf erase 0x60000 +$filesize - sf write $kernel_addr_r 0x60000 ${filesize} + load mmc 1:1 $kernel_addr_r u-boot-rockchip-spi.bin + sf update $kernel_addr_r <offset> ${filesize} 2. Package the image with Rockchip miniloader ---------------------------------------------
Signature · 1 line
2.35.3
RFC PATCH 6/8 rockchip: Enable binman for ARM64
In reply to Andrew AbbottBinman is now being used to build the final flashable images for Rockchip devices, thus enabling it for all Rockchip targets here. But it is not yet being used to generate the FIT image (u-boot.itb), thus we need to force it to be built.
---
Question: Will this causes issues with eg. Chromebook gru/bob, which build u-boot.itb with binman already?
--- Kconfig | 4 ++-- arch/arm/Kconfig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Kconfig +2 -2
@@ -406,8 +406,8 @@ config BUILD_TARGET default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5 default "u-boot-spl.kwb" if ARCH_MVEBU && SPL default "u-boot-elf.srec" if RCAR_GEN3 - default "u-boot.itb" if !BINMAN && SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ - ARCH_SUNXI || RISCV || ARCH_ZYNQMP) + default "u-boot.itb" if ARCH_ROCKCHIP || (!BINMAN && SPL_LOAD_FIT && \ + (ARCH_SUNXI || RISCV || ARCH_ZYNQMP)) default "u-boot.kwb" if ARCH_KIRKWOOD default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT default "u-boot-with-spl.imx" if ARCH_MX6 && SPL
arch/arm/Kconfig +1 -1
@@ -1961,7 +1961,7 @@ config ARCH_STM32MP config ARCH_ROCKCHIP bool "Support Rockchip SoCs" select BLK - select BINMAN if SPL_OPTEE || (SPL && !ARM64) + select BINMAN if SPL select DM select DM_GPIO select DM_I2C
Signature · 1 line
2.35.3
RFC PATCH 8/8 board: rockpro64: Enable building SPI image
In reply to Andrew Abbott--- arch/arm/mach-rockchip/rk3399/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/rk3399/Kconfig +1 -0
@@ -84,6 +84,7 @@ config TARGET_ROCK960_RK3399 config TARGET_ROCKPRO64_RK3399 bool "Pine64 Rockpro64 board" + select ROCKCHIP_SPI_IMAGE help Rockro64 is SBC produced by Pine64. Key features:
Signature · 1 line
2.35.3
Re: [RFC PATCH 2/8] rockchip: Add binman definitions for final images
In reply to Andrew AbbottQuoted 48 lines · Andrew Abbott
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 (seec4cea2bbf995764f325a907061c22ecd6768cf7b).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_IMAGEconfig setting - it now means to generate a generic SPI flash image, in addition to the generic SD/MMC image.Signed-off-by Andrew Abbott <[email protected]>---
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(-)arch/arm/dts/rockchip-u-boot.dtsi +0
-0
arch/arm/dts/rockchip-u-boot.dtsi line 18
Quoted 6 lines
arch/arm/dts/rockchip-u-boot.dtsi +0
-2@@ -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/
Quoted 85 lines
arch/arm/dts/rockchip-u-boot.dtsi +53
-4- 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_SPLarch/arm/mach-rockchip/Kconfig +3
-4@@ -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
Re: [RFC PATCH 2/8] rockchip: Add binman definitions for final images
Quoted 7 lines · Johan Jonker
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.
Quoted 6 lines
"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.
Thanks for your feedback! I'll fix whitespace issues in all the patches in the next version, as well as renaming "u-boot-rockchip-sdmmc.bin" to "u-boot-rockchip.bin" - that should be equivalent to the original output.
Regards,
Andrew
Re: [RFC PATCH 2/8] rockchip: Add binman definitions for final images
In reply to Johan JonkerQuoted 6 lines · Johan Jonker
[...]
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 themkimage.pyfile? (Simon ?)
Binman's mkimage support is mostly a wrapper around the mkimage executable, so that patch would need to be applied first. Assuming you want to run something like the example in that patch:
Quoted 1 line
mkimage -n rk3066 -T rknand -d <tpl>:<spl> -X 16384,1 <out>
I think you'd only need something like the first patch of this series for binman to get the multiple inputs working, and I expect a binman dtb fragment like the following would then work for the above command:
mkimage {
args = "-n", CONFIG_SYS_SOC, "-T", "rknand", "-X", "16384,1";
u-boot-tpl {
};
u-boot-spl {
};
};Quoted 5 lines
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.
(I don't know the formats' details, so can't comment on those.)
Quoted 11 lines
Currently there's a small section about rkimage, rksd and rkspi in README.rockchip. Move that to
rockchip.rstas 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/