[U-Boot] [PATCH v2 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 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 | 78 +++++++++++++++++++--------------------- include/configs/socfpga_mcvevk.h | 2 +- scripts/Makefile.spl | 26 +++++++++----- 3 files changed, 55 insertions(+), 51 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 v2: - Rewrite this commit based on tegra feedback
Makefile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index 06996d4..6b95e79 100644 --- a/Makefile +++ b/Makefile @@ -764,14 +764,8 @@ 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 -ALL-y += u-boot-nodtb-tegra.bin -endif -endif +ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) +ALL-y += u-boot-nodtb-tegra.bin u-boot-dtb-tegra.bin endif
# Add optional build target if defined in board/cpu/soc headers @@ -1078,8 +1072,9 @@ 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) +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 endif

Hi Simon,
2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
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
This commit introduces a build error for the combination of CONFIG_TEGRA=y and CONFIG_EMBED=y. (and fixed by 4/7)
$ make beaver_defconfig $ make menuconfig [ --> choose CONFIG_OF_EMBED] $ make CROSS_COMPILE=arm-linux-gnueabi- scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h [ snip ] CAT u-boot-nodtb-tegra.bin make: *** No rule to make target `u-boot-dtb-tegra.bin', needed by `all'. Stop.
Changes in v2:
- Rewrite this commit based on tegra feedback
Makefile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index 06996d4..6b95e79 100644 --- a/Makefile +++ b/Makefile @@ -764,14 +764,8 @@ 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 -ALL-y += u-boot-nodtb-tegra.bin -endif -endif +ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) +ALL-y += u-boot-nodtb-tegra.bin u-boot-dtb-tegra.bin endif
Judging from the discussion in v1,
ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) ALL-y += u-boot-nodtb-tegra.bin ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif
would be better, I think.
# Add optional build target if defined in board/cpu/soc headers @@ -1078,8 +1072,9 @@ 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)
+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 endif
ifdefs around build rules are unnecessary.

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 v2: None
Makefile | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile index 6b95e79..aebc43b 100644 --- a/Makefile +++ b/Makefile @@ -822,9 +822,17 @@ 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 +ifeq ($(CONFIG_OF_CONTROL),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,cat) +else +u-boot.bin: u-boot-nodtb.bin FORCE + $(call if_changed,cat) +endif + %.imx: %.bin $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
@@ -841,11 +849,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' \ @@ -853,12 +861,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) @@ -1017,7 +1025,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
@@ -1068,7 +1076,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)
ifeq ($(CONFIG_OF_SEPARATE),y)

Hi Simon,
2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
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
With this patch, u-boot-dtb.bin will be an intermediate file. (u-boot.bin depends on u-boot-dtb.bin if CONFIG_OF_SEPARATE=y)
You can change
ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
to
ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb
Changes in v2: None
Makefile | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile index 6b95e79..aebc43b 100644 --- a/Makefile +++ b/Makefile @@ -822,9 +822,17 @@ 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 +ifeq ($(CONFIG_OF_CONTROL),y)
I think this should be ifeq ($(CONFIG_OF_CONTROL_SEPARATE),y)
Otherwise, this patch embeds the DTB into the U-Boot image and also adds it to the tail of the image.
+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,cat)
+else +u-boot.bin: u-boot-nodtb.bin FORCE
$(call if_changed,cat)
+endif
Or, in stead, you can use $(call if_changed,copy) for clarification. (you need to move the "cmd_copy" define a bit above, though.)
This might be a matter of preference, so I will leave this to you.

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 v2: None
scripts/Makefile.spl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index dff16b9..2b4890f 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -131,14 +131,14 @@ 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 +ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-nodtb.bin endif
ifdef CONFIG_SAMSUNG @@ -166,11 +166,19 @@ 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 \ +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,cat) +else +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE + $(call if_changed,cat) +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 +219,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)

Hi Simon,
2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
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 v2: None
scripts/Makefile.spl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index dff16b9..2b4890f 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -131,14 +131,14 @@ 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 +ALL-$(CONFIG_OF_SEPARATE) += $(obj)/$(SPL_BIN)-pad.bin $(obj)/$(SPL_BIN)-nodtb.bin endif
I think this line can be completely omitted.
If CONFIG_SPL_OF_CONTROL=y, these two are generated by the following dependency chain:
$(SPL_BIN).bin -> $(SPL_BIN)-dtb.bin -> $(SPL_BIN)-nodtb.bin, $(SPL_BIN)-pad.bin
ifdef CONFIG_SAMSUNG @@ -166,11 +166,19 @@ 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 \ +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,cat)
+else +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN)-nodtb.bin FORCE
$(call if_changed,cat)
+endif
You can use if_changed,copy if you like.

Adjust the Makefile to build u-boot-tegra.bin which contains a device tree if OF_CONTROL 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 v2: - Update based on previous changes
Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index aebc43b..f9096c5 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 u-boot-dtb-tegra.bin +ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin u-boot-dtb-tegra.bin endif
# Add optional build target if defined in board/cpu/soc headers @@ -1079,11 +1079,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)
-ifeq ($(CONFIG_OF_SEPARATE),y) -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) -endif + +u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE + $(call if_changed,cat) endif
OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)

2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
Adjust the Makefile to build u-boot-tegra.bin which contains a device tree if OF_CONTROL is enabled, and does not if not. This mirrors U-Boot's new approach of using u-boot.bin to handle both cases.
CONFIG_TEGRA_COMMON selects OF_CONTROL, so the condition "if OF_CONTROL is enabled" is always true.
I assume "if OF_CONTROL_SEPARATE is enabled"
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Update based on previous changes
Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile index aebc43b..f9096c5 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 u-boot-dtb-tegra.bin +ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin u-boot-dtb-tegra.bin endif
# Add optional build target if defined in board/cpu/soc headers @@ -1079,11 +1079,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)
-ifeq ($(CONFIG_OF_SEPARATE),y) -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) -endif
+u-boot-dtb-tegra.bin: u-boot-tegra.bin FORCE
$(call if_changed,cat)
endif
I do not understand this logic.
From your description, I guess
u-boot-spl + u-boot-nodtb.bin -> u-boot-nodtb-tegra.bin
u-boot-spl + u-boot-dtb.bin -> u-boot-dtb-tegra.bin
u-boot-spl + u-boot.bin -> u-boot-tegra.bin

We don't need the -dtb suffix anymore, so drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
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 f9096c5..079636a 100644 --- a/Makefile +++ b/Makefile @@ -1009,10 +1009,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
@@ -1321,7 +1321,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 2b4890f..32324e9 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -146,7 +146,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 @@ -230,8 +230,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

When OF_CONTROL is enabled, u-boot.img has no purpose since it does not include the required device tree binary. The correct image to use is u-boot-dtb.img with OF_CONTROL but u-boot.img without OF_CONTROL.
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 v2: None
Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index 079636a..e796983 100644 --- a/Makefile +++ b/Makefile @@ -900,6 +900,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)
@@ -909,17 +911,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
@@ -1125,11 +1122,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

Hi Simon,
2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
When OF_CONTROL is enabled, u-boot.img has no purpose since it does not include the required device tree binary.
Why?
u-boot.img is created on u-boot.bin and, since 2/7, u-boot.bin includes DTB as needed.
The correct image to use is u-boot-dtb.img with OF_CONTROL but u-boot.img without OF_CONTROL.
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

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 v2: - Tweak the tegra rule slightly
Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile index e796983..a2aa227 100644 --- a/Makefile +++ b/Makefile @@ -914,7 +914,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 @@ -1055,7 +1055,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 @@ -1066,8 +1066,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
@@ -1077,7 +1076,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 @@ -1088,7 +1087,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 @@ -1098,10 +1097,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)

2016-01-29 12:24 GMT+09:00 Simon Glass sjg@chromium.org:
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 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
The basic concept is OK with me.
I left some comments in each patch.
participants (2)
-
Masahiro Yamada
-
Simon Glass