Skip to content

Instantly share code, notes, and snippets.

@downthecrop
Created November 12, 2019 04:34
Show Gist options
  • Save downthecrop/16642916ce16a462166c6398c493626d to your computer and use it in GitHub Desktop.
Save downthecrop/16642916ce16a462166c6398c493626d to your computer and use it in GitHub Desktop.
Some improvements
### Install packages.
sudo apt-get update
sudo apt-get install qemu-kvm qemu virt-manager virt-viewer libvirt-bin qemu-system qemu-utils python3 python3-pip git qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager ovmf
##Get macOS
git clone https://github.com/foxlet/macOS-Simple-KVM.git
cd macOS-Simple-KVM
git clone https://gitlab.com/driverctl/driverctl
./jumpstart.sh --high-sierra
qemu-img create -f qcow2 macOS.qcow2 64G
basic.sh append
-drive id=SystemDisk,if=none,file=macOS.qcow2 \
-device ide-hd,bus=sata.4,drive=SystemDisk \
sudo basic.sh ##Runs the Installer
macOS Recovery > Disk Utility > Erase disk Mac OS Extended (Journaled) > Close > Reinstall > Continue Select Drive.
@@ This will take about 30 minutes @@
Bootable macOS. Install Checkra1n if you want. You now have the VM but the more important part is passing through USB.
#########################################
Part 2: USB passthrough
## IOMMU
##make a flag to signal phase 1 done
touch phaseOneFlag
##Check for vmx(intel)/svm(AMD)
grep -o 'vmx\|svm' /proc/cpuinfo
## Checking vifo groups
dmesg | grep -i vfio
##checking IOMMU
dmesg | grep -E "DMAR|IOMMU"
## Find USB names
lspci -nn | grep "USB"
## get IOMMU ID's
lspci -nn | grep -i USB
/**
* Added to /etc/default/grub commands
*
* ##AMD##
*
* iommu=pt amd_iommu=on vfio-pci.ids=1002:66af
*
* ##Intel##
*
* iommu=pt intel_iommu=on vfio-pci.ids=1002:66af
*
* ##Update grub with##
*
* sudo update-grub
*
**/
## rebind
Attach card to QEMU
Append to basic.sh macOS-Simple-KVM
-device pcie-root-port,bus=pcie.0,multifunction=on,port=1,chassis=1,id=port.1 \
-device vfio-pci,host=00:14.0,bus=port.1,multifunction=on
##bindandrun.sh
sudo ./macOS-Simple-KVM/driverctl/driverctl --nosave set-override 0000:00:14.0 vfio-pci
cd macOS-Simple-KVM
sudo ./basic.sh
### DEVICE SHOULD NOW BE PASSED THROUGH DIRECTLY TO VM. ###
if you only have one USB controller you need to hard power off your PC. You dont have a mouse or keyboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment