Jump to content
Leoyzen

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

669 posts in this topic Last Reply

Recommended Posts

16 minutes ago, Leoyzen said:

 The replacement is correct, but that did not mean that the "NOOP" nor the "Debug" version of opencore will work ,because from the github, it only for debug purpose, which mean it did not resolve the bug, but the way to get more debug information

Yes, sure, what I was saying was to be able to use the noopt version to have more info for the bug, but unluckily both noopt and debug versions of ovmf don't run on unraid..

Share this post


Link to post
Posted (edited)
On 4/25/2020 at 5:33 PM, Daniel Ehrhardt said:

Does someone was able to get Docker working?

 

As far as I know, you need nested virtualization, so you need to have the vmx flag in the cpu futures in your vm.

I tried with my 2x e5-2687w and the following steps should enable nested virtualization (I checked only for the vmx flag, I didn't try to install any docker or vm in vm):

1- in your mac os vm type into terminal "sysctl -a | grep machdep.cpu" and check that the vmx flag is not there

2- shutdown all virtual machines

3- in unraid terminal, or through ssh, type "modprobe -r kvm_intel"

4- in unraid terminal, or through ssh, type "modprobe kvm_intel nested=1"

5- check that nested is activated: in unraid terminal, or through ssh, type "systool -m kvm_intel -v | grep nested"  ----> it should return Y

6- check in the xml of your virtual machine that you have: cpu mode='host-passthrough'

7- check in the xml of your virtual machine that you DON'T have "Penryn" in custom args; qemu:arg value='host' will work

8- start your mac os vm and check from the terminal for the vmx flag: "sysctl -a | grep machdep.cpu"

vmx.png.a94ea57217cec0c181b15a7ac1679ac2.png

Note 1: this is not persistent, try with non persistent mode, then if it works we will see how to make it persistent

Note 2: (untested) if you have amd processor:

a) in step 3 type "modprobe -r kvm_amd"

b) in step 4 type "modprobe kvm_amd nested=1"

c) in step 5 type "systool -m kvm_amd -v | grep nested"

 

Check also in the mac os vm with the command "sysctl kern.hv_support" that the cpu complies with all the Hypervisor.framework requirements : output should be "kern.hv_support: 1"

kern.png.8bf38f366cd40c27c0d1ad9c3b3a4a4d.png

Docker will not work with "kern.hv_support: 0"

 

Then,you need to check for the bios and you can use voltageshift (attached version for 10.15) and read the cpu register 0x3a: it should return 0x5 or 0x100005

Extract voltageshift, give proper permissions to the kext:

sudo chmod -R 755 VoltageShift.kext

sudo chown -R root:wheel VoltageShift.kext

 

cd to the folder and run in terminal:
sudo ./voltageshift read 0x3a

voltageshift.png.76f384f6e084e55b6163036f6b57fb54.png

 

Let us know

voltageshift-10.15.zip

Edited by ghost82

Share this post


Link to post
Posted (edited)
daniel@daniels-iMac voltageshift-10 % sudo chmod -R 755 VoltageShift.kext
Password:
daniel@daniels-iMac voltageshift-10 % sudo chown -R root:wheel VoltageShift.kext
daniel@daniels-iMac voltageshift-10 % sudo ./voltageshift read 0x3a
RDMSR 3a returns value 0x5
(00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000101)
daniel@daniels-iMac voltageshift-10 % 
daniel@daniels-iMac ~ % sysctl -a | grep machdep.cpu
machdep.cpu.max_basic: 13
machdep.cpu.max_ext: 2147483656
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel Core 2 Duo P9xxx (Penryn Class Core 2)
machdep.cpu.family: 6
machdep.cpu.model: 23
machdep.cpu.extmodel: 1
machdep.cpu.extfamily: 0
machdep.cpu.stepping: 3
machdep.cpu.feature_bits: 11437491729185111039
machdep.cpu.extfeature_bits: 4967106816
machdep.cpu.signature: 67187
machdep.cpu.brand: 0
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 HTT SSE3 VMX SSSE3 CX16 SSE4.1 SSE4.2 x2APIC POPCNT AES VMM PCID XSAVE OSXSAVE AVX1.0
machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI
machdep.cpu.logical_per_package: 2
machdep.cpu.cores_per_package: 2
machdep.cpu.microcode_version: 1
machdep.cpu.processor_flag: 0
machdep.cpu.mwait.linesize_min: 0
machdep.cpu.mwait.linesize_max: 0
machdep.cpu.mwait.extensions: 3
machdep.cpu.mwait.sub_Cstates: 0
machdep.cpu.thermal.sensor: 0
machdep.cpu.thermal.dynamic_acceleration: 0
machdep.cpu.thermal.invariant_APIC_timer: 0
machdep.cpu.thermal.thresholds: 0
machdep.cpu.thermal.ACNT_MCNT: 0
machdep.cpu.thermal.core_power_limits: 0
machdep.cpu.thermal.fine_grain_clock_mod: 0
machdep.cpu.thermal.package_thermal_intr: 0
machdep.cpu.thermal.hardware_feedback: 0
machdep.cpu.thermal.energy_policy: 0
machdep.cpu.xsave.extended_state: 7 832 832 0
machdep.cpu.xsave.extended_state1: 1 0 0 0
machdep.cpu.arch_perf.version: 0
machdep.cpu.arch_perf.number: 0
daniel@daniels-iMac voltageshift-10 % sysctl kern.hv_support
kern.hv_support: 0
daniel@daniels-iMac voltageshift-10 % 

I did all steps you wrote.
Still have hv_support 0. 
Does hv_support return 1 at your environment?

mac.xmlI attached my xml File

 

Edited by Daniel Ehrhardt

Share this post


Link to post
Posted (edited)
21 minutes ago, Daniel Ehrhardt said:

Does hv_support return 1 at your environment?

mmm, yes it returns 1, if it is 0 docker will not work..can you delete the line in the xml for vmx in the cpu section (no need for it if cpu supports vm-x and it is passed through), what is your cpu and what mac (smbios) are you virtualizing?

 

I noticed that you have also penryn in your custom qemu args and this is not correct for cpu passthrough, I will look more into details tomorrow.

Edited by ghost82

Share this post


Link to post
Posted (edited)
53 minutes ago, ghost82 said:

mmm, yes it returns 1, if it is 0 docker will not work..can you delete the line in the xml for vmx in the cpu section (no need for it if cpu supports vm-x and it is passed through), what is your cpu and what mac (smbios) are you virtualizing?

 

I noticed that you have also penryn in your custom qemu args and this is not correct for cpu passthrough, I will look more into details tomorrow.

Thank You!! 

 

Could you post your xml file?
Then i can compare.

 

CPU:
Intel® Core™ i5-7600K CPU @ 3.80GHz
BIOS:

image.png.f3c48e1dfd821a3df5f45b30d762e27d.png

 

i tried to add <qemu:arg value='host,kvm=on,+invtsc,+hypervisor'/> but then the vm does not boot

Edited by Daniel Ehrhardt

Share this post


Link to post
1 hour ago, Daniel Ehrhardt said:

Thank You!! 

 

Could you post your xml file?
Then i can compare.

 

CPU:
Intel® Core™ i5-7600K CPU @ 3.80GHz
BIOS:

image.png.f3c48e1dfd821a3df5f45b30d762e27d.png

 

i tried to add <qemu:arg value='host,kvm=on,+invtsc,+hypervisor'/> but then the vm does not boot

Try this for your host passthrough

 

 <qemu:arg value='host,vendor=GenuineIntel,+hypervisor,+invtsc,kvm=on,+fma,+avx,+avx2,+aes,+ssse3,+sse4_2,+popcnt,+sse4a,+bmi1,+bmi2'/>

 

Share this post


Link to post
1 hour ago, Daniel Ehrhardt said:

i tried to add <qemu:arg value='host,kvm=on,+invtsc,+hypervisor'/> but then the vm does not boot

See earlier post regarding Kernel patch required to boot CPUs that aren’t Penryn it’s also mentioned in the first post if this thread section 1.2

Are you using clover or opencore this will also make a difference to how you patch it 

Share this post


Link to post

He has a 7600k that should boot without any cpu patches. Its a native supported cpu.

Share this post


Link to post
1 hour ago, david279 said:

He has a 7600k that should boot without any cpu patches. Its a native supported cpu.

My 8700 requires the topology patch and his will too as his XML shows him using cores and threads if he swaps just to using sockets 

 

<topology sockets='2’ cores='1’ threads='1'/>

 

rather than 

 

<topology sockets='1' cores='2' threads='1'/>

 

it will work for him 

Share this post


Link to post
25 minutes ago, tpruszin said:

My 8700 requires the topology patch and his will too as his XML shows him using cores and threads if he swaps just to using sockets 

 

<topology sockets='2’ cores='1’ threads='1'/>

 

rather than 

 

<topology sockets='1' cores='2' threads='1'/>

 

it will work for him 

Wouldn't deleting the topology line work as well? I mean it's a chip with only 4 cores 4 thread. 

Share this post


Link to post
2 hours ago, david279 said:

Wouldn't deleting the topology line work as well? I mean it's a chip with only 4 cores 4 thread. 

It would yes but if so idve thought it would then default and recreate the topology line anyway to sockets=4 or 2 depending on how many he is choosing to passthrough 

Share this post


Link to post

Looking for help / guide on how to create a OpenCoreEFI qcow2 or img file that boots. I already have my Efi folder configured and ready.

 

Cheers!

Share this post


Link to post
Posted (edited)
13 hours ago, Daniel Ehrhardt said:

Could you post your xml file?

Here it is, see attached, some parts are <REDACTED>.

Relevant line in my xml is:

<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'/>

 

The cpu should be "host" instead of Penryn.

As suggested, delete the topology line, start simple.

If you can't boot post some more info.

 

Persistent mode (for intel based cpu):

in Unraid go to Main --> Flash

Syslinux Configuration --> Unraid OS

Add kvm_intel.nested=1 in the append line

Reboot unraid

 

Ex: my "append line" is:

append vfio-pci.ids=1b73:1100 kvm_intel.nested=1 initrd=/bzroot

 

Some more info: Intel core 2 duo lacks EPT (extended page tables) and UG (unrestricted guest) for virtualization, this is why Penryn will not work.

Should work on i3, i5, i7, so westmere, arrandale, sandy bridge and later.

 

Btw, +invtsc will have no effect without migratable=no (with cpu host)

 

vm.xml

Edited by ghost82

Share this post


Link to post
Posted (edited)
On 4/26/2020 at 7:26 AM, Carbongrip said:

Looking for help / guide on how to create a OpenCoreEFI qcow2 or img file that boots. I already have my Efi folder configured and ready.

 

Cheers!

 

Create a qcow2 image of 256 MB (from Unraid terminal):

qemu-img create -f qcow2 /path/to/the/image/test.qcow2 256M

This will create a qcow2 image of 256 MB.

 

Enable NBD on the host and connect the qcow2 image as a network block device (from Unraid terminal):

modprobe nbd max_part=8
qemu-nbd --connect=/dev/nbd0 /path/to/the/image/test.qcow2

 

Create EFI partition and format:

Create GPT (from Unraid terminal):

gdisk
/dev/nbd0
w
y

Create EFI partition (from Unraid terminal):

gdisk
/dev/nbd0
n
1
<press Enter to accept default value>
<press Enter to accept default value>
EF00
w
y

Format the EFI partition as FAT32 (from Unraid terminal):

mkfs.fat -F 32 /dev/nbd0p1

Create a folder for the mount point (advise is to create a folder in your shares, so you can write files into the EFI partition from your vm too):

mkdir /path/to/the/mount/point/

Mount the EFI partition (from Unraid terminal):

mount /dev/nbd0p1 /path/to/the/mount/point/

Copy your EFI files in /path/to/the/mount/point/

 

Unmount the EFI partition (from Unraid terminal):

umount /path/to/the/mount/point/

Disconnect nbd0 (from Unraid terminal):

qemu-nbd --disconnect /dev/nbd0
rmmod nbd

(Optional) Rename the EFI partition from "NO NAME" to "EFI"

From the virtual machine you can mount the new EFI partition and rename it with the command:

sudo diskutil rename /dev/disk0s1 "EFI"

where disk0s1 is the EFI partition.

 

In the vm xml point to the qcow2 image and add <boot order='1'/>

Edited by ghost82
  • Like 2
  • Thanks 1

Share this post


Link to post
Posted (edited)
3 hours ago, ghost82 said:

Here it is, see attached, some parts are <REDACTED>.

Relevant line in my xml is:


<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'/>

 

The cpu should be "host" instead of Penryn.

As suggested, delete the topology line, start simple.

If you can't boot post some more info.

 

Persistent mode (for intel based cpu):

in Unraid go to Main --> Flash

Syslinux Configuration --> Unraid OS

Add kvm_intel.nested=1 in the append line

Reboot unraid

 

Ex: my "append line" is:


append vfio-pci.ids=1b73:1100 kvm_intel.nested=1 initrd=/bzroot

 

Some more info: Intel core 2 duo lacks EPT (extended page tables) and UG (unrestricted guest) for virtualization, this is why Penryn will not work.

Should work on i3, i5, i7, so westmere, arrandale, sandy bridge and later.

 

Btw, +invtsc will have no effect without migratable=no

 

vm.xml 9.46 kB · 1 download

xml2.xml

I tried your quem CPU Settings. But the Problem is, that when i boot the Mac then i can see the Clover boot Screen and after some Seconds when it should start to boot up the Screen is Black and nothing happens anymore. 

I used Macinabox Catalina to create the Mac at all. 
I connect while testing over noVNC to the VM. If i add Verbose mode the Same thing happen. 

image.png.f414bfec5ffb0ecfe9db95e8e5911b0b.png

image.png.ecfa5da1deb40c3d88e3113980e5345f.png

-boot strict=on \
-device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \
-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \
-device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \
-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x7.0x7 \
-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x7 \
-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x7.0x1 \
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x7.0x2 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 \
-blockdev '{"driver":"file","filename":"/mnt/user/domains/MacinaboxCatalina/Clover.qcow2","node-name":"libvirt-3-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"qcow2","file":"libvirt-3-storage","backing":null}' \
-device ide-hd,bus=ide.2,drive=libvirt-3-format,id=sata0-0-2,bootindex=1,write-cache=on \
-blockdev '{"driver":"file","filename":"/mnt/user/domains/MacinaboxCatalina/Catalina-install.img","node-name":"libvirt-2-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \
-device ide-hd,bus=ide.3,drive=libvirt-2-format,id=sata0-0-3,write-cache=on \
-blockdev '{"driver":"file","filename":"/mnt/user/domains/MacinaboxCatalina/macos_disk.img","node-name":"libvirt-1-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \
-device ide-hd,bus=ide.4,drive=libvirt-1-format,id=sata0-0-4,write-cache=on \
-netdev tap,fd=35,id=hostnet0 \
-device vmxnet3,netdev=hostnet0,id=net0,mac=52:54:00:54:3a:24,bus=pci.1,addr=0x0 \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \
-chardev socket,id=charchannel0,fd=36,server,nowait \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 \
-device usb-tablet,id=input0,bus=usb.0,port=1 \
-vnc 0.0.0.0:0,websocket=5700 \
-k en-us \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.3,addr=0x0 \
-usb \
-device usb-kbd,bus=usb-bus.0 \
-device '************************' \
-smbios type=2 \
-cpu 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 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
2020-04-26 10:38:34.865+0000: Domain id=51 is tainted: high-privileges
2020-04-26 10:38:34.865+0000: Domain id=51 is tainted: custom-argv
2020-04-26 10:38:34.865+0000: Domain id=51 is tainted: host-cpu
char device redirected to /dev/pts/2 (label charserial0)

 

Edited by Daniel Ehrhardt

Share this post


Link to post
Posted (edited)
21 minutes ago, Daniel Ehrhardt said:

But the Problem is, that when i boot the Mac then i can see the Clover boot Screen and after some Seconds when it should start to boot up the Screen is Black and nothing happens anymore. 

I think you should fake your cpu id.

I'm sorry but I switched from clover to opencore months ago, however, try to fake the cpu id to skylake H:

in the config.plist, KernelAndKextPatches -->

		<key>FakeCPUID</key>
		<string>0x0506E3</string>

You should provide some debug logs from clover, otherwise we cannot know where the problem is.

Edited by ghost82

Share this post


Link to post
2 minutes ago, ghost82 said:

I think you should fake your cpu id.

I'm sorry but I switched from clover to opencore months ago, however, try to fake the cpu id to skylake H:

in the config.plist, KernelAndKextPatches -->


		<key>FakeCPUID</key>
		<string>0x0506E3</string>

You should provide some debug logs from clover, otherwise we cannot know where the problem is.

Thank you for the Quick Reply. Yes i saw that you are using opencore now. Do you have a Guide how to setup opencore?
Where can i find the Clover logs?

Share this post


Link to post
Posted (edited)
46 minutes ago, Daniel Ehrhardt said:

Do you have a Guide how to setup opencore?

Start from here:

https://github.com/Leoyzen/KVM-Opencore/

 

I think you can have a log file changing in config plist Debug to true (Boot section) (this if you have clover v. >3064)

		<key>Debug</key>
		<true/>

You will find the log in /EFI/CLOVER/misc/debug.log

Moreover add boot arguments debug=0x100, keepsyms=1

 

Does it boot with spoofed cpu?

 

Make a backup of the clover.qcow2 before starting with opencore.

Edited by ghost82

Share this post


Link to post

I think i am to dumb to install the opencore Version. 

Maybe we are able to find out why the Blackscreen is happening after the Clover Boot Screen. I tried Clover stuff like verbose mode but it does not change. 
The wried thing is the the first CPU Core is at 100% when the Blackscreen is Visible. 

 

Maybe we could find a log Clover log. 

 

Share this post


Link to post
Posted (edited)
26 minutes ago, Daniel Ehrhardt said:

I think i am to dumb to install the opencore Version.

Simply download the EFI folder from github, mount your EFI partition, delete the existing EFI folder and copy the downloaded one.

Did you try to boot with the spoofed cpu?And what version of mac os you are trying to boot?

Edited by ghost82

Share this post


Link to post
Posted (edited)
12 hours ago, david279 said:

He has a 7600k that should boot without any cpu patches

Apparently yes..also latest high sierra should be ok with kaby lake cpus..but he never told us what version of mac os he is running, nor his system specs..Or did I miss it?

Edited by ghost82

Share this post


Link to post
Posted (edited)

If you want to test my Configuration you can download Macinabox from the Unraid App Store and then Setup a Default Catalina Image. This is what i did. 
10.15.4 Catalina

 

Yes i tried the CPU Spoof. 

 

Edited by Daniel Ehrhardt

Share this post


Link to post
Posted (edited)

Unfortunatly it will not be usefull, because I already have a working Catalina 10.15.4 for my hardware; moreover I disabled dockers in unraid. You need to provide us more info about the issue, because "I have a black screen" is not enough to understnd what it's happening.

I know you understood and maybe the problem is that you don't know how to provide us these info..

CPU spoofing should not be required with 10.15.4, so the problem is somewhere else.

Edited by ghost82

Share this post


Link to post
<qemu:arg value='Penryn,vmx,rdtscp,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>

--> 

--> Normal Boot 

 

 

<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'/>

-->

 

--> Black Screen

 

 

i can provide any Logs you need. I will try out to flash opencore. 

Share this post


Link to post

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.