Skip to content

Commit

Permalink
adjust macos boot formula
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxVinyards committed May 22, 2024
1 parent 22ea52d commit 4eb36aa
Showing 1 changed file with 48 additions and 33 deletions.
81 changes: 48 additions & 33 deletions qqX.builtins/freebird/quickemu
Original file line number Diff line number Diff line change
Expand Up @@ -523,45 +523,60 @@ function vm_boot() {
esac
;;
macos)
# https://www.nicksherlock.com/2020/04/installing-macos-catalina-on-proxmox-with-opencore/
# https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/
# Penryn https://github.com/search?q=repo%3Akholia%2FOSX-KVM%20%20GenuineIntel&type=code
# https://en.wikipedia.org/wiki/MacOS_version_history#Releases
# quickget current list: high-sierra mojave catalina big-sur monterey ventura sonoma

# A CPU with SSE4.1 support is required for >= macOS Sierra
# A CPU with SSE4.2 support is required for >= macOS Catalina
# A CPU with AVX2 support is required for >= macOS Ventura

# qqX mod based on
# https://github.com/quickemu-project/quickemu/issues/1114#issuecomment-2115516935
# https://github.com/quickemu-project/quickemu/issues/1114#issuecomment-2120274893
# https://github.com/quickemu-project/quickemu/pull/1225#issuecomment-2117555805

CPU_MODEL="Haswell-v2"
CPU="-cpu ${CPU_MODEL},kvm=on,vendor=GenuineIntel,-pdpe1gb,+avx,+sse,+sse2,+ssse3,vmware-cpuid-freq=on"
# A CPU with fma is required for Metal support

case ${macos_release} in
ventura|sonoma)
if check_cpu_flag sse4_2 && check_cpu_flag avx2; then
# noTSX stops cpuid errors https://duckduckgo.com/?t=ffab&q=CPUID.07H%3AEBX.rtm+%5Bbit+11%5D&ia=web also cited by NickSherlock for Ventura install
CPU="-cpu Haswell-noTSX-IBRS,kvm=on,vendor=GenuineIntel,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 and AVX2 support."
exit 1
fi
;;
catalina|big-sur|monterey)
if check_cpu_flag sse4_2; then
# Used in past versions: +movbe,+smep,+xgetbv1,+xsavec,+avx2
# Warn on AMD: +fma4,+pcid
CPU="-cpu Haswell-noTSX-IBRS,kvm=on,vendor=GenuineIntel,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 support."
exit 1
fi
;;
*)
if check_cpu_flag sse4_1; then
# as above but 4.1 (for older hosts)
CPU="-cpu Penryn,kvm=on,vendor=GenuineIntel,+aes,+avx,+bmi1,+bmi2,+fma,+hypervisor,+invtsc,+kvm_pv_eoi,+kvm_pv_unhalt,+popcnt,+ssse3,+sse4.1,vmware-cpuid-freq=on,+xsave,+xsaveopt,check"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.1 support."
exit 1
fi
;;
ventura|sonoma)
# A CPU with AVX2 support is required for >= macOS Ventura
if check_cpu_flag sse4_2 && check_cpu_flag avx2; then
CPU+=",+avx2,+sse4.1,+sse4.2"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 and AVX2 support."
echo " Try macOS Monterey or Big Sur."
exit 1
fi ;;
catalina|big-sur|monterey)
# A CPU with SSE4.2 support is required for >= macOS Catalina
if check_cpu_flag sse4_2; then
CPU+=",+sse4.1,+sse4.2"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.2 support."
exit 1
fi ;;
*)
# A CPU with SSE4.1 support is required for >= macOS Sierra
if check_cpu_flag sse4_1; then
CPU+=",+sse4.1"
else
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.1 support."
exit 1
fi ;;
esac

for FLAG in abm aes apic arat bmi1 bmi2 clflush cmov cx8 cx16 de \
erms f16c fma fp87 fsgsbase fxsr invpcid invtsc lahf_lm lm \
mca mce mmx movbe mpx msr mtrr nx pae pat pcid pge pse popcnt pse36 \
rdrand rdtscp sep smep syscall tsc tsc_adjust vaes vbmi2 vmx vpclmulqdq \
x2apic xgetbv1 xsave xsaveopt; do
if check_cpu_flag "$FLAG"; then
QEMU_CPU_FLAG="${FLAG}"
QEMU_CPU_FLAG="${QEMU_CPU_FLAG//_/-}"
CPU+=",+${QEMU_CPU_FLAG}"
fi
done

OSK=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m')
# Disable S3 support in the VM to prevent macOS suspending during install
GUEST_TWEAKS="-global kvm-pit.lost_tick_policy=discard -global ICH9-LPC.disable_s3=1 -device isa-applesmc,osk=${OSK}"
Expand Down

0 comments on commit 4eb36aa

Please sign in to comment.