On Wed, Aug 22, 2018 at 2:18 AM, Jagdish Gediya <jagdish.ged...@nxp.com> wrote:
> Below is the sequence to embed dtb inside u-boot,
> 1. Remove bootpg and resetvec section if needed
> 2. Append dtb
> 3. Append bootpg and resetvec section back if removed previously
>
> Above procedure is required only when CONFIG_MPC85xx,
> CONFIG_BINMAN and CONFIG_OF_SEPARATE are defined.
>
> set PPC_MPC85XX_INCLUDE_DTB variable in Makefile if binman
> need to be used.
>
> set PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC variable in Makefile
> if bootpg and resetvec section need to be removed before appending
> dtb.
>
> Signed-off-by: Jagdish Gediya <jagdish.ged...@nxp.com>
> ---
>  Makefile | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 884b7d9..aad9dca 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -797,6 +797,13 @@ else
>  DO_STATIC_RELA =
>  endif
>
> +ifeq ($(CONFIG_MPC85xx)$(CONFIG_BINMAN)$(CONFIG_OF_SEPARATE),yyy)
> +PPC_MPC85XX_INCLUDE_DTB := y
> +ifeq ($(CONFIG_SYS_MPC85XX_NO_RESETVEC)$(CONFIG_NAND),)
> +PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC := y
> +endif
> +endif

This looks not good to me. Can you do the similar thing like x86? eg:
Not defining PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC here, instead use
Kconfig option to control the boot page and the reset vector. Besides,
the name itself is odd too.

> +
>  # Always append ALL so that arch config.mk's can add custom ones
>  ALL-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
>
> @@ -837,6 +844,10 @@ ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),)
>  ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
>  endif
>
> +ifeq ($(PPC_MPC85XX_INCLUDE_DTB),y)
> +ALL-y += u-boot-dtb.bin
> +endif
> +
>  # Build a combined spl + u-boot image for sunxi
>  ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
>  ALL-y += u-boot-sunxi-with-spl.bin
> @@ -938,7 +949,7 @@ u-boot-fit-dtb.bin: u-boot-nodtb.bin fit-dtb.blob
>
>  u-boot.bin: u-boot-fit-dtb.bin FORCE
>         $(call if_changed,copy)
> -else ifeq ($(CONFIG_OF_SEPARATE),y)
> +else ifeq ($(CONFIG_OF_SEPARATE)$(PPC_MPC85XX_INCLUDE_DTB),y)

This is a generic rule and we should not change it. The default rule
should work on mpc85xx too, like x86.

>  u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
>         $(call if_changed,cat)
>
> @@ -979,7 +990,8 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE
>         $(call if_changed,objcopy)
>
>  OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
> -               $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec)
> +               $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
> +               $(if $(PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC),-R .bootpg -R 
> .resetvec)
>
>  binary_size_check: u-boot-nodtb.bin FORCE
>         @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
> @@ -1222,6 +1234,18 @@ u-boot-x86-16bit.bin: u-boot FORCE
>         $(call if_changed,objcopy)
>  endif
>
> +ifeq ($(PPC_MPC85XX_INCLUDE_DTB), y)
> +u-boot-dtb.bin: u-boot.bin u-boot.dtb \
> +       $(if $(PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC), u-boot-br.bin) FORCE
> +       $(call if_changed,binman)
> +

See above comments. No need to add a mpc85xx-specific rule for u-boot-dtb.bin

> +ifeq ($(PPC_MPC85XX_REMOVE_BOOTPG_RESETVEC),y)
> +OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec
> +u-boot-br.bin: u-boot FORCE
> +       $(call if_changed,objcopy)
> +endif
> +endif
> +
>  ifneq ($(CONFIG_ARCH_SUNXI),)
>  ifeq ($(CONFIG_ARM64),)
>  u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE
> @@ -1291,6 +1315,8 @@ spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
>
>  ifeq ($(ARCH),arm)
>  UBOOT_BINLOAD := u-boot.img
> +else ifeq ($(PPC_MPC85XX_INCLUDE_DTB),y)
> +UBOOT_BINLOAD := u-boot-dtb.bin
>  else
>  UBOOT_BINLOAD := u-boot.bin
>  endif

Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to