Arthur Heymans has uploaded this change for review.

View Change

[WIP]Makefile.inc: Add Macro to generate cbfs int files

Add the makefile function 'add-cbfs-int' to generate cbfs files
containing a little endian integer.

Adding cbfs files containing a 64 bit is usually done with cbfstool
add-int, but this requires the coreboot.rom image to be already build
which clutters the Makefile. Instead add a method to cleanly generate
the cbfsfile containing a 64bit little endian int which integrates
better with the rest of the makefile.

Change-Id: I443e74f823cd29b4c181975bdbca89839931b3a3
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
M Makefile.inc
M payloads/external/Makefile.inc
2 files changed, 26 insertions(+), 12 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/53/33353/1
diff --git a/Makefile.inc b/Makefile.inc
index d4f7597..d0f47e9 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -788,6 +788,20 @@
$(call cbfs-add-cmd-for-region,$(1),$(2))
endef

+# add-cbfs-int (little endian)
+# $(call add-cbfs-int,
+# integer
+# cbfs-file-name)
+define add-cbfs-int
+ $(eval tmp_int:=$(shell mktemp -u int_file.XXXX))
+ $(eval $(obj)/$(tmp_int):
+ echo -n -e $$$$(printf "%016x" $$$$(($(1))) \
+ | sed -re "s/(..)(..)(..)(..)(..)(..)(..)(..)/\\\x\8\\\x\7\\\x\6\\\x\5\\\x\4\\\x\3\\\x\2\\\x\1/") > $$@)
+ cbfs-files-y += $(2)
+ $(2)-file := $(obj)/$(tmp_int)
+ $(2)-type := raw
+endef
+
# list of files to add (using their file system names, not CBFS names),
# for dependencies etc.
prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
@@ -1064,18 +1078,6 @@
# file (filled with \377 = 0xff) and copy the CBFS image over it.
dd if=/dev/zero bs=$(call _toint,$(CONFIG_ROM_SIZE)) count=1 2> /dev/null | tr '\000' '\377' > $@.tmp
dd if=$(obj)/coreboot.pre of=$@.tmp bs=8192 conv=notrunc 2> /dev/null
-ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),)
-ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),0)
-ifneq ($(CONFIG_UPDATE_IMAGE),y)
- @printf " SeaBIOS Wait up to $(CONFIG_SEABIOS_PS2_TIMEOUT) ms for PS/2 keyboard controller initialization\n"
- $(CBFSTOOL) $@.tmp add-int -i $(CONFIG_SEABIOS_PS2_TIMEOUT) -n etc/ps2-keyboard-spinup
-endif
-endif
-endif
-ifeq ($(CONFIG_SEABIOS_ADD_SERCON_PORT_FILE),y)
- @printf " SeaBIOS Add sercon-port file\n"
- $(CBFSTOOL) $@.tmp add-int -i $(CONFIG_SEABIOS_SERCON_PORT_ADDR) -n etc/sercon-port
-endif
ifeq ($(CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE),y)
ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y)
@printf " UPDATE-FIT\n"
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 9c34efa..24eeba6 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -110,6 +110,18 @@
bootorder-type := raw
endif

+# Add SeaBIOS PS2 timeout file
+ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),)
+ifneq ($(CONFIG_SEABIOS_PS2_TIMEOUT),0)
+$(eval $(call add-cbfs-int,$(CONFIG_SEABIOS_PS2_TIMEOUT),etc/ps2-keyboard-spinup))
+endif
+endif
+
+# Add SeaBIOS Sercon port file
+ifeq ($(CONFIG_SEABIOS_ADD_SERCON_PORT_FILE),y)
+$(eval $(call add-cbfs-int,$(CONFIG_SEABIOS_SERCON_PORT_ADDR),etc/sercon-port))
+endif
+
# Depthcharge

payloads/external/depthcharge/depthcharge/build/depthcharge.elf depthcharge: $(DOTCONFIG) $(CBFSTOOL)

To view, visit change 33353. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I443e74f823cd29b4c181975bdbca89839931b3a3
Gerrit-Change-Number: 33353
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange