diff options
author | mario <mario@slackverse.org> | 2010-10-10 14:17:24 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-10-10 14:17:24 -0500 |
commit | 602d2eb9eed94819b5cf4480ef403639afe028f5 (patch) | |
tree | 5c08c37f6f960a111af84c5aa58466c95947e73d /system/xen/domU | |
parent | f5fdea9bb70cc8950ab3e5c1ff0437bc7351cf52 (diff) |
system/xen: Added (the Xen virtualization hypervisor)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/xen/domU')
-rw-r--r-- | system/xen/domU/README.domU | 57 | ||||
-rw-r--r-- | system/xen/domU/domU.sh | 76 | ||||
-rw-r--r-- | system/xen/domU/mydom | 10 |
3 files changed, 143 insertions, 0 deletions
diff --git a/system/xen/domU/README.domU b/system/xen/domU/README.domU new file mode 100644 index 000000000000..f060dceece30 --- /dev/null +++ b/system/xen/domU/README.domU @@ -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. diff --git a/system/xen/domU/domU.sh b/system/xen/domU/domU.sh new file mode 100644 index 000000000000..d9b2792917d2 --- /dev/null +++ b/system/xen/domU/domU.sh @@ -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 diff --git a/system/xen/domU/mydom b/system/xen/domU/mydom new file mode 100644 index 000000000000..0ac1ad69d758 --- /dev/null +++ b/system/xen/domU/mydom @@ -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" |