system/xen: Added (the Xen virtualization hypervisor)

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
mario 2010-10-10 14:17:24 -05:00 committed by Robby Workman
parent f5fdea9bb7
commit 602d2eb9ee
15 changed files with 19450 additions and 0 deletions

21
system/xen/README Normal file
View file

@ -0,0 +1,21 @@
The Xen hypervisor, the powerful open source industry standard for
virtualization, offers a powerful, efficient, and secure feature set for
virtualization of x86, x86_64, IA64, ARM, and other CPU architectures. It
supports a wide range of guest operating systems including Windows, Linux,
Solaris, and various versions of the BSD operating systems.
In order to run Xen, you will need to install and boot from the Xen dom0
kernel. Check README.dom0 (in docs/dom0) for more information on how to do
that.
This requires acpica. mbootback is optional (see below).
Since booting Xen kernel with LILO is not supported by default we have to
use GRUB; alternatively, use mbootpack to create a LILO compatible kernel.
GRUB may be installed from Slackware's extra repository. The GRUB package
is not available from the Slackware x86_64 distribution, but the source and
a SlackBuild may be found in its extra/source repository.
See README.SLACKWARE (which is also installed with the package docs) for
setup, configuration, and usage hints.

View file

@ -0,0 +1,31 @@
After installing this package, in addition to the /usr/doc/xen-*/README file;
the Xen User Manual is installed as /usr/doc/xen-*/pdf/user.pdf.
The rc.xend service must be started before Xen can be used.
You may wish to add these lines to /etc/rc.d/rc.local to start this service
after booting from your xen kernel.
if [[ $(uname -r) = *xen ]]; then
if [ -x /etc/rc.d/rc.xend ]; then
/etc/rc.d/rc.xend start
fi
if [ -x /etc/rc.d/rc.xendomains ]; then
/etc/rc.d/rc.xendomains start
fi
fi
You may also add these lines to /etc/rc.d/rc.local_shutdown
if [[ $(uname -r) = *xen ]]; then
if [ -x /etc/rc.d/rc.xendomains ]; then
/etc/rc.d/rc.xendomains stop
fi
if [ -x /etc/rc.d/rc.xend ]; then
/etc/rc.d/rc.xend stop
fi
fi
Remember to give executable permission to /etc/rc.d/rc.local_shutdown:
chmod 0755 /etc/rc.d/rc.local_shutdown

31
system/xen/doinst.sh Normal file
View file

@ -0,0 +1,31 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.xend.new
preserve_perms etc/rc.d/rc.xendomains.new
config etc/xen/xend-config.sxp.new
config etc/xen/xend-pci-permissive.sxp.new
config etc/xen/xend-pci-quirks.sxp.new
config etc/xen/xendomains.config.new
config etc/xen/xm-config.xml.new

View file

@ -0,0 +1,84 @@
kernel-xen.sh: Xen dom0 kernel using rebased OpenSUSE xen-patches.
This script patches and builds the Linux Kernel for the Xen Hypervisor.
To run this scipt you will need the Xen kernel patches in this directory.
The patches may be downloaded from:
http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.34-4.tar.bz2
(md5sum: 25ba07cf0702130af26c045fd6227f2f)
Note on kernel: You will need to get kernel version 2.6.34.4 because patches
based on Slackware stock kernel tree (2.6.33.4) do not work as expected.
Anyway, you can get it from:
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.4.tar.bz2
(md5sum: f75d21e5c60f18adf0e99d61c243f964)
The included configuration files are based on Slackware's kernel. For
Slackware32, the SMP kernels were used as the non-smp kernels would not compile
with the Xen patches. For the Xen-specific parameters, the default options were
used as much as possible. You may run "make menuconfig" before compiling the
Xen kernel by passing the "MENUCONFIG=yes" to the scipt.
Another variable worth mentioning here is "BOOTLOADER=", you can use it to
select how kernel is packed. Valid options are "lilo" and "grub".
By default, the huge kernel is chosen, but you may opt for the generic kernel
by passing the "KERNEL=generic" variable to the script. In this case, you
will need to make an ad-hoc initrd after installing this package.
For example:
depmod 2.6.34.4-xen
mkinitrd -c -k 2.6.34.4-xen -f ext4 -r /dev/sda1 -m ext4 -o /boot/initrd-xen.gz
For details on initrd, read /boot/README.initrd, run
/usr/share/mkinitrd/mkinitrd_command_generator.sh for hints and read the Xen
User Manual and the README file that comes with the Xen package.
Since booting Xen kernel with LILO is not supported by default we have to
either use GRUB, or mbootpack to create a LILO compatible kernel.
This is an example how to do it with LILO, mbootpack and initrd:
cd /boot
gzip -d -c /boot/xen-4.0.1.gz > /boot/xen-4.0.1
gzip -d -c /boot/initrd-xen.gz > /boot/initrd-xen
mbootpack -o /boot/vmlinuz-2.6.34.4-xen -m /usr/src/linux-2.6.34.4-xen/vmlinux \
-m /boot/initrd-xen /boot/xen-4.0.1
After new kernel image is created, add something like the folowing to lilo.conf:
image = /boot/vmlinuz-xen
root = /dev/sda1
label = XenLinux
append="dom0_mem=256M -- nomodeset"
read-only
Note: everything before "--" is passed to Xen, and everything after "--" is
passed to the Linux kernel.
If for some reason LILO is not good enough, you can always use GRUB.
GRUB may be installed from Slackware's extra repository. The GRUB package
is not available from the Slackware x86_64 distribution, but the source
and a SlackBuild may be found in its extra/source repository.
grubconfig that comes with Slackware's GRUB package may give a starting point
to configure GRUB. Moreover, the Xen User Manual and its README file installed
with the Xen package include details on which parameters to include in the GRUB
configuration file. For example, include these lines in /boot/grub/menu.lst:
title Slackware XenLinux 13.1
root (hd0,0)
kernel /boot/xen.gz dom0_mem=262144 console=vga
module /boot/vmlinuz-xen root=/dev/sda1 ro console=tty0 nomodeset
module /boot/initrd-xen.gz
Notes on bootloader:
A dom0_mem parameter is critical for Slackware32.
You only need the initrd module if you install the generic kernel.
Aditional notes on framebuffer:
If your dom0 kernel gets stuck on boot with a blinking cursor on the screen,
and you have an old VGA card, don't panic, there is a way arround it!
Easiest method is to boot from non-xen kernel, and blacklist a framebuffer
module from ever loading. Another option would be to replace VGA card with
a newer one, or remove module in the next kernel build.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,110 @@
#!/bin/sh
# Xem dom0 kernel installation script
# Written by Chris Abela <chris.abela@maltats.com>
# 20100515
# Updated by mario <mario@slackverse.org>
# 20100904
KERNEL=${KERNEL:-huge}
VERSION=${VERSION:-2.6.34.4}
# Rebased patches version
SVERSION=${SVERSION:-2.6.34-4}
# Xen version
XVERSION=${XVERSION:-4.0.1}
BOOTLOADER=${BOOTLOADER:-lilo}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
x86_64) ARCH=x86_64 ;;
# Bail out on everything else:
*) echo "Unsupported architecture detected ($ARCH)"; exit ;;
esac
fi
CWD=$(pwd)
XEN=${XEN:-/tmp/xen}
PATCH=${PATCH:-/tmp/xen/patch-$VERSION}
MODINST=${MODINST:-/tmp/xen/modules}
set -e
rm -rf $XEN
mkdir -p $PATCH $MODINST
cd $PATCH
tar -xvf $CWD/xen-patches-$SVERSION.tar.bz2
if [ ! -d /usr/src/linux-$VERSION ]; then
echo "Missing kernel source, get it from kernel.org and rerun this script."
exit
fi
# Prepare kernel source
cd /usr/src
rm -rf linux-$VERSION-xen xenlinux
cp -ar linux-$VERSION linux-$VERSION-xen
ln -s linux-$VERSION-xen xenlinux
cd linux-$VERSION-xen
make clean
for i in $PATCH/* ; do
echo Patching $i
patch -p1 -s < $i
done
# Copy the right config
cat $CWD/config-${KERNEL}-${ARCH}-${VERSION}-xen > .config
# If the user wants, we will run menuconfig
if [ "$MENUCONFIG" = yes ]; then
unset junk
make menuconfig
while [ "$junk" != N ]; do
echo
echo "Do you want to run"
echo "# make menuconfig"
echo -n "again? (Y/N) "
read junk
if [ "$junk" = Y ]; then
make menuconfig
fi
done
fi
make vmlinux modules
make modules_install INSTALL_MOD_PATH=$MODINST
# We already have these
rm -rf $MODINST/lib/firmware
# Strip kernel symbols
strip vmlinux -o vmlinux-stripped
# For lilo we pack kernel up with mbootpack
if [ "$BOOTLOADER" = lilo ]; then
gzip -d -c /boot/xen-${XVERSION}.gz > xen-${XVERSION}
mbootpack -o vmlinux-stripped-mboot -m vmlinux-stripped xen-${XVERSION}
gzip vmlinux-stripped-mboot -c > vmlinuz
elif [ "$BOOTLOADER" = grub ]; then
gzip vmlinux-stripped -c > vmlinuz
fi
install -D -m 644 vmlinuz /boot/vmlinuz-$KERNEL-$VERSION-xen
install -m 644 System.map /boot/System.map-$KERNEL-$VERSION-xen
install -m 644 .config /boot/config-$KERNEL-$VERSION-xen
cd /boot
ln -s vmlinuz-$KERNEL-$VERSION-xen vmlinuz-xen
ln -s System.map-$KERNEL-$VERSION-xen System.map-xen
ln -s config-$KERNEL-$VERSION-xen config-xen
cp -ar $MODINST/lib/modules/$VERSION-xen /lib/modules
cd /usr/src/linux-$VERSION-xen
make clean

View file

@ -0,0 +1,57 @@
HOW TO INSTALL A SLACKWARE DOMU XEN GUEST
After the ordeal of installing and configuring LILO/GRUB, Xen, kernel-xen
and possibly also a new initrd, editing /etc/rc.d/rc.local and
/etc/rc.d/rc.local_shutdown, and finally booting on your Slackware XenLinux,
you might be wondering how are you to load you guest OS. If you look around,
you might find Xen domU (unprivileged) guest that you can download from the
Internet, but some of us might want to roll their own. This MINI-HOWTO shows
how to install a Slackware domU guest. The fastest way is to mount your
Slackware DVD on /media/SlackDVD, normally this is the mount point chosen by
HAL. Then run the included domU.sh script.
# ./domU.sh
This will install Slackware onto an 8GB file called slackware.img and a 500MB
swap file called swap_file. By default, a typical server installation ensues.
Have a good look at the mydom file as you need to fill in the full path to the
slackware.img and swap_file files.
Then run the following command:
# xm create -c mydom
Your Slackware XenLinux domU should boot instantly.
Since Xen domU support has been in mainline kernel for a while now, those that
wish to have the best performance can compile a seperate domU kernel based on a
stock Slackware kernel config.
This is what you have to select/unselect when building domU only kernel:
---
Processor type and features --->
[*] Paravirtualized guest support --->
[*] Xen guest support
Bus options (PCI etc.) --->
[ ] PCI support
Device Drivers --->
< > Serial ATA and Parallel ATA drivers --->
SCSI device support --->
< > SCSI device support
---
Disabling SCSI support frees up the /dev/sd* device names for use as Xen
virtual block devices. Basicly, this changes their names from /dev/sd* to a
Xen device name format /dev/xvd*. If this is left enabled, ocasionaly domU can
get stuck in a reboot-loop, with this error:
"XENBUS: Waiting for devices to initialise..."
Naturaly, to get the best performance you can disable everything that you
don't need in domU kernel.
Note that these files are not intended for a production environment. Users who
have particular requirements will need to set up their own methods, but these
files might provide a good starting point. Refer to the Xen manual and
http://xen.org for more details and options.

76
system/xen/domU/domU.sh Normal file
View file

@ -0,0 +1,76 @@
#!/bin/sh
# This Script builds a Slackware domU Xen Guest on a Slackware host,
# Although it might work correctly, this script is intended as a template, so
# simplicity is the priority here.
# Chris Abela <chris.abela@maltats.com>
# 20100308
# Updated by mario <mario@slackverse.org>
# 20100904
set -e
# Build an image for the root file system and another for the swap
# Default values : 8GB and 500MB resepectively.
ROOT_MB=${ROOT_MB:-8000}
SWAP_MB=${SWAP_MB:-500}
dd if=/dev/zero of=slackware.img bs=1M count=0 seek=$ROOT_MB
mkfs.ext4 -F slackware.img
dd if=/dev/zero of=swap_file bs=1M count=0 seek=$SWAP_MB
mkswap swap_file
# Make a mountpoint for the root file system and mount it
mkdir -p mnt
mount -o loop slackware.img mnt
# Make a mountpoint for proc and mount it
mkdir -p mnt/proc
mount --bind /proc mnt/proc
##############################################################################
# #
# IMPORTANT : This assumes that you have mounted your Slackware DVD on #
# /media/SlackDVD #
# #
##############################################################################
# This will install a "Server" with the listed packages
for i in a ap d e f k l n t tcl; do
installpkg --root mnt/ /media/SlackDVD/slackware*/$i/*.t?z
done
chroot mnt /sbin/ldconfig
# create fstab
cat >mnt/etc/fstab <<EOF
/dev/xvda2 swap swap defaults 0 0
/dev/xvda1 / ext4 defaults 1 1
#/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
EOF
chroot mnt /usr/sbin/timeconfig # Set the time
chroot mnt /sbin/netconfig # Set the network
chroot mnt /usr/bin/passwd # Set root's password
# Before we could use xencons=tty and leave inittab and securetty files intact,
# but that stopped working with new xen, so we fix it by adding hvc0.
sed 's/^\(c[1-6]:123\)/#\1/' /etc/inittab
echo -e '\nc1:1235:respawn:/sbin/agetty 38400 hvc0 linux' >> /etc/inittab
echo -e '\nhvc0' >> /etc/securetty
# This will save us an alarming (yet harmless) warning
(cd mnt/lib/modules
if [ -d 2.6.33.4-smp ] ;then
# for Slack32
ln -s 2.6.33.4-smp 2.6.33.4-xen
else
# for Slack64
ln -s 2.6.33.4 2.6.33.4-xen
fi
)
# unmount proc and the filesystem
umount mnt/proc
umount mnt

10
system/xen/domU/mydom Normal file
View file

@ -0,0 +1,10 @@
kernel = "/boot/vmlinuz-xen"
ramdisk = "/boot/initrd-xen.gz"
memory = 128
name = "slackware"
vif = [ 'mac=00:16:3e:00:00:01']
disk = [ 'file:/full_path_to/slackware.img,xvda1,w',
'file:/full_path_to/swap_file,xvda2,w' ]
root = "/dev/xvda1 ro"
extra = "3"
extra = "console=hvc0 elevator=noop"

19
system/xen/slack-desc Normal file
View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|---------handy-ruler------------------------------------------------------|
xen: xen (the Xen virtualization hypervisor)
xen:
xen: The Xen hypervisor, the powerful open source industry standard for
xen: virtualization, offers a powerful, efficient, and secure feature set for
xen: virtualization of x86, x86_64, IA64, ARM, and other CPU architectures. It
xen: supports a wide range of guest operating systems including Windows, Linux,
xen: Solaris, and various versions of the BSD operating systems.
xen:
xen: Homepage: http://xen.org
xen:
xen:

119
system/xen/xen.SlackBuild Normal file
View file

@ -0,0 +1,119 @@
#!/bin/sh
# Slackware build script for xen
# Written by:
# mario (mario@slackverse.org)
# Chris Abela (chris.abela@maltats.com)
PRGNAM=xen
VERSION=${VERSION:-4.0.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
make -C xen \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man
make -C tools \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man
make -C docs \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man
make install-xen \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man \
DESTDIR=$PKG
make install-tools \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man \
DESTDIR=$PKG
make install-docs \
docdir=/usr/doc/$PRGNAM-$VERSION \
DOCDIR=/usr/doc/$PRGNAM-$VERSION \
mandir=/usr/man \
MANDIR=/usr/man \
DESTDIR=$PKG
# Move from SYSV to BSD init scripts
mkdir -p $PKG/etc/rc.d/
mv $PKG/etc/init.d/xend $PKG/etc/rc.d/rc.xend.new
mv $PKG/etc/init.d/xendomains $PKG/etc/rc.d/rc.xendomains.new
mv $PKG/etc/sysconfig/xendomains $PKG/etc/xen/xendomains.config
sed -i 's:\/etc\/sysconfig\/xendomains:\/etc\/xen/xendomains.config:
s:\/etc\/init.d\/xendomains:\/etc\/rc.d\/rc.xendomains:' \
$PKG/etc/rc.d/rc.xendomains.new
# Fully qualified paths are needed for /etc/rc.d/rc.local_shutdown
sed -i 's:\(^[[:space:]]*\)xend :\1/usr/sbin/xend : ' $PKG/etc/rc.d/rc.xend.new
sed -i 's:\([^_/]\)xm :\1/usr/sbin/xm :' $PKG/etc/rc.d/rc.xendomains.new
# Put udev rules files in the right place
mkdir -p $PKG/lib/udev/rules.d
mv $PKG/etc/udev/xen*.rules $PKG/lib/udev/rules.d/
rm -rf $PKG/etc/udev
# Remove useless symlinks in boot/
find $PKG/boot/ -type l -a -name "xen-*" -exec rm -f {} \;
# Remove empty directories
rm -rf $PKG/etc/{init.d,sysconfig}
# Append .new to config files
for i in $PKG/etc/xen/{*.sxp,*.config,*.xml} ; do mv $i $i.new ; done
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
cp -a COPYING README $CWD/{dom0,domU} $PKG/usr/doc/$PRGNAM-$VERSION
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION/{dom0,domU}
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

10
system/xen/xen.info Normal file
View file

@ -0,0 +1,10 @@
PRGNAM="xen"
VERSION="4.0.1"
HOMEPAGE="http://www.xen.org/"
DOWNLOAD="http://bits.xensource.com/oss-xen/release/4.0.1/xen-4.0.1.tar.gz"
MD5SUM="d197afad975ab2396a67323d57388c27"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="mario"
EMAIL="mario@slackverse.org"
APPROVED="rworkman"