diff mbox series

[U-Boot,v2,7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399

Message ID 20190428090913.10568-8-jagan@amarulasolutions.com
State Superseded
Delegated to: Kever Yang
Headers show
Series rk3399: make u-boot-rockchip-with-spl.bin | expand

Commit Message

Jagan Teki April 28, 2019, 9:09 a.m. UTC
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.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 arch/arm/mach-rockchip/Kconfig |  8 ++++++++
 doc/README.rockchip            |  3 +--
 scripts/Makefile.spl           | 21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

Comments

Kever Yang May 7, 2019, 6:34 a.m. UTC | #1
Hi Jagan,

On 04/28/2019 05:09 PM, Jagan Teki wrote:
> 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.

    rk3399 may have TPL like other SoCs, for there will be image types:

SPL+u-boot.bin

SPL+u-boot.itb

TPL+SPL+u-boot.itb

Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?

Is it possible to make it more generic?


Thanks,

- Kever

>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  arch/arm/mach-rockchip/Kconfig |  8 ++++++++
>  doc/README.rockchip            |  3 +--
>  scripts/Makefile.spl           | 21 +++++++++++++++++++++
>  3 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index dbe7f11d39..286c870135 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -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
> diff --git a/doc/README.rockchip b/doc/README.rockchip
> index c4e5f83da7..ccbaaaa9a7 100644
> --- a/doc/README.rockchip
> +++ b/doc/README.rockchip
> @@ -421,11 +421,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.bin of=/dev/sdc seek=64
>  
>    - Write U-Boot proper at 16384 sector
>  
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 54b160d72b..49c0641aa2 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -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      $@
Jagan Teki May 7, 2019, 6:44 a.m. UTC | #2
On Tue, May 7, 2019 at 12:04 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Hi Jagan,
>
> On 04/28/2019 05:09 PM, Jagan Teki wrote:
> > 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.
>
>     rk3399 may have TPL like other SoCs, for there will be image types:
>
> SPL+u-boot.bin
>
> SPL+u-boot.itb
>
> TPL+SPL+u-boot.itb
>
> Seems this patch and 9/9 of this patch set only cover SPL+u-boot.itb?
>
> Is it possible to make it more generic?

Yes, I have watched your TPL changes. and we can extend this to
support TPL to make combination of all images.
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index dbe7f11d39..286c870135 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -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
diff --git a/doc/README.rockchip b/doc/README.rockchip
index c4e5f83da7..ccbaaaa9a7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -421,11 +421,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.bin of=/dev/sdc seek=64
 
   - Write U-Boot proper at 16384 sector
 
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 54b160d72b..49c0641aa2 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -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      $@