x86: Change how selection of ROMs works
Most x86 boards build a u-boot.rom which is programmed into SPI flash. But
this is not unique to x86. For example some rockchip boards can also boot
from SPI flash.
Also, at least on x86, binary blobs are sadly quite common. It is not
possible to build a functional image without them, and U-Boot needs to
know this at build time.
Introduce a new CONFIG_HAS_ROM option which selects whether u-boot.rom is
built and a new CONFIG_ROM_NEEDS_BLOBS option to indicate whether binary
blobs are also needed. If they are not needed, it is safe to build the ROM
always. Otherwise we still require the BUILD_ROM environment variable.
For now this affects only x86, but future patches will enable this for
rockchip too.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/Makefile b/Makefile
index d8b0c93..6309bda 100644
--- a/Makefile
+++ b/Makefile
@@ -921,9 +921,12 @@
ALL-$(CONFIG_EFI_APP) += u-boot-app.efi
ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi
+ifneq ($(CONFIG_HAS_ROM),)
ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),)
-ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
+ALL-y += u-boot.rom
endif
+endif
+
ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy)
ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin
endif
@@ -1585,7 +1588,7 @@
# 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_X86_RESET_VECTOR),)
+ifneq ($(CONFIG_HAS_ROM),)
rom: u-boot.rom FORCE
refcode.bin: $(srctree)/board/$(BOARDDIR)/refcode.bin FORCE
@@ -1595,11 +1598,12 @@
cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
$(filter-out FORCE,$^) -o $@
-u-boot.rom: u-boot-x86-start16.bin u-boot-x86-reset16.bin u-boot.bin \
+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) FORCE
- $(call if_changed,binman)
+ $(if $(CONFIG_HAVE_REFCODE),refcode.bin)
OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16
u-boot-x86-start16.bin: u-boot FORCE
@@ -1610,6 +1614,10 @@
$(call if_changed,objcopy)
endif
+u-boot.rom: $(rom-deps) FORCE
+ $(call if_changed,binman)
+endif
+
ifneq ($(CONFIG_ARCH_SUNXI),)
ifeq ($(CONFIG_ARM64),)
u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE