0%

pve安装macOS Big Sur

制作iso

fetch-macOS.py

生成一个BigSurInstaller.dmg

python3 fetch-macOS.py
hdiutil create -o BigSurInstaller.dmg -size 14g -layout GPTSPUD -fs HFS+J
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction
hdiutil detach -force "/Volumes/Install macOS Big Sur"
mv BigSurInstaller.dmg BigSurInstaller.iso

下载一个OpenCore-v10.iso

KVM-Opencore

OpenCore-v10.isoBigSurInstaller.iso上传到pve

新建虚拟机,配置如下

编辑 vim.tiny /etc/pve/qemu-server/101.conf

args: -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc

终端输入

echo "options kvm ignore_msrs=Y" >> /etc/modprobe.d/kvm.conf && update-initramfs -k all -u
echo 1 > /sys/module/kvm/parameters/ignore_msrs

将opencore放进efi

disk2s1 是opencorev10.iso disk0s1是安装BigSur的硬盘EFI分区

sudo dd if=/dev/disk2s1 of=/dev/disk0s1

直通设置

硬盘直通

qm set 592 -scsi2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC

显卡直通

加载vfio模块

编辑 /etc/modules

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

屏蔽gpu驱动

echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf 
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf

开启IOMMU

编辑 /etc/kernel/cmdline (编辑/etc/default/grub里的GRUB_CMDLINE_LINUX_DEFAULT没有启作用)

lspci -nn找到显卡的vendor_id, device_id

intremap=no_x2apic_optout intel_iommu=on vfio-pci.ids=<vendor_id>:<device_id>,<vendor_id>:<device_id> disable_vga=1

例如

intremap=no_x2apic_optout intel_iommu=on vfio-pci.ids=10de:1287,10de:0e0f disable_vga=1

更新、重启

update-initramfs -u -k all
pve-efiboot-tool refresh
reboot

验证

# kernel参数
cat /proc/cmdline
# IOMMU
dmesg |grep -E "DMAR|IOMMU"
# vfio
dmesg |grep -i vfio
# vfio-pci Kernel driver in use: vfio-pci
lspci -nnk
# IOMMU groups
find /sys/kernel/iommu_groups/ -type l

设置

显卡插上显示器,此时如果显示器没有信号,插拔一下显示器

OSK值

ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc

欢迎关注我的其它发布渠道