summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-10-07 15:39:40 +0200
committerTom Rini <trini@konsulko.com>2020-10-23 13:33:07 -0400
commitae897022d7bdf1466584f54655efe89e2f67ca82 (patch)
treee8cdbf8745d1b820baae4e4da23fd27e8304c299 /Makefile
parent7a462740d09f16a060ac74873a708214524c83d4 (diff)
downloadu-boot-ae897022d7bdf1466584f54655efe89e2f67ca82.tar.gz
u-boot-ae897022d7bdf1466584f54655efe89e2f67ca82.tar.xz
u-boot-ae897022d7bdf1466584f54655efe89e2f67ca82.zip
Makefile: Fix u-boot-nodtb.bin target
This change fixes two issues when building u-boot-nodtb.bin target: * Remove intermediate binary u-boot-nodtb.bin from disk when static_rela call (which modifies u-boot-nodtb.bin binary) failed. It is required because previous objcopy call creates binary and static_rela finish it. * Do not call static_rela cmd when u-boot-nodtb.bin binary was not created/updated by previous objcopy call. Second fix would ensure that u-boot-nodtb.bin binary is not updated when all prerequisites were up-to-date. And therefore final binary u-boot.bin is not updated in case all prerequisites were not modified and were up-to-date. Now running 'make SOURCE_DATE_EPOCH=0 u-boot.bin' second time now does not touch u-boot.bin binary in case nothing was modified, so GNU make can correctly detect that everything is up-to-date. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index e08cd751e0..5a0ef18668 100644
--- a/Makefile
+++ b/Makefile
@@ -885,7 +885,7 @@ cmd_static_rela = \
tools/relocate-rela $(3) $(4) $$start $$end
else
quiet_cmd_static_rela =
-cmd_static_rela =
+cmd_static_rela = true
endif
# Always append INPUTS so that arch config.mk's can add custom ones
@@ -1309,9 +1309,13 @@ init_sp_bss_offset_check: u-boot.dtb FORCE
fi
endif
+shell_cmd = { $(echo-cmd) $(cmd_$(1)); }
+
+quiet_cmd_objcopy_uboot = OBJCOPY $@
+cmd_objcopy_uboot = $(cmd_objcopy) && $(call shell_cmd,static_rela,$<,$@,$(CONFIG_SYS_TEXT_BASE)) || rm -f $@
+
u-boot-nodtb.bin: u-boot FORCE
- $(call if_changed,objcopy)
- $(call cmd,static_rela,$<,$@,$(CONFIG_SYS_TEXT_BASE))
+ $(call if_changed,objcopy_uboot)
$(BOARD_SIZE_CHECK)
u-boot.ldr: u-boot