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

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



On Thu, 2013-08-08 at 09:39 +0100, Ian Campbell wrote:
> On Wed, 2013-08-07 at 16:21 +0100, Ian Jackson wrote:
> > Ian Campbell writes ("[PATCH 2/3] tools: allow user to specify a system 
> > qemu-xen binary"):
> > 
> > > +  --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.

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

8<--------

From 620a0ba3721c2f991581b74814cab890264a45ee Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
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.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
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(-)

diff --git a/Makefile b/Makefile
index a936fbe..2b91537 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 2e80a93..3700e6d 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -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@
diff --git a/tools/Makefile b/tools/Makefile
index cee4229..5ce839f 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -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
diff --git a/tools/config.h.in b/tools/config.h.in
index 1f91319..8d5615b 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -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
 
diff --git a/tools/configure b/tools/configure
index 8638210..ae8a877 100755
--- a/tools/configure
+++ b/tools/configure
@@ -654,6 +654,7 @@ APPEND_LIB
 APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
+qemu_xen
 qemu_traditional
 debug
 seabios
@@ -736,6 +737,7 @@ enable_rombios
 enable_seabios
 enable_debug
 enable_qemu_traditional
+with_system_qemu
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1400,6 +1402,14 @@ Optional Features:
                           Enable qemu traditional device model, (DEFAULT is on
                           for x86, otherwise off)
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --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
+
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
@@ -3686,6 +3696,37 @@ fi
 
 
 
+# Check whether --with-system-qemu was given.
+if test "${with_system_qemu+set}" = set; then :
+  withval=$with_system_qemu;
+    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
+
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           qemu_xen=y;;
+        *) qemu_xen=n;;
+    esac
+
+fi
+
+if test "x$qemu_xen" = "xn"; then :
+
+
+cat >>confdefs.h <<_ACEOF
+#define QEMU_XEN_PATH "$qemu_xen_path"
+_ACEOF
+
+
+fi
+
+
+
 
 
 
diff --git a/tools/configure.ac b/tools/configure.ac
index 5b5f7f6..06cffdf 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -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],
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 7e54c02..22b0aed 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -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,
-- 
1.7.2.5




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.