LOADING STUFF...

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

PVE教程3年前 (2022)更新 ypng
57 0 0
PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)
PVE安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

​​苹果版本说明

版本发行时间最新版本
macOS Monterey202112.3.1
macOS Big Sur202011.6.5
macOS Catalina201910.15.7

一、制作macos镜像

这一步为非必须的,如果想省事可以直接去下载已经制作好的BigSur-recovery.img和Monterey-recovery.img,点击下载

在Mac上需要安装xcode环境,在linux上需要安装qemu-utils环境,然后下载GitHub上的一个OSX-KVM仓库,这个仓库里有bigsur和monterey制作执行脚本。

macOS上操作

xcode-select --install git clone https://github.com/thenickdude/OSX-KVM.git cd OSX-KVM/scripts # 也可以cd monterey cd bigsur # make Monterey-recovery.img make BigSur-full.img

Linux上操作

apt install qemu-utils make git clone https://github.com/thenickdude/OSX-KVM.git cd OSX-KVM/scripts # 也可以cd monterey cd bigsur # make Monterey-recovery.img make BigSur-recovery.img

make命令执行完成之后,在OSX-KVM/scripts/bigsur或OSX-KVM/scripts/monterey的目录下,会生成对应的img文件:BigSur-recovery.img和Monterey-recovery.img。这两个文件就是我们的系统还原安装包,要上传到PVE的镜像中的。下面这个是我在Ubuntu上制作的Monterey镜像,这个版本的MacOS也比较新,下面的操作均以monterey为主。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

准备OpenCore镜像

下载最新版本的OpenCore.iso.gz文件,解压后,将对应ISO文件上传至Proxmox的ISO存储目录(通常为/var/lib/vz/template/iso),目前最新版为OpenCore-v16.iso。

把BigSur-recovery.img或Monterey-recovery.img以及OpenCore-v16.iso上传到PVE的镜像中。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

获取OSK身份验证密钥

macOS检查它是否在真正的Mac硬件上运行,并拒绝在第三方硬件上启动。您可以通过从真实Mac硬件中读取身份验证密钥(OSK 密钥)来解决此问题。将下面代码保存为smc_read.c,并在改文件的路径下,运行gcc -o smc_read smc_read.c -framework IOKit,前提是mac必须安装了xcode环境。

​/*  * smc_read.c: Written for Mac OS X 10.5. Compile as follows:  *  * gcc -Wall -o smc_read smc_read.c -framework IOKit  */ ​ #include <stdio.h> #include <IOKit/IOKitLib.h> ​ typedef struct {     uint32_t key;     uint8_t  __d0[22];     uint32_t datasize;     uint8_t  __d1[10];     uint8_t  cmd;     uint32_t __d2;     uint8_t  data[32]; } AppleSMCBuffer_t; ​ int main(void) {     io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault,                                IOServiceMatching("AppleSMC"));     if (!service)         return -1; ​     io_connect_t port = (io_connect_t)0;     kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port);     IOObjectRelease(service);     if (kr != kIOReturnSuccess)         return kr; ​     AppleSMCBuffer_t inputStruct = { 'OSK0', {0}, 32, {0}, 5, }, outputStruct;     size_t outputStructCnt = sizeof(outputStruct); ​     kr = IOConnectCallStructMethod((mach_port_t)port, (uint32_t)2,              (const void*)&inputStruct, sizeof(inputStruct),              (void*)&outputStruct, &outputStructCnt);     if (kr != kIOReturnSuccess)         return kr; ​     int i = 0;     for (i = 0; i < 32; i++)         printf("%c", outputStruct.data[i]); ​     inputStruct.key = 'OSK1';     kr = IOConnectCallStructMethod((mach_port_t)port, (uint32_t)2,              (const void*)&inputStruct, sizeof(inputStruct),              (void*)&outputStruct, &outputStructCnt);     if (kr == kIOReturnSuccess)         for (i = 0; i < 32; i++)             printf("%c", outputStruct.data[i]); ​     printf("\n"); ​     return IOServiceClose(port); }

行gcc -o smc_read smc_read.c -framework IOKit会生成一个smc_read的可执行文件,点击运行可以获得OSK。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这里提供一下这个OSK:ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc

二、配置Monterey虚拟机

创建一个MacOS-Monterey的虚拟机。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

os选择我们上传过来的

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这个配置是关键,每一项都安装下面的来。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

硬盘配置如下,给了100G。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

CPU给4核。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

内存配置8G。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

网络这里配置成VirtIO(paravirtualized)。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

确认并完成PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

把安装的镜像文件以CD/DVD的方式添加过来。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

三、macos虚拟机启动项配置

打开主节点的shell窗口,为了避免循环引导输入以下命令,并回车:

echo “options kvm ignore_msrs=Y” >> /etc/modprobe.d/kvm.conf && update-initramfs -k all -u

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

编辑启动项文件,输入以下命令,注意这里的107对应创建虚拟机的VM ID:

nano /etc/pve/qemu-server/108.conf

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

然后在文件的第一行增加一行,根据不同类型的CPU进行配置,参数如下:

Intel CPU

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

AMD CPU

args: -device isa-applesmc,osk=”ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc” -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -cpu Penryn,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+avx2,+aes,+fma,+fma4,+bmi1,+bmi2,+xsave,+xsaveopt,check

然后将两处media=cdrom修改为cache=unsafe。CRRL + X然后输入Y进行保存。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

四、安装Mac

然后启动虚拟机,就可以进入这个页面,注意千万不要按ESC键。选择我们分配的100G的磁盘,回车。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

我们把磁盘格式化一下,选择Disk Utility,然后点击continue。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

选择第一个100G的磁盘,点击erase进行擦除。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这块盘取名为macMonterey,安装完成之后这个名称会在启动的时候显示。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击done。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击左上角的红点,关闭该窗口。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

选择第二项Reinstall MacOS。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击continue。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击agree。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

选择这款盘,然后点击install。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这时候macos Monterey就在安装啦,耐心等待一下。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这个时候会重启一两次,每次都选第一个盘符。直到第二块盘变成我们格式化的macMonterey盘符。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用) PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用) PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

五、初始化Mac系统

进入Mac系统选择第二个盘符,我们格式化之后的这个macMonterey盘。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

为了方便起见,安装好了之后,可以进行启动项设置,把100G这款盘调整到首选项启动。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

选择国家为中国大陆,并点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击not now。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点就Not Now

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

登陆自己的apple id,如果没有可以在线申请账号。我这里就不设置账号登录了,直接点击Set Up Later。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击Skip。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击Agree。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

输入mac系统的账号和密码。点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

点击继续。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

这样就进入到Mac系统的页面啦。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

版本系统如下。

PVE系列教程(十四)、安装黑苹果最新系统MacOS Monterey(BigSur、Monterey通用)

也可以在PVE的硬件设置选项卡,设置硬件直通,比如显卡、USB、声卡等直通给mac,就可以当做主力机使用了。

大功告成,enjoy it。

发布于 上海

© 版权声明

相关文章

暂无评论

暂无评论...