diff options
Diffstat (limited to 'system/xen/domU')
-rw-r--r-- | system/xen/domU/README.domU | 56 | ||||
-rw-r--r-- | system/xen/domU/domU.sh | 74 | ||||
-rw-r--r-- | system/xen/domU/mydom | 10 |
3 files changed, 140 insertions, 0 deletions
diff --git a/system/xen/domU/README.domU b/system/xen/domU/README.domU new file mode 100644 index 0000000000..023e432272 --- /dev/null +++ b/system/xen/domU/README.domU @@ -0,0 +1,56 @@ + 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 rc.local and 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: + +# xl 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 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 a 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 0000000000..44b24836c5 --- /dev/null +++ b/system/xen/domU/domU.sh @@ -0,0 +1,74 @@ +#!/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. +# Written by Chris Abela <chris.abela@maltats.com>, 20100308 +# Updated by mario <mario@slackverse.org>, 2010-2011 + +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 domU 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 as of Xen-4.x, so this has to be fixed by adding hvc0. +sed 's/^\(c[1-6]:123\)/#\1/' /etc/inittab +echo -e '\nc1:12345: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.37.6-smp ]; then + # for Slack32 + ln -s 2.6.37.6-smp 2.6.34.7-xen + else + # for Slack64 + ln -s 2.6.37.6 2.6.34.7-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 0000000000..72f7f511ef --- /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" |