This and That Rotating Header Image

HowTo: Windows XP on Xen 3.1 (from source) on a MacBook Pro

This guide assumes a decent working knowledge of Linux, compiling source, virtualization, and networking. For my purposes, it was easier to just blow away OSX and install a Linux distribution on the MacBook Pro. Supposedly, someone has been able to compile Xen on OSX, so you may want to check out the xen-users mailing list. Also, if you don’t intend on modifying any of the xen source, it’s probably easier to just install from modules using apt-get, yum, etc.

Picking a Distro:
The first step is to pick a Linux distribution that comes with GRUB 0.97 or greater so that the hybrid GPT/MBR that MacBooks come with will be supported. I chose RHEL 5.1 (Ubuntu 7.10 Workstation will also install on the MacBook, but I did not try to install Xen on it). It might be possible to install a distro with an earlier version of GRUB like RHEL4.5 and then use rescue mode to upgrade GRUB, but I did not try it.

Partitioning:
In previous RHEL/Xen installations, I followed the partitioning instructions found here. However, when I attempted to replicate the partitioning scheme with RHEL5.1 on a MacBook, the partitioner would crash. I even tried creating the LVM volumes manually with Knoppix and then running the RHEL installer, but the partitioner would still crash. I ended up just accepting the default RHEL partition scheme that only creates one LVG. This means that I am going to have to use QEMU files for VMs.

Xen Dependencies:
To compile Xen, you have to satisfy its dependencies (thanks to Fraser Campbell for the list):

  • bcc
  • binutils
  • bridge-utils
  • gcc
  • libncurses5-dev
  • libsdl-dev
  • libsdl1.2debian-all
  • make
  • python-dev
  • tetex-extra
  • transfig
  • zlib1g-dev

All but bridge-utils can be installed during RH’s installation by adding the selecting the appropriate packages.

Fixing the Network:
Once RHEL is installed and boots, you’ll quickly realize that the sky2 driver provided for the Marvell gigE card is woefully outdated. The updated driver, sk98lin is provided on the Marvell website. The package comes with a shell script, install.sh, that drives the compilation and installation process. It expects to find kernel header files at /usr/src/linux, so create a symbolic link as needed.

install.sh checks that the module loads correctly with insmod before copying it into the file system, but it calls insmod without the full path (./sbin/insmod), so the test fails if you login to redhat with your user account and su over (user account cannot sudo by default, so you have to su to perform privileged operations), because sbin is not in the path. To get around this, I just prepended /sbin to the call to insmod in install.sh (should be around line 1318).

You may need to run insmod and adjust /etc/modprobe.conf to use the sk98lin driver instead of sky2.

Installing Xen:
First, pull down the Xen 3.1 source from here, and extract it somewhere.

Then, do:

make world

and

make install

and, finally:

./install.sh

to copy the kernels to /boot

cd into /boot and create an initial ramdisk:

depmod 2.6.18-xen
mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod initrd-2.6.18-xen.img 2.6.16-xen

Next we need to add a grub entry to /boot/grub/grub.conf:

title Xen 3.1
root (hd0,0)
kernel /xen-3.1.gz dom0_mem=262144
module /vmlinuz-2.6-.18-xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
module /initrd-2.6.18-xen.img

Reboot, and select the Xen option from the grub menu. Hopefully, Xen boots followed by XenLinux. It’ll look like RH, because it’s using all of RH’s configuration files. Login to X as root.

Configuring network for XenLinux:
The Marvell card driver needs to be compiled for XenLinux as well, so remove the old link you created to /usr/src/linux and create a new one to build-linux-2.6.18-xen_x86_64 directory in the xen source directory, and run install.sh. For some reason, install.sh was more helpful this time and adjusted /etc/modprobe.conf.

Creating XP HVM:
At this point, I would just follow the documentation found here to create a configuration file for the XP VM. However, there are some important differences for Xen 3.1 (the guide was developed for Xen 3.0). The virtual disk and the cdrom/image path are now specified in one line:

disk =  [ 'file:/home/rpersaud/guests/xp-001/xp-demo-001.qcow,ioemu:hda,w','file:/home/rpersaud/en_winxp_pro_with_sp2.iso,hdc:cdrom,r' ]

Also, since we are using a QEMU qcow file for our VM and not a LVM volume, we need to create a QEMU image for the XP VM using qemu-img which can be found here.
The command I used:

qemu-img create xp-demo-001.qcow 10G

Leave a Reply