Skip to content

Instantly share code, notes, and snippets.

@fredmajor
Created September 20, 2019 09:44
Show Gist options
  • Save fredmajor/32baaa1888e17fc83cc5d4e0ae6b7c05 to your computer and use it in GitHub Desktop.
Save fredmajor/32baaa1888e17fc83cc5d4e0ae6b7c05 to your computer and use it in GitHub Desktop.
#!/bin/bash
# qemu-img create -f qcow2 mac_hdd_ng.img 128G
#
# echo 1 > /sys/module/kvm/parameters/ignore_msrs (this is required)
############################################################################
# NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems!
############################################################################
# This works for High Sierra as well as Mojave. Tested with macOS 10.13.6 and macOS 10.14.4.
MY_OPTIONS="+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"
# OVMF=./firmware
OVMF="./"
virsh nodedev-detach pci_0000_00_14_0
virsh nodedev-detach pci_0000_00_14_2
qemu-system-x86_64 -enable-kvm -m 8192 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS\
-machine q35 \
-smp 4,cores=2 \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
-device vfio-pci,host=00:14.0,id=hostdev0,bus=pci.2,addr=0x3 \
-device vfio-pci,host=00:14.2,id=hostdev1,bus=pci.2,addr=0x6 \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-drive if=pflash,format=raw,readonly,file=$OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=$OVMF/OVMF_VARS-1024x768.fd \
-smbios type=2 \
-device ich9-intel-hda -device hda-duplex \
-device ich9-ahci,id=sata \
-drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/CloverNG.qcow2' \
-device ide-hd,bus=sata.2,drive=Clover \
-device ide-hd,bus=sata.3,drive=InstallMedia \
-drive id=InstallMedia,if=none,file=BaseSystem.img,format=raw \
-drive id=MacHDD,if=none,file=./mac_hdd_ng.img,format=qcow2 \
-device ide-hd,bus=sata.4,drive=MacHDD \
-netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \
-monitor stdio \
-vga vmware
virsh nodedev-reattach pci_0000_00_14_0
virsh nodedev-reattach pci_0000_00_14_2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment