Add support for cbfs-files-y to the build system.
authorPatrick Georgi <patrick.georgi@coresystems.de>
Thu, 16 Dec 2010 07:36:28 +0000 (07:36 +0000)
committerPatrick Georgi <patrick.georgi@coresystems.de>
Thu, 16 Dec 2010 07:36:28 +0000 (07:36 +0000)
That variable allows chipset components to add files to
the CBFS image, for details see
http://www.coreboot.org/pipermail/coreboot/2010-December/062483.html

Compared to the patch in that mail this commit improves dependency
tracking a bit.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Joseph Smith <joe@settoplinux.org>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6182 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

Makefile
src/arch/x86/Makefile.bigbootblock.inc
src/arch/x86/Makefile.bootblock.inc
src/arch/x86/Makefile.inc

index 4361b20fc7b208d16cb8dfcce4499433a8aa860b..a61acdf9db387af202f39b2ed473c4f41ad259e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -184,6 +184,7 @@ ramstage-srcs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.c
 romstage-srcs:=
 driver-srcs:=
 smm-srcs:=
+cbfs-files:=
 
 ramstage-objs:=
 romstage-objs:=
@@ -197,11 +198,20 @@ types:=ramstage romstage driver smm
 includemakefiles= \
        $(foreach type,$(2), $(eval $(type)-y:=)) \
        $(eval subdirs-y:=) \
+       $(eval cbfs-files-y:=) \
        $(eval -include $(1)) \
        $(foreach type,$(2), \
                $(eval $(type)-srcs+= \
                        $$(subst $(top)/,, \
                        $$(abspath $$(addprefix $(dir $(1)),$$($(type)-y)))))) \
+       $(foreach file,$(cbfs-files-y), \
+               $(if $(wildcard $(dir $(1))$(file)), \
+                       $(eval tmp-cbfs-file:= $(wildcard $(dir $(1))$(file))), \
+                       $(eval tmp-cbfs-file:= $(file))) \
+               $(eval cbfs-files += $(tmp-cbfs-file)|$$($(file)-name)|$$($(file)-type)|$$($(file)-position)) \
+               $(eval $(file)-name:=) \
+               $(eval $(file)-type:=) \
+               $(eval $(file)-position:=)) \
        $(eval subdirs+=$$(subst $(CURDIR)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
 
 # For each path in $(subdirs) call includemakefiles
@@ -275,6 +285,7 @@ printall:
        @echo allsrcs=$(allsrcs)
        @echo DEPENDENCIES=$(DEPENDENCIES)
        @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME)
+       @echo cbfs-files:='$(cbfs-files)'
 
 printcrt0s:
        @echo crt0s=$(crt0s)
index a60681670bf790f02a1602428b66b7f0cf1f8e1b..a6b8e11bcafa1925442ed394ac00b9cb5ed06656 100644 (file)
@@ -1,9 +1,9 @@
 #######################################################################
 # Build the final rom image
 
-$(obj)/coreboot.pre: $(obj)/coreboot.bootblock $(CBFSTOOL)
+$(obj)/coreboot.pre: $(obj)/coreboot.pre1 $(CBFSTOOL)
        rm -f $@
-       $(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
+       cp $(obj)/coreboot.pre1 $@
 
 #######################################################################
 # Build the bootblock
index f522fc21508a001714125f705445a4962801f461..425ee0792ce70981344a1db7adc1d14d92d528c4 100644 (file)
@@ -1,15 +1,6 @@
 #######################################################################
 # Build the final rom image
 
-ifneq ($(CONFIG_UPDATE_IMAGE),y)
-$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $(CBFSTOOL)
-       rm -f $@
-       $(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
-else
-$(obj)/coreboot.pre1: $(CBFSTOOL)
-       mv $(obj)/coreboot.rom $@
-endif
-
 $(obj)/coreboot.pre: $(obj)/coreboot.romstage $(obj)/coreboot.pre1 $(CBFSTOOL)
        rm -f $@
        cp $(obj)/coreboot.pre1 $@
index ea6e3ecb14875a4aabf98129c2ce493af416c874..c4ac5cd75fca1b91565033b647436af0a6ff8faf 100644 (file)
@@ -53,6 +53,23 @@ ifeq ($(CONFIG_GEODE_VSA_FILE),y)
 COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_VSA_FILENAME)
 endif
 
+extract_nth=$(word $(1), $(subst |, ,$(2)))
+
+ifneq ($(CONFIG_UPDATE_IMAGE),y)
+prebuild-files = \
+       $(foreach file,$(cbfs-files), \
+               $(CBFSTOOL) $@ add $(call extract_nth,1,$(file)) $(call extract_nth,2,$(file)) $(call extract_nth,3,$(file)) $(call extract_nth,4,$(file)); )
+prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
+
+$(obj)/coreboot.pre1: $(obj)/coreboot.bootblock $(prebuilt-files) $(CBFSTOOL)
+       rm -f $@
+       $(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
+       $(prebuild-files)
+else
+$(obj)/coreboot.pre1: $(CBFSTOOL)
+       mv $(obj)/coreboot.rom $@
+endif
+
 $(obj)/coreboot.rom: $(obj)/coreboot.pre $(obj)/coreboot_ram $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES))
        @printf "    CBFS       $(subst $(obj)/,,$(@))\n"
        cp $(obj)/coreboot.pre $@.tmp