tools: consolidate Makefile runes to building+installing qemu-trad
PATCH 1/2 tools: consolidate Makefile runes to building+installing qemu-trad
Currently both subdir-all-qemu-traditional-dir and subdir-install-... recurse into qemu-traditional-dir and run xen-setup, but with subtly different options (--extra-cflags was only passed for install).
Consolidate these by having the install target depend on the all (build) target and only calling make install.
There is a subtlty which is that qemu-trad's build is not completely isolated from xen.git and requires some environment variables etc. To handle this refactor the setup code into a make macro and $(call) it in both cases.
Note that this doesn't actually omit a potential double call to configure, since all is still called during install, this is the same for qemu-xen. Note that it doesn't result in a double build in either case, since apparently the qemu configure is idempotent.
--- tools/Makefile | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
tools/Makefile +9 -12
@@ -184,28 +184,25 @@ qemu-xen-traditional-dir-force-update: qemu-xen-traditional-dir-find $(GIT) reset --hard $(QEMU_TRADITIONAL_REVISION); \ fi -subdir-all-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find +qemu-traditional-recurse = \ set -e; \ $(buildmakevars2shellvars); \ export CONFIG_BLKTAP1=n; \ cd qemu-xen-traditional-dir; \ - $(QEMU_ROOT)/xen-setup \ - $(IOEMU_EXTRA_LDFLAGS) \ - --cpu=$(IOEMU_CPU_ARCH) \ - $(IOEMU_CONFIGURE_CROSS); \ - $(MAKE) all + $(1) -subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find - set -e; \ - $(buildmakevars2shellvars); \ - export CONFIG_BLKTAP1=n; \ - cd qemu-xen-traditional-dir; \ +subdir-all-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find + $(call qemu-traditional-recurse,\ $(QEMU_ROOT)/xen-setup \ --extra-cflags="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \ $(IOEMU_EXTRA_LDFLAGS) \ --cpu=$(IOEMU_CPU_ARCH) \ $(IOEMU_CONFIGURE_CROSS); \ - $(MAKE) install + $(MAKE) all \ + ) + +subdir-install-qemu-xen-traditional-dir: subdir-all-qemu-xen-traditional-dir + $(call qemu-traditional-recurse,$(MAKE) install) subdir-clean-qemu-xen-traditional-dir: set -e; if test -d qemu-xen-traditional-dir/.; then \
Signature · 1 line
2.1.4
PATCH 2/2 tools: Do not expose all builds to unstable hypercall APIs by default
Currently __XEN_TOOLS__ is defined in the global CFLAGS used for tools builds, exposing them all to the various unstable hypercall interfaces.
However there are places where we do not want this (in particular all the stable libraries now under tools/libs), and there is a risk of such uses slipping in unnoticed (currently there are none, but I tripped over the mixed nature of the HVMOPs just now in some new code I was putting together).
Instead only define __XEN_TOOLS__ for things which explicitly want the unstable APIs. The vast majority of these are consumers of libxenctrl, which have opted into unstable interfaces by using libxenctrl already, so adding -D__XEN_TOOLS__ to CFLAGS_libxenctrl covers these without needing to patch the dozen or so tools manually.
The libxc build itself, which doesn't use CFLAGS_libxenctrl, now needs the define too. As does gdbsx's own low level hypercall binding library xg.
hvmloader no longer needs to undefine the symbol.
The ocaml evtchn bindings don't actually need sysctl.h and therefore don't actually need __XEN_TOOLS__ either.
Lastly qemu-xen-traditional doesn't use CFLAGS_libxenctrl and so we pass the define there too.
--- tools/Makefile | 2 +- tools/Rules.mk | 6 +++--- tools/debugger/gdbsx/xg/Makefile | 1 + tools/firmware/hvmloader/Makefile | 2 +- tools/libxc/Makefile | 1 + tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 1 - 6 files changed, 7 insertions(+), 6 deletions(-)
tools/Makefile +1 -1
@@ -194,7 +194,7 @@ qemu-traditional-recurse = \ subdir-all-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find $(call qemu-traditional-recurse,\ $(QEMU_ROOT)/xen-setup \ - --extra-cflags="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \ + --extra-cflags="-D__XEN_TOOLS__ $(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \ $(IOEMU_EXTRA_LDFLAGS) \ --cpu=$(IOEMU_CPU_ARCH) \ $(IOEMU_CONFIGURE_CROSS); \
tools/Rules.mk +3 -3
@@ -108,7 +108,9 @@ CFLAGS_libxenforeignmemory = -I$(XEN_LIBXENFOREIGNMEMORY)/include $(CFLAGS_xenin LDLIBS_libxenforeignmemory = $(XEN_LIBXENFOREIGNMEMORY)/libxenforeignmemory$(libextension) SHLIB_libxenforeignmemory = -Wl,-rpath-link=$(XEN_LIBXENFOREIGNMEMORY) -CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude) +# code which compiles against libxenctrl get __XEN_TOOLS__ and +# therefore sees the unstable hypercall interfaces. +CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ SHDEPS_libxenctrl = $(SHLIB_libxentoollog) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab) $(SHLIB_libxengntshr) $(SHLIB_libxencall) $(SHLIB_libxenforeignmemory) LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_LIBXC)/libxenctrl$(libextension) SHLIB_libxenctrl = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_LIBXC)
@@ -159,8 +161,6 @@ SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapc LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension) SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT) -CFLAGS += -D__XEN_TOOLS__ - # Get gcc to generate the dependencies for us. CFLAGS += -MMD -MF .$(if $(filter-out .,$(@D)),$(subst /,@,$(@D))@)$(@F).d DEPS = .*.d
tools/debugger/gdbsx/xg/Makefile +1 -0
@@ -4,6 +4,7 @@ include ../Rules.mk XG_HDRS := xg_public.h XG_OBJS := xg_main.o +CFLAGS += -D__XEN_TOOLS__ CFLAGS += $(CFLAGS_xeninclude)
tools/firmware/hvmloader/Makefile +1 -1
@@ -31,7 +31,7 @@ SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y) CFLAGS += $(CFLAGS_xeninclude) # We mustn't use tools-only public interfaces. -CFLAGS += -U__XEN_TOOLS__ -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ +CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ OBJS = hvmloader.o mp_tables.o util.o smbios.o OBJS += smp.o cacheattr.o xenbus.o vnuma.o
tools/libxc/Makefile +1 -0
@@ -105,6 +105,7 @@ endif CFLAGS += -Werror -Wmissing-prototypes CFLAGS += -I. -I./include $(CFLAGS_xeninclude) +CFLAGS += -D__XEN_TOOLS__ # Needed for posix_fadvise64() in xc_linux.c CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
tools/ocaml/libs/eventchn/xeneventchn_stubs.c +0 -1
@@ -21,7 +21,6 @@#include <errno.h> #include <stdint.h> #include <sys/ioctl.h> -#include <xen/sysctl.h> #include <xen/xen.h> #include <xen/sys/evtchn.h> #include <xenevtchn.h>
Signature · 1 line
2.1.4
Re: [PATCH 2/2] tools: Do not expose all builds to unstable hypercall APIs by default
Quoted 8 lines · Ian Campbell
(quoted diff) +0
-0@@ -159,8 +161,6 @@ SHDEPS_libxenlight = $(SHLIB_libxenctrl)$(SHLIB_libxenstore) $(SHLIB_libblktapc
LDLIBS_libxenlight= $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension) SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath- link=$(XEN_XENLIGHT)
-CFLAGS += -D__XEN_TOOLS__
It occurred to me afterwards that replacing this with -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ instead would probably be wise. I'll send a version with that.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel