build system: change addition order of files to go by region
Instead of adding each file in all requested regions, sort by region, then by file. This is in preparation of per-region file options (eg. position, alignment) Change-Id: Ide09a1c8840279380294a059bbd5d2f9f0cba780 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/16130 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
5de5458c2c
commit
a8b86b3a9f
34
Makefile.inc
34
Makefile.inc
|
@ -647,18 +647,40 @@ endef
|
||||||
# newline
|
# newline
|
||||||
|
|
||||||
# cbfs-add-cmd
|
# cbfs-add-cmd
|
||||||
# $(call cbfs-add-cmd,file in extract_nth format,non-empty if file removal requested)
|
# $(call cbfs-add-cmd,
|
||||||
|
# file in extract_nth format,
|
||||||
|
# region name,
|
||||||
|
# non-empty if file removal requested)
|
||||||
define cbfs-add-cmd
|
define cbfs-add-cmd
|
||||||
printf " CBFS $(call extract_nth,2,$(1))\n"
|
printf " CBFS $(call extract_nth,2,$(1))\n"
|
||||||
$(if $(2),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null)
|
$(if $(3),-$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null)
|
||||||
$(eval _tmp-cbfs-add-cmd-regions=$(call regions-for-file,$(call extract_nth,2,$(1)))) \
|
$(call cbfs-add-cmd-for-region,$(1),$(2))
|
||||||
$(foreach region,$(subst $(comma),$(spc),$(_tmp-cbfs-add-cmd-regions)), \
|
|
||||||
$(call cbfs-add-cmd-for-region,$(1),$(region)))
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
cbfs-files=$(cbfs-files-fixed) $(cbfs-files-aligned) $(cbfs-files-regular)
|
cbfs-files=$(cbfs-files-fixed) $(cbfs-files-aligned) $(cbfs-files-regular)
|
||||||
|
|
||||||
|
# list of files to add (using their file system names, not CBFS names),
|
||||||
|
# for dependencies etc.
|
||||||
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
|
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
|
||||||
prebuild-files = $(foreach file,$(cbfs-files), $(call cbfs-add-cmd,$(file),$(CONFIG_UPDATE_IMAGE)))
|
|
||||||
|
# $(all-regions)
|
||||||
|
# returns full list of fmap regions that we add files to
|
||||||
|
all-regions = $(sort $(subst $(comma),$(spc), \
|
||||||
|
$(foreach file,$(cbfs-files), \
|
||||||
|
$(call regions-for-file,$(call extract_nth,2,$(file))))))
|
||||||
|
|
||||||
|
# $(call all-files-in-region,region name)
|
||||||
|
# returns elements in $(cbfs-files) that end up in that region, in the order
|
||||||
|
# they appear in $(cbfs-files)
|
||||||
|
all-files-in-region = $(foreach file,$(cbfs-files), \
|
||||||
|
$(if $(filter $(1), \
|
||||||
|
$(subst $(comma),$(spc),$(call regions-for-file,$(call extract_nth,2,$(file))))), \
|
||||||
|
$(file)))
|
||||||
|
|
||||||
|
# command list to add files to CBFS
|
||||||
|
prebuild-files = $(foreach region,$(all-regions), \
|
||||||
|
$(foreach file,$(call all-files-in-region,$(region)), \
|
||||||
|
$(call cbfs-add-cmd,$(file),$(region),$(CONFIG_UPDATE_IMAGE))))
|
||||||
|
|
||||||
ifeq ($(CONFIG_FMDFILE),)
|
ifeq ($(CONFIG_FMDFILE),)
|
||||||
# For a description of the flash layout described by these variables, check
|
# For a description of the flash layout described by these variables, check
|
||||||
|
|
Loading…
Reference in New Issue