[PATCH v3 34/49] x86: Makefile: Drop explicit targets built by binman

Simon Glass sjg at chromium.org
Fri Jul 10 02:39:57 CEST 2020


On x86 various files that need to be created by binman. It does not make
sense to enumerate these in the Makefile. They are described in the
configuration (devicetree) for each board and we can simply run binman
(always) to generate them.

Update the Makefile to have a separate, final step which runs binman,
once all input dependencies are present.

This avoid sprinkling the Makefile with arch-specific code.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Drop rockchip changes which should not be in this patch

 Makefile | 63 +++++++++++++-------------------------------------------
 1 file changed, 14 insertions(+), 49 deletions(-)

diff --git a/Makefile b/Makefile
index 29175fb104..5929c50aea 100644
--- a/Makefile
+++ b/Makefile
@@ -919,16 +919,6 @@ INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf
 INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi
 INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
 
-ifneq ($(CONFIG_HAS_ROM),)
-ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),)
-INPUTS-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
-endif
-endif
-
-ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy)
-INPUTS-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin
-endif
-
 # Build a combined spl + u-boot image for sunxi
 ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
 INPUTS-y += u-boot-sunxi-with-spl.bin
@@ -959,6 +949,10 @@ ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
 INPUTS-y += u-boot-rockchip.bin
 endif
 
+INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
+	$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
+	$(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin)
+
 LDFLAGS_u-boot += $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
@@ -1016,7 +1010,14 @@ cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
 PHONY += inputs
 inputs: $(INPUTS-y)
 
-all: inputs
+all: .binman_stamp inputs
+ifeq ($(CONFIG_BINMAN),y)
+	$(call if_changed,binman)
+endif
+
+# Timestamp file to make sure that binman always runs
+.binman_stamp: FORCE
+	@touch $@
 
 ifeq ($(CONFIG_DEPRECATED),y)
 	$(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.")
@@ -1309,7 +1310,7 @@ quiet_cmd_binman = BINMAN  $@
 cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                 --toolpath $(objtree)/tools \
 		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
-		build -u -d u-boot.dtb -O . -m \
+		build -u -d u-boot.dtb -O . -m --allow-missing \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
 		$(BINMAN_$(@F))
 
@@ -1586,27 +1587,11 @@ u-boot-br.bin: u-boot FORCE
 endif
 endif
 
-# x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including
-# reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in
-# the middle. This is handled by binman based on an image description in the
-# board's device tree.
-ifneq ($(CONFIG_HAS_ROM),)
-rom: u-boot.rom FORCE
-
-refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE
-	$(call if_changed,copy)
-
 quiet_cmd_ldr = LD      $@
 cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
 	       $(filter-out FORCE,$^) -o $@
 
-rom-deps := u-boot.bin
 ifdef CONFIG_X86
-rom-deps += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
-		$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
-		$(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) \
-		$(if $(CONFIG_HAVE_REFCODE),refcode.bin)
-
 OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16
 u-boot-x86-start16.bin: u-boot FORCE
 	$(call if_changed,objcopy)
@@ -1615,24 +1600,7 @@ OBJCOPYFLAGS_u-boot-x86-reset16.bin := -O binary -j .resetvec
 u-boot-x86-reset16.bin: u-boot FORCE
 	$(call if_changed,objcopy)
 
-else # !CONFIG_X86
-
-ifdef CONFIG_SPL
-rom-deps += spl/u-boot-spl.bin
-
-# We can rely on CONFIG_SPL_FRAMEWORK being set for boards that use binman
-rom-deps += u-boot.img
-endif
-
-ifdef CONFIG_TPL
-rom-deps += tpl/u-boot-tpl.bin
-endif
-
-endif
-
-u-boot.rom: $(rom-deps) FORCE
-	$(call if_changed,binman)
-endif
+endif # CONFIG_X86
 
 ifneq ($(CONFIG_ARCH_SUNXI),)
 ifeq ($(CONFIG_ARM64),)
@@ -1644,9 +1612,6 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
 endif
 endif
 
-u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE
-	$(call if_changed,binman)
-
 ifneq ($(CONFIG_ARCH_TEGRA),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
 %-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: spl/%-spl %.bin FORCE
-- 
2.27.0.389.gc38d7665816-goog



More information about the U-Boot mailing list