[U-Boot] [PATCH v2 0/3] Introduce idbloader.img target for Makefile

Rockchip SoCs reqire the following deployment procedure for TPL/SPL:
./tools/mkimage -n rk3328 -T rksd -d ./tpl/u-boot-tpl.bin idbloader.img cat ./spl/u-boot-spl-dtb.bin >> idbloader.img dd if=idbloader.img of=/dev/mmcblk0 seek=64
The series is organized as the following. First patch introduces idbloader.img target for Makefile. The rest is for keeping the documentation up-to-date.
Changes since v2: - fix patch 5 - squash patches 2,3,5 into 2
Matwey V. Kornilov (3): rockchip, Makefile: add idbloader.img target doc: rockchip: use idbloader.img for rk3288, rk3328, rk3399 doc: lion_rk3368: use idbloader.img for rk3368
Makefile | 12 ++++++++++++ board/theobroma-systems/lion_rk3368/README | 4 +--- doc/README.rockchip | 21 ++------------------- 3 files changed, 15 insertions(+), 22 deletions(-)

Many Rockchip platforms require the same u-boot deploy procedure when TPL and SPL both enabled.
The following examples are taken from doc/README.rockchip and board/theobroma-systems/lion_rk3368/README:
RK3288:
./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out cat ./spl/u-boot-spl-dtb.bin >> out sudo dd if=out of=/dev/mmcblk0 seek=64
RK3328:
./tools/mkimage -n rk3328 -T rksd -d ./tpl/u-boot-tpl.bin idbloader.img cat ./spl/u-boot-spl.bin >> idbloader.img sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64
RK3368:
./tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img cat spl/u-boot-spl-dtb.bin >> spl-3368.img dd if=spl-3368.img of=/dev/sdb seek=64
RK3399:
./tools/mkimage -n rk3399 -T rksd -d ./tpl/u-boot-tpl-dtb.bin out cat ./spl/u-boot-spl-dtb.bin >> out sudo dd if=out of=/dev/sdc seek=64
Here, we introduce generic idbloader.img target which is the TPL image followed by the SPL binary.
Signed-off-by: Matwey V. Kornilov matwey.kornilov@gmail.com Reviewed-by: Kever Yang kever.yang@rock-chips.com --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/Makefile b/Makefile index 3b0864ae8e..eb12af9364 100644 --- a/Makefile +++ b/Makefile @@ -882,6 +882,10 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) ALL-y += u-boot-with-dtb.bin endif
+ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) +ALL-y += idbloader.img +endif + LDFLAGS_u-boot += $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. @@ -1293,6 +1297,14 @@ 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) +MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd +tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE + $(call if_changed,mkimage) +idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE + $(call if_changed,cat) +endif + ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)

Makefile now produces ready-to-deploy idbloader.img file.
Signed-off-by: Matwey V. Kornilov matwey.kornilov@gmail.com --- doc/README.rockchip | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/doc/README.rockchip b/doc/README.rockchip index 7d4dc1b33b..6007f3321e 100644 --- a/doc/README.rockchip +++ b/doc/README.rockchip @@ -276,9 +276,7 @@ As of now TPL is added on Vyasa-RK3288 board.
To write an image that boots from an SD card (assumed to be /dev/mmcblk0):
- ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out && - cat ./spl/u-boot-spl-dtb.bin >> out && - sudo dd if=out of=/dev/mmcblk0 seek=64 && + sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 && sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=16384
Booting from an SD card on RK3188 @@ -311,11 +309,6 @@ Booting from an SD card on Pine64 Rock64 (RK3328) For Rock64 rk3328 board the following three parts are required: TPL, SPL, and the u-boot image tree blob.
- - Create TPL/SPL image - - => tools/mkimage -n rk3328 -T rksd -d tpl/u-boot-tpl.bin idbloader.img - => cat spl/u-boot-spl.bin >> idbloader.img - - Write TPL/SPL image at 64 sector
=> sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 @@ -474,19 +467,9 @@ Hit any key to stop autoboot: 0
Option 3: Package the image with TPL:
- - Prefix rk3399 header to TPL image - - => cd /path/to/u-boot - => ./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl-dtb.bin out - - - Concatinate tpl with spl - - => cd /path/to/u-boot - => cat ./spl/u-boot-spl-dtb.bin >> out - - Write tpl+spl at 64th sector
- => sudo dd if=out of=/dev/sdc seek=64 + => sudo dd if=idbloader.img of=/dev/sdc seek=64
- Write U-Boot proper at 16384 sector

On 2019/9/4 上午12:29, Matwey V. Kornilov wrote:
Makefile now produces ready-to-deploy idbloader.img file.
Signed-off-by: Matwey V. Kornilov matwey.kornilov@gmail.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
doc/README.rockchip | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/doc/README.rockchip b/doc/README.rockchip index 7d4dc1b33b..6007f3321e 100644 --- a/doc/README.rockchip +++ b/doc/README.rockchip @@ -276,9 +276,7 @@ As of now TPL is added on Vyasa-RK3288 board.
To write an image that boots from an SD card (assumed to be /dev/mmcblk0):
- ./tools/mkimage -n rk3288 -T rksd -d ./tpl/u-boot-tpl.bin out &&
- cat ./spl/u-boot-spl-dtb.bin >> out &&
- sudo dd if=out of=/dev/mmcblk0 seek=64 &&
sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64 && sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 seek=16384
Booting from an SD card on RK3188
@@ -311,11 +309,6 @@ Booting from an SD card on Pine64 Rock64 (RK3328) For Rock64 rk3328 board the following three parts are required: TPL, SPL, and the u-boot image tree blob.
- Create TPL/SPL image
=> tools/mkimage -n rk3328 -T rksd -d tpl/u-boot-tpl.bin idbloader.img
=> cat spl/u-boot-spl.bin >> idbloader.img
Write TPL/SPL image at 64 sector
=> sudo dd if=idbloader.img of=/dev/mmcblk0 seek=64
@@ -474,19 +467,9 @@ Hit any key to stop autoboot: 0
Option 3: Package the image with TPL:
- Prefix rk3399 header to TPL image
=> cd /path/to/u-boot
=> ./tools/mkimage -n rk3399 -T rksd -d tpl/u-boot-tpl-dtb.bin out
- Concatinate tpl with spl
=> cd /path/to/u-boot
=> cat ./spl/u-boot-spl-dtb.bin >> out
- Write tpl+spl at 64th sector
=> sudo dd if=out of=/dev/sdc seek=64
=> sudo dd if=idbloader.img of=/dev/sdc seek=64
- Write U-Boot proper at 16384 sector

Makefile now produces ready-to-deploy idbloader.img file.
Signed-off-by: Matwey V. Kornilov matwey.kornilov@gmail.com --- board/theobroma-systems/lion_rk3368/README | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/board/theobroma-systems/lion_rk3368/README b/board/theobroma-systems/lion_rk3368/README index 83e4332984..ad3ac93bd4 100644 --- a/board/theobroma-systems/lion_rk3368/README +++ b/board/theobroma-systems/lion_rk3368/README @@ -18,8 +18,6 @@ Build the TPL/SPL stage =======================
make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm
- > tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img - > cat spl/u-boot-spl-dtb.bin >> spl-3368.img
Build the full U-Boot and a FIT image including the ATF ======================================================= @@ -35,7 +33,7 @@ Copy the SPL to offset 32k and the FIT image containing the payloads SD-Card -------
- > dd if=spl-3368.img of=/dev/sdb seek=64 + > dd if=idbloader.img of=/dev/sdb seek=64
dd if=u-boot.itb of=/dev/sdb seek=512
eMMC

On 2019/9/4 上午12:29, Matwey V. Kornilov wrote:
Makefile now produces ready-to-deploy idbloader.img file.
Signed-off-by: Matwey V. Kornilov matwey.kornilov@gmail.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
board/theobroma-systems/lion_rk3368/README | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/board/theobroma-systems/lion_rk3368/README b/board/theobroma-systems/lion_rk3368/README index 83e4332984..ad3ac93bd4 100644 --- a/board/theobroma-systems/lion_rk3368/README +++ b/board/theobroma-systems/lion_rk3368/README @@ -18,8 +18,6 @@ Build the TPL/SPL stage =======================
> make CROSS_COMPILE=aarch64-unknown-elf- ARCH=arm
tools/mkimage -n rk3368 -T rksd -d tpl/u-boot-tpl.bin spl-3368.img
cat spl/u-boot-spl-dtb.bin >> spl-3368.img
Build the full U-Boot and a FIT image including the ATF
@@ -35,7 +33,7 @@ Copy the SPL to offset 32k and the FIT image containing the payloads SD-Card
dd if=spl-3368.img of=/dev/sdb seek=64
dd if=idbloader.img of=/dev/sdb seek=64 dd if=u-boot.itb of=/dev/sdb seek=512
eMMC
participants (2)
-
Kever Yang
-
Matwey V. Kornilov