summaryrefslogtreecommitdiff
path: root/util/cbfstool/Makefile
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-11-20 17:58:59 +0100
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-12-02 18:43:01 +0100
commit0316e1a69fa5d60f70afca00686d4b18a04e6dd2 (patch)
treeaa074f350bf56cab1f2ff738937475183c83c4bf /util/cbfstool/Makefile
parentcbce4de97644e810251358fb212615a5b5244d42 (diff)
downloadcoreboot-0316e1a69fa5d60f70afca00686d4b18a04e6dd2.tar.xz
cbfstool: autocreate trampoline
Add the code necessary to create the linux trampoline blob. Don't enforce this for the in-coreboot build or use objcopy to produce linux_trampoline.o as it is a bit trickier to get all the details right than I had hoped: - you have to know the elf architecture of the host machine - you might have to have more tools (xxd, perl, etc) installed Change-Id: I9b7877c58d90f9fb21d16e0061a31e19fffa2470 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/12505 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/cbfstool/Makefile')
-rw-r--r--util/cbfstool/Makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
index 085a19a481..b595297c8d 100644
--- a/util/cbfstool/Makefile
+++ b/util/cbfstool/Makefile
@@ -4,6 +4,7 @@ objutil ?= $(top)/util
CONFIG_FMD_GENPARSER := y
HOSTCC ?= $(CC)
+OBJCOPY ?= objcopy
.PHONY: all
all: $(objutil)/cbfstool/cbfstool \
@@ -17,6 +18,18 @@ clean:
$(RM) $(objutil)/cbfstool/fmaptool $(fmapobj)
$(RM) $(objutil)/cbfstool/rmodtool $(rmodobj)
+linux_trampoline.c: linux_trampoline.S
+ rm -f linux_trampoline.c
+ $(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
+ $(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
+ echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
+ xxd -c 16 -i trampoline >> trampoline.c
+ perl -pi -e 's,unsigned int.*$$,,g;s,unsigned char,const unsigned char,g' trampoline.c
+ echo "const void * const trampoline_start = &trampoline;" >> trampoline.c
+ echo "const unsigned long trampoline_size = sizeof trampoline;" >> trampoline.c
+ mv trampoline.c linux_trampoline.c
+ rm linux_trampoline trampoline
+
.SILENT:
include Makefile.inc