[U-Boot] [PATCH 7/8][RESEND] powerpc: mpc85xx: Use binman to embed dtb inside u-boot

Jagdish Gediya jagdish.gediya at nxp.com
Tue Aug 21 18:18:26 UTC 2018


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.gediya at 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
+
 # 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)
 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)
+
+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
-- 
2.7.4



More information about the U-Boot mailing list