summaryrefslogtreecommitdiffstats
path: root/Makefile.inc
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-01-28 22:22:38 +0100
committerPatrick Georgi <pgeorgi@google.com>2016-01-29 17:19:35 +0100
commitefe7ff0f81902f59784b798fa54568cb03b68e78 (patch)
tree2e587278369a487622b1c8f8a43a795886027388 /Makefile.inc
parentddc30767dce49da80c10cdb981a8c06a533bac28 (diff)
downloadcoreboot-efe7ff0f81902f59784b798fa54568cb03b68e78.tar.gz
coreboot-efe7ff0f81902f59784b798fa54568cb03b68e78.tar.bz2
coreboot-efe7ff0f81902f59784b798fa54568cb03b68e78.zip
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>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc21
1 files changed, 17 insertions, 4 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 84d7a2de7b5b..8b6910942ad1 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -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)