Snow Leopard Server on Xen
(I'm kind of stuck on this page, so if anyone wants to help further, please do so! Maybe it won't even be necessary anymore, if Lion indeed comes with Server stuff...)
 Snow Leopard Server on Xen
This document describes how to install a Snow Leopard Server as a DomU virtual machine on Xen systems. I created this page because I don't want the work I'm doing to go to waste after I've had my fun with it - so hopefully you can put this to good use! (But don't hold me responsible if you break stuff while following this guide...)
You should have some Terminal skills before you try this. Please put any improvements right on this page, and any problems under Discussion. Good luck!
 Preparing the image
 Cloning the installation disk
We will assume an installation disc for which you have a license. The instructions below are from Lifehacker's "How to build a Hackintosh with Snow Leopard: Start to Finish" - see that URL for way more details than I'm including here…
First of all, create a 8 GB disk image with Disk Utility, by clicking "New Image" in the header. Save it on your desktop, set Size to "8.3 GB (DVD+R double layer)", set format to "Mac OS Extended (Case-sensitive, Journaled)", no encryption and set partitions to "One partition - GUID partition table". Leave the last drop down box at "read/write".
Now, we'll copy over the disc contents. Make sure the disc is in the drive (or the original Snow Leopard image is mounted). Then, click your new disk image partition and go to the Restore tab. Drag the partition of the installation disk (not the disk itself) into the Source bar, and the partition of the image we're creating into Destination (see this image). Make sure "erase destination" is unchecked, and click Restore to start the process. This might take a while. When Disk Utility is done, mount the image.
 Installing a bootloader
Now, we're going to install a bootloader for PC BIOS, as this is what Xen uses for its hardware virtualisation. First of all, run diskutil list to see your partitions (example). In the example, the disk image is mounted at disk2, and its data partition is at disk2s2. These might be different on your machine! Remember them well.
Download the latest release of Chameleon from their homepage. Inside the .zip you will find an i386 directory, containing some 'boot' files. Using Terminal.app, go into that directory, then execute these two commands:
sudo fdisk -f boot0 -u -y /dev/rDISK sudo dd if=boot1h of=/dev/rPARTITION
Replace DISK with the disk node, in the earlier example disk2; replace PARTITION with the partition node, disk2s2. The 'r' in front of the nodes is not a typo, don't forget it. example Terminal screenshot
Now we need an EFI bootloader which can be obtained from here, look for the bootloader link. Unpack the file you get and take the boot file from Bootloader.pkg/Contents/Resources/boot/boot; copy it to the volume. Depending on where you've downloaded the bootloader package and mounted the image, this should do:
sudo cp ~/Downloads/Bootloader.pkg/Contents/Resources/boot/boot /Volumes/HackintoshInstall
There's only one thing left: extract this Extra.zip to the drive.
Now, check the image as you have it. It does not look exactly like this image, because we have a Mac OS X Server disk, but you should notice the installer, a 'boot' file and an Extra directory.
 Converting to CD
In order for Xen to be able to mount the image, we must convert it to ISO format. We can do this easily using Disk Utility: with the new .dmg image mounted you should see it to the left; click Convert at the top to open the converting popup. You can leave the file name the same; make sure that the format is set to "DVD/CD master", and encryption should be disabled. Click "Save", and wait a moment.
This will create a .cdr file, which is the same as an .iso file. Copy this file to your Xen Dom0 host in whatever way you want, then continue to the next step.
 Configuring the VM
In this section, we will assume the Xen domains are installed at /xen/domains/HOSTNAME and configuration is saved at /etc/xen/HOSTNAME.cfg. If your paths are different, be sure to replace them everywhere.
We assume you have your disk image at ~/hackosx.iso. Replace the real path if it's different!
 Setting up the base files
We will create a 10GB disk image and a 1GB swap partition.
mkdir /xen/domains/hackosx cd /xen/domains/hackosx dd if=/dev/zero of=disk.img bs=128M count=80 dd if=/dev/zero of=swap.img bs=128M count=8 cp ~/hackosx.iso .
 Creating a configuration file
Now, we will create the configuration file at /etc/xen/hackosx.cfg. This is a good starting point:
import os, re arch = os.uname() if re.search('64', arch): arch_libdir = 'lib64' else: arch_libdir = 'lib' kernel = "/usr/lib/xen-3.2-1/boot/hvmloader" builder='hvm' memory = 128 name = "hackosx" pae=0 acpi=1 apic=1 vif = [ 'type=ioemu,ip=192.168.0.10' ] disk = [ 'file:/xen/domains/hackosx/disk.img,hda,w', 'file:/xen/domains/hackosx/swap.img,hdb,w', 'file:/xen/domains/hackosx/hackosx.iso,hdc:cdrom,r', ] device_model = '/usr/' + arch_libdir + '/xen-3.2-1/bin/qemu-dm' # first boot from disk, then from cd if that fails boot="cd" sdl=0 vnc=1 vnclisten="127.0.0.1" vncdisplay=1 vncconsole=0 vncunused=1 vncpasswd='Password' stdvga=0 serial='pty' monitor=1
There are a few things you will need to or maybe like to change:
- The path to the Xen files in my case was /usr/lib/xen-3.2-1 (Debian Lenny). In many cases, this will be /usr/lib/xen or /usr/lib/xen-default. Substitute the MULTIPLE instances of this path in the file above - since if the path is wrong, Xen does not seem to give any error about it!
- Properties such as the amount of memory.
- The IP address, 192.168.0.10. You probably want something else here. Maybe even bridge it.
- The paths to the disks. You'll probably want to keep hda, hdb and hdc the same.
- The display settings. Currently, VNC is selected and set up to listen at an unused port on 127.0.0.1. If you want a vnc window to open automatically, set vncconsole to 1; if you want an SDL window to open automatically, set sdl to 1 and vnc to 0. Play around with these settings until you have VNC working.
 Booting the VM
 Connecting with VNC
 Installing Mac OS X
This page was last modified on 20 July 2011, at 12:56.
This page has been accessed 10,844 times.