QEMU by itself can be built outside of its source directory. With the
qemu repository being separate from the hypervisor/tools one it seems
to make sense to make use of this feature, but doing so requires a
couple of adjustments to the Xen changes to it. Basically, if
CONFIG_QEMU is found to indicate an existing directory, this directory
will be used rather than cloning the git repo into the build tree.
The patch contains QEMU and tools/stubdom changes together for the
moment (with QEMU supposed to be residing in qemu/). For applying
this would need to be split.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- 2010-11-09.orig/qemu/Makefile.target 2010-11-02 13:36:40.000000000 +0100
+++ 2010-11-09/qemu/Makefile.target 2010-11-09 10:30:19.000000000 +0100
@@ -23,7 +23,7 @@ endif
ifeq ($(TARGET_ARCH), sparc64)
TARGET_BASE_ARCH:=sparc
endif
-TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
+TARGET_PATH?=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
#CFLAGS+=-Werror
@@ -210,8 +210,8 @@ endif
# libqemu
--include hookslib.mak
--include hookstarget.mak
+include $(QEMU_ROOT)/$(TARGET_DIRS)/hookslib.mak
+include $(QEMU_ROOT)/$(TARGET_DIRS)/hookstarget.mak
libqemu.a: $(LIBOBJS)
@@ -730,7 +730,8 @@ LDFLAGS+=-p
main.o: CFLAGS+=-p
endif
--include hooks.mak
+include $(QEMU_ROOT)/$(TARGET_DIRS)/hooks.mak
+
all: $(PROGS)
$(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS)
$(VDE_LIBS)
--- 2010-11-09.orig/qemu/i386-dm/hooks.mak 2008-07-24 13:41:59.000000000 +0200
+++ 2010-11-09/qemu/i386-dm/hooks.mak 2010-11-09 10:30:19.000000000 +0100
@@ -3,4 +3,4 @@ CPPFLAGS += -DHAS_AUDIO
endif
QEMU_PROG=qemu-dm
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
--- 2010-11-09.orig/qemu/i386-dm/hookstarget.mak 2009-07-10 13:12:28.000000000
+0200
+++ 2010-11-09/qemu/i386-dm/hookstarget.mak 2010-11-09 10:30:19.000000000 +0100
@@ -3,4 +3,4 @@ IOEMU_OS=$(shell uname -s)
install-hook:
$(INSTALL_DIR) "$(DESTDIR)/$(bindir)"
$(INSTALL_DIR) "$(DESTDIR)/$(configdir)"
- $(INSTALL_PROG) qemu-ifup-$(IOEMU_OS)
"$(DESTDIR)/$(configdir)/qemu-ifup"
+ $(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS)
"$(DESTDIR)/$(configdir)/qemu-ifup"
--- 2010-11-09.orig/qemu/i386-stubdom/hooks.mak 2008-09-18 08:37:22.000000000
+0200
+++ 2010-11-09/qemu/i386-stubdom/hooks.mak 2010-11-09 10:30:19.000000000 +0100
@@ -1,4 +1,4 @@
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
OBJS += block-vbd.o
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2010-11-09/qemu/i386-stubdom/hookslib.mak 2010-11-09 10:30:19.000000000
+0100
@@ -0,0 +1 @@
+include $(SRC_PATH)/i386-dm/hookslib.mak
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2010-11-09/qemu/i386-stubdom/hookstarget.mak 2010-11-09 10:30:19.000000000
+0100
@@ -0,0 +1 @@
+VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/i386-dm:$(SRC_PATH)/hw
--- 2010-11-09.orig/qemu/xen-config-host.mak 2009-01-08 10:31:24.000000000 +0100
+++ 2010-11-09/qemu/xen-config-host.mak 2010-11-09 10:30:19.000000000 +0100
@@ -3,12 +3,12 @@ XEN_ROOT ?= $(QEMU_ROOT)/../xen-unstable
include $(XEN_ROOT)/tools/Rules.mk
ifdef CONFIG_STUBDOM
-TARGET_DIRS=i386-stubdom
+export TARGET_DIRS=i386-stubdom
else
-TARGET_DIRS=i386-dm
+export TARGET_DIRS=i386-dm
endif
SUBDIR_RULES=subdir-$(TARGET_DIRS)
subdir-$(TARGET_DIRS): libqemu_common.a
--include $(QEMU_ROOT)/xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
--- 2010-11-09.orig/qemu/xen-config.mak 2009-07-10 13:12:28.000000000 +0200
+++ 2010-11-09/qemu/xen-config.mak 2010-11-09 10:30:19.000000000 +0100
@@ -4,6 +4,7 @@ XEN_ROOT ?= $(QEMU_ROOT)/../xen-unstable
include ../config-host.mak
TARGET_ARCH=i386
+TARGET_PATH:=$(SRC_PATH)/$(TARGET_DIRS)
CONFIG_SOFTMMU=yes
CFLAGS += -I$(QEMU_ROOT)/hw
--- 2010-11-09.orig/qemu/xen-hooks.mak 2010-09-20 08:27:46.000000000 +0200
+++ 2010-11-09/qemu/xen-hooks.mak 2010-11-09 10:30:19.000000000 +0100
@@ -38,7 +38,7 @@ OBJS += battery_mgmt.o
ifdef CONFIG_STUBDOM
CPPFLAGS += $(TARGET_CPPFLAGS) -DNEED_CPU_H \
- -I$(QEMU_ROOT)/i386-dm -I$(QEMU_ROOT)/hw -I$(QEMU_ROOT)/fpu
+ -I$(TARGET_DIRS) -I$(QEMU_ROOT)/i386-dm -I$(QEMU_ROOT)/hw -I$(QEMU_ROOT)/fpu
CONFIG_SDL CONFIG_AUDIO OBJS += xenfbfront.o
--- 2010-11-09.orig/qemu/xen-setup 2009-07-10 13:12:28.000000000 +0200
+++ 2010-11-09/qemu/xen-setup 2010-11-09 10:30:19.000000000 +0100
@@ -3,6 +3,8 @@ set -e
# git-clean -x -d && ./xen-setup && make prefix=/usr
CMDLINE_CFLAGS=''-O0 -g'' -j4 && make install
DESTDIR=`pwd`/dist/ prefix=/usr && rsync -a --stats --delete .
thule:shadow/qemu-iwj.git/ && rsync -a --stats dist/. root@thule:/
+target=i386-dm
+mkdir -p $target
rm -f $target/Makefile
rm -f $target/config.mak
rm -f config-host.mak
@@ -16,17 +18,15 @@ if test -z "${XEN_SCRIPT_DIR}"; then
XEN_SCRIPT_DIR="/etc/xen/scripts"
fi
-./configure --disable-gfx-check --disable-curses --disable-slirp "$@"
--prefix=${PREFIX}
-
-target=i386-dm
+$QEMU_ROOT/configure --disable-gfx-check --disable-curses --disable-slirp
"$@" --prefix=${PREFIX}
if [ "x$XEN_ROOT" != x ]; then
echo "XEN_ROOT=$XEN_ROOT" >>config-host.mak
fi
-ln -sf ../Makefile.target $target/Makefile
-ln -sf ../xen-config.mak $target/config.mak
-cat xen-config-host.mak >>config-host.mak
+ln -sf ${QEMU_ROOT:-..}/Makefile.target $target/Makefile
+ln -sf ${QEMU_ROOT:-..}/xen-config.mak $target/config.mak
+cat ${QEMU_ROOT:-.}/xen-config-host.mak >>config-host.mak
sed -e ''s,qemu,xen/qemu,'' config-host.h >config-host.h.new
echo "#define DEFAULT_NETWORK_SCRIPT
\"${XEN_SCRIPT_DIR}/qemu-ifup\"" >>config-host.h.new
--- 2010-11-09.orig/qemu/xen-setup-stubdom 2010-11-09 08:49:12.000000000 +0100
+++ 2010-11-09/qemu/xen-setup-stubdom 2010-11-09 10:30:19.000000000 +0100
@@ -1,11 +1,11 @@
#!/bin/sh
set -e
-qemu_version=`head VERSION`
-
-ln -sf ../Makefile.target i386-stubdom/Makefile
+qemu_version=`head ${QEMU_ROOT:-.}/VERSION`
target=i386-stubdom
+mkdir -p $target
+ln -sf ${QEMU_ROOT:-..}/Makefile.target $target/Makefile
#----------
cat <<END >$target/config.mak.new
@@ -15,6 +15,7 @@ XEN_ROOT ?= \$(QEMU_ROOT)/../xen-unstabl
include ../config-host.mak
TARGET_ARCH=i386
+TARGET_PATH:=\$(SRC_PATH)/\$(TARGET_DIRS)
CONFIG_SOFTMMU=yes
TARGET_CPPFLAGS += $TARGET_CPPFLAGS -DCONFIG_STUBDOM -D__XEN_TOOLS__
@@ -26,8 +27,7 @@ END
mv -f $target/config.mak.new $target/config.mak
#----------
-ln -sf ../i386-dm/hookslib.mak $target/
-(cd $target ; ln -sf ../i386-dm/*.[ch] .)
+test $QEMU_ROOT != .. || (cd $target ; ln -sf ../i386-dm/*.[ch] .)
#----------
cat <<END >config-host.h.new
@@ -48,7 +48,7 @@ mv -f config-host.h.new config-host.h
#----------
cat <<END >config-host.mak.new
CONFIG_STUBDOM=yes
-prefix=$(PREFIX)
+prefix=$PREFIX
bindir=\${prefix}/bin
mandir=\$(MANDIR)
datadir=\$(SHAREDIR)/qemu
@@ -70,7 +70,7 @@ CONFIG_GDBSTUB CONFIG_OSS CONFIG_OSS_LIB VERSION=$qemu_version
-SRC_PATH=`pwd`
+SRC_PATH=${QEMU_ROOT:-`pwd`}
TARGET_DIRS=$target
BUILD_DOCS CONFIG_AIO@@ -90,7 +90,7 @@ cat <<END
>>config-host.mak.new
include \$(XEN_ROOT)/tools/Rules.mk
SUBDIR_RULES=subdir-\$(TARGET_DIRS)
subdir-\$(TARGET_DIRS): libqemu_common.a
--include \$(QEMU_ROOT)/xen-hooks.mak
+include \$(QEMU_ROOT)/xen-hooks.mak
HOST_USB=stub
HOST_LDFLAGS= \$(LDFLAGS) -g -Wl,--warn-common
@@ -101,7 +101,7 @@ LDFLAGS= $TARGET_LDFLAGS
SUBDIR_RULES=subdir-\$(TARGET_DIRS)
subdir-\$(TARGET_DIRS): libqemu_common.a
--include \$(QEMU_ROOT)/xen-hooks.mak
+include \$(QEMU_ROOT)/xen-hooks.mak
END
mv -f config-host.mak.new config-host.mak
--- 2010-11-09.orig/stubdom/Makefile 2010-11-02 13:34:16.000000000 +0100
+++ 2010-11-09/stubdom/Makefile 2010-11-09 10:30:19.000000000 +0100
@@ -214,6 +214,9 @@ $(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_A
.PHONY: $(CROSS_ROOT)
$(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
+QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo
"$(CONFIG_QEMU)"; else echo .; fi)
+
+ifeq ($(QEMU_ROOT),.)
$(XEN_ROOT)/tools/ioemu-dir:
$(CROSS_MAKE) -C $(XEN_ROOT)/tools ioemu-dir-find
@@ -230,6 +233,13 @@ ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/
)) | \
while read f; do rm -f "$$f"; ln -s "$$src/$$f"
"$$f"; done
touch ioemu/linkfarm.stamp
+else
+export QEMU_ROOT
+
+ioemu/linkfarm.stamp:
+ mkdir -p ioemu
+ touch ioemu/linkfarm.stamp
+endif
mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
mkdir -p include/xen && \
@@ -286,8 +296,8 @@ ioemu: cross-zlib cross-libpci libxc
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
- ./xen-setup-stubdom )
- $(CROSS_MAKE) -C ioemu
+ $(QEMU_ROOT)/xen-setup-stubdom )
+ $(CROSS_MAKE) -C ioemu -f $(QEMU_ROOT)/Makefile
######
# caml
--- 2010-11-09.orig/tools/Makefile 2010-11-02 13:34:16.000000000 +0100
+++ 2010-11-09/tools/Makefile 2010-11-09 10:30:19.000000000 +0100
@@ -81,20 +81,15 @@ IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TAR
--interp-prefix=$(CROSS_SYS_ROOT)
endif
-ioemu/config-host.mak:
- cd ioemu && XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure \
- --prefix=$(PREFIX) $(IOEMU_CONFIGURE_CROSS)
-
-subdir-all-ioemu subdir-install-ioemu: ioemu/config-host.mak
-
-subdir-clean-ioemu:
- $(MAKE) -C ioemu distclean
+QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo
"$(CONFIG_QEMU)"; else echo .; fi)
+ifneq ($(QEMU_ROOT),.)
+export QEMU_ROOT
+endif
ioemu-dir-find:
set -ex; \
if test -d $(CONFIG_QEMU); then \
- rm -f ioemu-dir; \
- ln -sf $(CONFIG_QEMU) ioemu-dir; \
+ mkdir -p ioemu-dir; \
else \
if [ ! -d ioemu-remote ]; then \
rm -rf ioemu-remote ioemu-remote.tmp; \
@@ -115,7 +110,7 @@ ioemu-dir-find:
$(absolutify_xen_root); \
$(buildmakevars2shellvars); \
cd ioemu-dir; \
- ./xen-setup $(IOEMU_CONFIGURE_CROSS)
+ $(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
subdir-all-ioemu-dir subdir-install-ioemu-dir: ioemu-dir-find
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel