build system: Add option for auto generated cbfs attributes

Add a new Kconfig variable to enable the generation of
position and alignment attributes for cbfs files which
has constraints on this parameters.
In addition,  modify Makefile.inc to support that option.

Change-Id: Ibd725fe69a4de35964bdb2dde106d9a7c37ffb47
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/12968
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Werner Zeh 2016-01-14 15:08:36 +01:00
parent 27807c66ee
commit c0fb361be8
2 changed files with 16 additions and 3 deletions

View File

@ -657,6 +657,10 @@ extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-)
# multiple CBFSes in fmap regions, override it. # multiple CBFSes in fmap regions, override it.
regions-for-file ?= COREBOOT regions-for-file ?= COREBOOT
ifeq ($(CONFIG_CBFS_AUTOGEN_ATTRIBUTES),y)
cbfs-autogen-attributes=-g
endif
cbfs-add-cmd = \ cbfs-add-cmd = \
printf " CBFS $(call extract_nth,2,$(file))\n"; \ printf " CBFS $(call extract_nth,2,$(file))\n"; \
$(CBFSTOOL) $@.tmp \ $(CBFSTOOL) $@.tmp \
@ -664,7 +668,7 @@ cbfs-add-cmd = \
-f $(call extract_nth,1,$(file)) \ -f $(call extract_nth,1,$(file)) \
-n $(call extract_nth,2,$(file)) \ -n $(call extract_nth,2,$(file)) \
$(if $(filter-out stage,$(call extract_nth,3,$(file))),-t $(call extract_nth,3,$(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))) \ $(if $(call extract_nth,4,$(file)),-c $(call extract_nth,4,$(file))) $(cbfs-autogen-attributes)\
-r $(call regions-for-file,$(call extract_nth,2,$(file))) \ -r $(call regions-for-file,$(call extract_nth,2,$(file))) \
$(call extract_nth,7,$(file)) $(call extract_nth,7,$(file))
@ -742,7 +746,7 @@ ifeq ($(CONFIG_ARCH_X86),y)
-f $(objcbfs)/bootblock.bin \ -f $(objcbfs)/bootblock.bin \
-n bootblock \ -n bootblock \
-t bootblock \ -t bootblock \
-b -$(call file-size,$(objcbfs)/bootblock.bin) -b -$(call file-size,$(objcbfs)/bootblock.bin) $(cbfs-autogen-attributes)
else else
# don't add bootblock to cbfs yet, it's just a waste of space # don't add bootblock to cbfs yet, it's just a waste of space
true $(CBFSTOOL) $@.tmp add \ true $(CBFSTOOL) $@.tmp add \
@ -773,7 +777,8 @@ prebuild-files = \
$(foreach file,$(cbfs-files), \ $(foreach file,$(cbfs-files), \
$(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null ; \ $(CBFSTOOL) $@.tmp remove -n $(call extract_nth,2,$(file)) 2>/dev/null ; \
$(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&,\ $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&,\
$(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&)) $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) \
$(cbfs-autogen-attributes) &&))
.PHONY: $(obj)/coreboot.pre .PHONY: $(obj)/coreboot.pre
$(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL) $(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL)

View File

@ -409,6 +409,14 @@ config SYSTEM_TYPE_LAPTOP
default n default n
bool bool
config CBFS_AUTOGEN_ATTRIBUTES
default n
bool
help
If this option is selected, every file in cbfs which has a constraint
regarding position or alignment will get an additional file attribute
which describes this constraint.
menu "Chipset" menu "Chipset"
comment "SoC" comment "SoC"