qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/7] Allow a cross compiler to be used for rom build


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 4/7] Allow a cross compiler to be used for rom builds
Date: Wed, 29 Jul 2009 13:45:56 -0500

The host tool chain is not enough to build all of the possible roms for qemu.
This patch introduces a new option, --i386-cross-prefix, that provides the
cross prefix for a toolchain to build i386 roms.

This converts multiboot to use that toolchain.  If you don't specify
a cross prefix, then the host tool chain will be used if the architecture
matches.

Signed-off-by: Anthony Liguori <address@hidden>
---
 configure                  |   30 ++++++++++++++++++++++++++----
 roms/multiboot/Makefile    |    9 ++++-----
 roms/multiboot/multiboot.S |    2 +-
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index f477aaf..75e5657 100755
--- a/configure
+++ b/configure
@@ -25,6 +25,7 @@ prefix=""
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_prefix=""
+i386_cross_prefix=""
 cc="gcc"
 audio_drv_list=""
 audio_card_list="ac97 es1370 sb16"
@@ -43,6 +44,8 @@ for opt do
   case "$opt" in
   --cross-prefix=*) cross_prefix="$optarg"
   ;;
+  --i386-cross-prefix=*) i386_cross_prefix="$optarg"
+  ;;
   --cc=*) cc="$optarg"
   ;;
   esac
@@ -376,6 +379,8 @@ for opt do
   ;;
   --cross-prefix=*)
   ;;
+  --i386-cross-prefix=*)
+  ;;
   --cc=*)
   ;;
   --host-cc=*) host_cc="$optarg"
@@ -624,6 +629,7 @@ echo ""
 echo "Advanced options (experts only):"
 echo "  --source-path=PATH       path of source code [$source_path]"
 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
+echo "  --i386-cross-prefix=P    use P for i386 compile tools"
 echo "  --cc=CC                  use C compiler CC [$cc]"
 echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
 echo "  --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS"
@@ -1739,11 +1745,12 @@ 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" \) -a \
-        "$targetos" != "Darwin" ; then
-  roms="multiboot"
+# Mac OS X ships with a broken assembler
+if test \( \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
+        "$targetos" != "Darwin" \) -o \
+        "$i386_cross_prefix" ; then
+  roms="$roms multiboot"
 fi
 echo "ROMS=$roms" >> $config_host_mak
 
@@ -2114,6 +2121,21 @@ for rom in $roms; do
     mkdir -p pc-bios/$rom
     rm -f pc-bios/$rom/Makefile
     ln -s $source_path/roms/$rom/Makefile pc-bios/$rom/Makefile
+    config_mak="pc-bios/$rom/config.mak"
+    case "$rom" in
+      multiboot)
+       prefix=${i386_cross_prefix}
+       ;;
+    esac
+    echo "# Automatically generated by configure - do not modify" > $config_mak
+    echo "include ../../config-host.mak" >> $config_mak
+    echo "include ${source_path}/rules.mak" >> $config_mak
+    echo "SRC_PATH=${source_path}/roms/$rom" >> $config_mak
+    echo "TOP_DIR=${source_path}" >> $config_mak
+    echo "CC=${prefix}${cc}" >> $config_mak
+    echo "CPP=${prefix}cpp" >> $config_mak
+    echo "LD=${prefix}${ld}" >> $config_mak
+    echo "OBJCOPY=${prefix}${objcopy}" >> $config_mak
 done
 
 # build tree in object directory if source path is different from current one
diff --git a/roms/multiboot/Makefile b/roms/multiboot/Makefile
index c6b5ca4..010feff 100644
--- a/roms/multiboot/Makefile
+++ b/roms/multiboot/Makefile
@@ -1,12 +1,11 @@
 all: build-all
 
-include ../../config-host.mak
-include $(SRC_PATH)/rules.mak
+include config.mak
 
-VPATH=$(SRC_PATH)/roms/multiboot
+VPATH=$(SRC_PATH)
 
 CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
-CPPFLAGS += -I$(SRC_PATH)
+CPPFLAGS += -I$(TOP_DIR)
 CPPFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
 
 build-all: multiboot.bin
@@ -18,7 +17,7 @@ build-all: multiboot.bin
        $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building 
$(TARGET_DIR)$@")
 
 %.bin: %.raw
-       $(call quiet-command,$(SRC_PATH)/roms/multiboot/signrom.sh $< $@,"  
Signing $(TARGET_DIR)$@")
+       $(call quiet-command,$(SRC_PATH)/signrom.sh $< $@,"  Signing 
$(TARGET_DIR)$@")
 
 clean:
        $(RM) *.o *.img *.bin *~
diff --git a/roms/multiboot/multiboot.S b/roms/multiboot/multiboot.S
index 93beb51..ba7724b 100644
--- a/roms/multiboot/multiboot.S
+++ b/roms/multiboot/multiboot.S
@@ -19,7 +19,7 @@
  */
 
 #define NO_QEMU_PROTOS
-#include "../../hw/fw_cfg.h"
+#include "hw/fw_cfg.h"
 
 #define BIOS_CFG_IOPORT_CFG    0x510
 #define BIOS_CFG_IOPORT_DATA   0x511
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]