Skip to contentSkip to conversation

qemu: build adjustments

RFC PATCH Superseded Jan Beulich 2 participants 3 messages Nov 9, 2010 – Nov 10, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 qemu: build adjustments

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.

qemu/Makefile.target +5 -4
@@ -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)
qemu/i386-dm/hooks.mak +1 -1
@@ -3,4 +3,4 @@ CPPFLAGS += -DHAS_AUDIO
 endif
 QEMU_PROG=qemu-dm
 
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
qemu/i386-dm/hookstarget.mak +1 -1
@@ -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"
qemu/i386-stubdom/hooks.mak +1 -1
@@ -1,4 +1,4 @@
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
 
 OBJS += block-vbd.o
 
qemu/i386-stubdom/hookslib.mak new file +1 -0
@@ -0,0 +1 @@
+include $(SRC_PATH)/i386-dm/hookslib.mak
qemu/i386-stubdom/hookstarget.mak new file +1 -0
@@ -0,0 +1 @@
+VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/i386-dm:$(SRC_PATH)/hw
qemu/xen-config-host.mak +3 -3
@@ -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
qemu/xen-config.mak +1 -0
@@ -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
qemu/xen-hooks.mak +1 -1
@@ -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
qemu/xen-setup +6 -6
@@ -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
qemu/xen-setup-stubdom +9 -9
@@ -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
stubdom/Makefile +12 -2
@@ -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
tools/Makefile +6 -11
@@ -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
 

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.

qemu/Makefile.target +5 -4
@@ -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)
qemu/i386-dm/hooks.mak +1 -1
@@ -3,4 +3,4 @@ CPPFLAGS += -DHAS_AUDIO
 endif
 QEMU_PROG=qemu-dm
 
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
qemu/i386-dm/hookstarget.mak +1 -1
@@ -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"
qemu/i386-stubdom/hooks.mak +1 -1
@@ -1,4 +1,4 @@
-include ../xen-hooks.mak
+include $(QEMU_ROOT)/xen-hooks.mak
 
 OBJS += block-vbd.o
 
qemu/i386-stubdom/hookslib.mak new file +1 -0
@@ -0,0 +1 @@
+include $(SRC_PATH)/i386-dm/hookslib.mak
qemu/i386-stubdom/hookstarget.mak new file +1 -0
@@ -0,0 +1 @@
+VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/i386-dm:$(SRC_PATH)/hw
qemu/xen-config-host.mak +3 -3
@@ -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
qemu/xen-config.mak +1 -0
@@ -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
qemu/xen-hooks.mak +1 -1
@@ -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
qemu/xen-setup +6 -6
@@ -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
qemu/xen-setup-stubdom +9 -9
@@ -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
stubdom/Makefile +12 -2
@@ -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
tools/Makefile +6 -11
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Jan Beulich writes ("[Xen-devel] [PATCH, RFC] qemu: build adjustments"):

Quoted 10 lines

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.

I like the idea, in principle. But:

Before your patch, it was possible to build a standalone qemu tree by doing this or the moral equivalent:
XEN_ROOT=~/work/xen-unstable-tools.hg ./xen-setup
make -j4

Now the xen-setup fails:
./xen-setup: line 21: /configure: No such file or directory

Ian.

#2 lore raw
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Ian Jackson

Jan Beulich writes ("[Xen-devel] [PATCH, RFC] qemu: build adjustments"):

Quoted 10 lines

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.

I like the idea, in principle. But:

Quoted 7 lines

Before your patch, it was possible to build a standalone qemu tree by doing this or the moral equivalent:
XEN_ROOT=~/work/xen-unstable-tools.hg ./xen-setup
make -j4

Now the xen-setup fails:
./xen-setup: line 21: /configure: No such file or directory

Oh, indeed - I failed to add fallbacks in two places. I'll submit a second version shortly.

Jan