Makefile.inc: Create function to add a file to CBFS

This function can be called to more easily add a file to CBFS.

Additional file attributes can be added later:

cbfs-files-y += pagetables
pagetables-file := $(objcbfs)/pt
pagetables-type := raw
pagetables-compression := none
pagetables-COREBOOT-position := $(CONFIG_ARCH_X86_64_PGTBL_LOC)

becomes

$(call add-cbfs-file-simple, pagetables,  $(objcbfs)/pt, raw, none )
pagetables-COREBOOT-position := $(CONFIG_ARCH_X86_64_PGTBL_LOC)

This is especially useful inside macros where you may want to add
an unknown number of entries.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I72bb2f21fb22f650b7970c7a37a48c10a4af0ed5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75108
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Martin Roth 2023-05-10 12:43:24 -06:00 committed by Lean Sheng Tan
parent 32282c62c6
commit fda545d5dd
1 changed files with 13 additions and 0 deletions

View File

@ -326,6 +326,19 @@ define cbfs-files-processor-config
mv -f $(2).tmp $(2))
endef
#######################################################################
# Add a file to CBFS with just type and compression values
# arg1: name in CBFS
# arg2: filename and path
# arg3: type in CBFS
# arg4: compression type
define add-cbfs-file-simple
$(eval cbfs-files-y += $(1))
$(eval $(1)-file := $(2))
$(eval $(1)-type := $(3))
$(eval $(1)-compression := $(4))
endef
#######################################################################
# Compile a C file with a bare struct definition into binary
# arg1: C source file