diff options
author | Roger Pau Monne <roger.pau@entel.upc.edu> | 2012-01-07 00:46:20 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-01-12 20:39:35 +0000 |
commit | 49beded59a8d56b930765c9af2bbf3e0983e892c (patch) | |
tree | 28f0ddbc9df8725c957e9339314cf072e54463d8 /testing/xen | |
parent | 7ea9d9d7e0103e8ba8c023479de918206e52266a (diff) | |
download | aports-49beded59a8d56b930765c9af2bbf3e0983e892c.tar.bz2 aports-49beded59a8d56b930765c9af2bbf3e0983e892c.tar.xz |
testing/xen: add xen 4.1.2
Build full Xen distribution.
Changes since v4:
* Removed "opts=" from xencommons init script.
* Backported upstream patch to boot Syslinux PV-DomUs with pygrub
(allows booting Alpine PV-DomUs).
Changes since v3:
* Added bash as a runtime dependency, since some hotplug scripts
use that instead of /bin/sh.
Changes since v2:
* Clean and updated init scripts to be as similar as possible to
upstream version.
Changes since v1:
* Removed net from xencommons dependencies and added udev.
Diffstat (limited to 'testing/xen')
-rw-r--r-- | testing/xen/APKBUILD | 90 | ||||
-rw-r--r-- | testing/xen/blktap2_libvhd_add_iconv.patch | 31 | ||||
-rw-r--r-- | testing/xen/define_fsimage_dir.patch | 12 | ||||
-rw-r--r-- | testing/xen/detect_libiconv.patch | 22 | ||||
-rw-r--r-- | testing/xen/fix_bswap_blktap.patch | 61 | ||||
-rw-r--r-- | testing/xen/fix_bswap_blktap2.patch | 62 | ||||
-rw-r--r-- | testing/xen/fix_ipxe_no_pie_default.patch | 165 | ||||
-rw-r--r-- | testing/xen/pygrub_alpine.patch | 64 | ||||
-rw-r--r-- | testing/xen/xencommons.initd | 102 | ||||
-rw-r--r-- | testing/xen/xend.initd | 53 | ||||
-rw-r--r-- | testing/xen/xendomains.initd | 105 |
11 files changed, 767 insertions, 0 deletions
diff --git a/testing/xen/APKBUILD b/testing/xen/APKBUILD new file mode 100644 index 0000000000..fdeec5236a --- /dev/null +++ b/testing/xen/APKBUILD @@ -0,0 +1,90 @@ +# Contributor: Roger Pau Monne <roger.pau@entel.upc.edu> +# Maintainer: +pkgname=xen +pkgver=4.1.2 +pkgrel=0 +pkgdesc="Xen hypervisor" +url="http://www.xen.org" +arch="x86 x86_64" +license="GPL" +depends="udev syslinux bash" +depends_dev="openssl-dev python-dev e2fsprogs-dev gettext zlib-dev ncurses-dev libiconv-dev dev86 texinfo perl iasl sed" +makedepends="$depends_dev" +install="" +subpackages="$pkgname-doc" +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 + fix_ipxe_no_pie_default.patch + define_fsimage_dir.patch + pygrub_alpine.patch + xencommons.initd + xend.initd + xendomains.initd" + +_builddir="$srcdir"/$pkgname-$pkgver +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done + + # remove all -Werror + msg "Eradicating -Werror..." + find -name '*.mk' -o -name 'Make*' | xargs sed -i -e 's/-Werror//g' + + echo "LIBLEAFDIR_x86_64=lib" >> .config +} + +build() { + cd "$_builddir" + + # Unset CFLAGS and LDFLAGS because the xen build system + # doesn't support them. Instead use .config in xen root + # folder if necessary. + unset CFLAGS + unset LDFLAGS + + msg "Running preflight check..." + (cd tools/check; ./chk build) || return 1 + + msg "Building hypervisor..." + make -j1 xen || return 1 + + msg "Building tools..." + make -j1 tools || return 1 + + msg "Building stub domains..." + make -j1 stubdom || return 1 +} + +package() { + cd "$_builddir" + + unset CFLAGS + unset LDFLAGS + + make -j1 DESTDIR="$pkgdir" install-xen install-tools install-stubdom \ + || return 1 + + install -m755 -D "$srcdir"/xencommons.initd "$pkgdir"/etc/init.d/xencommons + install -m755 -D "$srcdir"/xend.initd "$pkgdir"/etc/init.d/xend + install -m755 -D "$srcdir"/xendomains.initd "$pkgdir"/etc/init.d/xendomains +} + +md5sums="73561faf3c1b5e36ec5c089b5db848ad xen-4.1.2.tar.gz +6d4b045ae56be6288733d0e078f591ea blktap2_libvhd_add_iconv.patch +ed3283697cb1ddff066f4087eabf68c6 detect_libiconv.patch +503f0883f4a0b50fe4e37e09ed9a6177 fix_bswap_blktap.patch +b973dc1ffcc6872e222b36f3b7b4836b fix_bswap_blktap2.patch +10dcf0b6a05691e9f88afc01bd414480 fix_ipxe_no_pie_default.patch +0bb8a435020a5a49b38b1a447fb69977 define_fsimage_dir.patch +f64405982218db306c2b5cf3167ff944 pygrub_alpine.patch +4cf88b53f8ca8d99ad52bae419b620a7 xencommons.initd +b5bfc08b82bc0d21193714719a719798 xend.initd +86e7923383a906404da321d1814657e9 xendomains.initd" diff --git a/testing/xen/blktap2_libvhd_add_iconv.patch b/testing/xen/blktap2_libvhd_add_iconv.patch new file mode 100644 index 0000000000..2353e38a6b --- /dev/null +++ b/testing/xen/blktap2_libvhd_add_iconv.patch @@ -0,0 +1,31 @@ +# 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/testing/xen/define_fsimage_dir.patch b/testing/xen/define_fsimage_dir.patch new file mode 100644 index 0000000000..04e4aed2af --- /dev/null +++ b/testing/xen/define_fsimage_dir.patch @@ -0,0 +1,12 @@ +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/testing/xen/detect_libiconv.patch b/testing/xen/detect_libiconv.patch new file mode 100644 index 0000000000..5b2359eb67 --- /dev/null +++ b/testing/xen/detect_libiconv.patch @@ -0,0 +1,22 @@ +# 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/testing/xen/fix_bswap_blktap.patch b/testing/xen/fix_bswap_blktap.patch new file mode 100644 index 0000000000..71671d9dc2 --- /dev/null +++ b/testing/xen/fix_bswap_blktap.patch @@ -0,0 +1,61 @@ +# 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/testing/xen/fix_bswap_blktap2.patch b/testing/xen/fix_bswap_blktap2.patch new file mode 100644 index 0000000000..69cd2e369c --- /dev/null +++ b/testing/xen/fix_bswap_blktap2.patch @@ -0,0 +1,62 @@ +# 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/testing/xen/fix_ipxe_no_pie_default.patch b/testing/xen/fix_ipxe_no_pie_default.patch new file mode 100644 index 0000000000..3ffb5388c4 --- /dev/null +++ b/testing/xen/fix_ipxe_no_pie_default.patch @@ -0,0 +1,165 @@ +# HG changeset patch +# Parent b60667a56ae085ee2bcea896887d0907fb86af41 +ipxe: fix compilation issues with some gcc versions + +Backported some changes from current ipxe, to fix a issue with some +new versions of gcc that add -fPIC by default, and compilation fails +with the following error: + +arch/i386/core/cpu.c: In function 'get_cpuinfo': +arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand +constraints in an 'asm' +arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand +constraints in an 'asm' +arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand +constraints in an 'asm' +arch/i386/include/bits/cpu.h:79:2: error: inconsistent operand +constraints in an 'asm' + +Two patches from ipxe git have been added. The problem is reproducible +with at least this version of gcc: + +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-uclibc/4.6.2/lto-wrapper +Target: x86_64-alpine-linux-uclibc +Configured with: +/home/buildozer/aports/main/gcc/src/gcc-4.6.2/configure --prefix=/usr +--mandir=/usr/share/man --infodir=/usr/share/info +--build=x86_64-alpine-linux-uclibc --host=x86_64-alpine-linux-uclibc +--target=x86_64-alpine-linux-uclibc --with-pkgversion='Alpine +4.6.2-r1' --disable-altivec --disable-checking --disable-fixed-point +--disable-libssp --disable-libstdcxx-pch --disable-multilib +--disable-nls --disable-werror --enable-__cxa_atexit --enable-cld +--enable-esp --enable-cloog-backend +--enable-languages=c,c++,objc,java,go --enable-shared +--enable-target-optspace --enable-tls --enable-threads +--with-dynamic-linker=ld64-uClibc.so.0.9.32 +--with-dynamic-linker-prefix=/lib --with-system-zlib +--without-system-libunwind +Thread model: posix +gcc version 4.6.2 (Alpine 4.6.2-r1) + +Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> + +diff -r b60667a56ae0 tools/firmware/etherboot/patches/gpxe-git-b8924c1aed51 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/tools/firmware/etherboot/patches/gpxe-git-b8924c1aed51 Fri Dec 16 13:48:49 2011 +0100 +@@ -0,0 +1,72 @@ ++commit b8924c1aed512aa40cf28a43635df383880f771d ++Author: Michael Brown <mcb30@ipxe.org> ++Date: Wed Mar 16 19:30:42 2011 +0000 ++ ++ [build] Allow workaround-specific flags to override default flags ++ ++ Signed-off-by: Michael Brown <mcb30@ipxe.org> ++ ++diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping ++index 709f8de..78e78c9 100644 ++--- a/src/Makefile.housekeeping +++++ b/src/Makefile.housekeeping ++@@ -109,6 +109,10 @@ VERYCLEANUP += .toolcheck ++ # Check for various tool workarounds ++ # ++ +++WORKAROUND_CFLAGS := +++WORKAROUND_ASFLAGS := +++WORKAROUND_LDFLAGS := +++ ++ # Make syntax does not allow use of comma or space in certain places. ++ # This ugly workaround is suggested in the manual. ++ # ++@@ -119,7 +123,7 @@ SPACE := $(EMPTY) $(EMPTY) ++ # Check for an old version of gas (binutils 2.9.1) ++ # ++ OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291) ++-CFLAGS += $(OLDGAS) +++WORKAROUND_CFLAGS += $(OLDGAS) ++ oldgas : ++ @$(ECHO) $(oldgas) ++ ++@@ -131,7 +135,7 @@ ifeq ($(CCTYPE),gcc) ++ SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \ ++ -o /dev/null >/dev/null 2>&1 ++ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector') ++-CFLAGS += $(SP_FLAGS) +++WORKAROUND_CFLAGS += $(SP_FLAGS) ++ endif ++ ++ # gcc 4.4 generates .eh_frame sections by default, which distort the ++@@ -141,7 +145,7 @@ ifeq ($(CCTYPE),gcc) ++ CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \ ++ -o /dev/null >/dev/null 2>&1 ++ CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm') ++-CFLAGS += $(CFI_FLAGS) +++WORKAROUND_CFLAGS += $(CFI_FLAGS) ++ endif ++ ++ # Some versions of gas choke on division operators, treating them as ++@@ -150,7 +154,7 @@ endif ++ # ++ DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null ++ DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide') ++-ASFLAGS += $(DIVIDE_FLAGS) +++WORKAROUND_ASFLAGS += $(DIVIDE_FLAGS) ++ ++ ############################################################################### ++ # ++@@ -375,9 +379,9 @@ CFLAGS += -diag-disable 1419 # Missing prototypes ++ CFLAGS += -diag-disable 1599 # Hidden variables ++ CFLAGS += -Wall -Wmissing-declarations ++ endif ++-CFLAGS += $(EXTRA_CFLAGS) ++-ASFLAGS += $(EXTRA_ASFLAGS) ++-LDFLAGS += $(EXTRA_LDFLAGS) +++CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS) +++ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS) +++LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS) ++ ++ # Inhibit -Werror if NO_WERROR is specified on make command line ++ # +diff -r b60667a56ae0 tools/firmware/etherboot/patches/gpxe-git-fe61f6de0dd5 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/tools/firmware/etherboot/patches/gpxe-git-fe61f6de0dd5 Fri Dec 16 13:48:49 2011 +0100 +@@ -0,0 +1,32 @@ ++commit fe61f6de0dd5d39ac3de5e8e18742f9bd0aafad7 ++Author: Gilles Espinasse <g.esp@free.fr> ++Date: Tue Mar 29 15:30:11 2011 +0100 ++ ++ [build] Fix compilation when gcc is patched to default to -fPIE -Wl,-pie ++ ++ Signed-off-by: Gilles Espinasse <g.esp@free.fr> ++ Modified-by: Michael Brown <mcb30@ipxe.org> ++ Signed-off-by: Michael Brown <mcb30@ipxe.org> ++ ++diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping ++index 57e52c0..c184351 100644 ++--- a/src/Makefile.housekeeping +++++ b/src/Makefile.housekeeping ++@@ -138,6 +138,17 @@ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector') ++ WORKAROUND_CFLAGS += $(SP_FLAGS) ++ endif ++ +++# Some widespread patched versions of gcc include -fPIE -Wl,-pie by +++# default. Note that gcc will exit *successfully* if it fails to +++# recognise an option that starts with "no", so we have to test for +++# output on stderr instead of checking the exit status. +++# +++ifeq ($(CCTYPE),gcc) +++PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ] +++PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie') +++WORKAROUND_CFLAGS += $(PIE_FLAGS) +++endif +++ ++ # gcc 4.4 generates .eh_frame sections by default, which distort the ++ # output of "size". Inhibit this. ++ # +diff -r b60667a56ae0 tools/firmware/etherboot/patches/series +--- a/tools/firmware/etherboot/patches/series Fri Dec 16 10:47:18 2011 +0100 ++++ b/tools/firmware/etherboot/patches/series Fri Dec 16 13:48:49 2011 +0100 +@@ -1,3 +1,5 @@ + boot_prompt_option.patch + gpxe-git-0edf2405b457 + gpxe-git-a803ef3dfeac ++gpxe-git-b8924c1aed51 ++gpxe-git-fe61f6de0dd5 diff --git a/testing/xen/pygrub_alpine.patch b/testing/xen/pygrub_alpine.patch new file mode 100644 index 0000000000..9d6ee577a8 --- /dev/null +++ b/testing/xen/pygrub_alpine.patch @@ -0,0 +1,64 @@ +# HG changeset patch +# Parent 3e02aa9670b3265e36bdddbd4760415cd87d047b +pygrub: fix extlinux parsing + +pygrub was unable to parse extlinux config files correctly, exactly +the ones like: + +LABEL grsec + KERNEL vmlinuz-3.0.10-grsec + APPEND initrd=initramfs-3.0.10-grsec +root=UUID=cfd4a7b4-8c40-4025-b877-8205f1c622ee +modules=sd-mod,usb-storage,ext4 xen quiet + +This patch fixes it, adding a new case when parsing the "append" line, +that searches for the initrd image. + +Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> + +diff -r 3e02aa9670b3 tools/pygrub/examples/alpine-linux-2.3.2.extlinux +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/tools/pygrub/examples/alpine-linux-2.3.2.extlinux Tue Jan 03 13:11:46 2012 +0100 +@@ -0,0 +1,11 @@ ++DEFAULT menu.c32 ++PROMPT 0 ++MENU TITLE Alpine/Linux Boot Menu ++MENU HIDDEN ++MENU AUTOBOOT Alpine will be booted automatically in # seconds. ++TIMEOUT 30 ++LABEL grsec ++ MENU DEFAULT ++ MENU LABEL Linux 3.0.10-grsec ++ KERNEL vmlinuz-3.0.10-grsec ++ APPEND initrd=initramfs-3.0.10-grsec root=UUID=a97ffe64-430f-4fd3-830e-4736d9a27af0 modules=sd-mod,usb-storage,ext4 quiet +diff -r 3e02aa9670b3 tools/pygrub/src/ExtLinuxConf.py +--- a/tools/pygrub/src/ExtLinuxConf.py Thu Dec 15 18:55:46 2011 +0100 ++++ b/tools/pygrub/src/ExtLinuxConf.py Tue Jan 03 13:11:46 2012 +0100 +@@ -60,6 +60,13 @@ class ExtLinuxImage(object): + + # Bypass regular self.commands handling + com = None ++ elif arg.find("initrd="): ++ # find initrd image in append line ++ args = arg.strip().split(" ") ++ for a in args: ++ if a.lower().startswith("initrd="): ++ setattr(self, "initrd", a.replace("initrd=", "")) ++ arg = arg.replace(a, "") + + if com is not None and self.commands.has_key(com): + if self.commands[com] is not None: +@@ -86,10 +93,12 @@ class ExtLinuxImage(object): + self._args = args + def get_kernel(self): + return self._kernel ++ def set_args(self, val): ++ self._args = val + def get_args(self): + return self._args + kernel = property(get_kernel, set_kernel) +- args = property(get_args) ++ args = property(get_args, set_args) + + def set_initrd(self, val): + self._initrd = (None,val) diff --git a/testing/xen/xencommons.initd b/testing/xen/xencommons.initd new file mode 100644 index 0000000000..3d3c5da387 --- /dev/null +++ b/testing/xen/xencommons.initd @@ -0,0 +1,102 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +if [ -d /etc/sysconfig ]; then + xencommons_config=/etc/sysconfig +else + xencommons_config=/etc/default +fi + +test -f $xencommons_config/xencommons && . $xencommons_config/xencommons + +XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid + +# not running in Xen dom0 or domU +if ! test -d /proc/xen ; then + exit 0 +fi + +# mount xenfs in dom0 or domU with a pv_ops kernel +if test "x$1" = xstart && \ + ! test -f /proc/xen/capabilities && \ + ! grep '^xenfs ' /proc/mounts >/dev/null; +then + mount -t xenfs xenfs /proc/xen +fi + +# run this script only in dom0: +# no capabilities file in xenlinux domU kernel +# empty capabilities file in pv_ops domU kernel +if test -f /proc/xen/capabilities && \ + ! grep -q "control_d" /proc/xen/capabilities ; then + exit 0 +fi + +depend() { + need udev + before xend +} + +start() { + local time=0 + local timeout=30 + + modprobe xen-evtchn 2>/dev/null + modprobe xen-gntdev 2>/dev/null + modprobe evtchn 2>/dev/null + modprobe gntdev 2>/dev/null + + if ! `xenstore-read -s / >/dev/null 2>&1` + then + test -z "$XENSTORED_ROOTDIR" || XENSTORED_ROOTDIR="/var/lib/xenstored" + rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null + test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log" + + ebegin "Starting xenstored..." + xenstored --pid-file=/var/run/xenstored.pid $XENSTORED_ARGS + + # Wait for xenstored to actually come up, timing out after 30 seconds + while [ $time -lt $timeout ] && ! `xenstore-read -s / >/dev/null 2>&1` ; do + time=$(($time+1)) + sleep 1 + done + + # Exit if we timed out + if ! [ $time -lt $timeout ] ; then + eend 1 + echo Could not start xenstored + exit 1 + fi + eend 0 + + ebegin "Setting domain 0 name..." + xenstore-write "/local/domain/0/name" "Domain-0" + eend $? + fi + + ebegin "Starting xenconsoled..." + test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" + xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS + eend $? + + test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d" + test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS +} + +stop() { + ebegin "Stopping xenconsoled" + if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then + kill $pid + while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done + rm -f $XENCONSOLED_PIDFILE + fi + eend 0 + + echo WARNING: Not stopping xenstored, as it cannot be restarted. +} + +status() { + xenstore-read -s / >/dev/null 2>&1 +} diff --git a/testing/xen/xend.initd b/testing/xen/xend.initd new file mode 100644 index 0000000000..398ecd86b9 --- /dev/null +++ b/testing/xen/xend.initd @@ -0,0 +1,53 @@ +#!/sbin/runscript + +depend() { + need xencommons + before xendomains +} + +await_daemons_up() { + i=1 + rets=10 + /usr/sbin/xend status + while [ $? -ne 0 -a $i -lt $rets ]; do + sleep 1 + i=$(($i + 1)) + /usr/sbin/xend status + done +} + +start() { + ebegin "Starting Xen daemons" + if [ -z "`ps xenconsoled -o pid=`" ]; then + eend 1 + echo "xencommons should be started first." + exit 1 + fi + mkdir -p /var/lock + if [ -d /var/lock/subsys ]; then + touch /var/lock/subsys/xend + else + touch /var/lock/xend + fi + /usr/sbin/xend start + await_daemons_up + eend $? +} + +stop() { + ebegin "Stopping Xen control daemon" + /usr/sbin/xend stop + rm -f /var/lock/subsys/xend /var/lock/xend + eend $? +} + +restart() { + ebegin "Restarting Xen control daemon" + /usr/sbin/xend restart + await_daemons_up + eend $? +} + +status() { + /usr/sbin/xend status +} diff --git a/testing/xen/xendomains.initd b/testing/xen/xendomains.initd new file mode 100644 index 0000000000..0f309ef3d0 --- /dev/null +++ b/testing/xen/xendomains.initd @@ -0,0 +1,105 @@ +#!/sbin/runscript + +CMD=xm +/usr/sbin/$CMD list &> /dev/null +if test $? -ne 0 +then + CMD=xl +fi + +/usr/sbin/$CMD list &> /dev/null +if test $? -ne 0 +then + eend 1; + exit 1; +fi + +# Correct exit code would probably be 5, but it's enough +# if xend complains if we're not running as privileged domain +if ! [ -e /proc/xen/privcmd ]; then + eend 1; + exit 1; +fi + +# See docs/misc/distro_mapping.txt +if [ -d /var/lock/subsys ]; then + LOCKFILE=/var/lock/subsys/xendomains +else + LOCKFILE=/var/lock/xendomains +fi + +if [ -d /etc/sysconfig ]; then + XENDOM_CONFIG=/etc/sysconfig/xendomains +else + XENDOM_CONFIG=/etc/default/xendomains +fi + +if ! [ -r $XENDOM_CONFIG ]; then + eend 1; + echo "$XENDOM_CONFIG not existing"; + exit 1; +fi + +. $XENDOM_CONFIG + +depend() { + need xencommons + after net xend +} + +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/$CMD 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}" + /usr/sbin/$CMD create --quiet --defconfig ${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}" + /usr/sbin/$CMD 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" + /usr/sbin/$CMD shutdown --wait ${name} + eend $? + else + einfo " Not stopping ${name} - not running." + fi + done +} + +status() { + /usr/sbin/$CMD list +} |