initial import
This commit is contained in:
177
xen/PKGBUILD
Normal file
177
xen/PKGBUILD
Normal file
@@ -0,0 +1,177 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
#####
|
||||
# Versions
|
||||
#####
|
||||
|
||||
_xen_version='4.14.6'
|
||||
_xen_major_version='4'
|
||||
_xen_minor_version='14'
|
||||
_debver=4.14.6
|
||||
_debrel=1
|
||||
|
||||
#####
|
||||
# Package metadata
|
||||
#####
|
||||
|
||||
pkgname=xen
|
||||
pkgver="${_xen_version}"
|
||||
pkgrel=4
|
||||
pkgdesc='Virtual Machine Hypervisor & Tools'
|
||||
url='https://www.xenproject.org/'
|
||||
license=('GPL-2')
|
||||
arch=('x86_64')
|
||||
validpgpkeys=('23E3222C145F4475FA8060A783FE14C957E82BD9') # Xen.org Xen tree code signing (signatures on the xen hypervisor and tools) <pgp@xen.org>
|
||||
options=(!buildflags !strip !staticlibs)
|
||||
install="${pkgname}.install"
|
||||
backup=("etc/conf.d/xen"{commons,domains}
|
||||
"etc/${pkgname}/efi-xen.cfg"
|
||||
"etc/${pkgname}/cpupool"
|
||||
"etc/${pkgname}/xl.conf")
|
||||
depends=('ocaml' 'python' 'qemu-headless-legacy' 'yajl' 'man-db')
|
||||
makedepends=('acpica' 'gettext-tiny' 'quilt')
|
||||
optdepends=('iproute2: configure networks'
|
||||
'bridge-utils: share networks via bridge interfaces'
|
||||
'seabios: boot VMs with BIOS'
|
||||
'edk2-ovmf: boot VMs with UEFI')
|
||||
source=(
|
||||
# Sources
|
||||
"https://downloads.xenproject.org/release/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz"
|
||||
"https://downloads.xenproject.org/release/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz.sig"
|
||||
# Debian patches
|
||||
"https://deb.debian.org/debian/pool/main/x/xen/xen_$_debver-$_debrel.debian.tar.xz"
|
||||
# Files
|
||||
'efi-xen.cfg'
|
||||
"${pkgname}.conf"
|
||||
# OpenRC init files
|
||||
'xen-watchdog.initd'
|
||||
'xencommons.initd'
|
||||
'xendomains.initd'
|
||||
'xendriverdomain.initd'
|
||||
# runit init files
|
||||
'xen.run'
|
||||
'xenconsoled.run'
|
||||
'xenstored.run'
|
||||
)
|
||||
|
||||
sha512sums=('e0738954af1090d141c56ea0c0900a3cc3ea26778756bf841f908a0ec34adca784dd8cefca5515acf3e6cef63a9832d454a6ce2c04c4c60429907bf49f88648c'
|
||||
'SKIP'
|
||||
'12db9cb0f37050197226b64ab60642f98daaebe60bae8ff8e334f7e561b13b920b838e5617c843fb7427c1568307ff57bb0421edf076f840c2da75a9b5a6cd48'
|
||||
'115b642af1b89c91c3dfa653aa1c7de0df067b1a9a3b52fe568764b7df17a742ed224cac083cf6ab64fab46d5057992679e9dae349922c2795021bdabda4424f'
|
||||
'7e4be0c4eeb19c860cdd83319168e15ae2446627bcfc304ad7e9ee49564b26975daa88ef64ddcfaa47374814dc4e1ad317163598d6abc626adc73cfa4c90f22c'
|
||||
'c61e4a66dda5077cdce91633a9704800306c378e49f538c5c67537380ad93396958669dd406836caf508a002b756d392b58b0af1a959e0385747f963447d8125'
|
||||
'e8550034cbef4ccc2636b03dc91afd837274cd0dfe86e5a56df36e7deb0ba56cacfa54f84be063188f2370a9d5431588d95ee5c442880c0e71e2e3475000be9e'
|
||||
'253c967c59682685e3c1a31d3782b1f50d7d07b6c31edb009b24b3fd33825189b3edb6ee97301de35b4d273ebd5357b9fe9be981034f4598c6085c6cd5385913'
|
||||
'8b05af432f1233f8f2c2ed80ed3a730cb55cadc97cd21349651ef34038acc612e79686118d3a79296cc486668959c931183c10652e9ff755946be8e82f310bd2'
|
||||
'8c42f28c0f6011d11acd4a6a7550e27e323d7fc477d64a0cfef129426c35935b0c4987489c90c2c88937c711b1e4467d256fec92e8b06c59ce7fcb5446a92ffc'
|
||||
'f44bed0e57af5943fa0bb8e8e2b018f44dac8a7bdeb1421b52535ed5ccf031b54e0995649552355d66e1333d3795ec1c5ea4e6e2c209bc30ed55ea06ea50a638'
|
||||
'bede46958348cea92f8d9f8ce03738a369d8391a0a2d8d397deed1136325c611aaf8614c20aeffdb00d1d0a9d17d03314164a0e2cfd2b045a980af014b359749')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
||||
if [[ ${pkgver} = ${_debver} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
# Doesn't apply and seems unimportant
|
||||
rm -v debian/patches/0001-Delete-config.sub-and-config.guess.patch || true
|
||||
rm -v debian/patches/0003-version.patch || true
|
||||
rm -v debian/patches/0017-Fix-empty-fields-in-first-hypervisor-log-line.patch || true
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
|
||||
# Fix Install Paths
|
||||
msg2 'Fixing installation paths...'
|
||||
sed -i 's|\$localstatedir/run/xen|/run/xen|' m4/paths.m4
|
||||
sed -i 's|/var/run|/run|g' tools/hotplug/Linux/locking.sh
|
||||
sed -i 's|/var/run|/run|g' tools/misc/xenpvnetboot
|
||||
sed -i 's|/var/run|/run|g' tools/xenmon/xenbaked.c
|
||||
sed -i 's|/var/run|/run|g' tools/xenmon/xenmon.py
|
||||
sed -i 's|/var/run|/run|g' tools/pygrub/src/pygrub
|
||||
|
||||
# Remove support for hardware based virtualization (multilib required)
|
||||
sed -i '\|SUBDIRS-$(CONFIG_X86) += firmware|d' tools/Makefile
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
#export LD_EFI='/usr/x86_64-w64-mingw32/bin/ld'
|
||||
|
||||
msg2 'Configuring...'
|
||||
./autogen.sh
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--exec_prefix=/usr \
|
||||
--libexecdir=/usr/libexec \
|
||||
--runstatedir=/run \
|
||||
--sharedstatedir=/var/lib \
|
||||
--sysconfdir=/etc \
|
||||
--disable-debug \
|
||||
--disable-ipxe \
|
||||
--disable-ovmf \
|
||||
--disable-qemu-traditional \
|
||||
--disable-rombios \
|
||||
--disable-seabios \
|
||||
--disable-stubdom \
|
||||
--disable-systemd \
|
||||
--disable-ocamltools \
|
||||
--enable-docs \
|
||||
--enable-githttp \
|
||||
--enable-monitors \
|
||||
--enable-tools \
|
||||
--enable-xen \
|
||||
--with-initddir=/etc/init.d \
|
||||
--with-rundir=/run \
|
||||
--with-sysconfig-leaf-dir=conf.d \
|
||||
--with-system-ovmf=/usr/share/edk2-ovmf/x64/OVMF.fd \
|
||||
--with-system-qemu=/usr/bin/qemu-system-x86_64 \
|
||||
--with-system-seabios=/usr/share/qemu/bios-256k.bin \
|
||||
--with-xenstored=xenstored
|
||||
|
||||
make XEN_VENDORVERSION=hyperbola
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
||||
msg2 'Installing Xen...'
|
||||
make DESTDIR="${pkgdir}" EFI_DIR="${pkgdir}/boot" OCAMLDESTDIR="${pkgdir}/usr/lib/ocaml" install
|
||||
|
||||
# License
|
||||
install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
|
||||
|
||||
cd "${pkgdir}"
|
||||
|
||||
# Install files for Hyperbola
|
||||
msg2 'Installing Hyperbola-specific files...'
|
||||
install -Dm644 "${srcdir}/efi-xen.cfg" etc/xen/efi-xen.cfg
|
||||
|
||||
# Install OpenRC init files
|
||||
msg2 'Installing OpenRC init files...'
|
||||
for f in xen-watchdog xencommons xendomains xendriverdomain; do
|
||||
install -Dm755 "${srcdir}/$f.initd" etc/init.d/$f
|
||||
done
|
||||
|
||||
# Install runit init files
|
||||
msg2 'Installing runit init files...'
|
||||
for f in xen xenconsoled xenstored; do
|
||||
install -Dm755 "${srcdir}/$f.run" etc/sv/$f/run
|
||||
done
|
||||
|
||||
mkdir -p var/log/xen/console
|
||||
|
||||
# Clean up
|
||||
msg2 'Cleaning up...'
|
||||
|
||||
# Hypervisor symlinks
|
||||
rm -f boot/xen{,-${_xen_major_version}{,.${_xen_minor_version}}}.gz
|
||||
|
||||
# Temporary directories
|
||||
rmdir run{/xen{,stored},}
|
||||
}
|
||||
7
xen/efi-xen.cfg
Normal file
7
xen/efi-xen.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[global]
|
||||
default=xen
|
||||
|
||||
[xen]
|
||||
options=console=vga dom0_mem=1024M,max:1024M dom0_max_vcpus=4 loglvl=all noreboot
|
||||
kernel=vmlinuz-linux-libre-lts root=<Root Device> rw
|
||||
ramdisk=initramfs-linux-libre-lts.img
|
||||
15
xen/xen-watchdog.initd
Normal file
15
xen/xen-watchdog.initd
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
. /etc/xen/scripts/hotplugpath.sh
|
||||
|
||||
description="Xen watchdog service"
|
||||
|
||||
command="$sbindir/xenwatchdogd"
|
||||
command_args="30 15"
|
||||
|
||||
depend() {
|
||||
need xencommons
|
||||
after xendomains
|
||||
}
|
||||
20
xen/xen.conf
Normal file
20
xen/xen.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
xen-evtchn
|
||||
xen-gntdev
|
||||
xen-gntalloc
|
||||
xen-blkback
|
||||
xen-netback
|
||||
xen-pciback
|
||||
|
||||
## This module may not work on all machines; try removing this first if it causes issues:
|
||||
xen-acpi-processor
|
||||
|
||||
## The following were included in xencommons:
|
||||
# evtchn
|
||||
# gntdev
|
||||
# netbk
|
||||
# blkbk
|
||||
# xen-scsibk
|
||||
# usbbk
|
||||
# pciback
|
||||
# blktap2
|
||||
# blktap
|
||||
27
xen/xen.install
Normal file
27
xen/xen.install
Normal file
@@ -0,0 +1,27 @@
|
||||
upgrade_msg() {
|
||||
cat << __EOF__
|
||||
Xen 4.8
|
||||
Release notes
|
||||
http://wiki.xen.org/wiki/Xen_Project_4.8_Release_Notes
|
||||
Feature list
|
||||
http://wiki.xen.org/wiki/Xen_Project_4.8_Feature_List
|
||||
__EOF__
|
||||
|
||||
if [ "$(vercmp 4.8.0-4 "$1")" -lt 0 ]; then
|
||||
cat << __EOF__
|
||||
!!!!!
|
||||
This Xen version has split out SeaBIOS and OVMF.
|
||||
If you need to use VMs with BIOS or UEFI, install seabios or ovmf respectively.
|
||||
!!!!!
|
||||
__EOF__
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
post_install() {
|
||||
upgrade_msg
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
upgrade_msg $@
|
||||
}
|
||||
5
xen/xen.run
Normal file
5
xen/xen.run
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
sv check xenconsoled >/dev/null || exit 1
|
||||
xenstore-write "/local/domain/0/domid" 0 || exit 1
|
||||
xenstore-write "/local/domain/0/name" "Domain-0" || exit 1
|
||||
exec chpst -b xen pause
|
||||
88
xen/xencommons.initd
Normal file
88
xen/xencommons.initd
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
. /etc/xen/scripts/hotplugpath.sh
|
||||
|
||||
BACKEND_MODULES="xen-evtchn xen-gntdev xen-gntalloc xen-blkback xen-netback xen-pciback evtchn gntdev netbk blkbk xen-scsibk usbbk pciback xen-acpi-processor blktap2"
|
||||
XENCONSOLED_PIDFILE=$XEN_RUN_DIR/xenconsoled.pid
|
||||
QEMU_PIDFILE=$XEN_RUN_DIR/qemu-dom0.pid
|
||||
|
||||
description="Xencommons - start and stop xenstored and xenconsoled"
|
||||
|
||||
depend() {
|
||||
after net
|
||||
before libvirtd libvirt-guests
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
shopt -s extglob
|
||||
|
||||
# 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 -f /proc/xen/capabilities; 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
|
||||
|
||||
local mod
|
||||
|
||||
for mod in $BACKEND_MODULES; do
|
||||
modprobe "$mod" &>/dev/null
|
||||
done
|
||||
|
||||
mkdir -p $XEN_RUN_DIR
|
||||
mkdir -p $XEN_LOCK_DIR
|
||||
|
||||
/etc/xen/scripts/launch-xenstore || exit 1
|
||||
|
||||
ebegin "Setting domain 0 name, domid and JSON config..."
|
||||
$LIBEXEC_BIN/xen-init-dom0 &
|
||||
eend $?
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting xenconsoled..."
|
||||
test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
|
||||
$sbindir/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS &
|
||||
eend $?
|
||||
|
||||
ebegin "Starting QEMU as disk backend for dom0"
|
||||
test -z "$QEMU_XEN" && QEMU_XEN="$LIBEXEC_BIN/qemu-system-i386"
|
||||
$QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
|
||||
-monitor /dev/null -serial /dev/null -parallel /dev/null \
|
||||
-pidfile $QEMU_PIDFILE &
|
||||
eend $?
|
||||
}
|
||||
|
||||
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 1; done
|
||||
rm -f $XENCONSOLED_PIDFILE
|
||||
fi
|
||||
eend $?
|
||||
|
||||
ebegin "Stopping QEMU"
|
||||
if read 2>/dev/null <$QEMU_PIDFILE pid; then
|
||||
kill $pid
|
||||
while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
|
||||
rm -f $QEMU_PIDFILE
|
||||
fi
|
||||
eend $?
|
||||
|
||||
ebegin "WARNING: Not stopping xenstored, as it cannot be restarted"
|
||||
eend $?
|
||||
}
|
||||
4
xen/xenconsoled.run
Normal file
4
xen/xenconsoled.run
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
sv check xenstored >/dev/null || exit 1
|
||||
mkdir -p /var/log/xen/console
|
||||
exec xenconsoled -i --log=all
|
||||
23
xen/xendomains.initd
Normal file
23
xen/xendomains.initd
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
. /etc/xen/scripts/hotplugpath.sh
|
||||
|
||||
description="Xendomains - start and stop guests on boot and shutdown"
|
||||
|
||||
depend() {
|
||||
need xencommons
|
||||
}
|
||||
|
||||
start() {
|
||||
$LIBEXEC_BIN/xendomains start
|
||||
}
|
||||
|
||||
stop() {
|
||||
$LIBEXEC_BIN/xendomains stop
|
||||
}
|
||||
|
||||
reload() {
|
||||
$LIBEXEC_BIN/xendomains reload
|
||||
}
|
||||
37
xen/xendriverdomain.initd
Normal file
37
xen/xendriverdomain.initd
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
. /etc/xen/scripts/hotplugpath.sh
|
||||
|
||||
description="Xen driver domain device service"
|
||||
command="$sbindir/xl"
|
||||
command_args="devd $XLDEVD_ARGS"
|
||||
pidfile="$XEN_RUN_DIR/xldevd.pid"
|
||||
|
||||
depend() {
|
||||
need xencommons
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
# 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 domU:
|
||||
# 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
|
||||
}
|
||||
7
xen/xenstored.run
Normal file
7
xen/xenstored.run
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
[ ! -d /run/xen ] && mkdir -p /run/xen
|
||||
modprobe -q xen-evtchn xen-gnttalloc || exit 1
|
||||
mountpoint -q /proc/xen || mount -t xenfs xenfs /proc/xen
|
||||
mountpoint -q /var/lib/xenstored || mount -t tmpfs xenstored /var/lib/xenstored
|
||||
grep -q control_d /proc/xen/capabilities || exit 1
|
||||
exec xenstored --verbose --no-fork
|
||||
Reference in New Issue
Block a user