[v3,1/4] Makefile: Drop to handle rkspi image type

Message ID 20200604145141.356702-2-jagan@amarulasolutions.com
State New
Headers show
Series
  • rockchip: rk3399: Add SPI boot
Related show

Commit Message

Jagan Teki June 4, 2020, 2:51 p.m. UTC
On rockchip platforms, SPI boot image creation is not
straightforward like MMC boot image creation where former
requires to specify tpl, spl in multimage format in mkimage,
and later simply do a concatenate mkimaged-tpl with spl.

On this note, let drop rkspi image type creation via kbuild
and let inform via rockchip.rst

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
Changes for v3:
- none

 Makefile | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Philipp Tomsich June 4, 2020, 2:55 p.m. UTC | #1
> On 04.06.2020, at 16:51, Jagan Teki <jagan@amarulasolutions.com> wrote:
> 
> On rockchip platforms, SPI boot image creation is not
> straightforward like MMC boot image creation where former
> requires to specify tpl, spl in multimage format in mkimage,
> and later simply do a concatenate mkimaged-tpl with spl.
> 
> On this note, let drop rkspi image type creation via kbuild
> and let inform via rockchip.rst
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
> ---
> Changes for v3:
> - none
> 
> Makefile | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 3851dd9fa0..db3b6b9991 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1438,22 +1438,15 @@ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
> 
> ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
> 
> -# rockchip image type
> -ifeq ($(CONFIG_SPL_SPI_LOAD),y)
> -ROCKCHIP_IMG_TYPE := rkspi
> -else
> -ROCKCHIP_IMG_TYPE := rksd
> -endif

This should not be either-or, but rather allow the creation of both a SPI and SD/eMMC image
for a platform, if so desired — e.g. the RK3399-Q7 supports both SPI and eMMC boot and it
is a user-choice which location will be used for the bootloader.

In other words: make this a “checkbox” option in Kconfig and output a rkspi, a rksd or both
images depending on what is selected.

Thanks,
Philipp.

> -
> # TPL + SPL
> ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
> -MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
> +MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd
> tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
> 	$(call if_changed,mkimage)
> idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
> 	$(call if_changed,cat)
> else
> -MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
> +MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd
> idbloader.img: spl/u-boot-spl.bin FORCE
> 	$(call if_changed,mkimage)
> endif
> -- 
> 2.25.1
>
Jagan Teki June 4, 2020, 3:08 p.m. UTC | #2
On Thu, Jun 4, 2020 at 8:25 PM Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
>
>
> > On 04.06.2020, at 16:51, Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > On rockchip platforms, SPI boot image creation is not
> > straightforward like MMC boot image creation where former
> > requires to specify tpl, spl in multimage format in mkimage,
> > and later simply do a concatenate mkimaged-tpl with spl.
> >
> > On this note, let drop rkspi image type creation via kbuild
> > and let inform via rockchip.rst
> >
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
> > ---
> > Changes for v3:
> > - none
> >
> > Makefile | 11 ++---------
> > 1 file changed, 2 insertions(+), 9 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 3851dd9fa0..db3b6b9991 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1438,22 +1438,15 @@ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
> >
> > ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
> >
> > -# rockchip image type
> > -ifeq ($(CONFIG_SPL_SPI_LOAD),y)
> > -ROCKCHIP_IMG_TYPE := rkspi
> > -else
> > -ROCKCHIP_IMG_TYPE := rksd
> > -endif
>
> This should not be either-or, but rather allow the creation of both a SPI and SD/eMMC image
> for a platform, if so desired — e.g. the RK3399-Q7 supports both SPI and eMMC boot and it
> is a user-choice which location will be used for the bootloader.
>
> In other words: make this a “checkbox” option in Kconfig and output a rkspi, a rksd or both
> images depending on what is selected.

Agree on the point that the build cannot create images when SPI or
both SPI/MMC enabled. I do have a patch to take care of that but the
SPI boot image creation in TPL-flow seems not building via Makefile.

./tools/mkimage -n rk3399 -T rkspi -d
tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img

Technically this patch allows us to build MMC boot image since it is a
default boot image requirement for most of the board.  And yes will
try to update Makefile once I have fixed the above problem with SPI
TPL-flow.

Jagan.

Patch

diff --git a/Makefile b/Makefile
index 3851dd9fa0..db3b6b9991 100644
--- a/Makefile
+++ b/Makefile
@@ -1438,22 +1438,15 @@  u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
 
 ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
 
-# rockchip image type
-ifeq ($(CONFIG_SPL_SPI_LOAD),y)
-ROCKCHIP_IMG_TYPE := rkspi
-else
-ROCKCHIP_IMG_TYPE := rksd
-endif
-
 # TPL + SPL
 ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
-MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
+MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd
 tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
 	$(call if_changed,mkimage)
 idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
 	$(call if_changed,cat)
 else
-MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
+MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd
 idbloader.img: spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 endif