Skip to contentSkip to conversation

tools: build: allow disabling qemu-trad and selecting system qemu-xen

PATCH In review Ian Campbell 3 participants 13 messages Aug 6, 2013 – Aug 21, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

cover tools: build: allow disabling qemu-trad and selecting system qemu-xen

depends on "autoconf: regenerate configure scripts with 4.4 version"

Make qemu-xen-trad optional:

Although we intend to support this code for the foreseeable users and or distros may wish to exclude this large body of code and reduce security/support/etc implications.

Allow use of system supplied upstream qemu:

Makes it easier for distros to do what they are very probably going to do anyway.

Ian

#1 lore raw

PATCH 1/3 tools: Make qemu-xen-traditional build optional.

Now that we have upstream qemu people may want to avoid building this extra code.

There is a little bit of trickery in stubdom/configure.ac to ensure that the ioemu stubdom is only built if qemu-traditional is enabled.

libxl will return an error if a caller tries to build a domain using qemu-xen-traditional when this support was disabled at build time. Since qemu-xen-traditional has been historically tightly bound to the Xen releases I don't see any value in supporting "3rd party" provision of qemu-xen-traditional.

We also do not want/need this on ARM therefore default is on for x86 and off otherwise.

---
 Makefile                   |   22 ++++---
 config/Tools.mk.in         |    1 +
 stubdom/Makefile           |    6 ++-
 stubdom/configure          |  152 ++++++++++++++++++++++++++++++++++++++++----
 stubdom/configure.ac       |   24 +++++++-
 tools/Makefile             |    2 +-
 tools/config.h.in          |    3 +
 tools/configure            |   31 +++++++++
 tools/configure.ac         |   16 +++++
 tools/libxl/libxl_create.c |   14 ++++
 10 files changed, 247 insertions(+), 24 deletions(-)
Makefile +13 -9
index 5a7107e..a936fbe 100644
@@ -73,8 +73,19 @@ install-xen:
 install-tools:
 	$(MAKE) -C tools install
 
+ifeq ($(CONFIG_QEMU_TRAD),y)
+QEMU_TRAD_DIR_TGT := tools/qemu-xen-traditional-dir
+
+tools/qemu-xen-traditional-dir:
+	$(MAKE) -C tools qemu-xen-traditional-dir-find
+
+.PHONY: tools/qemu-xen-traditional-dir-force-update
+tools/qemu-xen-traditional-dir-force-update:
+	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
+endif
+
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/qemu-xen-traditional-dir tools/qemu-xen-dir
+install-tools: $(QEMU_TRAD_DIR_TARGET) tools/qemu-xen-dir
 endif
 
 .PHONY: install-kernels
@@ -82,19 +93,12 @@ install-kernels:
 	for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
 
 .PHONY: install-stubdom
-install-stubdom: tools/qemu-xen-traditional-dir install-tools
+install-stubdom: $(QEMU_TRAD_DIR_TARGET) install-tools
 	$(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/qemu-xen-traditional-dir:
-	$(MAKE) -C tools qemu-xen-traditional-dir-find
-
-.PHONY: tools/qemu-xen-traditional-dir-force-update
-tools/qemu-xen-traditional-dir-force-update:
-	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
-
 tools/qemu-xen-dir:
 	$(MAKE) -C tools qemu-xen-dir-find
 
config/Tools.mk.in +1 -0
index 5e2c6d8..2e80a93 100644
@@ -52,6 +52,7 @@ CONFIG_LOMOUNT      := @lomount@
 CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
+CONFIG_QEMU_TRAD    := @qemu_traditional@
 
 #System options
 CONFIG_SYSTEM_LIBAIO:= @system_aio@
stubdom/Makefile +5 -1
index 35295f0..19f2228 100644
@@ -264,6 +264,10 @@ $(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
 
 QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi)
 
+ifneq ($(filter ioemu,$(STUBDOM_TARGETS)),)
+IOEMU_LINKFARM_TARGET := ioemu/linkfarm.stamp
+endif
+
 ifeq ($(QEMU_ROOT),.)
 $(XEN_ROOT)/tools/qemu-xen-traditional-dir:
 	$(MAKE) DESTDIR= -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
@@ -289,7 +293,7 @@ ioemu/linkfarm.stamp:
 	touch ioemu/linkfarm.stamp
 endif
 
-mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
+mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET)
 	mkdir -p include/xen && \
           ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) include/xen && \
           ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 hvm io xsm) include/xen && \
stubdom/configure +140 -12

216 lines not on this page · raw message

stubdom/configure.ac +23 -1
index 90fc94f..6468203 100644
@@ -8,6 +8,8 @@ AC_CONFIG_SRCDIR([../extras/mini-os/kernel.c])
 AC_CONFIG_FILES([../config/Stubdom.mk])
 AC_CONFIG_AUX_DIR([../])
 
+AC_CANONICAL_HOST
+
 # M4 Macro includes
 m4_include([../m4/stubdom.m4])
 m4_include([../m4/features.m4])
@@ -16,7 +18,7 @@ m4_include([../m4/depends.m4])
 m4_include([../m4/fetcher.m4])
 
 # Enable/disable stub domains
-AX_STUBDOM_DEFAULT_ENABLE([ioemu-stubdom], [ioemu])
+AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
 AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c])
 AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml])
 AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub])
@@ -24,6 +26,25 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
+AC_ARG_ENABLE([qemu-traditional],,,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
+AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+    qemu_traditional=y],[
+    qemu_traditional=n
+])
+AS_IF([test "x$ioemu" = "x"], [
+    ioemu=$qemu_traditional
+])
+echo "x$ioemu$qemu_traditional"
+AS_IF([test "x$ioemu$qemu_traditional" = "xyn"], [
+    AC_MSG_ERROR(IOEMU stubdomain requires qemu-traditional)
+])
+
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of stubdom])
 AX_ARG_DEFAULT_ENABLE([extfiles], [Use xen extfiles repository for libraries])
 
@@ -55,6 +76,7 @@ AX_STUBDOM_AUTO_DEPENDS([vtpmmgr], [vtpm])
 #Conditionally enable these stubdoms based on the presense of dependencies
 AX_STUBDOM_CONDITIONAL_FINISH([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL_FINISH([vtpmmgr-stubdom], [vtpmmgr])
+AX_STUBDOM_CONDITIONAL_FINISH([ioemu-stubdom], [ioemu])
 
 AX_STUBDOM_FINISH
 AC_OUTPUT()
tools/Makefile +1 -1
index e44a3e9..cee4229 100644
@@ -34,7 +34,7 @@ SUBDIRS-$(CONFIG_Linux) += libvchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
+SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir
 SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
 endif
 
tools/config.h.in +3 -0
index a67910b..1f91319 100644
@@ -15,6 +15,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Qemu traditional enabled */
+#undef HAVE_QEMU_TRADITIONAL
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
tools/configure +31 -0
index 079646c..8638210 100755
@@ -654,6 +654,7 @@ APPEND_LIB
 APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
+qemu_traditional
 debug
 seabios
 rombios
@@ -734,6 +735,7 @@ enable_ovmf
 enable_rombios
 enable_seabios
 enable_debug
+enable_qemu_traditional
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1394,6 +1396,9 @@ Optional Features:
   --disable-rombios       Disable ROM BIOS (default is ENABLED)
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-debug         Disable debug build of tools (default is ENABLED)
+  --enable-qemu-traditional
+                          Enable qemu traditional device model, (DEFAULT is on
+                          for x86, otherwise off)
 
 Some influential environment variables:
   CC          C compiler command
@@ -3654,6 +3659,32 @@ debug=$ax_cv_debug
 
 
 
+# Check whether --enable-qemu-traditional was given.
+if test "${enable_qemu_traditional+set}" = set; then :
+  enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+
+fi
+
+if test "x$enable_qemu_traditional" = "xyes"; then :
+
+
+$as_echo "#define HAVE_QEMU_TRADITIONAL 1" >>confdefs.h
+
+    qemu_traditional=y
+else
+
+    qemu_traditional=n
+
+fi
+
+
 
 
 
tools/configure.ac +16 -0
index 4f5e688..5b5f7f6 100644
@@ -60,6 +60,22 @@ AX_ARG_DEFAULT_ENABLE([rombios], [Disable ROM BIOS])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 
+AC_ARG_ENABLE([qemu-traditional],
+    AS_HELP_STRING([--enable-qemu-traditional],
+                   [Enable qemu traditional device model, (DEFAULT is on for x86, otherwise off)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
+AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
+    qemu_traditional=y],[
+    qemu_traditional=n
+])
+AC_SUBST(qemu_traditional)
+
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
 AC_ARG_VAR([PREPEND_LIB],
tools/libxl/libxl_create.c +14 -0
index 0c32d0b..e4c614b 100644
@@ -107,8 +107,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->device_model_version) {
         if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
             if (libxl_defbool_val(b_info->device_model_stubdomain)) {
+#ifdef HAVE_QEMU_TRADITIONAL
                 b_info->device_model_version =
                     LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+#else
+                LOG(ERROR, "device model stubdomains require \"qemu-xen-traditional\", "
+                    "but they were disabled at compile time");
+                return ERROR_INVAL;
+#endif
             } else {
                 b_info->device_model_version = libxl__default_device_model(gc);
             }
@@ -138,6 +144,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         }
     }
 
+#ifndef HAVE_QEMU_TRADITIONAL
+    if (b_info->device_model_version
+            == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
+        LOG(ERROR, "\"qemu-xen-traditional\" disabled at compile time");
+        return ERROR_INVAL;
+    }
+#endif
+
     if (b_info->blkdev_start == NULL)
         b_info->blkdev_start = libxl__strdup(NOGC, "xvda");
 
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH 1/3] tools: Make qemu-xen-traditional build optional.

Quoted 7 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Now that we have upstream qemu people may want to avoid building this extra code.

There is a little bit of trickery in stubdom/configure.ac to ensure that the ioemu stubdom is only built if qemu-traditional is enabled.

Quoted 8 lines

libxl will return an error if a caller tries to build a domain using qemu-xen-traditional when this support was disabled at build time. Since qemu-xen-traditional has been historically tightly bound to the Xen releases I don't see any value in supporting "3rd party" provision of qemu-xen-traditional.

We also do not want/need this on ARM therefore default is on for x86 and off otherwise.

Shouldn't turning qemu-trad off imply also turning off xend/xm?

Jan

#3 lore raw

Re: [PATCH 1/3] tools: Make qemu-xen-traditional build optional.

Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · Ian Campbell

Now that we have upstream qemu people may want to avoid building this extra code.

There is a little bit of trickery in stubdom/configure.ac to ensure that the ioemu stubdom is only built if qemu-traditional is enabled.

libxl will return an error if a caller tries to build a domain using qemu-xen-traditional when this support was disabled at build time. Since qemu-xen-traditional has been historically tightly bound to the Xen releases I don't see any value in supporting "3rd party" provision of qemu-xen-traditional.

Quoted 4 lines
Quoted 2 lines

We also do not want/need this on ARM therefore default is on for x86 and off otherwise.

Shouldn't turning qemu-trad off imply also turning off xend/xm?

You could still use PV domains without qemu-trad.

Ian.

Acked-by on v1 1/3
#4 lore raw

Re: [PATCH 1/3] tools: Make qemu-xen-traditional build optional.

In reply to Ian Campbell

Ian Campbell writes ("[PATCH 1/3] tools: Make qemu-xen-traditional build optional."):

Quoted 6 lines

Now that we have upstream qemu people may want to avoid building this extra code.

There is a little bit of trickery in stubdom/configure.ac to ensure that the ioemu stubdom is only built if qemu-traditional is enabled.

Quoted 8 lines

libxl will return an error if a caller tries to build a domain using qemu-xen-traditional when this support was disabled at build time. Since qemu-xen-traditional has been historically tightly bound to the Xen releases I don't see any value in supporting "3rd party" provision of qemu-xen-traditional.

We also do not want/need this on ARM therefore default is on for x86 and off otherwise.

#5 lore raw

PATCH 2/3 tools: allow user to specify a system qemu-xen binary

In reply to Ian Campbell

If this option is given don't bother building qemu-xen ourselves. Likely to be handy for distros who have an existing qemu package which they want to reuse.

---
 Makefile               |   20 ++++++++++++--------
 config/Tools.mk.in     |    1 +
 tools/Makefile         |    2 +-
 tools/config.h.in      |    3 +++
 tools/configure        |   41 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac     |   21 +++++++++++++++++++++
 tools/libxl/libxl_dm.c |   11 ++++++++++-
 7 files changed, 89 insertions(+), 10 deletions(-)
Makefile +12 -8
index a936fbe..2b91537 100644
@@ -84,8 +84,19 @@ tools/qemu-xen-traditional-dir-force-update:
 	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 endif
 
+ifeq ($(CONFIG_QEMU_XEN),y)
+QEMU_XEN_DIR_TGT := tools/qemu-xen-dir
+
+tools/qemu-xen-dir:
+	$(MAKE) -C tools qemu-xen-dir-find
+
+.PHONY: tools/qemu-xen-dir-force-update
+tools/qemu-xen-dir-force-update:
+	$(MAKE) -C tools qemu-xen-dir-force-update
+endif
+
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: $(QEMU_TRAD_DIR_TARGET) tools/qemu-xen-dir
+install-tools: $(QEMU_TRAD_DIR_TARGET) $(QEMU_XEN_DIR_TARGET)
 endif
 
 .PHONY: install-kernels
@@ -99,13 +110,6 @@ ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/qemu-xen-dir:
-	$(MAKE) -C tools qemu-xen-dir-find
-
-.PHONY: tools/qemu-xen-dir-force-update
-tools/qemu-xen-dir-force-update:
-	$(MAKE) -C tools qemu-xen-dir-force-update
-
 .PHONY: tools/firmware/seabios-dir-force-update
 tools/firmware/seabios-dir-force-update:
 	$(MAKE) -C tools/firmware seabios-dir-force-update
config/Tools.mk.in +1 -0
index 2e80a93..3700e6d 100644
@@ -53,6 +53,7 @@ CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
 CONFIG_QEMU_TRAD    := @qemu_traditional@
+CONFIG_QEMU_XEN     := @qemu_xen@
 
 #System options
 CONFIG_SYSTEM_LIBAIO:= @system_aio@
tools/Makefile +1 -1
index cee4229..5ce839f 100644
@@ -35,7 +35,7 @@ SUBDIRS-$(CONFIG_Linux) += libvchan
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
 SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
+SUBDIRS-$(CONFIG_QEMU_XEN) += qemu-xen-dir
 endif
 
 SUBDIRS-y += xenpmd
tools/config.h.in +3 -0
index 1f91319..8d5615b 100644
@@ -72,6 +72,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Qemu Xen path */
+#undef QEMU_XEN_PATH
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
tools/configure +41 -0

65 lines not on this page · raw message

tools/configure.ac +21 -0
index 5b5f7f6..e7e25c9 100644
@@ -76,6 +76,27 @@ AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
 ])
 AC_SUBST(qemu_traditional)
 
+AC_ARG_WITH([system-qemu],
+    AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@],
+       [Use system supplied qemu PATH or /usr/bin/qemu as qemu-xen device model instead of building
+        and installing our own version]),[
+    case $withval in
+    yes) qemu_xen=n ; qemu_xen_path=/usr/bin/qemu ;;
+    no)  qemu_xen=y ; qemu_xen_path= ;;
+    *)   qemu_xen=n ; qemu_xen_path=$withval ;;
+    esac
+],[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           qemu_xen=y;;
+        *) qemu_xen=n;;
+    esac
+])
+AS_IF([test "x$qemu_xen" = "xn"], [
+    AC_DEFINE_UNQUOTED([QEMU_XEN_PATH], ["$qemu_xen_path"], [Qemu Xen path])
+])
+AC_SUBST(qemu_xen)
+
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
 AC_ARG_VAR([PREPEND_LIB],
tools/libxl/libxl_dm.c +10 -1
index 7e54c02..22b0aed 100644
@@ -33,6 +33,15 @@ const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid)
     return libxl__sprintf(gc, "/var/lib/xen/qemu-save.%d", domid);
 }
 
+static const char *qemu_xen_path(libxl__gc *gc)
+{
+#ifdef QEMU_XEN_PATH
+    return QEMU_XEN_PATH;
+#else
+    return libxl__abs_path(gc, "qemu-system-i386", libxl__libexec_path());
+#endif
+}
+
 const char *libxl__domain_device_model(libxl__gc *gc,
                                        const libxl_domain_build_info *info)
 {
@@ -50,7 +59,7 @@ const char *libxl__domain_device_model(libxl__gc *gc,
             dm = libxl__abs_path(gc, "qemu-dm", libxl__libexec_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            dm = libxl__abs_path(gc, "qemu-system-i386", libxl__libexec_path());
+            dm = qemu_xen_path(gc);
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
Signature · 1 line
1.7.2.5
#6 lore raw

Re: [PATCH 2/3] tools: allow user to specify a system qemu-xen binary

Ian Campbell writes ("[PATCH 2/3] tools: allow user to specify a system qemu-xen binary"):

tools/configure Optional Features: · line 1411

Quoted 4 lines
tools/configure +4 -0
+  --with-system-qemu[=PATH]
+                          Use system supplied qemu PATH or /usr/bin/qemu as
+                          qemu-xen device model instead of building and
+                          installing our own version

I think that if you say "yes" you ought to get "qemu" from the ordinary search PATH, not necessarily /usr/bin/qemu. (eg, /usr/local/bin/qemu)

Ian.

#7 lore raw

Re: [PATCH 2/3] tools: allow user to specify a system qemu-xen binary

Quoted 10 lines · Ian Jackson

Ian Campbell writes ("[PATCH 2/3] tools: allow user to specify a system qemu-xen binary"):

tools/configure Optional Features: · line 1411

Quoted 4 lines
tools/configure +4 -0
+  --with-system-qemu[=PATH]
+                          Use system supplied qemu PATH or /usr/bin/qemu as
+                          qemu-xen device model instead of building and
+                          installing our own version

I think that if you say "yes" you ought to get "qemu" from the ordinary search PATH, not necessarily /usr/bin/qemu. (eg, /usr/local/bin/qemu)

Good idea.

Ian.

#8 lore raw

Re: [PATCH 2/3] tools: allow user to specify a system qemu-xen binary

Quoted 8 lines · Ian Campbell
Quoted 7 lines · Ian Jackson

Ian Campbell writes ("[PATCH 2/3] tools: allow user to specify a system qemu-xen binary"):

Quoted 4 lines
(quoted diff) +4 -0
+  --with-system-qemu[=PATH]
+                          Use system supplied qemu PATH or /usr/bin/qemu as
+                          qemu-xen device model instead of building and
+                          installing our own version
Quoted 5 lines
Quoted 3 lines

I think that if you say "yes" you ought to get "qemu" from the ordinary search PATH, not necessarily /usr/bin/qemu. (eg, /usr/local/bin/qemu)

Good idea.

Rather than resend the whole series here is v2 of that one patch:

8<--------

Quoted 1 line

From 620a0ba3721c2f991581b74814cab890264a45ee Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Wed, 15 May 2013 14:47:32 +0100
Subject: [PATCH] tools: allow user to specify a system qemu-xen binary

If this option is given don't bother building qemu-xen ourselves. Likely to be handy for distros who have an existing qemu package which they want to reuse.

---
v2: --with-system-qemu defaults to qemu rather than /usr/bin/qemu.

---
 Makefile               |   20 ++++++++++++--------
 config/Tools.mk.in     |    1 +
 tools/Makefile         |    2 +-
 tools/config.h.in      |    3 +++
 tools/configure        |   41 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac     |   21 +++++++++++++++++++++
 tools/libxl/libxl_dm.c |   11 ++++++++++-
 7 files changed, 89 insertions(+), 10 deletions(-)
Makefile +12 -8
index a936fbe..2b91537 100644
@@ -84,8 +84,19 @@ tools/qemu-xen-traditional-dir-force-update:
 	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 endif
 
+ifeq ($(CONFIG_QEMU_XEN),y)
+QEMU_XEN_DIR_TGT := tools/qemu-xen-dir
+
+tools/qemu-xen-dir:
+	$(MAKE) -C tools qemu-xen-dir-find
+
+.PHONY: tools/qemu-xen-dir-force-update
+tools/qemu-xen-dir-force-update:
+	$(MAKE) -C tools qemu-xen-dir-force-update
+endif
+
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: $(QEMU_TRAD_DIR_TARGET) tools/qemu-xen-dir
+install-tools: $(QEMU_TRAD_DIR_TARGET) $(QEMU_XEN_DIR_TARGET)
 endif
 
 .PHONY: install-kernels
@@ -99,13 +110,6 @@ ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/qemu-xen-dir:
-	$(MAKE) -C tools qemu-xen-dir-find
-
-.PHONY: tools/qemu-xen-dir-force-update
-tools/qemu-xen-dir-force-update:
-	$(MAKE) -C tools qemu-xen-dir-force-update
-
 .PHONY: tools/firmware/seabios-dir-force-update
 tools/firmware/seabios-dir-force-update:
 	$(MAKE) -C tools/firmware seabios-dir-force-update
config/Tools.mk.in +1 -0
index 2e80a93..3700e6d 100644
@@ -53,6 +53,7 @@ CONFIG_OVMF         := @ovmf@
 CONFIG_ROMBIOS      := @rombios@
 CONFIG_SEABIOS      := @seabios@
 CONFIG_QEMU_TRAD    := @qemu_traditional@
+CONFIG_QEMU_XEN     := @qemu_xen@
 
 #System options
 CONFIG_SYSTEM_LIBAIO:= @system_aio@
tools/Makefile +1 -1
index cee4229..5ce839f 100644
@@ -35,7 +35,7 @@ SUBDIRS-$(CONFIG_Linux) += libvchan
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
 SUBDIRS-$(CONFIG_QEMU_TRAD) += qemu-xen-traditional-dir
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
+SUBDIRS-$(CONFIG_QEMU_XEN) += qemu-xen-dir
 endif
 
 SUBDIRS-y += xenpmd
tools/config.h.in +3 -0
index 1f91319..8d5615b 100644
@@ -72,6 +72,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Qemu Xen path */
+#undef QEMU_XEN_PATH
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
tools/configure +41 -0

65 lines not on this page · raw message

tools/configure.ac +21 -0
index 5b5f7f6..06cffdf 100644
@@ -76,6 +76,27 @@ AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
 ])
 AC_SUBST(qemu_traditional)
 
+AC_ARG_WITH([system-qemu],
+    AS_HELP_STRING([--with-system-qemu@<:@=PATH@:>@],
+       [Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen 
+        device model instead of building and installing our own version]),[
+    case $withval in
+    yes) qemu_xen=n ; qemu_xen_path=qemu ;;
+    no)  qemu_xen=y ; qemu_xen_path= ;;
+    *)   qemu_xen=n ; qemu_xen_path=$withval ;;
+    esac
+],[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           qemu_xen=y;;
+        *) qemu_xen=n;;
+    esac
+])
+AS_IF([test "x$qemu_xen" = "xn"], [
+    AC_DEFINE_UNQUOTED([QEMU_XEN_PATH], ["$qemu_xen_path"], [Qemu Xen path])
+])
+AC_SUBST(qemu_xen)
+
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
 AC_ARG_VAR([PREPEND_LIB],
tools/libxl/libxl_dm.c +10 -1
index 7e54c02..22b0aed 100644
@@ -33,6 +33,15 @@ const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid)
     return libxl__sprintf(gc, "/var/lib/xen/qemu-save.%d", domid);
 }
 
+static const char *qemu_xen_path(libxl__gc *gc)
+{
+#ifdef QEMU_XEN_PATH
+    return QEMU_XEN_PATH;
+#else
+    return libxl__abs_path(gc, "qemu-system-i386", libxl__libexec_path());
+#endif
+}
+
 const char *libxl__domain_device_model(libxl__gc *gc,
                                        const libxl_domain_build_info *info)
 {
@@ -50,7 +59,7 @@ const char *libxl__domain_device_model(libxl__gc *gc,
             dm = libxl__abs_path(gc, "qemu-dm", libxl__libexec_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-            dm = libxl__abs_path(gc, "qemu-system-i386", libxl__libexec_path());
+            dm = qemu_xen_path(gc);
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
Signature · 1 line
1.7.2.5
Acked-by
#9 lore raw

Re: [PATCH 2/3] tools: allow user to specify a system qemu-xen binary

Ian Campbell writes ("Re: [Xen-devel] [PATCH 2/3] tools: allow user to specify a system qemu-xen binary"):

Quoted 9 lines · Ian Campbell
Quoted 6 lines · Ian Jackson
Quoted 3 lines

I think that if you say "yes" you ought to get "qemu" from the ordinary search PATH, not necessarily /usr/bin/qemu. (eg, /usr/local/bin/qemu)

Good idea.

Rather than resend the whole series here is v2 of that one patch:

#10 lore raw

PATCH 3/3 build: CONFIG_IOEMU is now obsolete

In reply to Ian Campbell
---
 Makefile         |    8 ++------
 config/x86_32.mk |    1 -
 config/x86_64.mk |    1 -
 3 files changed, 2 insertions(+), 8 deletions(-)
Makefile +2 -6
index 2b91537..d915660 100644
@@ -69,10 +69,6 @@ prep-kernels:
 install-xen:
 	$(MAKE) -C xen install
 
-.PHONY: install-tools
-install-tools:
-	$(MAKE) -C tools install
-
 ifeq ($(CONFIG_QEMU_TRAD),y)
 QEMU_TRAD_DIR_TGT := tools/qemu-xen-traditional-dir
 
@@ -95,9 +91,9 @@ tools/qemu-xen-dir-force-update:
 	$(MAKE) -C tools qemu-xen-dir-force-update
 endif
 
-ifeq ($(CONFIG_IOEMU),y)
+.PHONY: install-tools
 install-tools: $(QEMU_TRAD_DIR_TARGET) $(QEMU_XEN_DIR_TARGET)
-endif
+	$(MAKE) -C tools install
 
 .PHONY: install-kernels
 install-kernels:
config/x86_32.mk +0 -1
index df52bd6..7f76b25 100644
@@ -5,7 +5,6 @@ CONFIG_X86_$(XEN_OS) := y
 CONFIG_HVM := y
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
-CONFIG_IOEMU ?= y
 
 CFLAGS += -m32 -march=i686
 
config/x86_64.mk +0 -1
index 70c0d8d..d29eeda 100644
@@ -6,7 +6,6 @@ CONFIG_COMPAT := y
 CONFIG_HVM := y
 CONFIG_MIGRATE := y
 CONFIG_XCUTILS := y
-CONFIG_IOEMU ?= y
 
 CONFIG_XEN_INSTALL_SUFFIX := .gz
 
Signature · 1 line
1.7.2.5
#12 lore raw
In reply to Ian Campbell
Quoted 1 line · Ian Campbell

depends on "autoconf: regenerate configure scripts with 4.4 version"

There were some trivial conflicts with the "cruft removal" patch series I committed yesterday. I have fixed these up and committed.

Ian.