This commit is contained in:
James Cuzella 2025-05-06 15:30:11 -06:00 committed by GitHub
commit 8faaae8eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 9 deletions

Binary file not shown.

View File

@ -52,12 +52,14 @@ args=(
-smbios type=2
-device ich9-intel-hda -device hda-duplex
-device ich9-ahci,id=sata
-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore/OpenCore.qcow2"
-device ide-hd,bus=sata.2,drive=OpenCoreBoot
# Setup SSD trim support to keep qcow2 image sparse
-blockdev driver=qcow2,node-name=OpenCoreBoot,file.filename="$REPO_PATH/OpenCore/OpenCore.qcow2",file.aio=threads,file.driver=file,discard=unmap,detect-zeroes=unmap
-device ide-hd,bus=sata.2,drive=OpenCoreBoot,id=oc,rotation_rate=1
-device ide-hd,bus=sata.3,drive=InstallMedia
-drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",format=raw
-drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2
-device ide-hd,bus=sata.4,drive=MacHDD
# Again, setup SSD trim so macOS disk qcow2 image remains sparse
-blockdev driver=qcow2,node-name=MacHDD,file.driver=file,file.filename="$REPO_PATH/mac_hdd_ng.img",file.aio=threads,discard=unmap,detect-zeroes=unmap
-device ide-hd,bus=sata.4,drive=MacHDD,id=macssd,rotation_rate=1
# -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27
-netdev user,id=net0,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27
# -netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 # Note: Use this line for High Sierra

View File

@ -159,7 +159,11 @@ processors work just fine (even for macOS Sonoma).
qemu-img create -f qcow2 mac_hdd_ng.img 256G
```
NOTE: Create this HDD image file on a fast SSD/NVMe disk for best results.
> [!NOTE]
> Create this HDD image file on a fast SSD/NVMe disk for best results.
>
> To enable TRIM support inside macOS, you must run: `sudo trimforce enable` from
> _inside the VM_ after it boots.
* Now you are ready to install macOS 🚀
@ -236,6 +240,12 @@ work, patience, and a bit of luck (perhaps?).
### Post-Installation
* Run `sudo trimforce enable` to enable TRIM support on the macOS hard drive.
- NOTE: This is important so the `qcow2` image remains sparse, and does not
keep growing in size, even after deleting files to free space in the VM.
- This is supported by QEMU's `qcow2` image format block driver through the
`discard=unmap,detect-zeroes=unmap` parameters.
* See [networking notes](networking-qemu-kvm-howto.txt) on how to setup networking in your VM, outbound and also inbound for remote access to your VM via SSH, VNC, etc.
* To passthrough GPUs and other devices, see [these notes](notes.md#gpu-passthrough-notes).

View File

@ -61,16 +61,16 @@
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='writeback' io='threads'/>
<driver name='qemu' type='qcow2' cache='writeback' io='threads' discard='unmap' detect_zeroes='unmap'/>
<source file='/home/CHANGEME/OSX-KVM/OpenCore/OpenCore.qcow2'/>
<target dev='sda' bus='sata'/>
<target dev='sda' bus='sata' rotation_rate='1'/>
<boot order='2'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='writeback' io='threads'/>
<driver name='qemu' type='qcow2' cache='writeback' io='threads' discard='unmap' detect_zeroes='unmap'/>
<source file='/home/CHANGEME/OSX-KVM/mac_hdd_ng.img'/>
<target dev='sdb' bus='sata'/>
<target dev='sdb' bus='sata' rotation_rate='1'/>
<boot order='1'/>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>