build system: Unwind multi-region cbfstool add commands

Add files to fmap regions one-by-one, so we can modify options
per-file-per-region.

Change-Id: Ic3ff5a4e563796c9fdd5705236aef37c883abf5e
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/13504
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Patrick Georgi 2016-01-28 22:22:38 +01:00 committed by Patrick Georgi
parent ddc30767dc
commit efe7ff0f81
1 changed files with 17 additions and 4 deletions

View File

@ -649,9 +649,9 @@ ifeq ($(CONFIG_CBFS_AUTOGEN_ATTRIBUTES),y)
cbfs-autogen-attributes=-g
endif
define cbfs-add-cmd
printf " CBFS $(call extract_nth,2,$(1))\n"
$(if $(2),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null)
# cbfs-add-cmd-for-region
# $(call cbfs-add-cmd-for-region,file in extract_nth format,region name)
define cbfs-add-cmd-for-region
$(CBFSTOOL) $@.tmp \
add$(if $(filter stage,$(call extract_nth,3,$(1))),-stage)$(if $(filter payload,$(call extract_nth,3,$(1))),-payload) \
-f $(call extract_nth,1,$(1)) \
@ -659,10 +659,23 @@ define cbfs-add-cmd
$(if $(filter-out stage,$(call extract_nth,3,$(1))),-t $(call extract_nth,3,$(1))) \
$(if $(call extract_nth,4,$(1)),-c $(call extract_nth,4,$(1))) \
$(cbfs-autogen-attributes) \
-r $(call regions-for-file,$(call extract_nth,2,$(1))) \
-r $(2) \
$(if $(call extract_nth,6,$(1)),-a $(call extract_nth,6,$(file)), \
$(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file)))) \
$(call extract_nth,7,$(1))
endef
# Empty line before endef is necessary so cbfs-add-cmd-for-region ends in a
# newline
# cbfs-add-cmd
# $(call cbfs-add-cmd,file in extract_nth format,non-empty if file removal requested)
define cbfs-add-cmd
printf " CBFS $(call extract_nth,2,$(1))\n"
$(if $(2),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null)
$(eval _tmp-cbfs-add-cmd-regions=$(call regions-for-file,$(call extract_nth,2,$(1)))) \
$(foreach region,$(subst $(comma),$(spc),$(_tmp-cbfs-add-cmd-regions)), \
$(call cbfs-add-cmd-for-region,$(1),$(region)))
endef
cbfs-files=$(cbfs-files-fixed) $(cbfs-files-aligned) $(cbfs-files-regular)