Skip to content

Instantly share code, notes, and snippets.

@Shumen
Forked from will3942/kvm.sh
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shumen/320661fd766acab93d88 to your computer and use it in GitHub Desktop.
Save Shumen/320661fd766acab93d88 to your computer and use it in GitHub Desktop.
OSXKVM
# OSXKVM project's ultimate goal is to upstream to run MacOSX from unadulterated and standard images on KVM.
# http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/
# http://kashyapc.com/2014/03/10/notes-for-building-kvm-based-virtualization-components-from-upstream-git/
# http://blog.ostanin.org/2014/02/11/playing-with-mac-os-x-on-kvm/ #ubuntu12.04, http://files.ostanin.org/2014/02/osx-kvm.tar.xz
# http://www.vpsee.com/2014/06/install-and-run-os-x-mavericks-with-kvm-under-linux/ #Verified on CentOS 6.5 with 3.x kernel
# kernel 3.10.0-* can be patched directly, no need kvm-kmod external module.
# http://git.kernel.org/cgit/virt/kvm/kvm.git/commit/?id=100943c54e0947a07d2c0185368fc2fd848f7f28
# https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/?id=refs/tags/v3.10
# available from kernel 3.15.*, apply the patch since 3.15.1, you can skip this after 3.15 kernel
mkdir -p /home/$(whoami)/OSXGUEST
cd /home/$(whoami)/OSXGUEST
git clone git://git.kernel.org/pub/scm/virt/kvm/kvm.git
make defconfig
make -j4 && make bzImage && make modules
make modules_install && make install
modprobe -r kvm_intel
cp ./x86/kvm*.ko /lib/modules/$(uname -r)/kernel/arch/x86/kvm/
modprobe kvm_intel
# build an external module with older kernels such as 3.13.6-200.fc20)
git clone git://git.kernel.org/pub/scm/virt/kvm/kvm.git
git clone git://git.kiszka.org/kvm-kmod.git
cd kvm-kmod
./configure
make LINUX=../kvm clean sync all
modprobe -r kvm_intel
cp ./x86/kvm*.ko /lib/modules/$(uname -r)/kernel/arch/x86/kvm/
modprobe kvm_intel
-device virtio-net,netdev=hub0port0,id=eth0 \
-netdev user,id=hub0port0
-device ide-drive,bus=ide.4,drive=fatdrive \
-drive id=fatdrive,file=fat:ro:VirtIoNetDrv
<?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>Timeout</key>
<string>5</string>
<key>EthernetBuiltIn</key>
<string>Yes</string>
<key>PCIRootUID</key>
<string>1</string>
</dict>
git clone git://git.qemu.org/qemu.git;
cd qemu
./configure --prefix=../ --target-list=x86_64-softmmu
make clean; make; make install
cd ..
/root/osx/setup/bin/qemu-system-x86_64 -enable-kvm -m 4096 -cpu core2duo -machine q35 \
-smp 4 \
-usb -device usb-kbd -device usb-mouse \
-vga std \
-device isa-applesmc,osk="REPLACE KEY HERE" \
-kernel ./chameleon_svn2360_boot \
-smbios type=2 \
-device ide-drive,bus=ide.2,drive=MacHDD \
-drive id=MacHDD,if=none,cache=none,file=./osx.img \
-netdev user,id=hub0port0 \
-device e1000-82545em,netdev=hub0port0,id=mac_vnet0 \
-device ide-drive,bus=ide.0,drive=MacDVD \
-drive id=MacDVD,if=none,snapshot=on,file=./Mavericks.iso \
-bios ./share/qemu/bios-mac.bin \ # no this arg in somlo's manual
-monitor stdio \ # optional
-vnc localhost:1 # optional
note:
Another optional parameter instead of core2duo to start an SMP guest, such as:-smp 4,cores=2, -cpu host?
An appropriately patched SeaBIOS binary is required as well for old qemu, like bios-mac.bin
mkdir VirtIoNetDrv
(cd VirtIoNetDrv; wget http://github.com/pmj/virtio-net-osx/raw/master/bin/Virtio-Net-Driver-0.9.4.pkg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment