vivekmiyani / OSX_GVT-D

Guide to pass iGPU to MacOS KVM guest.
94 stars 8 forks source link

Issues re: 2. Configure Opencore #9

Open mkiiim opened 2 years ago

mkiiim commented 2 years ago

When I initially ran the build script, ./opencore-rebuild.sh

I got an error regarding guestfish:

./opencore-image-ng.sh: line 120: guestfish: command not found
ERROR: starting guestfish failed

So I installed (apt-get install) libguestfs-tools When I tried to re-run the script I got this error:

### partition disk image
# part-init /dev/sda gpt
# part-add /dev/sda p 2048 300000
# part-add /dev/sda p 302048 -2048
# part-set-gpt-type /dev/sda 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B
# part-set-bootable /dev/sda 1 true
# mkfs vfat /dev/sda1 label:EFI
# mkfs vfat /dev/sda2 label:OpenCoreBoot
libguestfs: error: mkfs: vfat: /dev/sda2: mkfs.vfat: Label can be no longer than 11 characters

For reference I am on proxmox kernel version: Linux 5.13.19-2-pve #1 SMP PVE 5.13.19-4 PVE manager version: pve-manager/7.1-7/df5740ad

Also, hardware is macmini 6,2 (late 2012) with core i7 3720QM and Intel HD Graphics 4000.

Thanks in advance!

vivekmiyani commented 2 years ago

This line has OpenCoreBoot label. Having 12 characters. Try to rename it to something else.

https://github.com/vivekmiyani/OSX_GVT-D/blob/43bee82860475af73e2bd32fbac126042bb55113/OpenCore-Catalina/opencore-image-ng.sh#L135

I guess you also need to change these occurrences with new name.: https://github.com/vivekmiyani/OSX_GVT-D/search?q=OpenCoreBoot

Edit:

Refer OSX-KVM repo they have renamed this to OpenCore.

mkiiim commented 2 years ago

in lieu of trying to solve the label length issue, I just inserted a pause into the script and copied the EFI contents back into the Opencore EFI partition of my MacOS X VM.

To make work with my proxmox VM, I then split the the boot.sh into 2 files. One for pre VM launch, and the second for post VM shutdown. I think this effectively does the same thing for proxmox VMs?

scripts look like this:

Pre VM launch:

# Set your iGPU pci id (fetched from lspci)
IGPU_PCIID="8086 0166"

modprobe vfio_pci
modprobe vfio
echo 0000:00:02.0 > /sys/bus/pci/devices/0000:00:02.0/driver/unbind
echo $IGPU_PCIID > /sys/bus/pci/drivers/vfio-pci/remove_id
echo $IGPU_PCIID > /sys/bus/pci/drivers/vfio-pci/new_id
modprobe -r i915

Post VM shutdown

modprobe -r vfio_pci
modprobe -r vfio
modprobe i915

In the end, the VM runs, and as was the case prior to going down the path of implementing OSX_GVT-D, I am able to boot the Monterey VM. The iGPU does show up on the list of Graphics/Displays ... Apple | About This Mac | System Report | Graphics/Displays ... it shows up among a list of two. The first item is "Display" which shows 7MB VRAM and the second is "Intel HD Graphics 4000" which has no VRAM.

And this is where this journey has taken me so far... The iGPU, as far as I can tell, has not/is not utilized by OS/system after launch, nor does it seem to be recognized/utilized by an apps that I imagine would require it.

I should also note that while the hdmi output from the macmini just displays a black screen, I am able to proxmox web console and/or macOS screen share into the VM.

For reference, my VM .conf is as follows

agent: 1
args: -device isa-applesmc,osk="..." -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -global nec-usb-xhci.msi=off -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off -cpu host,kvm=on,vendor=GenuineIntel,+kvm_pv_unhalt,+kvm_pv_eoi,+hypervisor,+invtsc
balloon: 0
bios: ovmf
boot: order=virtio0
cores: 4
cpu: Penryn
efidisk0: local-lvm:vm-2000-disk-1,efitype=4m,size=4M
hostpci0: 0000:00:02.0,pcie=1,x-vga=1
machine: q35
memory: 4096
meta: creation-qemu=6.1.0,ctime=1652798836
name: macos-monterey
net0: virtio=06:AA:8E:70:6D:23,bridge=vmbr0,firewall=1
numa: 1
ostype: other
scsihw: virtio-scsi-pci
smbios1: uuid=...
sockets: 1
vga: virtio
virtio0: local-lvm:vm-2000-disk-0,cache=unsafe,discard=on,size=64G
vmgenid: ...

What're my next steps?