[PATCH u-boot 2/2] Makefile: Build working u-boot-dtb.bin target also for mpc85xx

Pali Rohár pali at kernel.org
Wed Dec 28 21:04:37 CET 2022


U-Boot build process currently always produces broken u-boot-dtb.bin binary
for PowerPC mpc85xx architecture on boards which needs mpc85xx reset
vector. For these boards this (intermediate) binary is not used as input
for any other Makefile target on this architecture, so there is no real
problem with it.

But it is not a good idea to produce broken binaries during build phase. So
try to improve it. Binary u-boot-dtb.bin should contains u-boot code with
DTB blob. Such binary for those boards is build by binman. So change binman
output file name from u-boot.bin to u-boot-dtb.bin and then let generic
Makefile rule to generate final u-boot.bin from u-boot-dtb.bin. And finally
disable generic u-boot-dtb.bin rule for mpc85xx.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 Makefile                              | 17 ++++++++---------
 arch/powerpc/dts/socrates-u-boot.dtsi |  2 +-
 arch/powerpc/dts/u-boot.dtsi          |  2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 117adb1cd8da..3c0f783f633e 100644
--- a/Makefile
+++ b/Makefile
@@ -1201,30 +1201,29 @@ endif
 u-boot.bin: u-boot-fit-dtb.bin FORCE
 	$(call if_changed,copy)
 
+ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
 ifneq ($(CONFIG_TARGET_SOCRATES),y)
 u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
 	$(call if_changed,cat)
 endif
+endif
 
 else ifeq ($(CONFIG_OF_SEPARATE).$(CONFIG_OF_OMIT_DTB),y.)
+
+ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
 ifneq ($(CONFIG_TARGET_SOCRATES),y)
 u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
 	$(call if_changed,cat)
 endif
+endif
 
-ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
-ifneq ($(CONFIG_TARGET_SOCRATES),y)
 u-boot.bin: u-boot-dtb.bin FORCE
 	$(call if_changed,copy)
-endif
-endif
 
-else ifneq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
-ifneq ($(CONFIG_TARGET_SOCRATES),y)
+else
 u-boot.bin: u-boot-nodtb.bin FORCE
 	$(call if_changed,copy)
 endif
-endif
 
 # we call Makefile in arch/arm/mach-imx which
 # has targets which are dependent on targets defined
@@ -1603,14 +1602,14 @@ u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE
 endif
 
 ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR)$(CONFIG_OF_SEPARATE),yy)
-u-boot.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE
+u-boot-dtb.bin: u-boot-nodtb.bin u-boot.dtb u-boot-br.bin FORCE
 	$(call if_changed,binman)
 
 OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec
 u-boot-br.bin: u-boot FORCE
 	$(call if_changed,objcopy)
 else ifeq ($(CONFIG_TARGET_SOCRATES),y)
-u-boot.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
+u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
 	$(call if_changed,binman)
 endif
 
diff --git a/arch/powerpc/dts/socrates-u-boot.dtsi b/arch/powerpc/dts/socrates-u-boot.dtsi
index eff413f5b4a2..ba2e56d35675 100644
--- a/arch/powerpc/dts/socrates-u-boot.dtsi
+++ b/arch/powerpc/dts/socrates-u-boot.dtsi
@@ -5,7 +5,7 @@
  */
 / {
 	binman {
-		filename = "u-boot.bin";
+		filename = "u-boot-dtb.bin";
 		pad-byte = <0xff>;
 		// Place dtb one sector before u-boot-nodtb.bin
 		blob {
diff --git a/arch/powerpc/dts/u-boot.dtsi b/arch/powerpc/dts/u-boot.dtsi
index b4b5257362e5..b69c08808781 100644
--- a/arch/powerpc/dts/u-boot.dtsi
+++ b/arch/powerpc/dts/u-boot.dtsi
@@ -9,7 +9,7 @@
 
 / {
 	binman {
-		filename = "u-boot.bin";
+		filename = "u-boot-dtb.bin";
 		skip-at-start = <CONFIG_TEXT_BASE>;
 		sort-by-offset;
 		pad-byte = <0xff>;
-- 
2.20.1



More information about the U-Boot mailing list