Author: oxygene
Date: Thu Dec 16 08:36:28 2010
New Revision: 6182
URL: https://tracker.coreboot.org/trac/coreboot/changeset/6182

Log:
Add support for cbfs-files-y to the build system.
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 <[email protected]>
Acked-by: Joseph Smith <[email protected]>
Acked-by: Stefan Reinauer <[email protected]>

Modified:
   trunk/Makefile
   trunk/src/arch/x86/Makefile.bigbootblock.inc
   trunk/src/arch/x86/Makefile.bootblock.inc
   trunk/src/arch/x86/Makefile.inc

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile      Wed Dec 15 12:32:11 2010        (r6181)
+++ trunk/Makefile      Thu Dec 16 08:36:28 2010        (r6182)
@@ -184,6 +184,7 @@
 romstage-srcs:=
 driver-srcs:=
 smm-srcs:=
+cbfs-files:=
 
 ramstage-objs:=
 romstage-objs:=
@@ -197,11 +198,20 @@
 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 @@
        @echo allsrcs=$(allsrcs)
        @echo DEPENDENCIES=$(DEPENDENCIES)
        @echo LIBGCC_FILE_NAME=$(LIBGCC_FILE_NAME)
+       @echo cbfs-files:='$(cbfs-files)'
 
 printcrt0s:
        @echo crt0s=$(crt0s)

Modified: trunk/src/arch/x86/Makefile.bigbootblock.inc
==============================================================================
--- trunk/src/arch/x86/Makefile.bigbootblock.inc        Wed Dec 15 12:32:11 
2010        (r6181)
+++ trunk/src/arch/x86/Makefile.bigbootblock.inc        Thu Dec 16 08:36:28 
2010        (r6182)
@@ -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

Modified: trunk/src/arch/x86/Makefile.bootblock.inc
==============================================================================
--- trunk/src/arch/x86/Makefile.bootblock.inc   Wed Dec 15 12:32:11 2010        
(r6181)
+++ trunk/src/arch/x86/Makefile.bootblock.inc   Thu Dec 16 08:36:28 2010        
(r6182)
@@ -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 $@

Modified: trunk/src/arch/x86/Makefile.inc
==============================================================================
--- trunk/src/arch/x86/Makefile.inc     Wed Dec 15 12:32:11 2010        (r6181)
+++ trunk/src/arch/x86/Makefile.inc     Thu Dec 16 08:36:28 2010        (r6182)
@@ -53,6 +53,23 @@
 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 [email protected]

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to