aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2012-09-13 15:49:05 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2012-09-14 14:06:19 +0000
commita4e8938c1c5a2e6c89b02050d41654bc2af247e3 (patch)
tree1191b1c3a5045bec0688ea094ce24d240c5339bd /main/xen
parent5d10cb782ac6836c6f9d20a536b78260e47c7232 (diff)
downloadaports-a4e8938c1c5a2e6c89b02050d41654bc2af247e3.tar.bz2
aports-a4e8938c1c5a2e6c89b02050d41654bc2af247e3.tar.xz
xen: update to 4.2.0-rc4
Next version (4.2) is scheduled to be released very soon if everything goes ok. This is a very close rc, which we can start testing until 4.2 comes out.
Diffstat (limited to 'main/xen')
-rw-r--r--main/xen/APKBUILD71
-rw-r--r--main/xen/blktap2_libvhd_add_iconv.patch31
-rw-r--r--main/xen/busybox-sed.patch11
-rw-r--r--main/xen/define_fsimage_dir.patch12
-rw-r--r--main/xen/detect_libiconv.patch22
-rw-r--r--main/xen/fix_bswap_blktap.patch61
-rw-r--r--main/xen/fix_bswap_blktap2.patch62
-rw-r--r--main/xen/librt.patch4
-rw-r--r--main/xen/make_stubdoms.patch184
-rw-r--r--main/xen/qemu-xen_paths.patch15
-rw-r--r--main/xen/qemu_uclibc_configure.patch48
-rw-r--r--main/xen/xenqemu.confd2
-rw-r--r--main/xen/xenqemu.initd25
13 files changed, 319 insertions, 229 deletions
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
index 007f3006a0..fdc01f05fc 100644
--- a/main/xen/APKBUILD
+++ b/main/xen/APKBUILD
@@ -2,26 +2,24 @@
# Contributor: Roger Pau Monne <roger.pau@entel.upc.edu>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=xen
-pkgver=4.1.3
+pkgver=4.2.0
+pkgrc=4
pkgrel=0
pkgdesc="Xen hypervisor"
url="http://www.xen.org/"
arch="x86 x86_64"
license="GPL"
-depends="udev syslinux bash"
+depends="syslinux bash"
depends_dev="openssl-dev python-dev e2fsprogs-dev gettext zlib-dev ncurses-dev
- libiconv-dev dev86 texinfo perl iasl pciutils-dev"
+ libiconv-dev dev86 texinfo perl iasl pciutils-dev glib-dev yajl-dev"
makedepends="$depends_dev"
install=""
-subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-hypervisor"
-source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.gz
- blktap2_libvhd_add_iconv.patch
- detect_libiconv.patch
- fix_bswap_blktap.patch
- fix_bswap_blktap2.patch
- define_fsimage_dir.patch
+subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-hypervisor $pkgname-xend"
+source="http://xenbits.xen.org/people/royger/$pkgname-$pkgver-rc$pkgrc.tar.gz
+ qemu_uclibc_configure.patch
librt.patch
- busybox-sed.patch
+ make_stubdoms.patch
+ qemu-xen_paths.patch
xenstored.initd
xenstored.confd
@@ -32,12 +30,15 @@ source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.g
xendomains.initd
xendomains.confd
xen-consoles.logrotate
+ xenqemu.confd
+ xenqemu.initd
"
-_builddir="$srcdir"/$pkgname-$pkgver
+_builddir="$srcdir"/$pkgname
prepare() {
local i
cd "$_builddir"
+
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
@@ -48,7 +49,11 @@ prepare() {
msg "Eradicating -Werror..."
find -name '*.mk' -o -name 'Make*' | xargs sed -i -e 's/-Werror//g'
- echo "LIBLEAFDIR_x86_64=lib" >> .config
+ unset CFLAGS
+ unset LDFLAGS
+
+ msg "Running configure..."
+ ./configure || return 1
}
build() {
@@ -60,17 +65,17 @@ build() {
unset CFLAGS
unset LDFLAGS
- msg "Running preflight check..."
- (cd tools/check; ./chk build) || return 1
-
msg "Building hypervisor..."
make xen || return 1
msg "Building tools..."
make tools || return 1
+ msg "Building documentation..."
+ make docs || return 1
+
msg "Building stub domains..."
- make -j1 stubdom || return 1
+ make stubdom || return 1
}
package() {
@@ -79,8 +84,8 @@ package() {
unset CFLAGS
unset LDFLAGS
- make -j1 DESTDIR="$pkgdir" install-xen install-tools install-stubdom \
- || return 1
+ make -j1 DESTDIR="$pkgdir" install-xen install-tools install-docs \
+ install-stubdom || return 1
# remove default xencommons
rm -rf "$pkgdir"/etc/init.d/xencommons
@@ -113,14 +118,22 @@ hypervisor() {
mv "$pkgdir"/boot "$subpkgdir"/
}
-md5sums="bed929d5c5e5135cab40e2a6aab73fa0 xen-4.1.3.tar.gz
-6d4b045ae56be6288733d0e078f591ea blktap2_libvhd_add_iconv.patch
-ed3283697cb1ddff066f4087eabf68c6 detect_libiconv.patch
-503f0883f4a0b50fe4e37e09ed9a6177 fix_bswap_blktap.patch
-b973dc1ffcc6872e222b36f3b7b4836b fix_bswap_blktap2.patch
-0bb8a435020a5a49b38b1a447fb69977 define_fsimage_dir.patch
-fa06495a175571f4aa3b6cb88937953e librt.patch
-1bea3543ddc712330527b62fd9ff6520 busybox-sed.patch
+xend() {
+ pkgdesc="Xend toolstack"
+ replaces="xen"
+ depends="udev xen python"
+ mkdir -p "$subpkgdir"
+ sitepackages=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
+ mkdir -p "$subpkgdir"/"$sitepackages"/xen
+ find "$pkgdir"/"$sitepackages"/xen -maxdepth 1 -mindepth 1 -type d -not -name lowlevel \
+ -exec mv '{}' "$subpkgdir"/"$sitepackages"/xen \;
+}
+
+md5sums="336a2a6cde9cbbe861decf442bf5cd5e xen-4.2.0-rc4.tar.gz
+1b165c3b1288e2952cf852d36dfaaa67 qemu_uclibc_configure.patch
+35039c88b4f573f672b3178d9d65c5b7 librt.patch
+41ad48fdc269749776fa6aa04f6778c2 make_stubdoms.patch
+1ccde6b36a6f9542a16d998204dc9a22 qemu-xen_paths.patch
6e5739dad7e2bd1b625e55ddc6c782b7 xenstored.initd
b017ccdd5e1c27bbf1513e3569d4ff07 xenstored.confd
ed262f15fb880badb53575539468646c xenconsoled.initd
@@ -129,4 +142,6 @@ ec2252c72050d7d5870a3a629b873ba6 xenconsoled.confd
9261ad0f285836c1b0ea07f306e4586e xend.confd
35448ff063f8123ec4bba2e001f39c6c xendomains.initd
9b20e056d475b50586cf9e1fc94e13c4 xendomains.confd
-9df68ac65dc3f372f5d61183abdc83ff xen-consoles.logrotate"
+9df68ac65dc3f372f5d61183abdc83ff xen-consoles.logrotate
+6a2f777c16678d84039acf670d86fff6 xenqemu.confd
+fbd2082d448acfec2e69b860120d79b7 xenqemu.initd"
diff --git a/main/xen/blktap2_libvhd_add_iconv.patch b/main/xen/blktap2_libvhd_add_iconv.patch
deleted file mode 100644
index 2353e38a6b..0000000000
--- a/main/xen/blktap2_libvhd_add_iconv.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-# HG changeset patch
-# Parent 14e911353a91702b439bc06e2a77d67e8bd5f661
-blktap2/vhd: add -liconv when linking if using libiconv
-
-If libiconv is detected on the system add -liconv when linking the
-libvhd library.
-
-If -liconv is not added when compiling libvhd with libiconv the
-following error occours when linking vhd-util and vhd-update:
-
-gcc -o vhd-util vhd-util.o -Llib -lvhd
-lib/libvhd.so: undefined reference to `libiconv_open'
-lib/libvhd.so: undefined reference to `libiconv_close'
-lib/libvhd.so: undefined reference to `libiconv'
-
-Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
-
-diff -r 14e911353a91 tools/blktap2/vhd/lib/Makefile
---- a/tools/blktap2/vhd/lib/Makefile Tue Dec 20 02:30:12 2011 +0100
-+++ b/tools/blktap2/vhd/lib/Makefile Tue Dec 20 02:33:11 2011 +0100
-@@ -23,6 +23,10 @@ ifeq ($(CONFIG_Linux),y)
- LIBS := -luuid
- endif
-
-+ifeq ($(CONFIG_LIBICONV),y)
-+LIBS += -liconv
-+endif
-+
- LIB-SRCS := libvhd.c
- LIB-SRCS += libvhd-journal.c
- LIB-SRCS += vhd-util-coalesce.c
diff --git a/main/xen/busybox-sed.patch b/main/xen/busybox-sed.patch
deleted file mode 100644
index e1a9531577..0000000000
--- a/main/xen/busybox-sed.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./xen/arch/x86/boot/Makefile.orig
-+++ ./xen/arch/x86/boot/Makefile
-@@ -2,7 +2,7 @@
-
- head.o: reloc.S
-
--BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\{1\,\}BOOT_TRAMPOLINE[[:space:]]\{1\,\},,p' $(BASEDIR)/include/asm-x86/config.h)
-+BOOT_TRAMPOLINE := $(shell sed -n 's,^\#define[[:space:]]\+BOOT_TRAMPOLINE[[:space:]]\+,,p' $(BASEDIR)/include/asm-x86/config.h)
- %.S: %.c
- RELOC=$(BOOT_TRAMPOLINE) $(MAKE) -f build32.mk $@
-
diff --git a/main/xen/define_fsimage_dir.patch b/main/xen/define_fsimage_dir.patch
deleted file mode 100644
index 04e4aed2af..0000000000
--- a/main/xen/define_fsimage_dir.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -r 2863b2f43a3b tools/libfsimage/common/Makefile
---- a/tools/libfsimage/common/Makefile Thu Dec 22 14:49:38 2011 +0000
-+++ b/tools/libfsimage/common/Makefile Tue Dec 27 21:00:54 2011 +0100
-@@ -4,6 +4,8 @@
- MAJOR = 1.0
- MINOR = 0
-
-+CFLAGS += -DFSIMAGE_FSDIR=\"/usr/lib/fs\"
-+
- LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
- LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
- LDFLAGS = $(LDFLAGS-y)
diff --git a/main/xen/detect_libiconv.patch b/main/xen/detect_libiconv.patch
deleted file mode 100644
index 5b2359eb67..0000000000
--- a/main/xen/detect_libiconv.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-# HG changeset patch
-# Parent 2bc60167b9f8791747d2cea09c5207a9c2d7ef7b
-build: detect is libiconv is present
-
-Detect if libiconv is present in the system, since we will have to
-link against it when using iconv.
-
-Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
-
-diff -r 2bc60167b9f8 Config.mk
---- a/Config.mk Tue Dec 20 05:25:19 2011 +0100
-+++ b/Config.mk Tue Dec 20 07:52:38 2011 +0100
-@@ -9,6 +9,10 @@
- XEN_OS ?= $(shell uname -s)
-
- CONFIG_$(XEN_OS) := y
-+CONFIG_LIBICONV := $(shell export OS="`uname -s`"; \
-+ export CHECK_LIB="$(CHECK_LIB)"; \
-+ . $(XEN_ROOT)/tools/check/funcs.sh; \
-+ has_lib libiconv.so && echo 'y' || echo 'n')
-
- SHELL ?= /bin/sh
diff --git a/main/xen/fix_bswap_blktap.patch b/main/xen/fix_bswap_blktap.patch
deleted file mode 100644
index 71671d9dc2..0000000000
--- a/main/xen/fix_bswap_blktap.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-# HG changeset patch
-# Parent d61e6300274bbc6bc464ad340146bd81e91f64f3
-blktap: remove local definitions and include byteswap.h
-
-Use the same approach as tools/blktap2/include/libvhd.h, remove local
-definitions of bswap* and include byteswap.h. Also remove the
-HAVE_BYTESWAP_H ifdef, since it was not defined in this context (it's
-defined by QEMU).
-
-Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
-
-diff -r d61e6300274b tools/blktap/drivers/bswap.h
---- a/tools/blktap/drivers/bswap.h Tue Dec 20 05:20:02 2011 +0100
-+++ b/tools/blktap/drivers/bswap.h Tue Dec 20 05:24:16 2011 +0100
-@@ -13,45 +13,9 @@
- #define bswap_16(x) swap16(x)
- #define bswap_32(x) swap32(x)
- #define bswap_64(x) swap64(x)
--#else
-+#elif defined(__linux__)
-
--#ifdef HAVE_BYTESWAP_H
- #include <byteswap.h>
--#else
--
--#define bswap_16(x) \
--({ \
-- uint16_t __x = (x); \
-- ((uint16_t)( \
-- (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
-- (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
--})
--
--#define bswap_32(x) \
--({ \
-- uint32_t __x = (x); \
-- ((uint32_t)( \
-- (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
-- (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
-- (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
-- (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
--})
--
--#define bswap_64(x) \
--({ \
-- uint64_t __x = (x); \
-- ((uint64_t)( \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
--})
--
--#endif /* !HAVE_BYTESWAP_H */
-
- static inline uint16_t bswap16(uint16_t x)
- {
diff --git a/main/xen/fix_bswap_blktap2.patch b/main/xen/fix_bswap_blktap2.patch
deleted file mode 100644
index 69cd2e369c..0000000000
--- a/main/xen/fix_bswap_blktap2.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-# HG changeset patch
-# Parent 00d9ee3844121f4a7f01e42933751e49b0448abb
-blktap2: remove local definitions and include byteswap.h
-
-Use the same approach as tools/blktap2/include/libvhd.h, remove local
-definitions of bswap* and include byteswap.h. Also remove the
-HAVE_BYTESWAP_H ifdef, since it was not defined in this context (it's
-defined by QEMU).
-
-Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
-
-diff -r 00d9ee384412 tools/blktap2/drivers/bswap.h
---- a/tools/blktap2/drivers/bswap.h Tue Dec 20 05:24:17 2011 +0100
-+++ b/tools/blktap2/drivers/bswap.h Tue Dec 20 05:25:18 2011 +0100
-@@ -13,45 +13,10 @@
- #define bswap_16(x) swap16(x)
- #define bswap_32(x) swap32(x)
- #define bswap_64(x) swap64(x)
--#else
-+#elif defined(__linux__)
-
--#ifdef HAVE_BYTESWAP_H
-+#include <endian.h>
- #include <byteswap.h>
--#else
--
--#define bswap_16(x) \
--({ \
-- uint16_t __x = (x); \
-- ((uint16_t)( \
-- (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
-- (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
--})
--
--#define bswap_32(x) \
--({ \
-- uint32_t __x = (x); \
-- ((uint32_t)( \
-- (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
-- (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
-- (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
-- (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
--})
--
--#define bswap_64(x) \
--({ \
-- uint64_t __x = (x); \
-- ((uint64_t)( \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
-- (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
--})
--
--#endif /* !HAVE_BYTESWAP_H */
-
- static inline uint16_t bswap16(uint16_t x)
- {
diff --git a/main/xen/librt.patch b/main/xen/librt.patch
index cbb52071a5..1393f7ffb5 100644
--- a/main/xen/librt.patch
+++ b/main/xen/librt.patch
@@ -1,5 +1,5 @@
---- ./tools/ioemu-qemu-xen/Makefile.target.orig
-+++ ./tools/ioemu-qemu-xen/Makefile.target
+--- ./tools/qemu-xen-traditional-dir/Makefile.target.orig
++++ ./tools/qemu-xen-traditional-dir/Makefile.target
@@ -520,7 +520,7 @@
OBJS+=block-raw-posix.o
endif
diff --git a/main/xen/make_stubdoms.patch b/main/xen/make_stubdoms.patch
new file mode 100644
index 0000000000..0587ef1a58
--- /dev/null
+++ b/main/xen/make_stubdoms.patch
@@ -0,0 +1,184 @@
+diff --git a/stubdom/Makefile b/stubdom/Makefile
+index 2da70e3..618624c 100644
+--- a/stubdom/Makefile
++++ b/stubdom/Makefile
+@@ -76,8 +76,6 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib
+
+ TARGETS=ioemu c caml grub xenstore
+
+-CROSS_MAKE := $(MAKE) DESTDIR=
+-
+ .PHONY: all
+ all: build
+ ifeq ($(STUBDOM_SUPPORTED),1)
+@@ -113,8 +111,8 @@ $(NEWLIB_STAMPFILE): mk-headers-$(XEN_TARGET_ARCH) newlib-$(NEWLIB_VERSION)
+ mkdir -p newlib-$(XEN_TARGET_ARCH)
+ ( cd newlib-$(XEN_TARGET_ARCH) && \
+ CC_FOR_TARGET="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS)" AR_FOR_TARGET=$(AR) LD_FOR_TARGET=$(LD) RANLIB_FOR_TARGET=$(RANLIB) ../newlib-$(NEWLIB_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long --disable-multilib && \
+- $(CROSS_MAKE) && \
+- $(CROSS_MAKE) install )
++ $(MAKE) DESTDIR= && \
++ $(MAKE) DESTDIR= install )
+
+ ############
+ # Cross-zlib
+@@ -133,8 +131,8 @@ cross-zlib: $(ZLIB_STAMPFILE)
+ $(ZLIB_STAMPFILE): zlib-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE)
+ ( cd $< && \
+ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" CC=$(CC) ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
+- $(CROSS_MAKE) libz.a && \
+- $(CROSS_MAKE) install )
++ $(MAKE) DESTDIR= libz.a && \
++ $(MAKE) DESTDIR= install )
+
+ ##############
+ # Cross-libpci
+@@ -158,7 +156,7 @@ $(LIBPCI_STAMPFILE): pciutils-$(XEN_TARGET_ARCH) $(NEWLIB_STAMPFILE) $(ZLIB_STAM
+ chmod u+w lib/config.h && \
+ echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
+ ln -sf ../../libpci.config.mak lib/config.mk && \
+- $(CROSS_MAKE) CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
++ $(MAKE) DESTDIR= CC="$(CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -I$(call realpath,$(MINI_OS)/include)" lib/libpci.a && \
+ $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
+ $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
+ $(INSTALL_DATA) lib/config.h lib/header.h lib/pci.h lib/types.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
+@@ -203,8 +201,8 @@ $(OCAML_STAMPFILE): ocaml-$(XEN_TARGET_ARCH)/.dirstamp
+ -no-pthread -no-shared-libs -no-tk -no-curses \
+ -cc "$(CC) -U_FORTIFY_SOURCE -fno-stack-protector -mno-red-zone"
+ $(foreach i,$(MINIOS_HASNOT),sed -i 's,^\(#define HAS_$(i)\),//\1,' ocaml-$(XEN_TARGET_ARCH)/config/s.h ; )
+- $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) world
+- $(CROSS_MAKE) -C ocaml-$(XEN_TARGET_ARCH) opt
++ $(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) world
++ $(MAKE) DESTDIR= -C ocaml-$(XEN_TARGET_ARCH) opt
+ $(MAKE) -C ocaml-$(XEN_TARGET_ARCH) install
+ touch $@
+
+@@ -219,7 +217,7 @@ QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; els
+
+ ifeq ($(QEMU_ROOT),.)
+ $(XEN_ROOT)/tools/qemu-xen-traditional-dir:
+- $(CROSS_MAKE) -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
++ $(MAKE) DESTDIR= -C $(XEN_ROOT)/tools qemu-xen-traditional-dir-find
+
+ ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/qemu-xen-traditional-dir
+ mkdir -p ioemu
+@@ -250,7 +248,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
+ ( [ -h include/xen/libelf ] || ln -sf $(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
+ mkdir -p include/xen-foreign && \
+ ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*) include/xen-foreign/ && \
+- $(CROSS_MAKE) -C include/xen-foreign/ && \
++ $(MAKE) DESTDIR= -C include/xen-foreign/ && \
+ ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
+ mkdir -p libxc-$(XEN_TARGET_ARCH)
+ [ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
+@@ -267,7 +265,7 @@ mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
+ ln -sf $(XEN_ROOT)/tools/xenstore/*.c . && \
+ ln -sf $(XEN_ROOT)/tools/xenstore/*.h . && \
+ ln -sf $(XEN_ROOT)/tools/xenstore/Makefile . )
+- $(CROSS_MAKE) -C $(MINI_OS) links
++ $(MAKE) DESTDIR= -C $(MINI_OS) links
+ touch mk-headers-$(XEN_TARGET_ARCH)
+
+ TARGETS_MINIOS=$(addprefix mini-os-$(XEN_TARGET_ARCH)-,$(TARGETS))
+@@ -284,7 +282,7 @@ $(TARGETS_MINIOS): mini-os-%:
+ .PHONY: libxc
+ libxc: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a libxc-$(XEN_TARGET_ARCH)/libxenguest.a
+ libxc-$(XEN_TARGET_ARCH)/libxenctrl.a: cross-zlib
+- CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH)
++ CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH)
+
+ libxc-$(XEN_TARGET_ARCH)/libxenguest.a: libxc-$(XEN_TARGET_ARCH)/libxenctrl.a
+
+@@ -302,7 +300,7 @@ ioemu: cross-zlib cross-libpci libxc
+ TARGET_CFLAGS="$(TARGET_CFLAGS)" \
+ TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+ $(QEMU_ROOT)/xen-setup-stubdom )
+- $(CROSS_MAKE) -C ioemu -f $(QEMU_ROOT)/Makefile
++ $(MAKE) DESTDIR= -C ioemu -f $(QEMU_ROOT)/Makefile
+
+ ######
+ # caml
+@@ -310,7 +308,7 @@ ioemu: cross-zlib cross-libpci libxc
+
+ .PHONY: caml
+ caml: $(CROSS_ROOT)
+- CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
++ CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) OCAMLC_CROSS_PREFIX=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/bin/
+
+ ###
+ # C
+@@ -318,7 +316,7 @@ caml: $(CROSS_ROOT)
+
+ .PHONY: c
+ c: $(CROSS_ROOT)
+- CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH)
++ CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH)
+
+ ######
+ # Grub
+@@ -337,7 +335,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.gz
+ .PHONY: grub
+ grub: grub-upstream $(CROSS_ROOT)
+ mkdir -p grub-$(XEN_TARGET_ARCH)
+- CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
++ CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ OBJ_DIR=$(CURDIR)/grub-$(XEN_TARGET_ARCH)
+
+ ##########
+ # xenstore
+@@ -345,7 +343,7 @@ grub: grub-upstream $(CROSS_ROOT)
+
+ .PHONY: xenstore
+ xenstore: $(CROSS_ROOT)
+- CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(CROSS_MAKE) -C $@ xenstored.a CONFIG_STUBDOM=y
++ CPPFLAGS="$(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y
+
+ ########
+ # minios
+@@ -354,23 +352,23 @@ xenstore: $(CROSS_ROOT)
+ .PHONY: ioemu-stubdom
+ ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
+ ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxc ioemu
+- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
++ DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
+
+ .PHONY: caml-stubdom
+ caml-stubdom: mini-os-$(XEN_TARGET_ARCH)-caml lwip-$(XEN_TARGET_ARCH) libxc cross-ocaml caml
+- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
++ DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/caml/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a"
+
+ .PHONY: c-stubdom
+ c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxc c
+- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
++ DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/c/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS=$(CURDIR)/c/main.a
+
+ .PHONY: pv-grub
+ pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxc grub
+- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
++ DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+
+ .PHONY: xenstore-stubdom
+ xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore
+- DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(CROSS_MAKE) -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
++ DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
+
+ #########
+ # install
+@@ -412,13 +410,13 @@ clean:
+ rm -fr mini-os-$(XEN_TARGET_ARCH)-caml
+ rm -fr mini-os-$(XEN_TARGET_ARCH)-grub
+ rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore
+- $(CROSS_MAKE) -C caml clean
+- $(CROSS_MAKE) -C c clean
++ $(MAKE) DESTDIR= -C caml clean
++ $(MAKE) DESTDIR= -C c clean
+ rm -fr grub-$(XEN_TARGET_ARCH)
+ rm -f $(STUBDOMPATH)
+- [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(CROSS_MAKE) -C libxc-$(XEN_TARGET_ARCH) clean
+- -[ ! -d ioemu ] || $(CROSS_MAKE) -C ioemu clean
+- -[ ! -d xenstore ] || $(CROSS_MAKE) -C xenstore clean
++ [ ! -d libxc-$(XEN_TARGET_ARCH) ] || $(MAKE) DESTDIR= -C libxc-$(XEN_TARGET_ARCH) clean
++ -[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
++ -[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean
+
+ # clean the cross-compilation result
+ .PHONY: crossclean
diff --git a/main/xen/qemu-xen_paths.patch b/main/xen/qemu-xen_paths.patch
new file mode 100644
index 0000000000..1a17fc6bed
--- /dev/null
+++ b/main/xen/qemu-xen_paths.patch
@@ -0,0 +1,15 @@
+diff --git a/tools/Makefile b/tools/Makefile
+index 0edeb62..d5d02e8 100644
+--- a/tools/Makefile
++++ b/tools/Makefile
+@@ -166,6 +166,9 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
+ -L$(XEN_ROOT)/tools/xenstore" \
+ --bindir=$(LIBEXEC) \
+ --datadir=$(SHAREDIR)/qemu-xen \
++ --mandir=$(PREFIX)/share/man \
++ --docdir=$(PREFIX)/share/doc \
++ --sysconfdir=/etc/qemu \
+ --disable-kvm \
+ --python=$(PYTHON) \
+ $(IOEMU_CONFIGURE_CROSS); \
+
diff --git a/main/xen/qemu_uclibc_configure.patch b/main/xen/qemu_uclibc_configure.patch
new file mode 100644
index 0000000000..bef93c14d9
--- /dev/null
+++ b/main/xen/qemu_uclibc_configure.patch
@@ -0,0 +1,48 @@
+--- a/tools/qemu-xen-dir/configure
++++ b/tools/qemu-xen-dir/configure
+@@ -2457,19 +2457,44 @@ EOF
+ fi
+ fi
+
++##########################################
++# Do we need libm
++cat > $TMPC << EOF
++#include <math.h>
++int main(void) { return isnan(sin(0.0)); }
++EOF
++if compile_prog "" "" ; then
++ :
++elif compile_prog "" "-lm" ; then
++ LIBS="-lm $LIBS"
++ libs_qga="-lm $libs_qga"
++else
++ echo
++ echo "Error: libm check failed"
++ echo
++ exit 1
++fi
+
+ ##########################################
+ # Do we need librt
++# uClibc provides 2 versions of clock_gettime(), one with realtime
++# support and one without. This means that the clock_gettime() don't
++# need -lrt. We still need it for timer_create() so we check for this
++# function in addition.
+ cat > $TMPC <<EOF
+ #include <signal.h>
+ #include <time.h>
+-int main(void) { clockid_t id; return clock_gettime(id, NULL); }
++int main(void) {
++ timer_create(CLOCK_REALTIME, NULL, NULL);
++ return clock_gettime(CLOCK_REALTIME, NULL);
++}
+ EOF
+
+ if compile_prog "" "" ; then
+ :
+ elif compile_prog "" "-lrt" ; then
+ LIBS="-lrt $LIBS"
++ libs_qga="-lrt $libs_qga"
+ fi
+
+ if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
diff --git a/main/xen/xenqemu.confd b/main/xen/xenqemu.confd
new file mode 100644
index 0000000000..ccc7131434
--- /dev/null
+++ b/main/xen/xenqemu.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenqemu
+XENQEMU_OPTS=""
diff --git a/main/xen/xenqemu.initd b/main/xen/xenqemu.initd
new file mode 100644
index 0000000000..463bf598ff
--- /dev/null
+++ b/main/xen/xenqemu.initd
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need xenstored xenconsoled
+}
+
+start() {
+ ebegin "Starting QEMU as disk backend for dom0"
+ start-stop-daemon --start --exec /usr/lib/xen/bin/qemu-system-i386 \
+ --pidfile=/var/run/xenqemu.pid -b -- \
+ -xen-domid 0 -xen-attach -name dom0 -nographic \
+ -M xenpv -monitor /dev/null \
+ -pidfile /var/run/xenqemu.pid \
+ ${XENQEMU_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping QEMU as disk backend for dom0"
+ start-stop-daemon --stop --exec /usr/lib/xen/bin/qemu-system-i386 \
+ --pidfile /var/run/xenqemu.pid
+ eend $?
+}
+