[U-Boot] [PATCH v3 0/7] fdt: Replace u-boot-dtb.bin with u-boot.bin

At present u-boot.bin holds the plain U-Boot binary without the device tree. This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin depending on whether device tree is used.
This series adjusts the build such that u-boot.bin includes a device tree if enabled, and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains the same.
This should be acceptable since:
- without OF_CONTROL, u-boot.bin still does not include a device tree - with OF_CONTROL, u-boot-dtb.bin does not change
The main impact is to build systems which are set up to use u-boot.bin as the output file and then add a device tree. These will have to change to use u-boot-nodtb.bin instead.
The original decision to use a separate u-boot-dtb.bin was aimed at allowing any device tree file to be concatenated to the u-boot.bin image after the build. However this no-longer seems so important. More important is the convenience of using the same output file regardless of the setting for OF_CONTROL.
Changes in v3: - Fix build error when CONFIG_OF_EMBED is used - Drop unnecessary ifdef around Makefile rule - Adjust rules based on Masahiro's expert comments - Use cmd_copy instead of cmd_cat - Drop an unnecessary rule - Update commit message to say OF_SEPARATE instead of OF_CONTROL - Rewrite the commit message for clarity
Changes in v2: - Rewrite this commit based on tegra feedback - Update based on previous changes - Fix the update_filename in MCV - Tweak the tegra rule slightly
Simon Glass (7): tegra: Clarify generation of -nodtb file with OF_CONTROL fdt: Build a U-Boot binary without device tree fdt: Build an SPL binary without device tree tegra: Always build a boot image with the same filename socfpga: Simplify Makefile filenames Makefile: Make u-boot.img the same as u-boot-dtb.img Makefile: Drop unnecessary -dtb suffixes
Makefile | 89 +++++++++++++++++++--------------------- include/configs/socfpga_mcvevk.h | 2 +- scripts/Makefile.spl | 31 ++++++++------ 3 files changed, 63 insertions(+), 59 deletions(-)

Fix the ALL-y logic in the Makefile so that is clear that we always want the -nodtb file.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Fix build error when CONFIG_OF_EMBED is used - Drop unnecessary ifdef around Makefile rule
Changes in v2: - Rewrite this commit based on tegra feedback
Makefile | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile index 06996d4..dbb914a 100644 --- a/Makefile +++ b/Makefile @@ -764,14 +764,9 @@ ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom endif
# enable combined SPL/u-boot/dtb rules for tegra -ifneq ($(CONFIG_TEGRA),) -ifeq ($(CONFIG_SPL),y) -ifeq ($(CONFIG_OF_SEPARATE),y) -ALL-y += u-boot-dtb-tegra.bin -else +ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) ALL-y += u-boot-nodtb-tegra.bin -endif -endif +ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif
# Add optional build target if defined in board/cpu/soc headers @@ -1077,10 +1072,9 @@ OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE $(call if_changed,pad_cat)
-ifeq ($(CONFIG_OF_SEPARATE),y) -u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE - $(call if_changed,cat) -endif +OBJCOPYFLAGS_u-boot-dtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) +u-boot-dtb-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE + $(call if_changed,pad_cat) endif
OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)

On Sun, Jan 31, 2016 at 06:10:49PM -0700, Simon Glass wrote:
Fix the ALL-y logic in the Makefile so that is clear that we always want the -nodtb file.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

On Sun, Jan 31, 2016 at 06:10:49PM -0700, Simon Glass wrote:
Fix the ALL-y logic in the Makefile so that is clear that we always want the -nodtb file.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

At present u-boot.bin holds the plain U-Boot binary without the device tree. This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin depending on whether device tree is used.
Adjust the build such that u-boot.bin includes a device tree (if enabled), and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains the same.
This should be acceptable since:
- without OF_CONTROL, u-boot.bin still does not include a device tree - with OF_CONTROL, u-boot-dtb.bin does not change
The main impact is build systems which are set up to use u-boot.bin as the output file and then add a device tree. These will have to change to use u-boot-nodtb.bin instead.
Adjust tegra rules so it continues to produce the correct files.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Adjust rules based on Masahiro's expert comments
Changes in v2: None
Makefile | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile index dbb914a..67824ac 100644 --- a/Makefile +++ b/Makefile @@ -747,7 +747,7 @@ endif ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin -ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin +ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif @@ -823,15 +823,23 @@ PHONY += dtbs dtbs dts/dt.dtb: checkdtc u-boot $(Q)$(MAKE) $(build)=dts dtbs
-u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE +quiet_cmd_copy = COPY $@ + cmd_copy = cp $< $@ + +ifeq ($(CONFIG_OF_SEPARATE),y) +u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE $(call if_changed,cat)
+u-boot.bin: u-boot-dtb.bin FORCE + $(call if_changed,copy) +else +u-boot.bin: u-boot-nodtb.bin FORCE + $(call if_changed,copy) +endif + %.imx: %.bin $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
-quiet_cmd_copy = COPY $@ - cmd_copy = cp $< $@ - u-boot.dtb: dts/dt.dtb $(call cmd,copy)
@@ -842,11 +850,11 @@ OBJCOPYFLAGS_u-boot.srec := -O srec u-boot.hex u-boot.srec: u-boot FORCE $(call if_changed,objcopy)
-OBJCOPYFLAGS_u-boot.bin := -O binary \ +OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec)
-binary_size_check: u-boot.bin FORCE - @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \ +binary_size_check: u-boot-nodtb.bin FORCE + @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size=$(shell cat u-boot.map | \ awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \ | sed 's/0X//g' \ @@ -854,12 +862,12 @@ binary_size_check: u-boot.bin FORCE if [ "" != "$$map_size" ]; then \ if test $$map_size -ne $$file_size; then \ echo "u-boot.map shows a binary size of $$map_size" >&2 ; \ - echo " but u-boot.bin shows $$file_size" >&2 ; \ + echo " but u-boot-nodtb.bin shows $$file_size" >&2 ; \ exit 1; \ fi \ fi
-u-boot.bin: u-boot FORCE +u-boot-nodtb.bin: u-boot FORCE $(call if_changed,objcopy) $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) $(BOARD_SIZE_CHECK) @@ -1018,7 +1026,7 @@ rom: u-boot.rom FORCE IFDTOOL=$(objtree)/tools/ifdtool IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1) -IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot.bin +IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot-nodtb.bin IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin IFDTOOL_FLAGS += -C
@@ -1069,7 +1077,7 @@ endif
ifneq ($(CONFIG_TEGRA),) OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE +u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE $(call if_changed,pad_cat)
OBJCOPYFLAGS_u-boot-dtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE)

On Sun, Jan 31, 2016 at 06:10:50PM -0700, Simon Glass wrote:
At present u-boot.bin holds the plain U-Boot binary without the device tree. This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin depending on whether device tree is used.
Adjust the build such that u-boot.bin includes a device tree (if enabled), and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains the same.
This should be acceptable since:
- without OF_CONTROL, u-boot.bin still does not include a device tree
- with OF_CONTROL, u-boot-dtb.bin does not change
The main impact is build systems which are set up to use u-boot.bin as the output file and then add a device tree. These will have to change to use u-boot-nodtb.bin instead.
Adjust tegra rules so it continues to produce the correct files.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

At present u-boot-spl.bin holds the plain SPL binary without the device tree. This is somewhat annoying since you need either u-boot-spl.bin or u-boot-spl-dtb.bin depending on whether device tree is used.
Adjust the build such that u-boot-spl.bin includes a device tree (if enabled), and the plain binary is in u-boot-spl-nodtb.bin. For now u-boot-spl-dtb.bin remains the same.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Use cmd_copy instead of cmd_cat - Drop an unnecessary rule
Changes in v2: None
scripts/Makefile.spl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index dff16b9..bc6a330 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -131,16 +131,12 @@ boot.bin: $(obj)/u-boot-spl.bin else MKIMAGEFLAGS_boot.bin = -T zynqimage
-spl/boot.bin: $(obj)/u-boot-spl-dtb.bin +spl/boot.bin: $(obj)/u-boot-spl.bin $(call if_changed,mkimage) endif
ALL-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg
-ifdef CONFIG_SPL_OF_CONTROL -ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-dtb.bin -endif - ifdef CONFIG_SAMSUNG ALL-y += $(obj)/$(BOARD)-spl.bin endif @@ -166,11 +162,22 @@ all: $(ALL-y) quiet_cmd_cat = CAT $@ cmd_cat = cat $(filter-out $(PHONY), $^) > $@
-$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN)-pad.bin \ +quiet_cmd_copy = COPY $@ + cmd_copy = cp $< $@ + +ifeq ($(CONFIG_SPL_OF_CONTROL),y) +$(obj)/$(SPL_BIN)-dtb.bin: $(obj)/$(SPL_BIN)-nodtb.bin $(obj)/$(SPL_BIN)-pad.bin \ $(obj)/$(SPL_BIN).dtb FORCE $(call if_changed,cat)
-# Create a file that pads from the end of u-boot-spl.bin to bss_end +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-dtb.bin FORCE + $(call if_changed,copy) +else +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE + $(call if_changed,copy) +endif + +# Create a file that pads from the end of u-boot-spl-nodtb.bin to bss_end $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) @bss_size_str=$(shell $(NM) $< | awk 'BEGIN {size = 0} /__bss_size/ {size = $$1} END {print "ibase=16; " toupper(size)}' | bc); \ dd if=/dev/zero of=$@ bs=1 count=$${bss_size_str} 2>/dev/null; @@ -211,9 +218,9 @@ endif quiet_cmd_objcopy = OBJCOPY $@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
-OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJCFLAGS) -O binary +OBJCOPYFLAGS_$(SPL_BIN)-nodtb.bin = $(SPL_OBJCFLAGS) -O binary
-$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE +$(obj)/$(SPL_BIN)-nodtb.bin: $(obj)/$(SPL_BIN) FORCE $(call if_changed,objcopy)
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)

On Sun, Jan 31, 2016 at 06:10:51PM -0700, Simon Glass wrote:
At present u-boot-spl.bin holds the plain SPL binary without the device tree. This is somewhat annoying since you need either u-boot-spl.bin or u-boot-spl-dtb.bin depending on whether device tree is used.
Adjust the build such that u-boot-spl.bin includes a device tree (if enabled), and the plain binary is in u-boot-spl-nodtb.bin. For now u-boot-spl-dtb.bin remains the same.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Adjust the Makefile to build u-boot-tegra.bin which contains a device tree if OF_SEPARATE is enabled, and does not if not. This mirrors U-Boot's new approach of using u-boot.bin to handle both cases.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Update commit message to say OF_SEPARATE instead of OF_CONTROL
Changes in v2: - Update based on previous changes
Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile index 67824ac..74c13f0 100644 --- a/Makefile +++ b/Makefile @@ -765,7 +765,7 @@ endif
# enable combined SPL/u-boot/dtb rules for tegra ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) -ALL-y += u-boot-nodtb-tegra.bin +ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif
@@ -1080,9 +1080,12 @@ OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE $(call if_changed,pad_cat)
-OBJCOPYFLAGS_u-boot-dtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-dtb-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE +OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) +u-boot-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE $(call if_changed,pad_cat) + +u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE + $(call if_changed,copy) endif
OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)

On 01/31/2016 06:10 PM, Simon Glass wrote:
Adjust the Makefile to build u-boot-tegra.bin which contains a device tree if OF_SEPARATE is enabled, and does not if not. This mirrors U-Boot's new approach of using u-boot.bin to handle both cases.
diff --git a/Makefile b/Makefile
# enable combined SPL/u-boot/dtb rules for tegra ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) -ALL-y += u-boot-nodtb-tegra.bin +ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif
This seems different to the ALL-y entries for u-boot.bin and its -dtb/-nodtb variants. I believe that in that case, only u-boot.bin is in ALL-Y. No doubt my next comment is related.
@@ -1080,9 +1080,12 @@ OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE $(call if_changed,pad_cat)
-OBJCOPYFLAGS_u-boot-dtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-dtb-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE +OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) +u-boot-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE $(call if_changed,pad_cat)
+u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE
- $(call if_changed,copy) endif
That looks different to how the main u-boot.bin is handled too. There, u-boot.bin is a copy of u-boot-nodtb.bin or u-boot-dtb.bin depending on whether a DTB is in use. Here, the copy operation is backwards; u-boot-dt-tegra.bin gets copied from u-boot-tegra.bin (which actually might not contain a DTB if OF_SEPARATE isn't enabled).
Shouldn't the two sets of rules use identical schemes for the dependency chain so it's easy to compare the rules?

On Sun, Jan 31, 2016 at 06:10:52PM -0700, Simon Glass wrote:
Adjust the Makefile to build u-boot-tegra.bin which contains a device tree if OF_SEPARATE is enabled, and does not if not. This mirrors U-Boot's new approach of using u-boot.bin to handle both cases.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

We don't need the -dtb suffix anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: - Fix the update_filename in MCV
Makefile | 10 +++++----- include/configs/socfpga_mcvevk.h | 2 +- scripts/Makefile.spl | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile index 74c13f0..b4e75a5 100644 --- a/Makefile +++ b/Makefile @@ -1010,10 +1010,10 @@ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
ifneq ($(CONFIG_ARCH_SOCFPGA),) quiet_cmd_socboot = SOCBOOT $@ -cmd_socboot = cat spl/u-boot-spl-dtb.sfp spl/u-boot-spl-dtb.sfp \ - spl/u-boot-spl-dtb.sfp spl/u-boot-spl-dtb.sfp \ - u-boot-dtb.img > $@ || rm -f $@ -u-boot-with-spl-dtb.sfp: spl/u-boot-spl-dtb.sfp u-boot-dtb.img FORCE +cmd_socboot = cat spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ + spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ + u-boot.img > $@ || rm -f $@ +u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE $(call if_changed,socboot) endif
@@ -1322,7 +1322,7 @@ spl/u-boot-spl: tools prepare $(if $(CONFIG_OF_SEPARATE),dts/dt.dtb) spl/sunxi-spl.bin: spl/u-boot-spl @:
-spl/u-boot-spl-dtb.sfp: spl/u-boot-spl +spl/u-boot-spl.sfp: spl/u-boot-spl @:
spl/boot.bin: spl/u-boot-spl diff --git a/include/configs/socfpga_mcvevk.h b/include/configs/socfpga_mcvevk.h index e7b5675..f260a64 100644 --- a/include/configs/socfpga_mcvevk.h +++ b/include/configs/socfpga_mcvevk.h @@ -56,7 +56,7 @@ "netdev=eth0\0" \ "hostname=mcvevk\0" \ "kernel_addr_r=0x10000000\0" \ - "update_filename=u-boot-with-spl-dtb.sfp\0" \ + "update_filename=u-boot-with-spl.sfp\0" \ "update_sd_offset=0x800\0" \ "update_sd=" /* Update the SD firmware partition */ \ "if mmc rescan ; then " \ diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index bc6a330..f486feb 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -142,7 +142,7 @@ ALL-y += $(obj)/$(BOARD)-spl.bin endif
ifdef CONFIG_ARCH_SOCFPGA -ALL-y += $(obj)/$(SPL_BIN)-dtb.sfp +ALL-y += $(obj)/$(SPL_BIN).sfp endif
ifdef CONFIG_SUNXI @@ -229,8 +229,8 @@ LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) endif
ifdef CONFIG_ARCH_SOCFPGA -MKIMAGEFLAGS_$(SPL_BIN)-dtb.sfp = -T socfpgaimage -$(obj)/$(SPL_BIN)-dtb.sfp: $(obj)/$(SPL_BIN)-dtb.bin FORCE +MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage +$(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE $(call if_changed,mkimage) endif

On Sun, Jan 31, 2016 at 06:10:53PM -0700, Simon Glass wrote:
We don't need the -dtb suffix anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Create u-boot.img even when OF_CONTROL is enabled, so that this file can be used in both cases.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: - Rewrite the commit message for clarity
Changes in v2: None
Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index b4e75a5..6ddfd20 100644 --- a/Makefile +++ b/Makefile @@ -901,6 +901,8 @@ MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
+MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) + MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
@@ -910,17 +912,12 @@ MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
-u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE +u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE $(call if_changed,mkimage)
u-boot-spl.kwb: u-boot-dtb.img spl/u-boot-spl.bin FORCE $(call if_changed,mkimage)
-MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) - -u-boot-dtb.img: u-boot-dtb.bin FORCE - $(call if_changed,mkimage) - u-boot.sha1: u-boot.bin tools/ubsha1 u-boot.bin
@@ -1126,11 +1123,7 @@ spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE $(call if_changed,mkimage)
ifeq ($(ARCH),arm) -ifdef CONFIG_OF_CONTROL -UBOOT_BINLOAD := u-boot-dtb.img -else UBOOT_BINLOAD := u-boot.img -endif else UBOOT_BINLOAD := u-boot.bin endif

On 01/31/2016 06:10 PM, Simon Glass wrote:
Create u-boot.img even when OF_CONTROL is enabled, so that this file can be used in both cases.
Here also I wonder if it would be better to copy either u-boot-dtb.img or u-boot-nodtb.img to u-boot.img, to avoid running mkimage again?

On Mon, Feb 01, 2016 at 03:54:52PM -0700, Stephen Warren wrote:
On 01/31/2016 06:10 PM, Simon Glass wrote:
Create u-boot.img even when OF_CONTROL is enabled, so that this file can be used in both cases.
Here also I wonder if it would be better to copy either u-boot-dtb.img or u-boot-nodtb.img to u-boot.img, to avoid running mkimage again?
Sounds like a good clean-up.

On Sun, Jan 31, 2016 at 06:10:54PM -0700, Simon Glass wrote:
Create u-boot.img even when OF_CONTROL is enabled, so that this file can be used in both cases.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

When OF_CONTROL is enabled, u-boot-dtb.* files are the same as u-boot.* files. So we can use the latter for simplicity.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v3: None Changes in v2: - Tweak the tegra rule slightly
Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile index 6ddfd20..4ae6058 100644 --- a/Makefile +++ b/Makefile @@ -915,7 +915,7 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE $(call if_changed,mkimage)
-u-boot-spl.kwb: u-boot-dtb.img spl/u-boot-spl.bin FORCE +u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE $(call if_changed,mkimage)
u-boot.sha1: u-boot.bin @@ -1056,7 +1056,7 @@ endif cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp; cmd_ifdtool += mv u-boot.tmp $@
-u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin +u-boot.rom: u-boot-x86-16bit.bin u-boot.bin $(call if_changed,ifdtool)
OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec @@ -1067,8 +1067,7 @@ endif ifneq ($(CONFIG_SUNXI),) OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \ - u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE $(call if_changed,pad_cat) endif
@@ -1078,7 +1077,7 @@ u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot-nodtb.bin FORCE $(call if_changed,pad_cat)
OBJCOPYFLAGS_u-boot-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE) -u-boot-tegra.bin: spl/u-boot-spl u-boot-dtb.bin FORCE +u-boot-tegra.bin: spl/u-boot-spl u-boot.bin FORCE $(call if_changed,pad_cat)
u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE @@ -1089,7 +1088,7 @@ OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI) u-boot-app.efi: u-boot FORCE $(call if_changed,zobjcopy)
-u-boot-dtb.bin.o: u-boot-dtb.bin FORCE +u-boot.bin.o: u-boot.bin FORCE $(call if_changed,efipayload)
u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE @@ -1099,10 +1098,10 @@ u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE quiet_cmd_u-boot_payload ?= LD $@ cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \ -T u-boot-payload.lds arch/x86/cpu/call32.o \ - lib/efi/efi.o lib/efi/efi_stub.o u-boot-dtb.bin.o \ + lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \ $(addprefix arch/$(ARCH)/lib/efi/,$(EFISTUB))
-u-boot-payload: u-boot-dtb.bin.o u-boot-payload.lds FORCE +u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE $(call if_changed,u-boot_payload)
OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI)

On Sun, Jan 31, 2016 at 06:10:55PM -0700, Simon Glass wrote:
When OF_CONTROL is enabled, u-boot-dtb.* files are the same as u-boot.* files. So we can use the latter for simplicity.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Hello Simon,
Nitpicking:
On Sun, 31 Jan 2016 18:10:48 -0700, Simon Glass sjg@chromium.org wrote:
The original decision to use a separate u-boot-dtb.bin was aimed at allowing any device tree file to be concatenated to the u-boot.bin image after the build. However this no-longer seems so important. More important is the convenience of using the same output file regardless of the setting for OF_CONTROL.
Maybe explain in a few words why concatenating the DT no long seems important, so that readers who were intending to concatenate get a hint on what option they should follow instead?
Amicalement,

Hi Albert,
On 1 February 2016 at 00:31, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hello Simon,
Nitpicking:
On Sun, 31 Jan 2016 18:10:48 -0700, Simon Glass sjg@chromium.org wrote:
The original decision to use a separate u-boot-dtb.bin was aimed at allowing any device tree file to be concatenated to the u-boot.bin image after the build. However this no-longer seems so important. More important is the convenience of using the same output file regardless of the setting for OF_CONTROL.
Maybe explain in a few words why concatenating the DT no long seems important, so that readers who were intending to concatenate get a hint on what option they should follow instead?
I'm not sure what to say here. If people want to concatenate in a build system, then they can use u-boot-nodtb.bin for that. Everything should then work as expected.
Regards, Simon

On 01/31/2016 06:10 PM, Simon Glass wrote:
At present u-boot.bin holds the plain U-Boot binary without the device tree. This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin depending on whether device tree is used.
This series adjusts the build such that u-boot.bin includes a device tree if enabled, and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains the same.
This should be acceptable since:
- without OF_CONTROL, u-boot.bin still does not include a device tree
- with OF_CONTROL, u-boot-dtb.bin does not change
The main impact is to build systems which are set up to use u-boot.bin as the output file and then add a device tree. These will have to change to use u-boot-nodtb.bin instead.
The original decision to use a separate u-boot-dtb.bin was aimed at allowing any device tree file to be concatenated to the u-boot.bin image after the build. However this no-longer seems so important. More important is the convenience of using the same output file regardless of the setting for OF_CONTROL.
The series, Tested-by: Stephen Warren <swarren@nvidia.com
(Both out T124-and-before and T210-and-later flashing processes still seem to work OK with the new file naming etc.)
Patches 1-3, Reviewed-by: Stephen Warren swarren@nvidia.com

On Mon, Feb 01, 2016 at 04:00:30PM -0700, Stephen Warren wrote:
On 01/31/2016 06:10 PM, Simon Glass wrote:
At present u-boot.bin holds the plain U-Boot binary without the device tree. This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin depending on whether device tree is used.
This series adjusts the build such that u-boot.bin includes a device tree if enabled, and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains the same.
This should be acceptable since:
- without OF_CONTROL, u-boot.bin still does not include a device tree
- with OF_CONTROL, u-boot-dtb.bin does not change
The main impact is to build systems which are set up to use u-boot.bin as the output file and then add a device tree. These will have to change to use u-boot-nodtb.bin instead.
The original decision to use a separate u-boot-dtb.bin was aimed at allowing any device tree file to be concatenated to the u-boot.bin image after the build. However this no-longer seems so important. More important is the convenience of using the same output file regardless of the setting for OF_CONTROL.
The series, Tested-by: Stephen Warren <swarren@nvidia.com
(Both out T124-and-before and T210-and-later flashing processes still seem to work OK with the new file naming etc.)
Patches 1-3, Reviewed-by: Stephen Warren swarren@nvidia.com
I've pushed this since I want -rc1 to have it (so everyone sees it and adjusts now on a clean tag) and the feedback seems like minor updates that we can do after the fact. Thanks!
participants (4)
-
Albert ARIBAUD
-
Simon Glass
-
Stephen Warren
-
Tom Rini