Add macos_release VM configuration variable. Tune macOS based on release

Tune Qemu optimisations based on the macOS release, or fallback to lowest common supported options if macos_release is not specified.
pull/61/head
Martin Wimpress 3 years ago
parent c240a17bda
commit 561d04a2b5
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
  1. 12
      README.md
  2. 41
      quickemu
  3. 9
      quickget

@ -162,9 +162,13 @@ The default macOS configuration looks like this:
guest_os="macos"
img="macos-big-sur/RecoveryImage.img"
disk_img="macos-big-sur/disk.qcow2"
macos_release="big-sur"
```
* The `guest_os="macos"` line instructs Quickemu to optimise for macOS.
* The `macos_release="big-sur"` line instructs Quickemu to optimise for a particular macOS release.
* For example VirtIO Network and Memory Ballooning are available in Big Sir, but not previous releases.
* And VirtIO Block Media (disks) are supported/stable in Catalina and newer.
* If you want to disable VirtIO Block Media and use SATA emulation add `virtio_blk="off"` to your configuration.
* `quickget` disables VirtIO Block Media for High Sierra and Mojave by default since it is not supported on those releases.
@ -181,10 +185,12 @@ There are some considerations when running macOS via Quickemu.
* Big Sur
* Optimised by default
* Host CPU vendor is detected and guest CPU is optimised accordingly.
* [VirtIO block device](https://www.kraxel.org/blog/2019/06/macos-qemu-guest/) is used for the system disk where supported.
* [VirtIO Block Media](https://www.kraxel.org/blog/2019/06/macos-qemu-guest/) is used for the system disk where supported.
* [VirtIO `usb-tablet`](http://philjordan.eu/osx-virt/) is used for the mouse.
* `vmxnet3` network device is used.
* USB host pass-through is limited to UHCI (USB 2.0).
* VirtIO Network (`virtio-net`) is supported and enabled on macOS Big Sur but previous releases use `vmxnet3`.
* VirtIO Memory Ballooning is supported and enabled on macOS Big Sur but disabled for other support macOS releases.
* USB host pass-through is limited to UHCI (USB 2.0) on macOS Catalina and earlier.
* macOS Big Sur support XHCI (USB 3.0) host-passthrough.
* Display resolution can only be changed via macOS System Preferences.
* macOS Big Sur has no audio, but Full Duplex audio works on macOS Catalina is previous releases.
* File sharing between guest and host is available via [virtio-9p](https://wiki.qemu.org/Documentation/9psetup).

@ -137,6 +137,7 @@ function vm_boot() {
local GUEST_TWEAKS=""
local HOST_CPU=""
local MAC_MISSING=""
local MAC_VIRTIO_BLK="ide-hd,bus=ahci.2"
local NET_DEVICE="virtio-net"
local OSK=""
local QEMU_VER=""
@ -205,7 +206,6 @@ function vm_boot() {
disk="16G"
;;
macos)
BALLOON=""
#https://www.nicksherlock.com/2020/06/installing-macos-big-sur-on-proxmox/
if [ "${HOST_CPU}" == "AuthenticIntel" ]; then
CPU="-cpu host,kvm=on,vendor=GenuineIntel,+hypervisor,+invtsc,+kvm_pv_eoi,+kvm_pv_unhalt"
@ -219,8 +219,36 @@ function vm_boot() {
OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m')
GUEST_TWEAKS="-device isa-applesmc,osk=${OSK} -global kvm-pit.lost_tick_policy=discard"
disk="64G"
# Tune Qemu optimisations based on the macOS release, or fallback to lowest
# common supported options if none is specificed.
# * VirtIO Block Media doesn't work in High Sierra or Mojave
# * VirtIO Network is supported in Big Sur
# * VirtIO Memory Balloning is supported in Big Sur (https://pmhahn.github.io/virtio-balloon/)
# * VirtIO RNG is supported in Big Sur, but exposed to all guests.
case ${macos_release} in
catalina)
BALLOON=""
MAC_DISK_DEV="virtio-blk-pci"
NET_DEVICE="vmxnet3"
USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci"
;;
big-sur)
BALLOON="-device virtio-balloon"
MAC_DISK_DEV="virtio-blk-pci"
NET_DEVICE="virtio-net"
USB_HOST_PASSTHROUGH_CONTROLLER="qemu-xhci"
;;
*)
# Backwards compatibility if no macos_release is specified.
# Also safe catch all for High Sierra and Mojave
BALLOON=""
MAC_DISK_DEV="ide-hd,bus=ahci.2"
NET_DEVICE="vmxnet3"
USB_HOST_PASSTHROUGH_CONTROLLER="usb-ehci"
;;
esac
;;
windows)
CPU="-cpu host,kvm=on,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_frequencies,kvm_pv_unhalt,hv_reenlightenment,hv_relaxed,hv_spinlocks=8191,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vendor_id=1234567890ab,hv_vpindex"
@ -556,13 +584,9 @@ function vm_boot() {
-drive id=RecoveryImage,if=none,format=raw,file="${img}",cache=none,aio=native)
fi
# shellcheck disable=SC2054
case ${virtio_blk} in
off) args+=(-device ide-hd,bus=ahci.2,drive=SystemDisk);;
on) args+=(-device virtio-blk-pci,drive=SystemDisk);;
esac
# shellcheck disable=SC2054,SC2206
args+=(-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",cache=none,aio=native ${STATUS_QUO})
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",cache=none,aio=native ${STATUS_QUO})
else
# shellcheck disable=SC2054,SC2206
args+=(-device virtio-blk-pci,drive=SystemDisk
@ -656,11 +680,12 @@ floppy=""
guest_os="linux"
img=""
iso=""
macos_release=""
port_forwards=()
preallocation="metadata"
ram=""
usb_devices=()
virtio_blk="on"
DELETE=0
FULLSCREEN=""

@ -148,12 +148,9 @@ EOF
echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf"
fi
# VirtIO Block Media doesn't work in High Sierra or Mojave so use SATA
case ${RELEASE} in
high-sierra|mojave)
echo "virtio_blk=\"off\"" >> "${OS}-${RELEASE}.conf"
;;
esac
if [ "${OS}" == "macos" ]; then
echo "macos_release=\"${RELEASE}\"" >> "${OS}-${RELEASE}.conf"
fi
fi
}

Loading…
Cancel
Save