aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/xen/APKBUILD77
-rw-r--r--main/xen/xen-blktap-uclibc.patch11
-rw-r--r--main/xen/xen-blktap2-uclibc.patch22
-rw-r--r--main/xen/xen-disable-firmware.patch10
-rw-r--r--main/xen/xen-disable-fsback.patch10
-rw-r--r--main/xen/xen-disable-werror.patch33
-rw-r--r--main/xen/xen-dont-use-lib64.patch11
-rw-r--r--main/xen/xend.initd38
-rw-r--r--main/xen/xendomains.initd63
9 files changed, 275 insertions, 0 deletions
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
new file mode 100644
index 0000000000..c3ff291ae2
--- /dev/null
+++ b/main/xen/APKBUILD
@@ -0,0 +1,77 @@
+# Contributor: William Pitcock <nenolod@dereferenced.org>
+# Maintainer: William Pitcock <nenolod@dereferenced.org>
+pkgname=xen
+pkgver=4.0.1
+pkgrel=2
+pkgdesc="Xen hypervisor"
+url="http://www.xen.org/"
+license="GPL"
+depends="coreutils python sed gawk"
+makedepends="libgcrypt-dev gnutls-dev pciutils-dev texinfo wget mesa-dev sdl-dev zlib-dev openssl-dev util-linux-ng-dev python-dev gettext-dev ncurses-dev"
+install=
+subpackages="$pkgname-doc"
+source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.gz
+ xen-blktap-uclibc.patch
+ xen-blktap2-uclibc.patch
+ xen-disable-firmware.patch
+ xen-disable-fsback.patch
+ xen-disable-werror.patch
+ xen-dont-use-lib64.patch
+ xend.initd
+ xendomains.initd"
+arch="x86_64"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir"
+
+ for i in $source; do
+ case $i in
+ *.patch)
+ msg "Applying $i..."
+ patch -s -p1 -N -i "$srcdir"/$i || return 1
+ ;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+
+ # We unset $CFLAGS and $LDFLAGS because Xen's buildsystem does not
+ # like these values being set. Arguably this is a bug but I can't be
+ # bothered to track it down. --nenolod
+ unset CFLAGS
+ unset LDFLAGS
+
+ # If we provide no parameters it tries to build a kernel image. We
+ # definitely don't want that.
+ (cd tools/check; ./chk build) || return 1
+ make -j1 xen tools stubdom || return 1
+}
+
+package() {
+ cd "$_builddir"
+
+ # We unset $CFLAGS and $LDFLAGS because Xen's buildsystem does not
+ # like these values being set. Arguably this is a bug but I can't be
+ # bothered to track it down. --nenolod
+ unset CFLAGS
+ unset LDFLAGS
+
+ make DESTDIR="$pkgdir" install-xen install-tools install-stubdom
+
+ install -m755 -D "$srcdir"/xend.initd "$pkgdir"/etc/init.d/xend
+ install -m755 -D "$srcdir"/xendomains.initd "$pkgdir"/etc/init.d/xendomains
+}
+
+md5sums="d197afad975ab2396a67323d57388c27 xen-4.0.1.tar.gz
+edb5c3e7fba8214702fac709f0e53124 xen-blktap-uclibc.patch
+1f7f847ae0baa915c7b52d0ed5869fe6 xen-blktap2-uclibc.patch
+a569f16a7e3c832ba3fab6154f657244 xen-disable-firmware.patch
+03d1fff892e627b812bba4e6c56d696a xen-disable-fsback.patch
+949d0d3bc1e8f300a849279b60760c6a xen-disable-werror.patch
+b6599060e22b61dabee0fe460b4a0c9d xen-dont-use-lib64.patch
+1d81b04f8c8b919879a73f0e3d2fe80f xend.initd
+a2b5234483f1b5892d22e9315d9c307f xendomains.initd"
diff --git a/main/xen/xen-blktap-uclibc.patch b/main/xen/xen-blktap-uclibc.patch
new file mode 100644
index 0000000000..d8668ec19b
--- /dev/null
+++ b/main/xen/xen-blktap-uclibc.patch
@@ -0,0 +1,11 @@
+--- xen-4.0.1/tools/blktap/drivers/bswap.h
++++ xen-4.0.1.mod/tools/blktap/drivers/bswap.h
+@@ -15,6 +15,8 @@
+ #define bswap_64(x) swap64(x)
+ #else
+
++#define HAVE_BYTESWAP_H
++
+ #ifdef HAVE_BYTESWAP_H
+ #include <byteswap.h>
+ #else
diff --git a/main/xen/xen-blktap2-uclibc.patch b/main/xen/xen-blktap2-uclibc.patch
new file mode 100644
index 0000000000..7ce1dc0cfd
--- /dev/null
+++ b/main/xen/xen-blktap2-uclibc.patch
@@ -0,0 +1,22 @@
+--- xen-4.0.1/tools/blktap2/drivers/bswap.h
++++ xen-4.0.1.mod/tools/blktap2/drivers/bswap.h
+@@ -15,6 +15,8 @@
+ #define bswap_64(x) swap64(x)
+ #else
+
++#define HAVE_BYTESWAP_H
++
+ #ifdef HAVE_BYTESWAP_H
+ #include <byteswap.h>
+ #else
+--- xen-4.0.1/tools/blktap2/vhd/lib/Makefile
++++ xen-4.0.1.mod/tools/blktap2/vhd/lib/Makefile
+@@ -23,6 +23,8 @@
+ LIBS := -luuid
+ endif
+
++LIBS += -liconv
++
+ # Get gcc to generate the dependencies for us.
+ CFLAGS += -Wp,-MD,.$(@F).d
+ DEPS = .*.d
diff --git a/main/xen/xen-disable-firmware.patch b/main/xen/xen-disable-firmware.patch
new file mode 100644
index 0000000000..06e43d41c4
--- /dev/null
+++ b/main/xen/xen-disable-firmware.patch
@@ -0,0 +1,10 @@
+--- xen-4.0.1/tools/Makefile
++++ xen-4.0.1.mod/tools/Makefile
+@@ -13,7 +13,6 @@
+ SUBDIRS-y += hotplug
+ SUBDIRS-y += xentrace
+ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
+-SUBDIRS-$(CONFIG_X86) += firmware
+ SUBDIRS-$(ACM_SECURITY) += security
+ SUBDIRS-y += console
+ SUBDIRS-y += xenmon
diff --git a/main/xen/xen-disable-fsback.patch b/main/xen/xen-disable-fsback.patch
new file mode 100644
index 0000000000..d0ae91b122
--- /dev/null
+++ b/main/xen/xen-disable-fsback.patch
@@ -0,0 +1,10 @@
+--- xen-4.0.1/tools/Makefile
++++ xen-4.0.1.mod/tools/Makefile
+@@ -29,7 +28,6 @@
+ SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
+ SUBDIRS-y += libfsimage
+ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
+-SUBDIRS-$(CONFIG_Linux) += fs-back
+ SUBDIRS-$(CONFIG_NetBSD) += fs-back
+ SUBDIRS-$(CONFIG_IOEMU) += ioemu-dir
+ SUBDIRS-y += xenpmd
diff --git a/main/xen/xen-disable-werror.patch b/main/xen/xen-disable-werror.patch
new file mode 100644
index 0000000000..c2c5512457
--- /dev/null
+++ b/main/xen/xen-disable-werror.patch
@@ -0,0 +1,33 @@
+--- xen-4.0.1/Config.mk
++++ xen-4.0.1.mod/Config.mk
+@@ -14,7 +14,7 @@
+
+ # Tools to run on system hosting the build
+ HOSTCC = gcc
+-HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
++HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+ HOSTCFLAGS += -fno-strict-aliasing
+
+ DISTDIR ?= $(XEN_ROOT)/dist
+--- xen-4.0.1/extras/mini-os/minios.mk
++++ xen-4.0.1.mod/extras/mini-os/minios.mk
+@@ -6,7 +6,7 @@
+
+ # Define some default flags.
+ # NB. '-Wcast-qual' is nasty, so I omitted it.
+-DEF_CFLAGS += -fno-builtin -Wall -Werror -Wredundant-decls -Wno-format -Wno-redundant-decls
++DEF_CFLAGS += -fno-builtin -Wall -Wredundant-decls -Wno-format -Wno-redundant-decls
+ DEF_CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
+ DEF_CFLAGS += $(call cc-option,$(CC),-fgnu89-inline)
+ DEF_CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline
+--- xen-4.0.1/tools/libxc/Makefile
++++ xen-4.0.1.mod/tools/libxc/Makefile
+@@ -57,7 +57,7 @@
+
+ -include $(XEN_TARGET_ARCH)/Makefile
+
+-CFLAGS += -Werror -Wmissing-prototypes
++CFLAGS += -Wmissing-prototypes
+ CFLAGS += $(INCLUDES) -I. -I../xenstore -I../include
+
+ # Needed for posix_fadvise64() in xc_linux.c
diff --git a/main/xen/xen-dont-use-lib64.patch b/main/xen/xen-dont-use-lib64.patch
new file mode 100644
index 0000000000..a22f139029
--- /dev/null
+++ b/main/xen/xen-dont-use-lib64.patch
@@ -0,0 +1,11 @@
+--- xen-4.0.1/config/StdGNU.mk
++++ xen-4.0.1.mod/config/StdGNU.mk
+@@ -28,7 +28,7 @@
+ INCLUDEDIR = $(PREFIX)/include
+ LIBLEAFDIR = lib
+ LIBLEAFDIR_x86_32 = lib
+-LIBLEAFDIR_x86_64 = lib64
++LIBLEAFDIR_x86_64 = lib
+ LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
+ LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
+ LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
diff --git a/main/xen/xend.initd b/main/xen/xend.initd
new file mode 100644
index 0000000000..6958c0479f
--- /dev/null
+++ b/main/xen/xend.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+depend() {
+ need net
+ before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+}
+
+is_privileged_domain() {
+ grep -qsE '^control_d$' /proc/xen/capabilities
+ return $?
+}
+
+start() {
+ if is_privileged_domain ; then
+ ebegin "Starting Xen daemons"
+ /usr/sbin/xend start
+ eend $?
+ else
+ eerror "Can't start xend - not a privileged domain"
+ return 1
+ fi
+}
+
+stop() {
+ ebegin "Stopping Xen control daemon"
+ /usr/sbin/xend stop
+ eend $?
+}
+
+restart() {
+ ebegin "Restarting Xen control daemon"
+ /usr/sbin/xend restart
+ eend $?
+}
+
+status() {
+ is_privileged_domain && /usr/sbin/xend status
+}
diff --git a/main/xen/xendomains.initd b/main/xen/xendomains.initd
new file mode 100644
index 0000000000..d12577c2b0
--- /dev/null
+++ b/main/xen/xendomains.initd
@@ -0,0 +1,63 @@
+#!/sbin/runscript
+
+depend() {
+ need xend
+ after dhcp
+}
+
+get_domname() {
+ local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1)
+
+ if [[ -z ${name_from_file} ]] ; then
+ basename "${1}"
+ else
+ echo ${name_from_file}
+ fi
+}
+
+is_running() {
+ /usr/sbin/xm list "${1}" >/dev/null 2>&1
+}
+
+start() {
+ einfo "Starting Xen domains in ${AUTODIR:=/etc/xen/auto}"
+
+ for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+ name=$(get_domname ${dom})
+ if ! is_running ${name} ; then
+ ebegin " Starting domain ${name}"
+ xm create --quiet ${dom}
+ eend $?
+ else
+ einfo " Not starting ${name} - already running."
+ fi
+ done
+}
+
+stop() {
+ einfo "Stopping Xen domains in ${AUTODIR:=/etc/xen/auto}"
+
+ for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Sending shutdown signal to ${name}"
+ xm shutdown ${name} >/dev/null
+ eend $?
+ fi
+ done
+
+ for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Waiting for domain ${name} to shutdown"
+ xm shutdown --wait ${name}
+ eend $?
+ else
+ einfo " Not stopping ${name} - not running."
+ fi
+ done
+}
+
+status() {
+ /usr/sbin/xm list
+}