optionrom build fixes
cover optionrom build fixes
From: Juan Quintela <[email protected]>
Hi
This series of patches get optionrom to use rules.mak and use the normal qemu build system. As it used its own variant of cc-option, move cc-option definition to rules.mak and remove the own implementation in optionrom.
Anthony, this one includes my two previous patches to this zone:
- put pc-bios/optionrom/multiboot.bin into .gitignore
- Don't build it in mac os X
cc'd alexander graf, that was the original author.
Later, Juan.
Juan Quintela (5):
move cc-option definition to rules.mak
Use quiet-command for building optionrom
use cc-option for optionrom
multiboot.bin is a generated file
Don't build option roms on Mac OS X
.gitignore | 1 + Makefile.target | 6 ------ configure | 4 +++- pc-bios/optionrom/Makefile | 36 +++++++----------------------------- rules.mak | 6 ++++++ 5 files changed, 17 insertions(+), 36 deletions(-)
PATCH 1/5 move cc-option definition to rules.mak
From: Juan Quintela <[email protected]>
--- Makefile.target | 6 ------ rules.mak | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)
Makefile.target +0 -6
@@ -21,12 +21,6 @@ endif PROGS=$(QEMU_PROG) -# cc-option -# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) - -cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) - HELPER_CFLAGS= ifeq ($(ARCH),i386)
rules.mak +6 -0
@@ -17,3 +17,9 @@ LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^," AR $(TARGET_DIR)$@") quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) + +# cc-option +# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) + +cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ + > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
Signature · 1 line
1.6.2.5
PATCH 3/5 use cc-option for optionrom
In reply to [email protected]From: Juan Quintela <[email protected]>
--- pc-bios/optionrom/Makefile | 22 +--------------------- 1 files changed, 1 insertions(+), 21 deletions(-)
pc-bios/optionrom/Makefile +1 -21
@@ -5,29 +5,9 @@ include ../../rules.mak VPATH=$(SRC_PATH)/pc-bios/optionrom -# 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) - CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin CPPFLAGS += -I$(SRC_PATH) -ifeq ($(call cc-option-yn,-fno-stack-protector),y) -CPPFLAGS += -fno-stack-protector -endif +CPPFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"") build-all: multiboot.bin
Signature · 1 line
1.6.2.5
PATCH 2/5 Use quiet-command for building optionrom
In reply to [email protected]From: Juan Quintela <[email protected]>
--- pc-bios/optionrom/Makefile | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
pc-bios/optionrom/Makefile +7 -9
@@ -1,6 +1,7 @@ all: build-all include ../../config-host.mak +include ../../rules.mak VPATH=$(SRC_PATH)/pc-bios/optionrom
@@ -22,25 +23,22 @@ try-run = $(shell set -e; \ 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) +CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin +CPPFLAGS += -I$(SRC_PATH) ifeq ($(call cc-option-yn,-fno-stack-protector),y) -CFLAGS += -fno-stack-protector +CPPFLAGS += -fno-stack-protector endif build-all: multiboot.bin -%.o: %.S - $(CC) $(CFLAGS) -o $@ -c $< - %.img: %.o - $(LD) -Ttext 0 -e _start -s -o $@ $< + $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") %.raw: %.img - $(OBJCOPY) -O binary -j .text $< $@ + $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") %.bin: %.raw - $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@ + $(call quiet-command,$(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@," Signing $(TARGET_DIR)$@") clean: $(RM) *.o *.img *.bin *~
Signature · 1 line
1.6.2.5
PATCH 4/5 multiboot.bin is a generated file
In reply to [email protected]From: Juan Quintela <[email protected]>
--- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
@@ -42,4 +42,5 @@ qemu-monitor.texi patches pc-bios/bios-pq/status pc-bios/vgabios-pq/status +pc-bios/optionrom/multiboot.bin .stgit-*
Signature · 1 line
1.6.2.5
PATCH 5/5 Don't build option roms on Mac OS X
In reply to [email protected]From: Juan Quintela <[email protected]>
--- configure | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
configure +3 -1
@@ -1826,8 +1826,10 @@ if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then fi echo "TOOLS=$tools" >> $config_host_mak +# Mac OS X ships with a broken assembler roms= -if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then +if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ + "$targetos" != "Darwin" ; then roms="pc-bios/optionrom" fi echo "ROMS=$roms" >> $config_host_mak
Signature · 1 line
1.6.2.5
Quoted 8 lines · On 21.07.2009, at 14:11, [email protected] wrote:
From: Juan Quintela <[email protected]>
Hi
This series of patches get optionrom to use rules.mak and use the normal qemu build system. As it used its own variant of cc-option, move cc-option definition to rules.mak and remove the own implementation in optionrom.
Quoted 5 lines
Anthony, this one includes my two previous patches to this zone:
- put pc-bios/optionrom/multiboot.bin into .gitignore
- Don't build it in mac os Xcc'd alexander graf, that was the original author.
The patches look good. I haven't compile-tested them though.
Thanks for doing the Makefile magic! :-)