build system: allow assigning files to regions

Using the regions-for-file function, the build system can now declare
which (CBFS formatted) fmap region(s) a file should end up in.
The default is to put them in the regular COREBOOT region, but more
complex boot schemes (eg. vboot or fallback/normal) can use the function
to implement suitable policies.

Change-Id: I5e2e6b8e8759fda2cfb0144d5b998ba3e05650c8
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/13039
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins)
This commit is contained in:
Patrick Georgi 2016-01-18 16:24:10 +01:00 committed by Patrick Georgi
parent 9a17d04e40
commit e02be0e14a
1 changed files with 9 additions and 0 deletions

View File

@ -648,6 +648,14 @@ $(objcbfs)/%.elf: $(objcbfs)/%.debug
# 4) replace all '*' characters with spaces
extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-))))
# regions-for-file - Returns a cbfstool regions parameter
# $(call regions-for-file,$(filename))
# returns "REGION1,REGION2,..."
#
# This is the default implementation. When using a boot strategy employing
# multiple CBFSes in fmap regions, override it.
regions-for-file ?= COREBOOT
cbfs-add-cmd = \
printf " CBFS $(call extract_nth,2,$(file))\n"; \
$(CBFSTOOL) $@.tmp \
@ -656,6 +664,7 @@ cbfs-add-cmd = \
-n $(call extract_nth,2,$(file)) \
$(if $(filter-out stage,$(call extract_nth,3,$(file))),-t $(call extract_nth,3,$(file))) \
$(if $(call extract_nth,4,$(file)),-c $(call extract_nth,4,$(file))) \
-r $(call regions-for-file,$(call extract_nth,2,$(file))) \
$(call extract_nth,7,$(file))
cbfs-files=$(cbfs-files-fixed) $(cbfs-files-aligned) $(cbfs-files-regular)