summaryrefslogtreecommitdiff
path: root/Makefile.inc
diff options
context:
space:
mode:
authorPatrick Georgi <Patrick.Georgi@secunet.com>2012-03-09 12:30:07 +0100
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-04-03 18:33:23 +0200
commit3bbd2bfa1c2343c6f28e7a1935c485848340116e (patch)
treefe62c42c83f0bb1e0250748eb57462e4b3fda43b /Makefile.inc
parent499fc926f8c877ab049f936fb9da7234e123edfb (diff)
downloadcoreboot-3bbd2bfa1c2343c6f28e7a1935c485848340116e.tar.xz
Add preprocessing capabilities to the cbfs-files mechanism
It's now possible to generate files that are about to be added to CBFS by specifying "sourcefile:method" as real file name. This makes the build system use the cbfs-files-preprocessor-$(method) function to create a file from sourcefile. That generated file is then added to CBFS. The first method to be defined is "nvramtool". It expects a plain text specification of the CMOS configuration and emits the binary format suitable for cmos.default. Change-Id: I33a142718fc7238eaf5317b0ed62b4726d9b48f2 Signed-off-by: Patrick Georgi <Patrick.Georgi@secunet.com> Reviewed-on: http://review.coreboot.org/847 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc14
1 files changed, 14 insertions, 0 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 470077e4fd..81d40df844 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -79,12 +79,26 @@ $(obj)/$(1).ramstage.o: src/$(1).asl $(obj)/config.h
endef
#######################################################################
+# Parse plaintext cmos defaults into binary format
+# arg1: source file
+# arg2: binary file name
+cbfs-files-processor-nvramtool= \
+ $(eval $(2): $(1) $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout | $(objutil)/nvramtool/nvramtool ; \
+ printf " CREATE $(2) (from $(1))\n"; $(objutil)/nvramtool/nvramtool -y $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout -D $(2).tmp -p $(1) && mv $(2).tmp $(2))
+
+#######################################################################
# Add handler for arbitrary files in CBFS
$(call add-special-class,cbfs-files)
cbfs-files-handler= \
+ $(eval tmp-cbfs-method:=$(word 2, $(subst :, ,$($(2)-file)))) \
+ $(eval $(2)-file:=$(word 1, $(subst :, ,$($(2)-file)))) \
$(if $(wildcard $(1)$($(2)-file)), \
$(eval tmp-cbfs-file:= $(wildcard $(1)$($(2)-file))), \
$(eval tmp-cbfs-file:= $($(2)-file))) \
+ $(if $(tmp-cbfs-method), \
+ $(eval tmp-old-cbfs-file:=$(tmp-cbfs-file)) \
+ $(eval tmp-cbfs-file:=$(shell mktemp $(obj)/mainboard/$(MAINBOARDDIR)/cbfs-file.XXXXXX).out) \
+ $(call cbfs-files-processor-$(tmp-cbfs-method),$(tmp-old-cbfs-file),$(tmp-cbfs-file))) \
$(eval cbfs-files += $(tmp-cbfs-file)|$(2)|$($(2)-type)|$($(2)-position)) \
$(eval $(2)-name:=) \
$(eval $(2)-type:=) \