You’d think that with the popularity of the work that had been done by the original Hackint0sh team on OSX86 that bringing up OSX on any reasonable PC would be pretty easy, and it IS! These days, you’d get something that has PC-EFI/Chameleon on it, with Netkas’ SMC emulator and boom, be done. As long as you had something that resembled Mac hardware and could coax the device drivers to notice, you would end up with a fairly functional Hackint0sh. Team Hackint0sh made it easy for those who came along afterwards to throw together all-in-one installations for the latest version of OSX, but also slapped their own name on it, and that’s why there are 5,000 different distributions, USB and CD booters, and a mass confusion of whose distribution you should run, since they are all subtly different and have or lack drivers that may work with your configuration. So while some distributions are updated and more ‘successful’ than others, there is no single distribution that encompasses the project. This was sadly due to infighting and egos in the early days, rather than pulling together to keep producing THE single consistent distribution OSX86 Hackint0sh… but I digress.
Now, while some have ventured to get previous versions of OSX running under Xen with limited success, I needed it to be actually usable. The problem is that under Xen, you have to run in HVM mode, and that effectively spawns QEMU which emulates a 440BX motherboard with whatever CPU you have running (provided that it has SSE3 (though I’m not sure how well semthex’s original SSE2 code fairs emulating SSE3 speed-wise). QEMU defaults to emulating a realtek 8139 10Mbps half-duplex ethernet card (speed has no real meaning since it’s wired virtually and limited to whatever you really have). This was apparently acceptable during 32bit versions of OSX, but also had a horrible speed drop in some cases. I found a 64bit version, and only managed to get 50kbps out of it at max. So, I set QEMU to emulate the Intel Pro 10/100 Ethernet (e1000) and actually found a driver for it… that was 64bit, and actually worked at full wire speed.
The first problem is getting OSX onto a Xen disk image (I chose LVM for speed, though a flat file would work). The underlying issue is that Google searching for help was pretty much utterly worthless. With outdated information, and just plain wrong guessing, there were many rabbit holes that I went down only to dead end. Once I got a USB stick setup with the ESD Base System, the ESD packages in the right place, and Chameleon with the appropriate drivers in /Extra/Extensions, I was able to do the normal installation. There are numerous instructions available on how to create the USB stick for Mountain Lion, but the important thing to note are:
This will cause a nice kernel panic with org.apple.ApplePolicyControl as the culprit if you don’t. This will happen when you upgrade to to 10.8.3 as well, but the installation will have completed enough that it crashes when the kexts caches are being regenerated. You will just need to boot into Single User Mode, mount the drive read/write, and then go remove the new kext the update put there.
In /Extra (on my USB, and then copied to the harddrive) are my plists:
My SMBios.plist: (Edit the serial number slightly at the end)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SMbiosdate</key> <string>02/29/08</string> <key>SMbiosversion</key> <string>MP31.88Z.006C.B05.0802291410</string> <key>SMfamily</key> <string>MacPro</string> <key>SMmanufacter</key> <string>Apple Inc.</string> <key>SMproductname</key> <string>MacPro3,1</string> <key>SMserial</key> <string>G88666V4YYZ</string> <key>SMboardproduct</key> <string>Mac-F42C88C8</string> <key>SMmemspeed</key> <string>800</string> </dict> </plist>
My org.chameleon.Boot.plist (note: not com.apple.Boot.plist)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Kernel</key> <string>mach_kernel</string> <key>Kernel Flags</key> <string>-v</string> <key>Legacy Logo</key> <string>Yes</string> <key>ShowInfo</key> <string>Yes</string> <key>Timeout</key> <string>50</string> <key>EthernetBuiltIn<key> <string>Yes</string> </dict> </plist>
The REQUIRED Extra/Extension drivers: (these MUST BE 64bit ones and I leave it to your Google-fu to find them)
These are for VNC to work:
fakesmc.kext – This is the magic that lets us run OSX at all.
NullCPUPowerManagement.kext – This keeps QEMU from freaking out over the number of CPUs in APIC as well as keeping AppleIntelCPUPowerManagement.kext in line.
OpenHaltRestart.kext – This lets the machine restart/shutdown cleanly without having to destroy/create.
SuperVIAATA.kext – This is for the QEMU SATA Harddrives to show up
AppleIntelE1000.kext (the pci driver, not the pcie one) – e1000 driver for QEMU emulation
I created the LV with a nice padding for working afterwards:
ACTIVE ‘/dev/xen/osx_boot’ [120.00 GiB] inherit
Here is the xen configuration file:
import os, re arch = os.uname() if re.search('64', arch): arch_libdir = 'lib64' else: arch_libdir = 'lib' device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm' kernel = "/usr/lib/xen-default/boot/hvmloader" builder='hvm' memory = 2048 vcpus= 4 cpus='^0' name = "osx" # Make the MAC address of the ethernet card unique leave the 00:16:3E prefix. vif = [ 'type=ioemu,model=e1000,mac=00:16:3E:22:22:22,bridge=eth0,vifname=osx.0' ] boot="c" disk = [ # 'phy:/dev/sdb,hda,w', # USB stick 'phy:/dev/vg0/osx_boot,hda,w', # ML root ] # Must have to make Darwin happy. acpi=1 apic=1 pae=1 hpet=1 # Viewing with VNC vnc=1 vncconsole=1 vnclisten="0.0.0.0" # I ssh to the Xen server, and port forward. Otherwise your IP. vncpasswd='' serial='pty' # Don't use tablet or the mouse won't work in VNC under OSX stdvga=1 videoram=16
Wayward Internet traveller looking for this information, you are welcome. I spent many hours cobbling this together and having rebooted over 60 times to get the right concoction of voodoo to work. There is no warranty implied, and questionable legality (I do own a copy of mountain lion, and this is for my personal use).
Helpful hints of running OSX under Xen QEMU:
- Turn off the screen blanker or set it to the Message one. This will keep it from sucking CPU with pretty graphics.
- Turn off Energy Savings by moving both sliders to the far end. Xen doesn’t seem to like it when the instance tries to go to sleep on it.
Known issues and bugs I haven’t worked around yet:
- VNC pointer and the Mouse pointer are off and can be a pain to use. Screen sharing is fine. Screen Sharing needs to have a VNC password set under Computer Settings in the Screen Sharing selection in Sharing Preferences Pane or they’ll complain about not being able to deal with the encryption.
- About this Mac will crash and drop you back to the login prompt or kill QEMU and/or kill the Xen hypervisor. This has something to do with the memory information that SMBios should be providing from QEMU but doesn’t, so it grovels memory until it crashes or hits something that QEMU/XEN doesn’t like. I haven’t found a solution to emulate the SMBios structure for memory since Chameleon SHOULD be doing it but doesn’t (bug because it can’t find an SMBus in QEMU?)
- Lots of IOHID noise about the mouse pointer in the console logs. Harmless.
- Diagnostics in System Information shows Memory failed test. Harmless.
- Contention between read and writing disk and doing network (stress testing). It appears only when the destination is sending a lot of data TO the Xen instance that it gets overwhelmed and stops.. and the driver stops responding. When the instance is fetching FROM, it works perfect.