It is always nice to have a possibility to run a virtual system to test various software designed for different platforms. Recently I have moved completely off from VirtualBox and started to use QEMU-KVM only. With GRSEC/PAX hardened kernel qemu-kvm works fine without any paxctl exceptions to its binaries or any modifications in the kernel config. I have managed to install and run iATKOS ML2 which is modified OSX 10.8.2 for PCs. Maybe the following information might be handy to somebody wishing to virtualize 64bit OSX for testing.
My software specifications are as follows:
- OS: Debian stable 64bit with vanilla kernel 2.6.50 & GRSEC/PAX patches and kvm_intel module
- QEMU-KVM version 0.14.1 (Please check notes further on)
- iATKOS ML2 (no links here, please find your copy..)
I have had best success with qemu-kvm version 0.14.1 because of the RTL8139 network driver in this version. I had no luck in 1.2.x or 1.1.x to get the virtual network card to work and earlier versions were also buggy, so stick to this one (works fine for Windows,Linux,OSX,BSDs…).
Another important thing is that any newer OSX system wont even boot on APIC IDs that are 11 or less. And QEMU-KVM 0.14.1 reports APIC=0x11. But no worries, it is open-source after-all and a simple patch can fix this which I will show further on. So what we need is to download a proper QEMU-KVM version from here: sourceforge.net/projects/kvm/files/qemu-kvm/0.14.1/ or direct download sourceforge.net/projects/kvm/files/qemu-kvm/0.14.1/qemu-kvm-0.14.1.tar.gz/download
Extract the file and modify the hw/apic.c like this :
user@Obelix:~/qemu-kvm-0.14.1/hw/BACKUP$ diff patched.apic.c apic.c 737c737 < val = 0x14 | ((APIC_LVT_NB - 1) << 16); /* version 0x11 */ --- > val = 0x11 | ((APIC_LVT_NB - 1) << 16); /* version 0x11 */
Just make sure you change the 0x11 to 0x14 on line 737. Now you can configure make and install the package.
Before booting make sure the kvm_intel kernel module is loaded (Im on an INTEL CPU, did not try AMD kvm_amd)
There are some parameters to be passed on to QEMU-KVM when booting OSX so here is a quick summary:
qemu-img create -f qcow2 lion.img 20G (create an empty hdd for installation)
kvm -m 1400 -vga vmware lion.img -cdrom /PATH/TO/ISO.iso -boot d -cpu core2duo -net nic,model=rtl8139,macaddr=10:1f:74:55:11:21 -net user -no-kvm-irqchip
Once you are in the iATKOS boot menu hit F8 and enter these boot parameters:
We are just telling the bootloader to use 1 CPU and boot verbosely. You should boot to the setup menu where you create the OSX partition on the empty drive (use erase with label) and before hitting install select some custom options like PS/2 drivers (actually there are very few options to choose from in iATKOS ML2.
After installation you can boot OSX like so :
kvm -m 1400 -vga vmware lion.img -cpu core2duo -net nic,model=rtl8139,macaddr=10:1f:74:55:11:21 -net user -no-kvm-irqchip
And dont forget to issue F8 cpus=1 boot flag