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>
This commit is contained in:
Patrick Georgi 2016-08-10 13:25:02 +02:00 committed by Patrick Georgi
parent 1f3458b7b5
commit 513693ca3a
1 changed files with 17 additions and 1 deletions

View File

@ -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),)