[coreboot-gerrit] New patch to review for coreboot: build system: order per-region files to optimize placement success

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Wed Aug 10 13:30:01 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/16137

-gerrit

commit cac19f75fae10eb74024d5556a5c74c6421f806c
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Wed Aug 10 13:25:02 2016 +0200

    build system: order per-region files to optimize placement success
    
    Make sure that files with a fixed position are placed first (whose order
    doesn't matter: either they collide or they don't), then all aligned
    files (where we just hope that the right thing happens) and finally the
    files with no further requirements (again, hope).
    It's still a pretty good heuristic given a typical coreboot image.
    
    The global sorting that happens earlier in the build flow will be
    removed in the future to make room for per-region requirements.
    
    Change-Id: I269c00b2ece262c95d310b76a6651c9574badb58
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
 Makefile.inc | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index 53bb59a..52b91ab 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -676,9 +676,25 @@ all-files-in-region = $(foreach file,$(cbfs-files), \
 		$(subst $(comma),$(spc),$(call regions-for-file,$(call extract_nth,2,$(file))))), \
 		$(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.
+sort-files = \
+	$(eval _tmp_fixed:=) \
+	$(eval _tmp_aligned:=) \
+	$(eval _tmp_regular:=) \
+	$(foreach file,$(1), \
+		$(if $(call extract_nth,5,$(file)),\
+			$(eval _tmp_fixed += $(file)), \
+		$(if $(call extract_nth,6,$(file)), \
+			$(eval _tmp_aligned += $(file)), \
+			$(eval _tmp_regular += $(file))))) \
+	$(_tmp_fixed) $(_tmp_aligned) $(_tmp_regular)
+
 # command list to add files to CBFS
 prebuild-files = $(foreach region,$(all-regions), \
-	$(foreach file,$(call all-files-in-region,$(region)), \
+	$(foreach file, \
+		$(call sort-files,$(call all-files-in-region,$(region))), \
 		$(call cbfs-add-cmd,$(file),$(region),$(CONFIG_UPDATE_IMAGE))))
 
 ifeq ($(CONFIG_FMDFILE),)



More information about the coreboot-gerrit mailing list