** Hackintosh ** Tips to make a bare metal MacOS


Recommended Posts

I have just started playing with VMs myself, but is it ok to passthrough all the CPU cores to the VM?
I have a 7980xe and if I passthourgh 36 threads my disk writes and speeds go to 1/10 of what they are supposed to be, even with passthrough SSDs. I just want to run MacOS so I want to keep unraid overhead to a minimum, but I found I need to reserve to it one core/two threads.

Link to comment
11 hours ago, nofdak said:

I'm attempting to get IvyBridge working on my Threadripper 3970X and having difficulties. Using "Penryn" works without issue, but as soon as I try IvyBridge, I get a hang while trying to load OpenCore. This happens at the TianoCore logo, before getting to the OpenCore boot selection.

 


...
OC: OcMiscEarlyInit...
OC: Loaded configuration of 12285 bytes

I'm using the latest OpenCore (5.5) with all drivers up to date as well. I'm clearly missing something, but I'm not sure what do do in the mean time other than just deal with Penryn and the lack of CPU features.

I have just yesterday managed to get Opencore 0.5.5 to boot into MacOS 10.15.3 using host CPU passthrough with QEMU, and this is my first attempt at moving from Clover to Opencore.

 

My setup: Asrock Taichi x570, AMD 3950x, Sapphire Nitro+ 580, Unraid 6.8.2.

The Mac VM is a music production environment.

 

To achieve this, I needed to follow this awesome Opencore setup guide pretty closely as if it were a bare metal install: https://aplus.rs/archives/ <-- check all the Feb 9 posts from here. I also spent a lot of time on this unraid forum, on the AMD-OSX forums, discord and reading their vanilla guide too.. all of which very useful.

I wanted to be able to boot natively into MacOS instead of Unraid, to test the difference between VM and 'native' performance. But it turns out even though QEMU abstracts much of the VM hardware, the same Opencore EFI is so far still useful in the context of a VM and boots ok.

 

For the 3950x I had to take the Opencore kernel patches as discussed in that guide and merge to Kernel>Patches sections of the Opencore config.plist (can do this easily using PlistEdit Pro). https://github.com/AMD-OSX/AMD_Vanilla/blob/opencore/17h/patches.plist

 

Once I'd followed the guide and manually built myself an EFI folder, I used OC-Tool to lint/validate the plist and download any missing dependencies. https://github.com/rusty-bits/OC-tool.

 

Finally, the EFI needs to be put into the opencore qcow2 image to use in the VM, so I grabbed `opencore.release.qcow2` from elsewhere in this forum, and mounted it on unraid using:

modprobe nbd
qemu-nbd --connect=/dev/nbd0 opencore.release.qcow2 <-- use network block device to mount qcow2 image into /dev/nbd0
mkdir EFI
mount /dev/nbd0p1 EFI
rm -rf EFI/* <-- delete all previous contents
cp -r <prepared EFI folder>/* EFI/ <-- copy in the new OC-Tool validated EFI folder
umount EFI
qemu-nbd -d /dev/nbd0 <-- need to do this before you can boot your VM again otherwise the volume is locked

 

In the Libvirt VM xml I am CPU pinning 16 cores and just passing the host CPU through :

  <cputune>
    <vcpupin vcpu="0" cpuset="2"/>
    <vcpupin vcpu="1" cpuset="18"/>
    <vcpupin vcpu="2" cpuset="3"/>
    <vcpupin vcpu="3" cpuset="19"/>
    <vcpupin vcpu="4" cpuset="4"/>
    <vcpupin vcpu="5" cpuset="20"/>
    <vcpupin vcpu="6" cpuset="5"/>
    <vcpupin vcpu="7" cpuset="21"/>
    <vcpupin vcpu="8" cpuset="6"/>
    <vcpupin vcpu="9" cpuset="22"/>
    <vcpupin vcpu="10" cpuset="7"/>
    <vcpupin vcpu="11" cpuset="23"/>
    <vcpupin vcpu="12" cpuset="8"/>
    <vcpupin vcpu="13" cpuset="24"/>
    <vcpupin vcpu="14" cpuset="9"/>
    <vcpupin vcpu="15" cpuset="25"/>
    <emulatorpin cpuset="0,4"/>
    <iothreadpin iothread="1" cpuset="7"/>
  </cputune>
  <cpu mode="host-passthrough" check="none"/>

 

and in my qemu:commandline section:

    <qemu:arg value="-cpu"/>
    <qemu:arg value="host,+hypervisor,migratable=no,-erms,+invtsc,kvm=on,+topoext,+invtsc,+avx,+aes,+xsave,+xsaveopt,+ssse3,+sse4_2,+popcnt,+arat,+pclmuldq,+pdpe1gb,+rdtscp,+vme,+umip,check"/>

 

I'm not sure about the CPU feature switches I have on there are right in this situation, but I can see the kernel patches working in the booted VM as the CPU is named correctly when doing:

$ sysctl -n machdep.cpu.brand_string
AMD Ryzen 9 3950X 16-Core Processor

 

Although, looking in 'About This Mac' shows a CPU of '3.5 Ghz Intel Core i5' (I did see something about forcing family Penryn in those 17h Kernel patches), but CPU performance has been pretty good so far, but still have a few things to sort out.

My ethernet is no longer en0 and built-in, I have no working wifi yet (I've got a Fenvi 919 but no room to fit it until I get a pci-e riser and move the GFX card out of the way first) so no working airdrop or sidecar (not sure if sidecar can work anyway?)...

 

Also I have a Gigabyte Titan Ridge card but haven't got this working yet either. Unraid detects it, but can't detect the egpu enclosure underneath yet or the 1080 ti inside it.

Booting into Ubuntu 19.10 directly on my machine does show the egpu enclosure though, so I'm hoping I just need to wait for an Unraid with 5.3+ kernel and Thunderbolt support compiled in, and perhaps boltctl (not sure), but I'm not in a desperate hurry to get that working in my macOS vm (I have a windows VM as well I want for gaming but lower priority right now).

Edited by gzilla
borked code blocks fixed
Link to comment
6 hours ago, Matteo said:

is it ok to passthrough all the CPU cores to the VM?

No. The computer hardware that the VM is running on is being partially created on the fly by the VM host. If you don't allow some processing power to that emulated hardware, it will be very slow, and your VM will slow down. How much the VM host needs to work depends on a bunch of variables, so you may need to experiment with the split between host and VM to determine the fastest mix. Sometimes even a 50/50 mix is faster, depending on what's available. That goes for RAM and CPU. To complicate things, it even matters WHICH pieces of RAM and CPU are allocated, not just the quantity. Tuning for max performance is hard.

Link to comment

Thanks @gzilla, those were helpful links. Now using `host` CPU gets me past the UEFI screen into the OpenCore boot selection menu, when it hangs upon booting. No debug text or anything, just a black screen. I thought I'd read somewhere that Threadripper 3 wasn't supported yet, so that might be the issue there.

 

I've also tried other different Intel CPU models. Penryn, IvyBridge, Nehalem, Haswell, Skylake-Client, etc. The only one that boots into macOS is Penryn. Every other model I tried either hangs at the TianoCore logo or hangs on a black screen after selecting the boot drive.

Edited by nofdak
Link to comment
8 hours ago, nofdak said:

Thanks @gzilla, those were helpful links. Now using `host` CPU gets me past the UEFI screen into the OpenCore boot selection menu, when it hangs upon booting. No debug text or anything, just a black screen. I thought I'd read somewhere that Threadripper 3 wasn't supported yet, so that might be the issue there.

 

I've also tried other different Intel CPU models. Penryn, IvyBridge, Nehalem, Haswell, Skylake-Client, etc. The only one that boots into macOS is Penryn. Every other model I tried either hangs at the TianoCore logo or hangs on a black screen after selecting the boot drive.

Did you see about that in the Troubleshooting section here? https://khronokernel.github.io/Opencore-Vanilla-Desktop-Guide/troubleshooting/troubleshooting.html (Black screen after picker)

See also: https://www.reddit.com/r/hackintosh/comments/euwwe5/opencore_black_screen_after_boot_picker_even

 

As I understand it, Threadripper should be supported in bare metal, so should also be supported through KVM, but I can't confirm that as I don't have one.

 

8 hours ago, david279 said:

@gzillahow is your GPU performance using those AMD patches? I found the GPU performance to be way below when using the AMD patches and just spoofing the Ivy bridge lead to way better performance out of my GPU.

GPU seems ok to me generally, however when running Ableton on a heavyish project something is throttling it quite a bit, but I haven't yet dug into what it might be. CPU in iStat shows about 25% usage across all 16 cores, so plenty to spare. Going to go back tonight to IvyBridge to see what the differences are (also have you tried Skylake-Server? That one worked well for me in Clover previously.)

It might be something to do with the USB (I've got a Focusrite 2i2), but I am passing through an entire Fresco Logic FL1100 USB 3.0 Host Controller so support should be perfect for the controller and the devices on it.

 

7 hours ago, nofdak said:

@david279 and/or @gzilla would you be able to share your KVM configs and EFI folders so I could reference them? I must be missing something if I'm unable to spoof Ivy Bridge at all if others are able to do it just fine.

I've attached them with redactions.

 

Now some questions for you guys:

Does anyone know if sidecar works with Ryzen host CPU pass-through? (or Intel emulated?)

Has anyone managed to get Gigabyte Titan Ridge TB3 card working in Mac VM with device passthroughs?

Shutting down or rebooting the OS seems to just pause the VM. Anyone know what I need to do to fix that?

I'm guessing configuring some devices in opencore will help get my NIC back to en0/builtin again? iCloud/iMessage so far doesn't seem to care.

 

libvirt.xml EFI.zip

Edited by gzilla
Link to comment
9 hours ago, david279 said:

@gzillahow is your GPU performance using those AMD patches? I found the GPU performance to be way below when using the AMD patches and just spoofing the Ivy bridge lead to way better performance out of my GPU.

Hmm.. definitely better CPU performance when back on my old Penryn again in Clover compared to the Opencore one. The Ableton glitching has mostly disappeared. But that could well just be me misconfiguring something somewhere, or not understanding something properly yet. Still pretty new to opencore, but love it already for its potential. No noticeable change in GPU performance.

 

I'll try IvyBridge again and let you know in a bit.

Link to comment
9 hours ago, gzilla said:

Hmm.. definitely better CPU performance when back on my old Penryn again in Clover compared to the Opencore one. The Ableton glitching has mostly disappeared. But that could well just be me misconfiguring something somewhere, or not understanding something properly yet. Still pretty new to opencore, but love it already for its potential. No noticeable change in GPU performance.

 

I'll try IvyBridge again and let you know in a bit.

AMD GPU performance issues is well-known with 17th AMD Vanilla patches( see here). You can use 15/16th patches or back to IvyBridge.

It is not a opencore related issue.

Link to comment
42 minutes ago, Leoyzen said:

AMD GPU performance issues is well-known with 17th AMD Vanilla patches( see here). You can use 15/16th patches or back to IvyBridge.

It is not a opencore related issue.

Ooo thanks Leoyzen, hadn't seen that before. Good to know. I wasn't sure if the other patches could be used or not. I will try those and see if it changes anything.

Link to comment
2 hours ago, phyzical said:

nah im trying to run virtiualization inside the mac produced by the container, use it for development purposes. docker virtualbox ect.

 

But i think the specs that are mocked dont allow vt-x to be detected mac OS vm side

It's interesting that vt-x not working....I'm on a AMD build so I just use docker-machine + virtualbox to developing, so I don't know much about Intel builds.

But it should work like linux or windows, so something must be wrong.

Link to comment
1 hour ago, Leoyzen said:

It's interesting that vt-x not working....I'm on a AMD build so I just use docker-machine + virtualbox to developing, so I don't know much about Intel builds.

But it should work like linux or windows, so something must be wrong.

Oh really? i am actually trying this on an amd cpu also.. to confirm are you using macinabox also? or is it a straight mac osx vm?

 

thats pretty much the functionality im chasing

Link to comment
3 hours ago, phyzical said:

Oh really? i am actually trying this on an amd cpu also.. to confirm are you using macinabox also? or is it a straight mac osx vm?

 

thats pretty much the functionality im chasing

I'm not using macinabox, I prefer configure the VM by hand.

The docker-machine + virtualbox is working fine for me now, here is the setup procedure: the link

Link to comment

@Leoyzen I’m running macinabox and ostensibly have everything working perfectly, but cannot for the life of me get hardware acceleration working for the RX580 I have passed through, despite the fact that it’s outputting a picture fine, shows up in system info fine, and I have the latest versions of Lilu and WEG installed. I’m considering killing the whole VM and building it by manually like you mentioned to see if that helps resolve the issue. Do you have any resources you’d recommend on getting started setting up the VM manually? 

Link to comment
17 hours ago, swallace said:

@Leoyzen I’m running macinabox and ostensibly have everything working perfectly, but cannot for the life of me get hardware acceleration working for the RX580 I have passed through, despite the fact that it’s outputting a picture fine, shows up in system info fine, and I have the latest versions of Lilu and WEG installed. I’m considering killing the whole VM and building it by manually like you mentioned to see if that helps resolve the issue. Do you have any resources you’d recommend on getting started setting up the VM manually? 

Do you do all the things I've mentioned?

  1. Make sure your smbios is MacPro7,1/iMacPro1,1
  2. Using Latest Lilu/WEB
  3. Put the audio and gfx in same bus

If you do so, post your screenshot of sysinfo and your graphic vendor

 

 

17 hours ago, david279 said:

I moved to 0.5.6 today and didn't even add the audio stuff into the config.plist. I remember when it was added to clover back when that's when clover started freezing on boot. Maybe I will try it at some point..

I'm using opencore but 0.5.5, some problem I can't solve, maybe your have some ideas?

 

  1. My 10gb nic not work in bare metal hackintosh(smalltree driver said there is "cable unpluged", but works well in a VM...
  2. I can't get hotkey working neither VM nor bare metal.... With PollAppleHotKeys=yes and KeySupport=yes.

 

I think maybe I should make a git repo for hackintosh VM user to build a bare metal hackintosh.

  • Thanks 1
Link to comment
58 minutes ago, Leoyzen said:

Do you do all the things I've mentioned?

  1. Make sure your smbios is MacPro7,1/iMacPro1,1
  2. Using Latest Lilu/WEB
  3. Put the audio and gfx in same bus

If you do so, post your screenshot of sysinfo and your graphic vendor

 

 

I'm using opencore but 0.5.5, some problem I can't solve, maybe your have some ideas?

 

  1. My 10gb nic not work in bare metal hackintosh(smalltree driver said there is "cable unpluged", but works well in a VM...
  2. I can't get hotkey working neither VM nor bare metal.... With PollAppleHotKeys=yes and KeySupport=yes.

 

I think maybe I should make a git repo for hackintosh VM user to build a bare metal hackintosh.

Funny you should say that i have a private repo setup just to keep a history of my config plist changes etc. Its not much but it keeps a history of my changes. 

Link to comment
17 hours ago, Leoyzen said:

Do you do all the things I've mentioned?

  1. Make sure your smbios is MacPro7,1/iMacPro1,1
  2. Using Latest Lilu/WEB
  3. Put the audio and gfx in same bus

If you do so, post your screenshot of sysinfo and your graphic vendor

@Leoyzen I just setup a fresh Catalina VM from scratch using macinabox, and configured the settings you recommend, just to be sure. 

 

My VM is setup as an iMacPro1,1 ; Lilu/WEG is installed and updated via Clover Configurator, and I have setup audio and gfx to be in the same bus. You can see that the GPU is showing up as passed through to system in the following image: 

1434151234_ScreenShot2020-03-03at11_17_49PM.png.06f40b8b9edaeb4706a7d75c412ae1da.png

My GPU is a Sapphire Radeon RX 580 Pulse (Model SKU 11265-05-20G)  (amazon link there, if helpful). Also, I've attached my VM's XML config below: 

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>MacinaboxCatalina</name>
  <uuid>8a3255ee-994c-46ca-ae12-a903b3eb8839</uuid>
  <description>MacOS Catalina</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="catalina.png" os="Catalina"/>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-3.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/mnt/user/domains/MacinaboxCatalina/ovmf/OVMF_CODE.fd</loader>
    <nvram>/mnt/user/domains/MacinaboxCatalina/ovmf/OVMF_VARS.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none'/>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/mnt/user/domains/MacinaboxCatalina/Clover.qcow2'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/MacinaboxCatalina/Catalina-install.img'/>
      <target dev='hdd' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/MacinaboxCatalina/macos_disk.img'/>
      <target dev='hde' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:de:f0:40'/>
      <source bridge='br0'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0e' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0e' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc52b'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk='/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>
</domain>

 

Link to comment

@swallace It is very strang, you don't even have metal support according to your screenshots.

Check this:

 

1. What is your Lilu/WEG version? Don't use clover updater, manually download from github and place them into kext/others.

2. What is the BIOS version of your graphic?Download from techpower and add it to your xml.

3. Then check your Lilu/WEG is loaded(you can get the log from hackintool)

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.