Skip to contentSkip to conversation

Introduce idbloader.img target for Makefile

PATCH New Matwey V. Kornilov 2 participants 6 messages Sep 3, 2019 – Sep 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
2.16.4
#1 lore raw

PATCH v2 1/3 rockchip, Makefile: add idbloader.img target

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.

---
 Makefile | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Makefile +12 -0
index 3b0864ae8e..eb12af9364 100644
@@ -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)
 
Signature · 1 line
2.16.4
#2 lore raw

PATCH v2 2/3 doc: rockchip: use idbloader.img for rk3288, rk3328, rk3399

In reply to Matwey V. Kornilov

Makefile now produces ready-to-deploy idbloader.img file.

---
 doc/README.rockchip | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
doc/README.rockchip +2 -19
index 7d4dc1b33b..6007f3321e 100644
@@ -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
 
Signature · 1 line
2.16.4
#3 lore raw

PATCH v2 2/3 doc: rockchip: use idbloader.img for rk3288, rk3328, rk3399

Quoted 3 lines · Matwey V. Kornilov

Makefile now produces ready-to-deploy idbloader.img file.

Thanks,
- Kever

Quoted 52 lines
---
  doc/README.rockchip | 21 ++-------------------
  1 file changed, 2 insertions(+), 19 deletions(-)
doc/README.rockchip +2 -19
index 7d4dc1b33b..6007f3321e 100644
@@ -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
 
#4 lore raw

PATCH v2 3/3 doc: lion_rk3368: use idbloader.img for rk3368

In reply to Matwey V. Kornilov

Makefile now produces ready-to-deploy idbloader.img file.

---
 board/theobroma-systems/lion_rk3368/README | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
board/theobroma-systems/lion_rk3368/README +1 -3
index 83e4332984..ad3ac93bd4 100644
@@ -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
Signature · 1 line
2.16.4
#5 lore raw

PATCH v2 3/3 doc: lion_rk3368: use idbloader.img for rk3368

Quoted 3 lines · Matwey V. Kornilov

Makefile now produces ready-to-deploy idbloader.img file.

Thanks,
- Kever

Quoted 26 lines
---
  board/theobroma-systems/lion_rk3368/README | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
board/theobroma-systems/lion_rk3368/README +1 -3
index 83e4332984..ad3ac93bd4 100644
@@ -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