[U-Boot] [PATCH v2 0/4] Kbuild fixes

Changes in v2: - Drop 3/5 ("kbuild: use $(call cmd, ) rather than $(call if_changed, ) where possible") - add tools/fdtgrep to the dependency
Masahiro Yamada (4): kbuild: remove unneeded ifdef conditionals around build rules kbuild: sunxi: fix build rule of sunxi-spl.bin kbuild: add missing FORCE where $(call if_changed, ) is used kbuild: fix build rule of u-boot-spl.dtb
Makefile | 12 ++++++------ scripts/Makefile.spl | 20 ++++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-)

These rules are only used for SOCFPGA, SUNXI, but no need to hide them from other SoCs.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
Changes in v2: - Drop 3/5 ("kbuild: use $(call cmd, ) rather than $(call if_changed, ) where possible")
scripts/Makefile.spl | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index f486feb..adabfcf 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -228,18 +228,14 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE) endif
-ifdef CONFIG_ARCH_SOCFPGA MKIMAGEFLAGS_$(SPL_BIN).sfp = -T socfpgaimage $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE $(call if_changed,mkimage) -endif
-ifdef CONFIG_SUNXI quiet_cmd_mksunxiboot = MKSUNXI $@ cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin $(call if_changed,mksunxiboot) -endif
quiet_cmd_u-boot-spl = LD $@ cmd_u-boot-spl = (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \

The build command for sunxi-spl.bin is constant, so it is pointless to use $(call if_changed,...). $(call cmd,...) is enough.
On the other hand, if the tools/mksunxiboot is updated, the resulted output may be different. Make the output image dependent on tools/mksunxiboot.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
Changes in v2: None
scripts/Makefile.spl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index adabfcf..d8b3947 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -234,8 +234,8 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
quiet_cmd_mksunxiboot = MKSUNXI $@ cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@ -$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin - $(call if_changed,mksunxiboot) +$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin $(objtree)/tools/mksunxiboot + $(call cmd,mksunxiboot)
quiet_cmd_u-boot-spl = LD $@ cmd_u-boot-spl = (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \

FORCE is needed for $(call if_changed,...) to be evaluated every time. Otherwise, the command is not executed when the command line has changed but any prerequisite has not been updated.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
Changes in v2: None
Makefile | 12 ++++++------ scripts/Makefile.spl | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile index 430dd4f..a46c1ae 100644 --- a/Makefile +++ b/Makefile @@ -924,7 +924,7 @@ u-boot.sha1: u-boot.bin u-boot.dis: u-boot $(OBJDUMP) -d $< > $@
-u-boot.cfg: include/config.h +u-boot.cfg: include/config.h FORCE $(call if_changed,cpp_cfg)
ifdef CONFIG_TPL @@ -945,15 +945,15 @@ lpc32xx-spl.img: spl/u-boot-spl.bin FORCE
OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
-lpc32xx-boot-0.bin: lpc32xx-spl.img +lpc32xx-boot-0.bin: lpc32xx-spl.img FORCE $(call if_changed,objcopy)
OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
-lpc32xx-boot-1.bin: lpc32xx-spl.img +lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE $(call if_changed,objcopy)
-lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img +lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE $(call if_changed,cat)
CLEAN_FILES += lpc32xx-* @@ -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.bin +u-boot.rom: u-boot-x86-16bit.bin u-boot.bin FORCE $(call if_changed,ifdtool)
OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec @@ -1171,7 +1171,7 @@ cmd_smap = \ $(CC) $(c_flags) -DSYSTEM_MAP=""$${smap}"" \ -c $(srctree)/common/system_map.c -o common/system_map.o
-u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds +u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds FORCE $(call if_changed,u-boot__) ifeq ($(CONFIG_KALLSYMS),y) $(call cmd,smap) diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index d8b3947..d21c278 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -114,7 +114,7 @@ MKIMAGEFLAGS_MLO = -T omapimage -a $(CONFIG_SPL_TEXT_BASE)
MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE)
-MLO MLO.byteswap: $(obj)/u-boot-spl.bin +MLO MLO.byteswap: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage)
ifeq ($(CONFIG_SYS_SOC),"at91") @@ -126,12 +126,12 @@ MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params) boot.bin: $(obj)/../tools/atmel_pmecc_params endif
-boot.bin: $(obj)/u-boot-spl.bin +boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) else MKIMAGEFLAGS_boot.bin = -T zynqimage
-spl/boot.bin: $(obj)/u-boot-spl.bin +spl/boot.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) endif
@@ -200,7 +200,7 @@ quiet_cmd_cpp_cfg = CFG $@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \ -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
-$(obj)/$(SPL_BIN).cfg: include/config.h +$(obj)/$(SPL_BIN).cfg: include/config.h FORCE $(call if_changed,cpp_cfg)
ifdef CONFIG_SAMSUNG

The build command of u-boot-spl.dtb is not constant, but dependent on CONFIG_OF_SPL_REMOVE_PROPS. Use $(call if_changed,...) so that the change of CONFIG_OF_SPL_REMOVE_PROPS is detected.
Also, add tools/fdtgrep to the dependency to make sure u-boot-spl.dtb is generated by the up-to-date fdtgrep in case the tool is modified.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
Changes in v2: - add tools/fdtgrep to the dependency
scripts/Makefile.spl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index d21c278..43df675 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -193,8 +193,8 @@ quiet_cmd_fdtgrep = FDTGREP $@ $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \ $(addprefix -P ,$(subst $",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
-$(obj)/$(SPL_BIN).dtb: dts/dt.dtb - $(call cmd,fdtgrep) +$(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE + $(call if_changed,fdtgrep)
quiet_cmd_cpp_cfg = CFG $@ cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
participants (1)
-
Masahiro Yamada