diff options
author | Alexander Graf <agraf@suse.de> | 2009-06-29 15:37:40 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-29 14:17:49 -0500 |
commit | 253d0942fac33c5c15c9a7f8657f55f125dc5816 (patch) | |
tree | 818646933d3ed85cd34e10e2a74b1568fa128612 /pc-bios/optionrom/Makefile | |
parent | f16408dfb0eaef2b900caf731cab7e0b99623dd0 (diff) |
Multiboot build system v4
In order to build the multiboot option rom, we need a Makefile and a tool
to sign the rom with.
Both are provided by this patch and mostly taken from the extboot source,
written by Anthony Liguori.
Once built, the resulting binary gets copied to pc-bios automatically.
Building also occurs automatically when on an x86 host.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'pc-bios/optionrom/Makefile')
-rw-r--r-- | pc-bios/optionrom/Makefile | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile new file mode 100644 index 0000000000..c4a6f42625 --- /dev/null +++ b/pc-bios/optionrom/Makefile @@ -0,0 +1,48 @@ +all: build-all + +include ../../config-host.mak + +VPATH=$(SRC_PATH)/pc-bios/optionrom +OBJCOPY=objcopy + +# from kernel sources - scripts/Kbuild.include +# try-run +# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) +# Exit code chooses option. "$$TMP" is can be used as temporary file and +# is automatically cleaned up. +try-run = $(shell set -e; \ + TMP="$(TMPOUT).$$$$.tmp"; \ + if ($(1)) >/dev/null 2>&1; \ + then echo "$(2)"; \ + else echo "$(3)"; \ + fi; \ + rm -f "$$TMP") + +# cc-option-yn +# Usage: flag := $(call cc-option-yn,-march=winchip-c6) +cc-option-yn = $(call try-run,\ + $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n) + +CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin +CFLAGS += -I$(SRC_PATH) +ifeq ($(call cc-option-yn,-fno-stack-protector),y) +CFLAGS += -fno-stack-protector +endif + +build-all: multiboot.bin + +%.o: %.S + $(CC) $(CFLAGS) -o $@ -c $< + +%.img: %.o + $(LD) --oformat binary -Ttext 0 -o $@ $< + +%.bin: %.img signrom + ./signrom $< $@ + cp $@ $(SRC_PATH)/pc-bios/ + +signrom: signrom.c + $(CC) -o $@ -g -Wall $^ + +clean: + $(RM) *.o *.img *.bin signrom *~ |