Update 30.04.2015: I was able to run Yosemite after switching to QEMU 2.3 and Chimera 4.1. See below.

In the last post we set up a VM running Mac OSX Yosemite the help of VirtualBox.
Now what if we would like to run a prepared VM on a Linux machine running KVM instead of VirtualBox?

Gabriel L. Somlo already did great work for running Mac OSX on KVM (see http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/) but didn't cover Yosemite so far.
Andrei Ostanin also wrote a nice post on how to run Mac OSX Mavericks on KVM (see http://blog.ostanin.org/2014/02/11/playing-with-mac-os-x-on-kvm/).
I had success with Gabriel's description for running Mavericks and tried the same approach with Yosemite: It didn't work in the same way.

I found out that the Chameleon bootloader was not able to load the kernel from /mach_kernel. The cause for this was that the kernel in Yosemite now lives at /System/Library/Kernels/kernel. So I needed a newer bootloader version.
There are different forks of Chameleon which support Yosemite. I tried Chimera as it seemed to be the most advanced variant.

According to Gabriel's requirements, we need a Linux machine with kernel 3.15+ and QEMU 2.1+. I used the new Ubuntu 14.10 Utopic Unicorn server variant which also features the OpenStack Juno release.

  • convert our VDI image from VirtualBox to RAW fomat:
VBoxManage clonehd --format RAW Yosemite.vdi Yosemite.raw
  • copy RAW image to Linux machine
  • convert RAW image to QCOW2 format:
qemu-img convert -f raw Yosemite.raw -O qcow2 mac_hdd_10.10.img
  • copy chimera_4.1_boot bootloader file to Linux machine
  • learn how to get the OSK string at Andrei's blog post.

It appears that QEMU 2.1 in Ubuntu 14.10 is a little bit too old. OSX started to boot but only showed a black screen after the kernel output.
So I installed QEMU 2.3 manually. Version 2.2 works too. It might be enough to upgrade to Ubuntu 15.04 Vivid Vervet which also contains QEMU 2.2.

  • install QEMU 2.3:
wget http://wiki.qemu-project.org/download/qemu-2.3.0.tar.bz2
tar xvzf qemu-2.3.0.tar.bz2
cd qemu-2.3.0
./configure --prefix=/home/$(whoami)/qemu_2.3 --target-list=x86_64-softmmu
make clean
make -j8
make install
  • ignore MSR readout on host by VM (as described by Gabriel):
echo 1 > /sys/module/kvm/parameters/ignore_msrs
  • start KVM:
~/qemu_2.3/bin/qemu-system-x86_64 -enable-kvm -m 2048 -cpu core2duo \
	  -machine q35 -smp 4,cores=2 \
	  -usb -device usb-kbd -device usb-mouse \
	  -device isa-applesmc,osk="insert-real-64-char-OSK-string-here" \
	  -kernel ./chimera_4.1_boot \
	  -smbios type=2 \
	  -device ide-drive,bus=ide.2,drive=MacHDD \
	  -drive id=MacHDD,if=none,file=./mac_hdd_10.10.img \
	  -netdev user,id=hub0port0 \
	  -device e1000-82545em,netdev=hub0port0,id=mac_vnet0 \
	  -monitor stdio \
	  -device ide-drive,bus=ide.0,drive=MacDVD \
	  -drive id=MacDVD,if=none,snapshot=on,file=./Yosemite.iso

Now the VM boots and the Chimera bootloader appears. You can type in -v for booting in verbose mode.

Booting from the Yosemite install DVD didn't work for me:

panic(cpu 0 caller 0xfff...): "Unable to find driver for this platform: \" ACPI\".\n"@/SourceCache/...IOPlatformExpert.cpp:1590
...

ceph on zfs diagram

Booting from the harddisk works but appears to be a little bit slow. There are also some visual glitches. It was also possible to upgrade to 10.10.3.

ceph on zfs diagram

:)