tools, build: Build xenstore in rump kernel
v2 cover tools, build: Build xenstore in rump kernel
These miscellaneous build system and tools patches make it possible to build and run libxenstore in the NetBSD Xen rump kernel environment.
a 01/11 xenstore: Use $(PTHREAD_LIBS) not -lpthread a 02/11 xenstore: In xenstore_client, avoid stack buffer in recursive function a 03/11 rump kernels: Start introducing new XEN_OS NetBSDRump * 04/11 libxc: rump kernels: Use standard xc_osdep_get_info a 05/11 xenstore: rump kernels: Look for /dev/xen/xenbus a 06/11 xenstore: Make building of xenstored optional a 07/11 build system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB a 08/11 build system: Introduce libextension variable * 09/11 build system: Introduce nosharedlibs variable. * 10/11 rump kernels: Handle rumpxen host in configure a 11/11 tools/Makefile: Build only a subset of things for rump kernels
a = acked
* = modified in v2
Specifically,
.../rumpuser-xen/app-tools/rumpuserxen-app-configure ./configure .../rumpuser-xen/app-tools/rumpuserxen-app-make make -j4 tools
yields a xenstore client utility in xen.git/tools/xenstore/xenstore.
Running that utility with an xl config file containing
extra="ls -fp device"
gives the expected listing of the domain's xenstore device subtree. I have also done some (rather minimal) testing of watches.
PATCH v2 1/11 xenstore: Use $(PTHREAD_LIBS) not -lpthread
--- tools/xenstore/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/Makefile +1 -1
@@ -87,7 +87,7 @@ libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR) xs.opic: CFLAGS += -DUSE_PTHREAD libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS) libxenstore.a: xs.o xs_lib.o $(AR) rcs $@ $^
Signature · 1 line
1.7.10.4
PATCH v2 1/11 xenstore: Use $(PTHREAD_LIBS) not -lpthread
Ian Jackson writes ("[PATCH 01/11] xenstore: Use $(PTHREAD_LIBS) not -lpthread"):
Quoted 1 line
Signed-off-by Ian Jackson <[email protected]>
I discovered that this didn't build in the non-rumpkernel case!
This version does.
Ian.
Quoted 1 line
From
8d82316c2b922dc490373377207b06b155c56161Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Wed, 28 May 2014 17:06:50 +0100
Subject: [PATCH] xenstore: Use $(PTHREAD_LDFLAGS) and $(PTHREAD_LIBS) not
-lpthread
---
v3: We need PTHREAD_LDFLAGS too (!)
--- tools/xenstore/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/Makefile +1 -1
@@ -87,7 +87,7 @@ libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR) xs.opic: CFLAGS += -DUSE_PTHREAD libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS) libxenstore.a: xs.o xs_lib.o $(AR) rcs $@ $^
Signature · 1 line
1.7.10.4
Re: [PATCH 01/11] xenstore: Use $(PTHREAD_LIBS) not -lpthread
Quoted 9 lines · Ian Jackson
From
8d82316c2b922dc490373377207b06b155c56161Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Wed, 28 May 2014 17:06:50 +0100
Subject: [PATCH] xenstore: Use $(PTHREAD_LDFLAGS) and $(PTHREAD_LIBS) not
-lpthreadSigned-off-by Ian Jackson <[email protected]>---
v3: We needPTHREAD_LDFLAGStoo (!)
Looks like there is some rationalisation which could happen here post autoconf, but for now this is fine:
PATCH v2 2/11 xenstore: In xenstore_client, avoid stack buffer in recursive function
In reply to Ian Jacksondo_ls is recursive. It had a buffer of size around 5K allocated on the stack. This combination is not a very good idea: some environments (eg, Mini-OS) have limited stack sizes (eg 64K).
--- tools/xenstore/xenstore_client.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/xenstore/xenstore_client.c +8 -3
@@ -128,11 +128,15 @@ static int show_whole_path = 0;static void do_ls (struct xs_handle *h,char *path,int cur_depth,int show_perms) {char **e; -char newpath[STRING_MAX ], *val; +char *newpath, *val;int newpath_len;int i;unsigned int num, len; + newpath =malloc (STRING_MAX ); +if (!newpath) +err (1 ,"malloc in do_ls" ); + e =xs_directory (h,XBT_NULL , path, &num);if (e ==NULL )err (1 ,"xs_directory (%s)" , path);
@@ -144,7 +148,7 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_permsint linewid;/* Compose fullpath */ - newpath_len =snprintf (newpath,sizeof (newpath),"%s%s%s" , path, + newpath_len =snprintf (newpath,STRING_MAX ,"%s%s%s" , path, path[strlen (path)-1 ] =='/' ?"" :"/" , e[i]);
@@ -161,7 +165,7 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms }/* Fetch value */ -if ( newpath_len <sizeof (newpath) ) { +if ( newpath_len <STRING_MAX ) { val =xs_read (h,XBT_NULL , newpath, &len); }else {
@@ -217,6 +221,7 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_permsdo_ls (h, newpath, cur_depth+1 , show_perms); }free (e); +free (newpath); } static void
Signature · 1 line
1.7.10.4
PATCH v2 3/11 rump kernels: Start introducing new XEN_OS NetBSDRump
In reply to Ian JacksonProvide an entry in config/, and a copy of xen-sys privcmd.h.
--- config/NetBSDRump.mk | 8 +++++++ tools/include/xen-sys/NetBSDRump/privcmd.h | 31 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 config/NetBSDRump.mk create mode 100644 tools/include/xen-sys/NetBSDRump/privcmd.h
config/NetBSDRump.mk new file +8 -0
@@ -0,0 +1,8 @@ +include $(XEN_ROOT)/config/StdGNU.mk + +DLOPEN_LIBS = +PTHREAD_LIBS = + +XEN_LOCK_DIR = /var/lib + +WGET = ftp
tools/include/xen-sys/NetBSDRump/privcmd.h new file +31 -0
@@ -0,0 +1,31 @@ + +#ifndef __NetBSDRump_PRIVCMD_H__ +#define __NetBSDRump_PRIVCMD_H__ + +typedef struct privcmd_hypercall +{ +unsigned long op; +unsigned long arg[5 ]; +long retval; +}privcmd_hypercall_t ; + +typedef struct privcmd_mmap_entry { +unsigned long va; +unsigned long mfn; +unsigned long npages; +}privcmd_mmap_entry_t ; + +typedef struct privcmd_mmap { +int num; +domid_t dom;/* target domain */ +privcmd_mmap_entry_t *entry; +}privcmd_mmap_t ; + +typedef struct privcmd_mmapbatch { +int num;/* number of pages to populate */ +domid_t dom;/* target domain */ +unsigned long addr;/* virtual address */ +unsigned long *arr;/* array of mfns - top nibble set on err */ +}privcmd_mmapbatch_t ; + +#endif
Signature · 1 line
1.7.10.4
PATCH v2 4/11 libxc: rump kernels: Use standard xc_osdep_get_info
In reply to Ian JacksonDo not try to support the dlopen-based xc indirection.
Introduce a local #define DO_DYNAMIC_OSDEP to centralise the condition.
Add comments to the #endifs.
---
v2: Remove duplication by introducing DO_DYNAMIC_OSDEP.
Add comments to the #endifs.
--- tools/libxc/xc_private.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
tools/libxc/xc_private.c +10 -6
@@ -33,6 +33,10 @@#define XENCTRL_OSDEP "XENCTRL_OSDEP" +#if !defined (__MINIOS__) && !defined(__RUMPUSER_XEN__) +#define DO_DYNAMIC_OSDEP +#endif +/* * Returns a (shallow) copy of the xc_osdep_info_t for the * active OS interface.
@@ -50,7 +54,7 @@static int xc_osdep_get_info (xc_interface *xch,xc_osdep_info_t *info) {int rc =-1 ; -#ifndef __MINIOS__ +#ifdef DO_DYNAMIC_OSDEP const char *lib =getenv (XENCTRL_OSDEP );xc_osdep_info_t *pinfo;void *dl_handle =NULL ;
@@ -86,7 +90,7 @@ static int xc_osdep_get_info(xc_interface *xch, xc_osdep_info_t *info) info->dl_handle = dl_handle; } else -#endif +#endif /*DO_DYNAMIC_OSDEP*/ { *info = xc_osdep_info; info->dl_handle =NULL ;
@@ -94,21 +98,21 @@ static int xc_osdep_get_info(xc_interface *xch, xc_osdep_info_t *info) rc =0 ; -#ifndef __MINIOS__ +#ifdef DO_DYNAMIC_OSDEP out:if ( dl_handle && rc ==-1 )dlclose (dl_handle); -#endif +#endif /*DO_DYNAMIC_OSDEP*/ return rc; }static void xc_osdep_put (xc_osdep_info_t *info) { -#ifndef __MINIOS__ +#ifdef DO_DYNAMIC_OSDEP if ( info->dl_handle )dlclose (info->dl_handle); -#endif +#endif /*DO_DYNAMIC_OSDEP*/ }static const char *xc_osdep_type_name (enum xc_osdep_type type)
Signature · 1 line
1.7.10.4
Re: [PATCH 04/11] libxc: rump kernels: Use standard xc_osdep_get_info
Quoted 7 lines · Ian Jackson
Do not try to support the dlopen-based xc indirection.
Introduce a local #define
DO_DYNAMIC_OSDEPto centralise the condition.Add comments to the #endifs.
Signed-off-by Ian Jackson <[email protected]>
PATCH v2 5/11 xenstore: rump kernels: Look for /dev/xen/xenbus
In reply to Ian Jackson--- tools/xenstore/xs_lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/xenstore/xs_lib.c +3 -2
@@ -79,8 +79,9 @@ const char *xs_domain_dev(void)char *s =getenv ("XENSTORED_PATH" );if (s)return s; - -#if defined(__linux__) +#if defined(__RUMPUSER_XEN__) +return "/dev/xen/xenbus" ; +#elif defined(__linux__)return "/proc/xen/xenbus" ;#elif defined(__NetBSD__)return "/kern/xen/xenbus" ;
Signature · 1 line
1.7.10.4
PATCH v2 6/11 xenstore: Make building of xenstored optional
In reply to Ian JacksonIn principle it would be possible to make a rumpuser-xen-based stub xenstored, but all the necessary pieces do not yet exist.
So provide a facility to disable compilation of xenstored, and use it to disable it on rump kernels.
--- config/NetBSDRump.mk | 2 ++ tools/Rules.mk | 2 ++ tools/xenstore/Makefile | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-)
config/NetBSDRump.mk +2 -0
@@ -6,3 +6,5 @@ PTHREAD_LIBS = XEN_LOCK_DIR = /var/lib WGET = ftp + +XENSTORE_XENSTORED=n
tools/Rules.mk +2 -0
@@ -19,6 +19,8 @@ XEN_LIBVCHAN = $(XEN_ROOT)/tools/libvchan CFLAGS_xeninclude = -I$(XEN_INCLUDE) +XENSTORE_XENSTORED ?= y + CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude) LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so SHLIB_libxenctrl = -Wl,-rpath-link=$(XEN_LIBXC)
tools/xenstore/Makefile +6 -1
@@ -28,7 +28,10 @@ LIBXENSTORE := libxenstore.a xenstore xenstore-control: CFLAGS += -static endif -ALL_TARGETS = libxenstore.so libxenstore.a clients xs_tdb_dump xenstored +ALL_TARGETS = libxenstore.so libxenstore.a clients +ifeq ($(XENSTORE_XENSTORED),y) +ALL_TARGETS += xs_tdb_dump xenstored +endif ifeq ($(CONFIG_Linux),y) ALL_TARGETS += init-xenstore-domain
@@ -114,8 +117,10 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xenstore-compat +ifeq ($(XENSTORE_XENSTORED),y) $(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored $(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR) +endif $(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR) $(INSTALL_PROG) xenstore $(DESTDIR)$(BINDIR) set -e ; for c in $(CLIENTS) ; do \
Signature · 1 line
1.7.10.4
PATCH v2 7/11 build system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB
In reply to Ian JacksonINSTALL_SHLIB is like INSTALL_PROG but used only for shared libraries. SYMLINK_SHLIB is the ln -sf rune for shared library symlinks.
Use these in the appropriate places in tools/libxc and tools/xenstore.
No functional change right now. In a forthcoming patch these variables might take on different values.
--- tools/Rules.mk | 3 +++ tools/libxc/Makefile | 20 ++++++++++---------- tools/libxl/Makefile | 20 ++++++++++---------- tools/xenstore/Makefile | 2 +- 4 files changed, 24 insertions(+), 21 deletions(-)
tools/Rules.mk +3 -0
@@ -21,6 +21,9 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE) XENSTORE_XENSTORED ?= y +INSTALL_SHLIB = $(INSTALL_PROG) +SYMLINK_SHLIB = ln -sf + CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude) LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so SHLIB_libxenctrl = -Wl,-rpath-link=$(XEN_LIBXC)
tools/libxc/Makefile +10 -10
@@ -136,15 +136,15 @@ libs: $(LIB) install: build $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) - $(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) + $(INSTALL_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) $(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(LIBDIR) - ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so.$(MAJOR) - ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so + $(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so.$(MAJOR) + $(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenctrl.so $(INSTALL_DATA) xenctrl.h xenctrlosdep.h xentoollog.h $(DESTDIR)$(INCLUDEDIR) - $(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) + $(INSTALL_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) $(INSTALL_DATA) libxenguest.a $(DESTDIR)$(LIBDIR) - ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenguest.so.$(MAJOR) - ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenguest.so + $(SYMLINK_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenguest.so.$(MAJOR) + $(SYMLINK_SHLIB) libxenguest.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenguest.so $(INSTALL_DATA) xenguest.h $(DESTDIR)$(INCLUDEDIR) .PHONY: TAGS
@@ -174,9 +174,9 @@ libxenctrl.a: $(CTRL_LIB_OBJS) $(AR) rc $@ $^ libxenctrl.so: libxenctrl.so.$(MAJOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS) $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
@@ -187,9 +187,9 @@ libxenguest.a: $(GUEST_LIB_OBJS) $(AR) rc $@ $^ libxenguest.so: libxenguest.so.$(MAJOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ ifeq ($(CONFIG_MiniOS),y) zlib-options =
tools/libxl/Makefile +10 -10
@@ -193,10 +193,10 @@ _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_ $(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c) libxenlight.so: libxenlight.so.$(MAJOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxenlight.so.$(MAJOR): libxenlight.so.$(MAJOR).$(MINOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS) $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) $(APPEND_LDFLAGS)
@@ -208,10 +208,10 @@ libxenlight.a: $(LIBXL_OBJS) $(AR) rcs libxenlight.a $^ libxlutil.so: libxlutil.so.$(XLUMAJOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxlutil.so.$(XLUMAJOR): libxlutil.so.$(XLUMAJOR).$(XLUMINOR) - ln -sf $< $@ + $(SYMLINK_SHLIB) $< $@ libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS) $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) $(APPEND_LDFLAGS)
@@ -240,13 +240,13 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR) $(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR) $(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(PRIVATE_BINDIR) - $(INSTALL_PROG) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) - ln -sf libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenlight.so.$(MAJOR) - ln -sf libxenlight.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so + $(INSTALL_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) + $(SYMLINK_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenlight.so.$(MAJOR) + $(SYMLINK_SHLIB) libxenlight.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so $(INSTALL_DATA) libxenlight.a $(DESTDIR)$(LIBDIR) - $(INSTALL_PROG) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR) - ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR) - ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so + $(INSTALL_SHLIB) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR) + $(SYMLINK_SHLIB) libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR) + $(SYMLINK_SHLIB) libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR) $(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
tools/xenstore/Makefile +1 -1
@@ -127,7 +127,7 @@ endif ln -f $(DESTDIR)$(BINDIR)/xenstore $(DESTDIR)$(BINDIR)/$${c} ; \ done $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) - $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) + $(INSTALL_SHLIB) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR) ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so $(INSTALL_DATA) libxenstore.a $(DESTDIR)$(LIBDIR)
Signature · 1 line
1.7.10.4
PATCH v2 8/11 build system: Introduce libextension variable
In reply to Ian JacksonThis variable is the suffix to use for finding libraries when doing compile-time linking. For now we always set it to ".so" - so no functional change.
In a forthcoming patch it may take on different values.
--- tools/Rules.mk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/Rules.mk +6 -5
@@ -23,21 +23,22 @@ XENSTORE_XENSTORED ?= y INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf +libextension = .so CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude) -LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so +LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl$(libextension) SHLIB_libxenctrl = -Wl,-rpath-link=$(XEN_LIBXC) CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_xeninclude) -LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest.so +LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest$(libextension) SHLIB_libxenguest = -Wl,-rpath-link=L$(XEN_LIBXC) CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_xeninclude) -LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore.so +LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore$(libextension) SHLIB_libxenstore = -Wl,-rpath-link=$(XEN_XENSTORE) CFLAGS_libxenstat = -I$(XEN_LIBXENSTAT) -LDLIBS_libxenstat = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat.so +LDLIBS_libxenstat = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat$(libextension) SHLIB_libxenstat = -Wl,-rpath-link=$(XEN_LIBXENSTAT) CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN)
@@ -61,7 +62,7 @@ SHLIB_libblktapctl = endif CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) -LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight.so $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) +LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight$(libextension) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) SHLIB_libxenlight = -Wl,-rpath-link=$(XEN_XENLIGHT) CFLAGS += -D__XEN_TOOLS__
Signature · 1 line
1.7.10.4
PATCH v2 9/11 build system: Introduce nosharedlibs variable.
In reply to Ian JacksonIntroduce a new build variable "nosharedlibs".
In tools/libxc use it instead of $(stubdom). In tools/xenstore honour it, and build static clients.
If shared libs are disabled, do not try to install or symlink them.
Set nosharedlibs when building for MiniOS or NetBSDRump.
---
v2: Clarify deliberate INSTALL_SHLIB and SYMLINK_SHLIB breakage.
--- config/MiniOS.mk | 1 + config/NetBSDRump.mk | 1 + tools/Rules.mk | 9 +++++++++ tools/libxc/Makefile | 6 +++--- tools/xenstore/Makefile | 5 ++++- 5 files changed, 18 insertions(+), 4 deletions(-)
config/MiniOS.mk +1 -0
@@ -7,3 +7,4 @@ LDFLAGS += $(DEF_LDFLAGS) $(ARCH_LDFLAGS) # Override settings for this OS PTHREAD_LIBS = +nosharedlibs=y
config/NetBSDRump.mk +1 -0
@@ -8,3 +8,4 @@ XEN_LOCK_DIR = /var/lib WGET = ftp XENSTORE_XENSTORED=n +nosharedlibs=y
tools/Rules.mk +9 -0
@@ -21,9 +21,18 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE) XENSTORE_XENSTORED ?= y +ifneq ($(nosharedlibs),y) INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf libextension = .so +else +libextension = .a +XENSTORE_STATIC_CLIENTS=y +# If something tries to use these it is a mistake. Provide references +# to nonexistent programs to produce a sane error message. +INSTALL_SHLIB = : install-shlib-unsupported-fail +SYMLINK_SHLIB = : symlink-shlib-unsupported-fail +endif CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude) LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl$(libextension)
tools/libxc/Makefile +3 -3
@@ -109,16 +109,16 @@ $(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) $(OSDEP_LIB_OBJS) \ $(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS) $(OSDEP_PIC_OBJS) : CFLAGS += -include $(XEN_ROOT)/tools/config.h LIB := libxenctrl.a -ifneq ($(stubdom),y) +ifneq ($(nosharedlibs),y) LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR) endif LIB += libxenguest.a -ifneq ($(stubdom),y) +ifneq ($(nosharedlibs),y) LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR) endif -ifneq ($(stubdom),y) +ifneq ($(nosharedlibs),y) LIB += xenctrl_osdep_ENOSYS.so endif
tools/xenstore/Makefile +4 -1
@@ -28,7 +28,10 @@ LIBXENSTORE := libxenstore.a xenstore xenstore-control: CFLAGS += -static endif -ALL_TARGETS = libxenstore.so libxenstore.a clients +ALL_TARGETS = libxenstore.a clients +ifneq ($(nosharedlibs),y) +ALL_TARGETS += libxenstore.so +endif ifeq ($(XENSTORE_XENSTORED),y) ALL_TARGETS += xs_tdb_dump xenstored endif
Signature · 1 line
1.7.10.4
Re: [PATCH 09/11] build system: Introduce nosharedlibs variable.
Quoted 10 lines · Ian Jackson
Introduce a new build variable "nosharedlibs".
In
tools/libxcuse it instead of $(stubdom). Intools/xenstorehonour it, and build static clients.If shared libs are disabled, do not try to install or symlink them.
Set nosharedlibs when building for MiniOS or NetBSDRump.
Signed-off-by Ian Jackson <[email protected]>
PATCH v2 10/11 rump kernels: Handle rumpxen host in configure
In reply to Ian JacksonSupport
./configure --host=x86_64-rumpxen-netbsd
./configure --host=i386-rumpxen-netbsd
Setting --host tells configure we are cross compiling and therefore has various automatic effects.
But in this patch we make some deliberate changes as well:
* We disable a large number of configure tests for libraries etc. which don't exist.
* We set CONFIG_RUMP in Tools.mk.
* Hence, we automatically set XEN_OS.
(I have only tested the 32-bit build but I think the 64-bit build should work just as well.)
---
v2: Mention x86_64.
Drop an erroneous whitespace change.
--- config/Tools.mk.in | 5 +++++ tools/configure | 11 +++++++++++ tools/configure.ac | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-)
config/Tools.mk.in +5 -0
@@ -1,3 +1,8 @@ +CONFIG_RUMP := @CONFIG_RUMP@ +ifeq ($(CONFIG_RUMP),y) +XEN_OS := NetBSDRump +endif + # Prefix and install folder prefix := @prefix@ PREFIX := $(prefix)
tools/configure +11 -0
@@ -706,6 +706,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +CONFIG_RUMP host_os host_vendor host_cpu
@@ -2323,6 +2324,12 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +case $host_vendor in +rumpxen) CONFIG_RUMP=y; rump=true ;; +*) CONFIG_RUMP=n; rump=false ;; +esac + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -6704,6 +6711,8 @@ LDLFAGS=$ac_previous_ldflags fi +if ! $rump; then + # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -8160,6 +8169,8 @@ fi done +fi + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure
tools/configure.ac +12 -2
@@ -20,6 +20,12 @@ APPEND_INCLUDES and APPEND_LIB instead when possible.]) AC_CANONICAL_HOST +case $host_vendor in +rumpxen) CONFIG_RUMP=y; rump=true ;; +*) CONFIG_RUMP=n; rump=false ;; +esac +AC_SUBST(CONFIG_RUMP) + AC_SYS_LARGEFILE case $ac_cv_sys_file_offset_bits in #(
@@ -34,11 +40,11 @@ AC_SUBST(FILE_OFFSET_BITS) m4_include([../m4/savevar.m4]) m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4]) +m4_include([../m4/checkpolicy.m4]) +m4_include([../m4/set_cflags_ldflags.m4]) m4_include([../m4/python_version.m4]) m4_include([../m4/python_devel.m4]) m4_include([../m4/ocaml.m4]) -m4_include([../m4/checkpolicy.m4]) -m4_include([../m4/set_cflags_ldflags.m4]) m4_include([../m4/uuid.m4]) m4_include([../m4/pkg.m4]) m4_include([../m4/curses.m4])
@@ -233,6 +239,8 @@ AS_IF([test "$cross_compiling" != yes], [ AX_CHECK_PYTHON_DEVEL() ]) +if ! $rump; then + AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext]) dnl as86, ld86, bcc and iasl are only required when the host system is x86*. dnl "host" here means the platform on which the hypervisor and tools is
@@ -287,5 +295,7 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) +fi + AC_OUTPUT()
Signature · 1 line
1.7.10.4
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
Quoted 13 lines · Ian Jackson
Support
./configure --host=x86_64-rumpxen-netbsd
./configure --host=i386-rumpxen-netbsdSetting --host tells configure we are cross compiling and therefore has various automatic effects.
But in this patch we make some deliberate changes as well:
* We disable a large number of configure tests for libraries etc. which don't exist.
* We setCONFIG_RUMPin Tools.mk.
* Hence, we automatically setXEN_OS.
Quoted 4 lines
(I have only tested the 32-bit build but I think the 64-bit build should work just as well.)
Signed-off-by Ian Jackson <[email protected]>
tools/configure fi · line 8172
Quoted 5 lines
tools/configure +1
-0@@ -8160,6 +8169,8 @@ fi done +fi
Perhaps this would benefit from a trailing "# ! $rump" since it is so far from the if.
Ian.
Ian Jackson
Acked-by Ian CampbellRe: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
Ian Campbell writes ("Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
...
Quoted 1 line
Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 4 lines
Quoted 1 line
+fi
Perhaps this would benefit from a trailing "# ! $rump" since it is so far from the if.
Yes. Here's the result. I've kept your ack. If this is OK with you, I will now push this whole series.
Thanks,
Ian.
Quoted 1 line
From
84560875f95322be15d0f0a47be33593260ac89fMon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Wed, 28 May 2014 17:04:52 +0100
Subject: [PATCH] rump kernels: Handle rumpxen host in configure
Support
./configure --host=x86_64-rumpxen-netbsd
./configure --host=i386-rumpxen-netbsd
Setting --host tells configure we are cross compiling and therefore has various automatic effects.
But in this patch we make some deliberate changes as well:
* We disable a large number of configure tests for libraries etc. which don't exist.
* We set CONFIG_RUMP in Tools.mk.
* Hence, we automatically set XEN_OS.
(I have only tested the 32-bit build but I think the 64-bit build should work just as well.)
---
v3: Add comment to `fi'
v2: Mention x86_64.
Drop an erroneous whitespace change.
--- config/Tools.mk.in | 5 +++++ tools/configure | 11 +++++++++++ tools/configure.ac | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-)
config/Tools.mk.in +5 -0
@@ -1,3 +1,8 @@ +CONFIG_RUMP := @CONFIG_RUMP@ +ifeq ($(CONFIG_RUMP),y) +XEN_OS := NetBSDRump +endif + # Prefix and install folder prefix := @prefix@ PREFIX := $(prefix)
tools/configure +11 -0
@@ -706,6 +706,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +CONFIG_RUMP host_os host_vendor host_cpu
@@ -2323,6 +2324,12 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +case $host_vendor in +rumpxen) CONFIG_RUMP=y; rump=true ;; +*) CONFIG_RUMP=n; rump=false ;; +esac + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -6704,6 +6711,8 @@ LDLFAGS=$ac_previous_ldflags fi +if ! $rump; then + # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -8160,6 +8169,8 @@ fi done +fi # ! $trump + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure
tools/configure.ac +12 -2
@@ -20,6 +20,12 @@ APPEND_INCLUDES and APPEND_LIB instead when possible.]) AC_CANONICAL_HOST +case $host_vendor in +rumpxen) CONFIG_RUMP=y; rump=true ;; +*) CONFIG_RUMP=n; rump=false ;; +esac +AC_SUBST(CONFIG_RUMP) + AC_SYS_LARGEFILE case $ac_cv_sys_file_offset_bits in #(
@@ -34,11 +40,11 @@ AC_SUBST(FILE_OFFSET_BITS) m4_include([../m4/savevar.m4]) m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4]) +m4_include([../m4/checkpolicy.m4]) +m4_include([../m4/set_cflags_ldflags.m4]) m4_include([../m4/python_version.m4]) m4_include([../m4/python_devel.m4]) m4_include([../m4/ocaml.m4]) -m4_include([../m4/checkpolicy.m4]) -m4_include([../m4/set_cflags_ldflags.m4]) m4_include([../m4/uuid.m4]) m4_include([../m4/pkg.m4]) m4_include([../m4/curses.m4])
@@ -233,6 +239,8 @@ AS_IF([test "$cross_compiling" != yes], [ AX_CHECK_PYTHON_DEVEL() ]) +if ! $rump; then + AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext]) dnl as86, ld86, bcc and iasl are only required when the host system is x86*. dnl "host" here means the platform on which the hypervisor and tools is
@@ -287,5 +295,7 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) +fi # ! $trump + AC_OUTPUT()
Signature · 1 line
1.7.10.4
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
Quoted 6 lines · Ian Jackson
Ian Campbell writes ("Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
...Quoted 1 line
Acked-by Ian Campbell <[email protected]>Thanks.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+fi
Perhaps this would benefit from a trailing "# ! $rump" since it is so far from the if.
Yes. Here's the result. I've kept your ack. If this is OK with you, I will now push this whole series.
Sure, go for it.
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
In reply to Ian Jacksontools/configure fi · line 8172
Quoted 12 lines · Ian Jackson
Ian Campbell writes ("Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
tools/configure +3
-0+if ! $rump; then + # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5@@ -8160,6 +8169,8 @@ fi done +fi # ! $trump
Extra T?
Also below.
Quoted 14 lines
tools/configure.ac +4
-0+if ! $rump; then + AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext]) dnl as86, ld86, bcc and iasl are only required when the host system is x86*. dnl "host" here means the platform on which the hypervisor and tools is@@ -287,5 +295,7 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h]) +fi # ! $trump + AC_OUTPUT()
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
David Vrabel writes ("Re: [Xen-devel] [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
Quoted 4 lines · Ian Jackson
Quoted 1 line
+fi # ! $trump
Extra T?
Oops! Fixed, thanks.
Ian.
PATCH v2 11/11 tools/Makefile: Build only a subset of things for rump kernels
In reply to Ian JacksonOverride the set of tools/ subdirectories for rump kernel builds.
--- tools/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
tools/Makefile +4 -0
@@ -43,6 +43,10 @@ SUBDIRS-y += pygrub SUBDIRS-$(OCAML_TOOLS) += ocaml endif +ifeq ($(CONFIG_RUMP),y) +SUBDIRS-y := include libxc xenstore +endif + # For the sake of linking, set the sys-root ifneq ($(CROSS_COMPILE),) CROSS_BIN_PATH ?= /usr/$(CROSS_COMPILE:-=)/bin
Signature · 1 line
1.7.10.4
Ian Jackson writes ("[PATCH v2 00/11] tools, build: Build xenstore in rump kernel"):
Quoted 2 lines
These miscellaneous build system and tools patches make it possible to build and run libxenstore in the NetBSD Xen rump kernel environment.
Thanks for the acks; I've pushed v3.
Ian.