Attention is currently required from: Martin Roth. Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56114 )
Change subject: Makefile.inc: Split of image generation in multiple targets ......................................................................
Makefile.inc: Split of image generation in multiple targets
The big '$(obj)/coreboot.pre' target did a lot of things and made the build process inflexible. Split of much of the functionality in INTERMEDIATE targets that can have proper dependencies.
Change-Id: If36aee0bd2f75f3941b3bc424a7ec6c775eb1353 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M Makefile.inc M src/arch/x86/Makefile.inc 2 files changed, 46 insertions(+), 29 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/56114/1
diff --git a/Makefile.inc b/Makefile.inc index 66af076..3fedca3 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -830,7 +830,7 @@ # add commands with any additional arguments for cbfstool. # Example: --ext-win-base <base> --ext-win-size <size> define cbfs-add-cmd-for-region - $(CBFSTOOL) $@.tmp \ + $(CBFSTOOL) $(obj)/coreboot.pre \ add$(if $(filter stage,$(call extract_nth,3,$(1))),-stage)$(if \ $(filter payload,$(call extract_nth,3,$(1))),-payload)$(if \ $(filter flat-binary,$(call extract_nth,3,$(1))),-flat-binary) \ @@ -857,7 +857,7 @@ # non-empty if file removal requested) define cbfs-add-cmd printf " CBFS $(call extract_nth,2,$(1))\n" - $(if $(3),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null) + $(if $(3),-$(CBFSTOOL) $(obj)/coreboot.pre remove -n $(call extract_nth,2,$(1)) 2>/dev/null) $(call cbfs-add-cmd-for-region,$(1),$(2)) endef
@@ -1090,34 +1090,10 @@ endif
ifneq ($(CONFIG_UPDATE_IMAGE),y) +# Add all cbfs files and bootblock as deps to make sure the cbfs image gets rebuild $(obj)/coreboot.pre: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL) $(obj)/fmap.fmap $(obj)/fmap.desc + @printf " CBFS Creating new image\n" $(CBFSTOOL) $@.tmp create -M $(obj)/fmap.fmap -r $(shell cat $(obj)/fmap.desc) -ifeq ($(CONFIG_ARCH_X86),y) - $(CBFSTOOL) $@.tmp add \ - -f $(objcbfs)/bootblock.bin \ - -n bootblock \ - -t bootblock \ - $(TXTIBB) \ - -b -$(call file-size,$(objcbfs)/bootblock.bin) $(cbfs-autogen-attributes) \ - $(TS_OPTIONS) \ - $(CBFSTOOL_ADD_CMD_OPTIONS) -else # ifeq ($(CONFIG_ARCH_X86),y) - $(CBFSTOOL) $@.tmp write -u \ - -r BOOTBLOCK \ - -f $(objcbfs)/bootblock.bin - # make space for the CBFS master header pointer. "ptr_" is just - # arbitrary 4 bytes that will be overwritten by add-master-header. - printf "ptr_" > $@.tmp.2 - $(CBFSTOOL) $@.tmp add \ - -f $@.tmp.2 \ - -n "header pointer" \ - -t "cbfs header" \ - -b -4 \ - $(CBFSTOOL_ADD_CMD_OPTIONS) - rm -f $@.tmp.2 -endif # ifeq ($(CONFIG_ARCH_X86),y) - $(CBFSTOOL) $@.tmp add-master-header $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS) - $(prebuild-files) true mv $@.tmp $@ else # ifneq ($(CONFIG_UPDATE_IMAGE),y) .PHONY: $(obj)/coreboot.pre @@ -1126,7 +1102,6 @@ (echo "Error: You have UPDATE_IMAGE set in Kconfig, but have no existing image to update." && \ echo "Exiting." && \ false) - $(prebuild-files) true mv $@.tmp $@ endif # ifneq ($(CONFIG_UPDATE_IMAGE),y)
@@ -1146,6 +1121,36 @@ $(1): $(obj)/coreboot.pre $(2) \ $(eval INTERMEDIATE+=$(1)) $(eval PHONY+=$(1))
+ifneq ($(CONFIG_UPDATE_IMAGE),y) +$(call add_intermediate, update_master_header, add_bootblock add_cbfs_ptr) + printf " CBFS Updating master header\n" + $(CBFSTOOL) $< add-master-header $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS) + +ifneq ($(CONFIG_ARCH_X86),y) +$(call add_intermediate, add_cbfs_ptr, add_bootblock) + printf "ptr_" > $@.tmp + $(CBFSTOOL) $< add \ + -f $@.tmp \ + -n "header pointer" \ + -t "cbfs header" \ + -b -4 \ + $(CBFSTOOL_ADD_CMD_OPTIONS) + rm $@.tmp + +$(call add_intermediate, add_bootblock, $(objcbfs)/bootblock.bin) + printf " FMAP BOOTBLOCK adding bootblock\n" + $(CBFSTOOL) $< write -u \ + -r BOOTBLOCK \ + -f $(objcbfs)/bootblock.bin +else +$(call add_intermediate, add_cbfs_ptr, add_bootblock) + true +endif # ARCH_X86 +endif # UPDATE_IMAGE + +$(call add_intermediate, add_prebuild_files, $$(prebuilt-files) update_master_header) + $(prebuild-files) true + $(obj)/coreboot.rom: $(obj)/coreboot.pre $(CBFSTOOL) $$(INTERMEDIATE) @printf " CBFS $(subst $(obj)/,,$(@))\n" # The full ROM may be larger than the CBFS part, so create an empty diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 3949e3a..54731ea 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -85,6 +85,18 @@ bootblock-y += id.S bootblock-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c
+ifneq ($(CONFIG_UPDATE_IMAGE),y) +$(call add_intermediate, add_bootblock, $(objcbfs)/bootblock.bin) + $(CBFSTOOL) $< add \ + -f $(objcbfs)/bootblock.bin \ + -n bootblock \ + -t bootblock \ + $(TXTIBB) \ + -b -$(call file-size,$(objcbfs)/bootblock.bin) $(cbfs-autogen-attributes) \ + $(TS_OPTIONS) \ + $(CBFSTOOL_ADD_CMD_OPTIONS) +endif + $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)