[coreboot-gerrit] New patch to review for coreboot: build system: allow overriding file position and alignment per region

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Wed Aug 10 17:13:35 CEST 2016


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16140

-gerrit

commit 61716c99f075bf65e5f76ddae3501503743c2fe3
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Wed Aug 10 17:02:58 2016 +0200

    build system: allow overriding file position and alignment per region
    
    To override fallback/foo's position or alignment in region BAR, use
    fallback/foo-BAR-{position,align} = 0x1234
    
    Like for the global settings, specifying both isn't allowed
    because that's rather pointless.
    
    Change-Id: I94f41ebc9f35108267265df4164f23b70e3d0bf6
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
 Makefile.inc | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index c16657e..783b324 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -669,6 +669,26 @@ all-files-in-region = $(foreach file,$(cbfs-files), \
 		$(subst $(comma),$(spc),$(call regions-for-file,$(call extract_nth,2,$(file))))), \
 		$(file)))
 
+# $(call update-file-for-region,file string from $(cbfs-files),region name)
+# Update position and alignment according to overrides for region
+# Doesn't check for invalid configurations (eg. resetting neither or both
+# position and align)
+# Returns the updated file string
+update-file-for-region = \
+	$(subst $(spc),*,$(call extract_nth,1,$(1))|$(call extract_nth,2,$(1))|$(call extract_nth,3,$(1))|$(call extract_nth,4,$(1))|$($(call extract_nth,2,$(1))-$(2)-position)|$($(call extract_nth,2,$(1))-$(2)-align)|$(call extract_nth,7,$(1)))
+
+# $(call placed-files-in-region,region name)
+# like all-files-in-region, but updates the files to contain region overrides
+# to position or alignment.
+placed-files-in-region = $(foreach file,$(call all-files-in-region,$(1)), \
+	$(if $($(call extract_nth,2,$(file))-$(1)-position), \
+		$(if $($(call extract_nth,2,$(file))-$(1)-align), \
+			$(error It is not allowed to specify both alignment and position for $(call extract_nth,2,$(file))-$(1))) \
+		$(call update-file-for-region,$(file),$(1)), \
+		$(if $($(call extract_nth,2,$(file))-$(1)-align), \
+			$(call update-file-for-region,$(file),$(1)), \
+			$(file))))
+
 # $(call sort-files,subset of $(cbfs-files))
 # reorders the files in the given set to list files at fixed positions first,
 # followed by aligned files and finally those with no constraints.
@@ -687,7 +707,7 @@ sort-files = \
 # command list to add files to CBFS
 prebuild-files = $(foreach region,$(all-regions), \
 	$(foreach file, \
-		$(call sort-files,$(call all-files-in-region,$(region))), \
+		$(call sort-files,$(call placed-files-in-region,$(region))), \
 		$(call cbfs-add-cmd,$(file),$(region),$(CONFIG_UPDATE_IMAGE))))
 
 ifeq ($(CONFIG_FMDFILE),)



More information about the coreboot-gerrit mailing list