Skip to contentSkip to conversation

build enhancements related to qemu

PATCH In review Juergen Gross 3 participants 10 messages Mar 2, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover build enhancements related to qemu

Last week I started an effort to use upstream qemu as a replacement for qemu-trad in ioemu stubdom. This small series addresses some problems I met in this effort. I believe all modifications are worth doing regardless whether qemu upstream stubdom will become a reality or not.

Changes in V2:
- Replaced patch 1
- Updated patch description of patch 3 (Ian Jackson)

Juergen Gross (4):
stubdom: set xen interface version for stubdom apps using xenctrl.h
tools: add pkg-config file for libxc
tools: use a dedicated build directory for qemu
tools: set pkg-config path when configuring qemu

 .gitignore                   |  4 ++++
 stubdom/Makefile             |  2 ++
 stubdom/ioemu-minios.cfg     |  1 +
 tools/Makefile               | 17 ++++++++++-------
 tools/Rules.mk               | 13 +++++++++++++
 tools/libxc/Makefile         | 22 +++++++++++++++++++++-
 tools/libxc/xencontrol.pc.in |  9 +++++++++
 7 files changed, 60 insertions(+), 8 deletions(-)
 create mode 100644 tools/libxc/xencontrol.pc.in
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH v2 1/4 stubdom: set xen interface version for stubdom apps using xenctrl.h

A stubdom app using xenctrl.h must use the latest interface version of Xen in order to avoid compatibility issues. Add the related config item to the stubdom config files where needed.

---
 stubdom/ioemu-minios.cfg | 1 +
 1 file changed, 1 insertion(+)
stubdom/ioemu-minios.cfg +1 -0
index d690553..a65baa3 100644
@@ -1,3 +1,4 @@
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
 CONFIG_PCIFRONT=y
+XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] stubdom: set xen interface version for stubdom apps using xenctrl.h

Juergen Gross writes ("[PATCH v2 1/4] stubdom: set xen interface version for stubdom apps using xenctrl.h"):

Quoted 3 lines

A stubdom app using xenctrl.h must use the latest interface version of Xen in order to avoid compatibility issues. Add the related config item to the stubdom config files where needed.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

PATCH v2 2/4 tools: add pkg-config file for libxc

In reply to Juergen Gross

When configuring the build of qemu the configure script is building various test programs to determine the exact version of libxencontrol.

Instead of a try and error approach needing updates for nearly each new version of Xen just provide xencontrol.pc to be used via pkg-config.

In the end we need two different variants of that file: one for the target system where eventually someone wants to build qemu, and one for the local system to be used for building qemu as part of the Xen build process.

The local variant is created in a dedicated directory in order to be able to collect more pkg-config files used for building tools there.

---
 .gitignore                   |  3 +++
 stubdom/Makefile             |  2 ++
 tools/Makefile               |  3 ++-
 tools/Rules.mk               | 13 +++++++++++++
 tools/libxc/Makefile         | 22 +++++++++++++++++++++-
 tools/libxc/xencontrol.pc.in |  9 +++++++++
 6 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 tools/libxc/xencontrol.pc.in
.gitignore +3 -0
index 3713b1e..015a189 100644
@@ -79,6 +79,7 @@ stubdom/newlib-1.*
 stubdom/newlib-x86*
 stubdom/ocaml-*
 stubdom/pciutils-*
+stubdom/pkg-config/*
 stubdom/polarssl-*
 stubdom/stubdompath.sh
 stubdom/tpm_emulator-*
@@ -179,6 +180,7 @@ tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
+tools/libxc/*.pc
 tools/libxl/_libxl.api-for-check
 tools/libxl/*.api-ok
 tools/libxl/*.pc
@@ -204,6 +206,7 @@ tools/misc/xen-hvmctx
 tools/misc/xenlockprof
 tools/misc/lowmemd
 tools/misc/xencov
+tools/pkg-config/*
 tools/xentrace/xenalyze
 tools/pygrub/build/*
 tools/python/build/*
stubdom/Makefile +2 -0
index 39b81c9..c6458e8 100644
@@ -318,6 +318,7 @@ define do_links
   cd $(dir $@); \
   ln -sf $(dir $<)include/*.h include/; \
   ln -sf $(dir $<)*.[ch] .; \
+  ln -sf $(dir $<)*.pc.in .; \
   ln -sf $(dir $<)Makefile .
   touch $@
 endef
@@ -623,6 +624,7 @@ clean:
 	rm -fr grub-$(XEN_TARGET_ARCH)
 	rm -f $(STUBDOMPATH)
 	rm -f *-minios-config.mk
+	rm -fr pkg-config
 	[ ! -e libs-$(XEN_TARGET_ARCH)/toollog/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/toollog clean
 	[ ! -e libs-$(XEN_TARGET_ARCH)/evtchn/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/evtchn clean
 	[ ! -e libs-$(XEN_TARGET_ARCH)/gnttab/Makefile ] || $(MAKE) DESTDIR= -C libs-$(XEN_TARGET_ARCH)/gnttab clean
tools/Makefile +2 -1
index 68633a4..9548ab4 100644
@@ -111,9 +111,10 @@ uninstall:
 
 .PHONY: clean
 clean: subdirs-clean
+	rm -rf pkg-config
 
 .PHONY: distclean
-distclean: subdirs-distclean
+distclean: subdirs-distclean clean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
 	rm -rf qemu-xen-dir qemu-xen-dir-remote
 	rm -rf ../config/Tools.mk config.h config.log config.status \
tools/Rules.mk +13 -0
index 52bdd1a..e676c6b 100644
@@ -245,3 +245,16 @@ ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 $(XEN_ROOT)/config/Tools.mk:
 	$(error You have to run ./configure before building or installing the tools)
 endif
+
+$(PKG_CONFIG_DIR)/%.pc: %.pc.in Makefile
+	mkdir -p $(PKG_CONFIG_DIR)
+	@sed -e 's!@@version@@!$(PKG_CONFIG_VERSION)!g' \
+	     -e 's!@@prefix@@!$(PKG_CONFIG_PREFIX)!g' \
+	     -e 's!@@incdir@@!$(PKG_CONFIG_INCDIR)!g' \
+	     -e 's!@@libdir@@!$(PKG_CONFIG_LIBDIR)!g' < $< > $@
+
+%.pc: %.pc.in Makefile
+	@sed -e 's!@@version@@!$(PKG_CONFIG_VERSION)!g' \
+	     -e 's!@@prefix@@!$(PKG_CONFIG_PREFIX)!g' \
+	     -e 's!@@incdir@@!$(PKG_CONFIG_INCDIR)!g' \
+	     -e 's!@@libdir@@!$(PKG_CONFIG_LIBDIR)!g' < $< > $@
tools/libxc/Makefile +21 -1
index da689c4..a161ba7 100644
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../..
+PKG_CONFIG_DIR = ../pkg-config
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 4.9
@@ -159,6 +160,22 @@ endif
 $(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) \
 $(CTRL_PIC_OBJS) $(GUEST_PIC_OBJS): xc_private.h
 
+PKG_CONFIG := xencontrol.pc
+PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
+
+ifneq ($(CONFIG_LIBXC_MINIOS),y)
+PKG_CONFIG_INST := $(PKG_CONFIG)
+$(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
+endif
+
+PKG_CONFIG_LOCAL := $(foreach pc,$(PKG_CONFIG),$(PKG_CONFIG_DIR)/$(pc))
+
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_LIBXC)/include
+$(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
+
 .PHONY: all
 all: build
 
@@ -167,12 +184,13 @@ build:
 	$(MAKE) libs
 
 .PHONY: libs
-libs: $(LIB)
+libs: $(LIB) $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL)
 
 .PHONY: install
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
 	$(INSTALL_DIR) $(DESTDIR)$(includedir)
+	$(INSTALL_DIR) $(DESTDIR)$(PKG_INSTALLDIR)
 	$(INSTALL_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)
 	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)$(libdir)
 	$(SYMLINK_SHLIB) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenctrl.so.$(MAJOR)
@@ -183,6 +201,7 @@ install: build
 	$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenguest.so.$(MAJOR)
 	$(SYMLINK_SHLIB) libxenguest.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenguest.so
 	$(INSTALL_DATA) include/xenguest.h $(DESTDIR)$(includedir)
+	$(INSTALL_DATA) xencontrol.pc $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: TAGS
 TAGS:
@@ -192,6 +211,7 @@ TAGS:
 clean:
 	rm -rf *.rpm $(LIB) *~ $(DEPS) \
             _paths.h \
+	    xencontrol.pc \
             $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
             $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS)
 
tools/libxc/xencontrol.pc.in new file +9 -0
new file mode 100644
index 0000000..213206f
@@ -0,0 +1,9 @@
+prefix=@@prefix@@
+includedir=@@incdir@@
+libdir=@@libdir@@
+
+Name: Xencontrol
+Description: The Xencontrol library for Xen hypervisor
+Version: @@version@@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lxenctrl
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] tools: add pkg-config file for libxc

Juergen Gross writes ("[PATCH v2 2/4] tools: add pkg-config file for libxc"):

Quoted 3 lines

Instead of a try and error approach needing updates for nearly each new version of Xen just provide xencontrol.pc to be used via pkg-config.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH v2 2/4] tools: add pkg-config file for libxc

In reply to Juergen Gross
Quoted 12 lines · Juergen Gross

When configuring the build of qemu the configure script is building various test programs to determine the exact version of libxencontrol.

Instead of a try and error approach needing updates for nearly each new version of Xen just provide xencontrol.pc to be used via pkg-config.

In the end we need two different variants of that file: one for the target system where eventually someone wants to build qemu, and one for the local system to be used for building qemu as part of the Xen build process.

Quoted 4 lines

The local variant is created in a dedicated directory in order to be able to collect more pkg-config files used for building tools there.

Please consider writing a follow-up patch to at least move libxenlight.pc and libxlutil.pc there, too. :-)

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH v2 2/4] tools: add pkg-config file for libxc

Quoted 13 lines · Wei Liu
Quoted 12 lines · Juergen Gross

When configuring the build of qemu the configure script is building various test programs to determine the exact version of libxencontrol.

Instead of a try and error approach needing updates for nearly each new version of Xen just provide xencontrol.pc to be used via pkg-config.

In the end we need two different variants of that file: one for the target system where eventually someone wants to build qemu, and one for the local system to be used for building qemu as part of the Xen build process.

Quoted 7 lines
Quoted 4 lines

The local variant is created in a dedicated directory in order to be able to collect more pkg-config files used for building tools there.

Please consider writing a follow-up patch to at least move libxenlight.pc and libxlutil.pc there, too. :-)

I'm planning to do this and more:

- add *.pc for all other Xen libraries
- add the library dependencies to the *.pc files
- use the pkg-config files for the Xen build process in order to get rid of the lib specific variables in tools/Rules.mk

When this has been done qemu can be switched to use pkg-config files from Xen 4.9 on. After this (when Xen is using the enhanced qemu version) we can drop passing the CFLAGS and LDFLAGS to qemu's configure.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw

Re: [PATCH v2 2/4] tools: add pkg-config file for libxc

Quoted 29 lines · Juergen Gross
Quoted 13 lines · Wei Liu
Quoted 12 lines · Juergen Gross

When configuring the build of qemu the configure script is building various test programs to determine the exact version of libxencontrol.

Instead of a try and error approach needing updates for nearly each new version of Xen just provide xencontrol.pc to be used via pkg-config.

In the end we need two different variants of that file: one for the target system where eventually someone wants to build qemu, and one for the local system to be used for building qemu as part of the Xen build process.

Quoted 7 lines
Quoted 4 lines

The local variant is created in a dedicated directory in order to be able to collect more pkg-config files used for building tools there.

Please consider writing a follow-up patch to at least move libxenlight.pc and libxlutil.pc there, too. :-)

I'm planning to do this and more:

- add *.pc for all other Xen libraries
- add the library dependencies to the *.pc files
- use the pkg-config files for the Xen build process in order to get rid of the lib specific variables in tools/Rules.mk

Quoted 5 lines

When this has been done qemu can be switched to use pkg-config files from Xen 4.9 on. After this (when Xen is using the enhanced qemu version) we can drop passing the CFLAGS and LDFLAGS to qemu's configure.

Great! Looking forward to more patches!

Quoted 3 lines

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

PATCH v2 3/4 tools: use a dedicated build directory for qemu

In reply to Juergen Gross

Instead of using the downloaded git tree as target directory for the qemu build create a dedicated directory for that purpose.

This way it is possible to use the same source directory of qemu to configure and build qemu upstream in a stubdom environment in future.

---
 .gitignore     |  1 +
 tools/Makefile | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
.gitignore +1 -0
index 015a189..443b12a 100644
@@ -207,6 +207,7 @@ tools/misc/xenlockprof
 tools/misc/lowmemd
 tools/misc/xencov
 tools/pkg-config/*
+tools/qemu-xen-build
 tools/xentrace/xenalyze
 tools/pygrub/build/*
 tools/python/build/*
tools/Makefile +7 -6
index 9548ab4..99080ab 100644
@@ -116,7 +116,7 @@ clean: subdirs-clean
 .PHONY: distclean
 distclean: subdirs-distclean clean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
-	rm -rf qemu-xen-dir qemu-xen-dir-remote
+	rm -rf qemu-xen-dir qemu-xen-dir-remote qemu-xen-build
 	rm -rf ../config/Tools.mk config.h config.log config.status \
 		config.cache autom4te.cache
 
@@ -244,9 +244,10 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_LOC) ; then \
 		source=$(QEMU_UPSTREAM_LOC); \
 	else \
-		source=.; \
+		source=$(XEN_ROOT)/tools/qemu-xen-dir; \
 	fi; \
-	cd qemu-xen-dir; \
+	mkdir -p qemu-xen-build; \
+	cd qemu-xen-build; \
 	if $$source/scripts/tracetool.py --check-backend --backend log ; then \
 		enable_trace_backend='--enable-trace-backend=log'; \
 	elif $$source/scripts/tracetool.py --check-backend --backend stderr ; then \
@@ -299,12 +300,12 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	$(MAKE) all
 
 subdir-install-qemu-xen-dir: subdir-all-qemu-xen-dir
-	cd qemu-xen-dir; \
+	cd qemu-xen-build; \
 	$(MAKE) install
 
 subdir-clean-qemu-xen-dir:
-	set -e; if test -d qemu-xen-dir/.; then \
-		$(MAKE) -C qemu-xen-dir clean; \
+	set -e; if test -d qemu-xen-build/.; then \
+		$(MAKE) -C qemu-xen-build clean; \
 	fi
 
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw

PATCH v2 4/4 tools: set pkg-config path when configuring qemu

In reply to Juergen Gross

When calling configure for qemu provide the local pkg-config directory in order to let the configure process find the libxenctrl version.

---
 tools/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/Makefile +1 -0
index 99080ab..d6f8ce1 100644
@@ -255,6 +255,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	else \
 		enable_trace_backend='' ; \
 	fi ; \
+	PKG_CONFIG_PATH=$(XEN_ROOT)/tools/pkg-config \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		$(QEMU_XEN_ENABLE_DEBUG) \
 		$$enable_trace_backend \
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel