tools, build: Build xenstore in rump kernel
cover tools, build: Build xenstore in rump kernel
These miscellaneous build system and tools patches make it possible to build libxc and libxenstore in the NetBSD Xen rump kernel environment.
01/11 xenstore: Use $(PTHREAD_LIBS) not -lpthread
02/11 xenstore: In xenstore_client, avoid stack buffer in recursive function 03/11 rump kernels: Start introducing new XEN_OS NetBSDRump 04/11 libxc: rump kernels: Use standard xc_osdep_get_info
05/11 xenstore: rump kernels: Look for /dev/xen/xenbus
06/11 xenstore: Make building of xenstored optional
07/11 build system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB 08/11 build system: Introduce libextension variable
09/11 build system: Introduce nosharedlibs variable.
10/11 rump kernels: Handle rumpxen host in configure
11/11 tools/Makefile: Build only a subset of things for rump kernels
With these patches and the corresponding rumpuser-xen series (just pushed) it is possible to build parts of the Xen management tools.
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 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
Re: [PATCH 01/11] xenstore: Use $(PTHREAD_LIBS) not -lpthread
Quoted 1 line · Ian Jackson
Signed-off-by Ian Jackson <[email protected]>
PATCH 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
Re: [PATCH 02/11] xenstore: In xenstore_client, avoid stack buffer in recursive function
Quoted 5 lines · Ian Jackson
do_lsis 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).Signed-off-by Ian Jackson <[email protected]>
PATCH 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
Re: [PATCH 03/11] rump kernels: Start introducing new XEN_OS NetBSDRump
Quoted 3 lines · Ian Jackson
Provide an entry in config/, and a copy of xen-sys
privcmd.h.Signed-off-by Ian Jackson <[email protected]>
Seems ok, but wrt privcmd.h -- since you need the rump kernel to link against is it worth duplicating it here? Or maybe it's not duplicated, but I'd have more expected it to live in the rumpkernels side next to the driver.
In any case it's not a big deal:
Re: [PATCH 03/11] rump kernels: Start introducing new XEN_OS NetBSDRump
Ian Campbell writes ("Re: [Xen-devel] [PATCH 03/11] rump kernels: Start introducing new XEN_OS NetBSDRump"):
Quoted 9 lines · Ian Jackson
Quoted 3 lines
Provide an entry in config/, and a copy of xen-sys
privcmd.h.Signed-off-by Ian Jackson <[email protected]>Seems ok, but wrt
privcmd.h-- since you need the rump kernel to link against is it worth duplicating it here? Or maybe it's not duplicated, but I'd have more expected it to live in the rumpkernels side next to the driver.
You would have thought so, wouldn't you ? But it seems that all of these headers are in xen.git/tools/include/xen-sys/.
Quoted 2 lines
In any case it's not a big deal:
Acked-by Ian Campbell <[email protected]>
Thanks,
Ian.
PATCH 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.
--- tools/libxc/xc_private.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/libxc/xc_private.c +3 -3
@@ -50,7 +50,7 @@static int xc_osdep_get_info (xc_interface *xch,xc_osdep_info_t *info) {int rc =-1 ; -#ifndef __MINIOS__ +#if !defined (__MINIOS__) && !defined(__RUMPUSER_XEN__)const char *lib =getenv (XENCTRL_OSDEP );xc_osdep_info_t *pinfo;void *dl_handle =NULL ;
@@ -94,7 +94,7 @@ static int xc_osdep_get_info(xc_interface *xch, xc_osdep_info_t *info) rc =0 ; -#ifndef __MINIOS__ +#if !defined (__MINIOS__) && !defined(__RUMPUSER_XEN__) out:if ( dl_handle && rc ==-1 )dlclose (dl_handle);
@@ -105,7 +105,7 @@ out:static void xc_osdep_put (xc_osdep_info_t *info) { -#ifndef __MINIOS__ +#if !defined (__MINIOS__) && !defined(__RUMPUSER_XEN__)if ( info->dl_handle )dlclose (info->dl_handle);#endif
Signature · 1 line
1.7.10.4
Re: [PATCH 04/11] libxc: rump kernels: Use standard xc_osdep_get_info
Quoted 3 lines · Ian Jackson
Do not try to support the dlopen-based xc indirection.
Signed-off-by Ian Jackson <[email protected]>
But maybe you would prefer to avoid the repetition with #if !defined (__MINIOS__) && !defined(__RUMPUSER_XEN__) #define DO_DYNAMIC_OSDEP
#endif
?
Re: [PATCH 04/11] libxc: rump kernels: Use standard xc_osdep_get_info
Ian Campbell writes ("Re: [Xen-devel] [PATCH 04/11] libxc: rump kernels: Use standard xc_osdep_get_info"):
Quoted 5 lines · Ian Jackson
Quoted 3 lines
Do not try to support the dlopen-based xc indirection.
Signed-off-by Ian Jackson <[email protected]>
Quoted 7 lines
Acked-by Ian Campbell <[email protected]>But maybe you would prefer to avoid the repetition with #if !defined (
__MINIOS__) && !defined(__RUMPUSER_XEN__) #defineDO_DYNAMIC_OSDEP
#endif
?
Good idea, thanks.
Ian.
PATCH 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
Re: [PATCH 05/11] xenstore: rump kernels: Look for /dev/xen/xenbus
Quoted 1 line · Ian Jackson
Signed-off-by Ian Jackson <[email protected]>
PATCH 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
Re: [PATCH 06/11] xenstore: Make building of xenstored optional
Quoted 2 lines · Ian Jackson
In principle it would be possible to make a rumpuser-xen-based stub xenstored, but all the necessary pieces do not yet exist.
Do you plan to do this eventually?
Quoted 4 lines
So provide a facility to disable compilation of xenstored, and use it to disable it on rump kernels.
Signed-off-by Ian Jackson <[email protected]>
Re: [PATCH 06/11] xenstore: Make building of xenstored optional
Ian Campbell writes ("Re: [Xen-devel] [PATCH 06/11] xenstore: Make building of xenstored optional"):
Quoted 5 lines · Ian Jackson
Quoted 2 lines
In principle it would be possible to make a rumpuser-xen-based stub xenstored, but all the necessary pieces do not yet exist.
Do you plan to do this eventually?
Yes, but probably not soon. I'm currently trying to work towards an upstream qemu stubdom.
Ian.
PATCH 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
@@ -190,10 +190,10 @@ _libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py i $(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)
@@ -205,10 +205,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)
@@ -237,13 +237,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
Re: [PATCH 07/11] build system: Introduce INSTALL_SHLIB and SYMLINK_SHLIB
Quoted 9 lines · Ian Jackson
INSTALL_SHLIBis likeINSTALL_PROGbut used only for shared libraries.SYMLINK_SHLIBis the ln -sf rune for shared library symlinks.Use these in the appropriate places in
tools/libxcandtools/xenstore.No functional change right now. In a forthcoming patch these variables might take on different values.
Signed-off-by Ian Jackson <[email protected]>
PATCH 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
Re: [PATCH 08/11] build system: Introduce libextension variable
Quoted 7 lines · Ian Jackson
This 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.
Signed-off-by Ian Jackson <[email protected]>
PATCH 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.
--- config/MiniOS.mk | 1 + config/NetBSDRump.mk | 1 + tools/Rules.mk | 7 +++++++ tools/libxc/Makefile | 6 +++--- tools/xenstore/Makefile | 5 ++++- 5 files changed, 16 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 +7 -0
@@ -21,9 +21,16 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE) XENSTORE_XENSTORED ?= y +ifneq ($(nosharedlibs),y) INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf libextension = .so +else +INSTALL_SHLIB = : install-shlib +SYMLINK_SHLIB = : symlink-shlib +libextension = .a +XENSTORE_STATIC_CLIENTS=y +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 5 lines · Ian Jackson
tools/Rules.mk +0
-0
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 30
Quoted 10 lines
tools/Rules.mk +4
-0@@ -21,9 +21,16 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE) XENSTORE_XENSTORED ?= y +ifneq ($(nosharedlibs),y) INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf libextension = .so +else +INSTALL_SHLIB = : install-shlib +SYMLINK_SHLIB = : symlink-shlib
I don't see install-shlib or symlink-shlib neither in our build system nor installed on my usual build machine.
Are these a (Rump)BSD-ism? In which case I expect they won't work for minios builds on Linux?
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 32
Quoted 2 lines
tools/Rules.mk +2
-0+libextension = .a +XENSTORE_STATIC_CLIENTS=y
Not in tools/xenstored/Makefile?
Re: [PATCH 09/11] build system: Introduce nosharedlibs variable.
Ian Campbell writes ("Re: [Xen-devel] [PATCH 09/11] build system: Introduce nosharedlibs variable."):
Quoted 11 lines · Ian Jackson
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 30
Quoted 7 lines
tools/Rules.mk +4
-0+ifneq ($(nosharedlibs),y) INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf libextension = .so +else +INSTALL_SHLIB = : install-shlib +SYMLINK_SHLIB = : symlink-shlibI don't see install-shlib or symlink-shlib neither in our build system nor installed on my usual build machine.
They don't exist. If they are called it is a bug. Clearly this is too confusing. How about
+INSTALL_SHLIB = : install-shlib-unsupported-fail
?
I could write
+INSTALL_SHLIB = : false install shlib unsupported
but "false" doesn't print anything to stderr if it is executed, which would make the failure more obscure.
Quoted 7 lines
Are these a (Rump)BSD-ism? In which case I expect they won't work for minios builds on Linux?
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 32
Quoted 2 lines
tools/Rules.mk +2
-0+libextension = .a +XENSTORE_STATIC_CLIENTS=yNot in
tools/xenstored/Makefile?
No. I felt that XENSTORE_STATIC_CLIENTS was a knob that is exposed by tools/xenstore/Makefile to the rest of the build system. And putting it here puts all the "disable shared libraries" options in the same place.
Thanks,
Ian.
Re: [PATCH 09/11] build system: Introduce nosharedlibs variable.
Quoted 13 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] [PATCH 09/11] build system: Introduce nosharedlibs variable."):
Quoted 11 lines · Ian Jackson
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 30
Quoted 7 lines
tools/Rules.mk +4
-0+ifneq ($(nosharedlibs),y) INSTALL_SHLIB = $(INSTALL_PROG) SYMLINK_SHLIB = ln -sf libextension = .so +else +INSTALL_SHLIB = : install-shlib +SYMLINK_SHLIB = : symlink-shlibI don't see install-shlib or symlink-shlib neither in our build system nor installed on my usual build machine.
Quoted 2 lines
They don't exist. If they are called it is a bug. Clearly this is too confusing.
Ah, that's what "do no try to install" in the commit message meant, of course.
Quoted 3 lines
How about
+INSTALL_SHLIB = : install-shlib-unsupported-fail
?
That plus a comment
# These don't exist in order to force a failure if they are used
perhaps?
Quoted 14 lines
I could write
+INSTALL_SHLIB = : false install shlib unsupported
but "false" doesn't print anything to stderr if it is executed, which would make the failure more obscure.Quoted 7 lines
Are these a (Rump)BSD-ism? In which case I expect they won't work for minios builds on Linux?
tools/Rules.mk CFLAGS_xeninclude = -I$(XEN_INCLUDE) · line 32
Quoted 2 lines
tools/Rules.mk +2
-0+libextension = .a +XENSTORE_STATIC_CLIENTS=yNot in
tools/xenstored/Makefile?
Quoted 4 lines
No. I felt that
XENSTORE_STATIC_CLIENTSwas a knob that is exposed bytools/xenstore/Makefileto the rest of the build system. And putting it here puts all the "disable shared libraries" options in the same place.
OK
PATCH 10/11 rump kernels: Handle rumpxen host in configure
In reply to Ian JacksonSupport
./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.
--- config/Tools.mk.in | 5 +++++ tools/configure | 12 ++++++++++++ tools/configure.ac | 15 +++++++++++++-- 3 files changed, 30 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 +12 -0
@@ -705,6 +705,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +CONFIG_RUMP host_os host_vendor host_cpu
@@ -2319,6 +2320,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'
@@ -6635,6 +6642,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
@@ -7504,6 +7513,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for io_setup in -laio" >&5 $as_echo_n "checking for io_setup in -laio... " >&6; } if ${ac_cv_lib_aio_io_setup+:} false; then :
@@ -8084,6 +8094,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 +13 -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])
@@ -215,6 +221,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
@@ -244,6 +252,7 @@ AC_CHECK_HEADER([lzo/lzo1x.h], [ AC_CHECK_LIB([lzo2], [lzo1x_decompress], [zlib="$zlib -DHAVE_LZO1X -llzo2"]) ]) AC_SUBST(zlib) + AC_CHECK_LIB([aio], [io_setup], [], [AC_MSG_ERROR([Could not find libaio])]) AC_SUBST(system_aio) AC_CHECK_LIB([crypto], [MD5], [], [AC_MSG_ERROR([Could not find libcrypto])])
@@ -267,5 +276,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 2 lines · Ian Jackson
Support
./configure --host=i386-rumpxen-netbsd
Are things happy without some sort of update to config.{sub,guess,blah}? Debian keep having to update those for a new arch. Maybe that's for when --host isn't used though?
Why i386-* and not x86_64-*?
Ian.
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
Quoted 7 lines · Ian Jackson
Quoted 2 lines
Support
./configure --host=i386-rumpxen-netbsdAre things happy without some sort of update to config.{sub,guess,blah}? Debian keep having to update those for a new arch. Maybe that's for when --host isn't used though?
Yes, they don't need updating. This is one reason to choose this rather than (eg) i386-unknown-rumpxen.
Indeed, earlier I had this exchange with the rumpkernel folks:
Quoted 2 lines · Justin Cormack
I think i386-unknown-rumpxen is probably more correct, as it is not strictly netbsd even if it is netbsd like.
I have two counterarguments to that.
Firstly, that causes config.sub to fail with:
checking host system type... Invalid configuration
i386-unknown-rumpxen': system rumpxen' not recognized
We need something that will work with existing configure scripts. Now `i386-rumpxen-none' would work, but:
Secondly, the point of this is to cause a configure script of a naive userland program (which is what we are trying to compile) to do the right thing. The rumpuserxen application environment is much more like NetBSD than anything else. It has a NetBSD libc and a good number of the NetBSD system calls.
If a program is choosing between multiple implementation/interfaces to try to use, then if it chooses NetBSD there is a good chance that it will build and even a hope that it will work.
"none" is much less accurate.
Quoted 1 line
Why i386-* and not x86_64-*?
There's no particular reason why I mentioned that rather than the other in the commit message. I think it ought to work with either.
Should I mention both ? I haven't tested x86_64, although if and when I plumb this new stuff into osstest that will end up being tested.
Thanks,
Ian.
Re: [PATCH 10/11] rump kernels: Handle rumpxen host in configure
Quoted 5 lines · Ian Jackson
Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/11] rump kernels: Handle rumpxen host in configure"):
Quoted 4 lines · Ian Jackson
Quoted 2 lines
Support
./configure --host=i386-rumpxen-netbsd
Quoted 8 lines
Quoted 3 lines
Are things happy without some sort of update to config.{sub,guess,blah}? Debian keep having to update those for a new arch. Maybe that's for when --host isn't used though?
Yes, they don't need updating. This is one reason to choose this rather than (eg) i386-unknown-rumpxen.
Indeed, earlier I had this exchange with the rumpkernel folks:
Got it, thanks.
Quoted 7 lines
Quoted 1 line
Why i386-* and not x86_64-*?
There's no particular reason why I mentioned that rather than the other in the commit message. I think it ought to work with either.
Should I mention both ? I haven't tested
x86_64, although if and when I plumb this new stuff into osstest that will end up being tested.
OK. For the most part I think only x86_64 is interesting for this stuff these days. (To the extent that if we were to only end up support x86_64 rump kernels I wouldn't blink).
Ian.
PATCH 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
@@ -47,6 +47,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
Re: [PATCH 11/11] tools/Makefile: Build only a subset of things for rump kernels
Quoted 3 lines · Ian Jackson
Override the set of
tools/subdirectories for rump kernel builds.Signed-off-by Ian Jackson <[email protected]>
Is this the biggest list you envisage or do you expect it to grow? It might become unwieldy but we can deal with that as and when...
Ian.
Re: [PATCH 11/11] tools/Makefile: Build only a subset of things for rump kernels
Ian Campbell writes ("Re: [Xen-devel] [PATCH 11/11] tools/Makefile: Build only a subset of things for rump kernels"):
Quoted 4 lines · Ian Jackson
Quoted 1 line
Override the set of
tools/subdirectories for rump kernel builds.Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 2 lines
Is this the biggest list you envisage or do you expect it to grow? It might become unwieldy but we can deal with that as and when...
I don't think it is going to grow very much, but I could be wrong.
As you say, if it does, we will have to do something different, probably by transposing the representation (which would be a big and quite annoying patch).
Ian.
Ian Jackson writes ("[PATCH 00/11] tools, build: Build xenstore in rump kernel"):
Quoted 23 lines
These miscellaneous build system and tools patches make it possible to build libxc and libxenstore in the NetBSD Xen rump kernel environment.
01/11 xenstore: Use $(PTHREAD_LIBS) not -lpthread
02/11 xenstore: Inxenstore_client, avoid stack buffer in recursive function 03/11 rump kernels: Start introducing newXEN_OSNetBSDRump 04/11 libxc: rump kernels: Use standardxc_osdep_get_info
05/11 xenstore: rump kernels: Look for/dev/xen/xenbus
06/11 xenstore: Make building of xenstored optional
07/11 build system: IntroduceINSTALL_SHLIBandSYMLINK_SHLIB08/11 build system: Introduce libextension variable
09/11 build system: Introduce nosharedlibs variable.
10/11 rump kernels: Handle rumpxen host in configure
11/11tools/Makefile: Build only a subset of things for rump kernelsWith these patches and the corresponding rumpuser-xen series (just pushed) it is possible to build parts of the Xen management tools.
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.
Quoted 4 lines
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.
These are all tools patches, but it appears I forgot to CC Ian C. Rather than reposting the whole series with extra CCs, I'll just send this message ...
Thanks,
Ian.