Tested on my PineTab 2 using rkusbboot. Tested-by: Dang Huynh <[email protected]> (RK3566 - PineTab 2)
On Saturday, August 2, 2025 10:07:21 PM Coordinated Universal Time Jonas Karlman wrote: > The BootROM in Rockchip SoCs will enter maskrom mode when boot firmware > cannot be found in nand/spi/mmc storage. > > In maskrom mode the USB OTG port can accept one of two custom commands. > > Initially a 0x471 command to load TPL into SRAM. After TPL has been > executed and it has returned back-to-BROM, a 0x472 command to load SPL > into start of DRAM. > > This series adds two binman images that can be used to RAM boot from > maskrom mode: > - u-boot-rockchip-usb471.bin that contains TPL to init DRAM. > - u-boot-rockchip-usb472.bin that contains SPL and the normal FIT > payload with i.e. U-Boot proper, TF-A and FDT. > > The config fragment rockchip-ramboot.config can be used to enable > building of these two binman images, e.g.: > > make generic-rk3588_defconfig rockchip-ramboot.config > > These binman images can be used with the proprietary rkbin boot_merger > tool to create a special loader image that can be used with tools such > as rkdeveloptool or rockusb tools to RAM boot from maskrom, e.g.: > > Create loader image: > $ ../rkbin/tools/boot_merger ./RK3588MINIALL.ini > > Boot from maskrom: > $ rkdeveloptool db u-boot-rockchip-rk3588-loader.bin > or > $ rockusb download-boot u-boot-rockchip-rk3588-loader.bin > > Another option that does not require use of proprietary tools is using > open source tools such as rkflashtool or rkusbboot that can load the > binman images directly without any need to first create a special loader > image to RAM boot from maskrom, e.g.: > > $ rkflashtool l < u-boot-rockchip-usb471.bin > $ rkflashtool L < u-boot-rockchip-usb472.bin > or > $ rkusbboot u-boot-rockchip-usb471.bin u-boot-rockchip-usb472.bin > > I am setting up a new personal lab for rockchip boards that primarily > will use this RAM boot method for testing new U-Boot and Linux builds. > > More detailed instructions on how RAM boot can be used will be added > under doc/board/rockchip/ in a follow-up series, after this series has > been accepted and my new lab is fully up and running. > > Changes in v3: > - Use read_brom_bootsource_id() to support RAM boot on RK3576 > - Add a rockchip-ramboot.config fragment to explicitly enable instead of > imply the new Kconfig option on a few select SoCs > - Update commit message to highlight that the binman images can be used > directly without use of the proprietary rkbin boot_merger tool > - Include a special patch, not intended to be merged, to demonstrate use > of RAM boot with rk loader images > > Changes in v2: > - Rebase on top of "rockchip: binman: Use a template for FIT and other > improvements" series > - Add patch to fix booting into Linux on RK3588 board with 16+ GiB DRAM > > This series depends on the "rockchip: Add support for ROCK 5B+" [1] and > "board: rockchip: Add Radxa ROCK 4D" [2] series for a clean apply. > See [3] for a branch including both depends. > > [1] https://patchwork.ozlabs.org/cover/2118033/ > [2] https://patchwork.ozlabs.org/cover/2118088/ > [3] > https://source.denx.de/u-boot/contributors/kwiboo/u-boot/-/commits/ramboot-> > v3 > > Jonas Karlman (4): > rockchip: Move TEXT_BASE to 8 MiB offset from start of DRAM > rockchip: Add support for RAM boot from maskrom mode > rockchip: sdram: Add fallback that fixup DRAM gaps on RK3588 > HACK: rockchip: Add miniall.ini files to simplify test of RAM boot > > RK3308MINIALL.ini | 22 +++++++++++++++++ > RK3328MINIALL.ini | 20 +++++++++++++++ > RK3399MINIALL.ini | 20 +++++++++++++++ > RK3528MINIALL.ini | 25 +++++++++++++++++++ > RK3566MINIALL.ini | 25 +++++++++++++++++++ > RK3568MINIALL.ini | 25 +++++++++++++++++++ > RK3576MINIALL.ini | 27 ++++++++++++++++++++ > RK3588MINIALL.ini | 25 +++++++++++++++++++ > arch/arm/dts/rockchip-u-boot.dtsi | 33 +++++++++++++++++++++++++ > arch/arm/mach-rockchip/Kconfig | 14 ++++++++--- > arch/arm/mach-rockchip/rk3308/Kconfig | 3 --- > arch/arm/mach-rockchip/rk3568/Kconfig | 3 --- > arch/arm/mach-rockchip/rk3588/Kconfig | 3 --- > arch/arm/mach-rockchip/rk3588/rk3588.c | 27 ++++++++++++++++++++ > arch/arm/mach-rockchip/sdram.c | 7 +++++- > arch/arm/mach-rockchip/spl-boot-order.c | 14 ++++++++--- > board/rockchip/rockchip-ramboot.config | 1 + > boot/Kconfig | 3 +++ > 18 files changed, 281 insertions(+), 16 deletions(-) > create mode 100644 RK3308MINIALL.ini > create mode 100644 RK3328MINIALL.ini > create mode 100644 RK3399MINIALL.ini > create mode 100644 RK3528MINIALL.ini > create mode 100644 RK3566MINIALL.ini > create mode 100644 RK3568MINIALL.ini > create mode 100644 RK3576MINIALL.ini > create mode 100644 RK3588MINIALL.ini > create mode 100644 board/rockchip/rockchip-ramboot.config

