Arthur Heymans has uploaded this change for review.

View Change

[WIP] 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 <>
M payloads/external/
2 files changed, 26 insertions(+), 12 deletions(-)

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

+# 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
# 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
- @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
- @printf " SeaBIOS Add sercon-port file\n"
- $(CBFSTOOL) $@.tmp add-int -i $(CONFIG_SEABIOS_SERCON_PORT_ADDR) -n etc/sercon-port
@printf " UPDATE-FIT\n"
diff --git a/payloads/external/ b/payloads/external/
index 9c34efa..24eeba6 100644
--- a/payloads/external/
+++ b/payloads/external/
@@ -110,6 +110,18 @@
bootorder-type := raw

+# Add SeaBIOS PS2 timeout file
+$(eval $(call add-cbfs-int,$(CONFIG_SEABIOS_PS2_TIMEOUT),etc/ps2-keyboard-spinup))
+# Add SeaBIOS Sercon port file
+$(eval $(call add-cbfs-int,$(CONFIG_SEABIOS_SERCON_PORT_ADDR),etc/sercon-port))
# 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 <>
Gerrit-MessageType: newchange