summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-08-10 13:25:02 +0200
committerPatrick Georgi <pgeorgi@google.com>2016-08-11 20:31:36 +0200
commit513693ca3a5ee101636baaa0b8e2ea25fba19538 (patch)
tree3d9291d3a1675ded2cf665b42c0747d8f5dc35bf
parent1f3458b7b5fc0bc030861286fb78f9b0465196bb (diff)
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@chromium.org> Reviewed-on: https://review.coreboot.org/16137 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--Makefile.inc18
1 files changed, 17 insertions, 1 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 4959a9fb4d..3852132201 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -677,9 +677,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),)