Xen concepts
There are a number of ways you can get multiple operating systems running simultanously on the same computer. There are two basic methods, emulation and virtualization.
HOWTO Gentoo in domain 0
# emerge app-emulation/xen sys-kernel/xen-sources
# cd /usr/src/linux-2.6.11.10-xen
# make menuconfig
# make && make modules_install
# cp vmlinux /boot/vmlinux-syms-2.6.10-xen
# cp vmlinuz /boot/vmlinuz-2.6.11-xen
# System.map /boot/System.map-2.6.11-xen
# .config /boot/config-2.6.11-xen
# nano /boot/grub/menu.lst
You need to set the root partition to your boot partition.
title=Xen 2.0.6 / XenLinux 2.6.11(gentoo)
root (hd0,0)
kernel /xen.gz dom0_mem=131072
module /boot/vmlinuz-2.6.11-xen root=/dev/hda6
HOWTO Gentoo in domain >= 1
It is presumed that you have allready installed a domain 0 OS. This is a domain0 is a prerequsite for running all other domains.
This choice is mostly arbitrary check out the Gentoo Linux x86 Handbook http://www.gentoo.org/doc/en/handbook/2005.0/handbook-x86.xml?part=1&chap=4#doc_chap2 for other possiable partition schemes.
creating the root partition
# lvcreate -L500M -nxen1-root vg
# lvcreate -L2G -nxen1-usr vg
# lvcreate -L1G -nxen1-var vg
# lvcreate -L100M -nxen1-swap vg
vg will be whatever your volume group is
# mkfs.ext2 /dev/vg/xen1-root
# mkfs.ext2 /dev/vg/xen1-usr
# mkfs.ext2 /dev/vg/xen1-var
# mkswap /dev/vg/xen1-swap
Installing the OS
# mkdir /mnt/gentoo
# mount -t ext3 /dev/vg/xen1-root /mnt/gentoo
# mkdir /mnt/gentoo/usr
# mkdir /mnt/gentoo/var
# mount -t ext3 /dev/vg/xen1-usr /mnt/gentoo/usr
# mount -t ext3 /dev/vg/xen1-var /mnt/gentoo/var
# mkdir /mnt/gentoo/proc
# mount --bind /proc /mnt/gentoo/proc
# mkdir /mnt/gentoo/dev
# mount --bind /dev /mnt/gentoo/dev
# mkdir /mnt/gentoo/usr/portage
# mount --bind /usr/portage /mnt/gentoo/usr/portage
You will need to get a tarball with one of the stages and unpack it to your /mnt/gentoo directory. If you don't know how to do this read http://www.gentoo.org/doc/en/handbook/2005.0/handbook-x86.xml?part=1&chap=5
# cd /mnt/gentoo
# tar -xvjpf stage3--2005.0.tar.bz2
# cp /etc/resolve.conf /mnt/gentoo/etc/resolve.conf
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
creating the os configuration file.
# nano /etc/xen/auto/xen1
kernel = "/usr/src/linux-2.6.11.10-xen/vmlinuz"
memory = 128
name = "xen1"
vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0' ]
disk = [ 'phy:0801,vg/xen1-root,sda1,w','phy:0802,vg/xen1-swap,sda2,w','phy:0803,vg/xen1-usr,sda3,w','phy:0804,vg/xen1-var,sda4,w' ]
root = "/dev/hda1"
Tips/Tricks/Thoughts/Hacks/etc
tls does not work directly with xen and has to be emulated. This makes tls libraries very slow. It is recommended that you dissable tls for domains running under xen.
dissable tls
# nano /etc/make.conf
USE="-tls ... "
# mv /lib/tls /lib/tls.disable