Skip to contentSkip to conversation

Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

PATCH In review Jagan Teki 4 participants 4 messages Apr 25, 2019 – Apr 26, 2019 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH 1/1 Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

Rockchip platform would require an explicit call to mkimage for creating bootable images which indeed specific to SoC family along with boot devices.

Example of creating bootable image for rk3399 family with SD boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support other families of SoC's with variety of boot stages like TPL, SPL.

---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/Kconfig +8 -0
index dbe7f11d39..286c870135 100644
@@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
 config ROCKCHIP_BROM_HELPER
 	bool
 
+config SPL_ROCKCHIP_IMG_NAME
+	string "SPL Rockchip image name"
+	default "rk3399" if ROCKCHIP_RK3399
+	help
+	  To create SPL image for rockchip targets the image name would
+	  depends on the SoC family that would pass as an argument as
+	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
+
 config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
         bool "SPL requires early-return (for RK3188-style BROM) to BROM"
 	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
doc/README.rockchip +1 -2
index e8f6a2dfba..6341f47b21 100644
@@ -399,11 +399,10 @@ Option 2: Package the image with SPL:
   - Prefix rk3399 header to SPL image
 
     => cd /path/to/u-boot
-    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
 
   - Write prefixed SPL at 64th sector
 
-    => sudo dd if=out of=/dev/sdc seek=64
+    => sudo dd if=spl/u-boot-spl-rockchip.dtb of=/dev/sdc seek=64
 
   - Write U-Boot proper at 16384 sector
 
scripts/Makefile.spl +21 -0
index 54b160d72b..49c0641aa2 100644
@@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
 
 ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
 
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
+endif
+
 all:	$(ALL-y)
 
 quiet_cmd_cat = CAT     $@
@@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
 $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 
+# Rockchip specific SPL build
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+
+ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
+ROCKCHIP_IMG_TYPE := rkspi
+else
+ROCKCHIP_IMG_TYPE := rksd
+endif
+
+MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \
+	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
+
+$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+
+endif # CONFIG_ROCKCHIP_RK3399
+
 # Rule to link u-boot-spl
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot-spl ?= LD      $@
Signature · 6 lines
2.18.0.321.gffc6fa0e3

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot
#1 lore raw

Hi,

Quoted 45 lines · Jagan Teki

Rockchip platform would require an explicit call to mkimage for creating bootable images which indeed specific to SoC family along with boot devices.

Example of creating bootable image for rk3399 family with SD boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support other families of SoC's with variety of boot stages like TPL, SPL.

---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/Kconfig +8 -0
index dbe7f11d39..286c870135 100644
@@ -222,6 +222,14 @@ config ROCKCHIP_SPL_RESERVE_IRAM
 config ROCKCHIP_BROM_HELPER
 	bool
 
+config SPL_ROCKCHIP_IMG_NAME
+	string "SPL Rockchip image name"
+	default "rk3399" if ROCKCHIP_RK3399
+	help
+	  To create SPL image for rockchip targets the image name would
+	  depends on the SoC family that would pass as an argument as
+	  '-n rk3399' to mkimage for creating Rockchip SPL boot image.
+
 config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
         bool "SPL requires early-return (for RK3188-style BROM) to BROM"
 	depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
doc/README.rockchip +0 -0
index e8f6a2dfba..6341f47b21 100644

doc/README.rockchip Option 2: Package the image with SPL: · line 405

Quoted 9 lines
doc/README.rockchip +1 -2
@@ -399,11 +399,10 @@ Option 2: Package the image with SPL:
   - Prefix rk3399 header to SPL image
 
     => cd /path/to/u-boot
-    => ./tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl-dtb.bin out
 
   - Write prefixed SPL at 64th sector
 
-    => sudo dd if=out of=/dev/sdc seek=64
+    => sudo dd if=spl/u-boot-spl-rockchip.dtb of=/dev/sdc seek=64

u-boot-spl-rockchip.bin?

Regards,
Jack.

Quoted 33 lines
doc/README.rockchip +0 -0
   - Write U-Boot proper at 16384 sector
 
scripts/Makefile.spl +14 -0
index 54b160d72b..49c0641aa2 100644
@@ -235,6 +235,10 @@ ALL-$(CONFIG_ARCH_ZYNQMP)	+= $(obj)/boot.bin
 
 ALL-$(CONFIG_ARCH_MEDIATEK)	+= $(obj)/u-boot-spl-mtk.bin
 
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP)	+= $(obj)/u-boot-spl-rockchip.bin
+endif
+
 all:	$(ALL-y)
 
 quiet_cmd_cat = CAT     $@
@@ -369,6 +373,23 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \
 $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 
+# Rockchip specific SPL build
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+
+ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y)
+ROCKCHIP_IMG_TYPE := rkspi
+else
+ROCKCHIP_IMG_TYPE := rksd
+endif
+
+MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SPL_ROCKCHIP_IMG_NAME) \

scripts/Makefile.spl MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \ · line 395

Quoted 10 lines
scripts/Makefile.spl +7 -0
+	-T $(ROCKCHIP_IMG_TYPE) -d $(MKIMAGEOUTPUT)
+
+$(obj)/u-boot-spl-rockchip.bin: $(obj)/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+
+endif # CONFIG_ROCKCHIP_RK3399
+
 # Rule to link u-boot-spl
 # May be overridden by arch/$(ARCH)/config.mk
 quiet_cmd_u-boot-spl ?= LD      $@

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

A message that is not in the archive (sent off-list or not yet received): 20190425175431.15370-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

#3 lore raw

Hi Jagan,

Quoted 15 lines · Jagan Teki

Rockchip platform would require an explicit call to mkimage for creating bootable images which indeed specific to SoC family along with boot devices.

Example of creating bootable image for rk3399 family with SD boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support other families of SoC's with variety of boot stages like TPL, SPL.

Quoted 6 lines
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

Can we set this up to use binman? That would also allow us to produce an image with padding so that we can use a simpler dd command.

Regards,
Simon

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ0bVGMr-y8hct8XMjgiOLFFLp9monhXnx3cgVrn-pbitw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw

Hi Simon,

Quoted 26 lines · Simon Glass

Hi Jagan,

Quoted 15 lines · Jagan Teki

Rockchip platform would require an explicit call to mkimage for creating bootable images which indeed specific to SoC family along with boot devices.

Example of creating bootable image for rk3399 family with SD boot device as

₹ mkimage -n rk3399 -T rksd -d ./spl/u-boot-spl-dtb.bin u-boot-spl-rockchip.bin

This patch would do the same think via Makefile.spl for rk3399.

This would be an initial version and it can easily expand further to support other families of SoC's with variety of boot stages like TPL, SPL.

Quoted 6 lines
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)
Quoted 2 lines

Can we set this up to use binman? That would also allow us to produce an image with padding so that we can use a simpler dd command.

Yes, ie what that I planned initially and fired some issue. will try again and post if I succeed.

Jagan.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip