summaryrefslogtreecommitdiff
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
parentddc30767dce49da80c10cdb981a8c06a533bac28 (diff)
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>
-rw-r--r--Makefile.inc21
1 files changed, 17 insertions, 4 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 84d7a2de7b..8b6910942a 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)