[U-Boot] [PATCH] Makefile: fdt: Make the final build result be u-boot.bin

Stephen Warren swarren at wwwdotorg.org
Thu Mar 8 23:29:33 CET 2012


Users expect the final build result to be u-boot.bin. Preserve this
expectation even when CONFIG_OF_SEPARATE is enabled.

If the user wants to append a custom DTB rather than the one the U-Boot
build process creates, they can append it to u-boot-nofdt.bin.

Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
---
This patch fixes the issue I have with the Makefile changes in the FDT
patch series currently pending pull from u-boot-tegra.git to u-boot-arm.git.

As mentioned above, the issue I have is that the patch series changes the
name of the file that must be burned into flash for DT-enabled boards.
While this is documented in the README, people won't in general even be
aware that anything like this has changed, and hence probably won't go and
re-read the README to discover this. I'd imagine most people won't even be
aware that Seaboard now uses device tree to boot. This wouldn't be a
problem if either:

a) The expected u-boot.bin no longer existed, so it wasn't possible to use
it.

or:

b) The file u-boot.bin would print some meaningful message when burned to
flash, rather than simply being silent, or spewing garbage to the serial
port.

Those issues prevent the problem from being readily "discoverable". This
patch fixes the issue in a somewhat more direct manner, such that nobody
has to change their workflow, let alone find out why.

Tom Warren asked me to ask the U-Boot community's opinion on this problem,
so I'm doing so by posting my proposed solution.

Tom, if this is acceptable, I think this patch should be squashed into one
of the patches in your to-be-pulled branch so that there is no set of
commits where this is broken.

Potential open question: Should more than just u-boot.bin be renamed by
appending $(UBOOT_BIN_EXTRANAME)?

 Makefile |   18 +++++++++++++-----
 README   |    6 +++---
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 36246b6..ebd6402 100644
--- a/Makefile
+++ b/Makefile
@@ -360,6 +360,12 @@ else
 BOARD_SIZE_CHECK =
 endif
 
+ifeq ($(CONFIG_OF_SEPARATE),y)
+UBOOT_BIN_EXTRANAME := -nodtb
+else
+UBOOT_BIN_EXTRANAME :=
+endif
+
 # Always append ALL so that arch config.mk's can add custom ones
 ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 
@@ -368,7 +374,7 @@ ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
 ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
-ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
+ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot$(UBOOT_BIN_EXTRANAME).bin
 
 all:		$(ALL-y) $(SUBDIR_EXAMPLES)
 
@@ -376,19 +382,21 @@ $(obj)u-boot.dtb:	$(obj)u-boot
 		$(MAKE) -C dts binary
 		mv $(obj)dts/dt.dtb $@
 
-$(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
-		cat $^ >$@
-
 $(obj)u-boot.hex:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
 
 $(obj)u-boot.srec:	$(obj)u-boot
 		$(OBJCOPY) -O srec $< $@
 
-$(obj)u-boot.bin:	$(obj)u-boot
+$(obj)u-boot$(UBOOT_BIN_EXTRANAME).bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 		$(BOARD_SIZE_CHECK)
 
+ifeq ($(CONFIG_OF_SEPARATE),y)
+$(obj)u-boot.bin:	$(obj)u-boot$(UBOOT_BIN_EXTRANAME).bin $(obj)u-boot.dtb
+		cat $^ > $@
+endif
+
 $(obj)u-boot.ldr:	$(obj)u-boot
 		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
diff --git a/README b/README
index 7adf7c7..990cefc 100644
--- a/README
+++ b/README
@@ -865,10 +865,10 @@ The following options need to be configured:
 		binary. It will be called u-boot.dtb. Architecture-specific
 		code will locate it at run-time. Generally this works by:
 
-			cat u-boot.bin u-boot.dtb >image.bin
+			cat u-boot-notdb.bin u-boot.dtb > u-boot.bin
 
-		and in fact, U-Boot does this for you, creating a file called
-		u-boot-dtb.bin which is useful in the common case. You can
+		and in fact, U-Boot does this for you, as part of creating
+		u-boot.bin which is useful in the common case. You can
 		still use the individual files if you need something more
 		exotic.
 
-- 
1.7.0.4



More information about the U-Boot mailing list