Jump to content

Insanely fast virtual Mac (QEMU, OVMF, Clover and native graphics)


514 posts in this topic

Recommended Posts

@KillerKelvUK Thanks for the feedback, 

ThatGord, your linked OVMF to tinacore's site is ancient, read a few posts further up this thread where I direct to a maintained repo for up-to-date builds

 

This comment?
 
 
Do you know where the source for those builds came from?  I would prefer to build myself if possible.
 

You need to ensure Clover is configured with "Install for UEFI booting only" and include from the 'Drviers64UEFI' section "DataHubDxe-64" as well as at least one theme.
 
I have selected the "Install for UEFI booting only", which also selected "Install Clover in the ESP".  Additionally, this automatically unselected "Bootloader, Don't update MBR and PBR sectors" and unselected "CloverEFI, CloverEFI 64-bits SATA"
 
I then selected a theme and selected "Drivers64UEFI, OsxAptioDrv-64", I will also select "DataHubDxe-64"
 
 
After this you'll need the dsdt noted at the start of this thread as well as the fixes which are all applied using Clover Configurator.  
 
I was under the impression that this change was checked in?  Or is this not part of the `Clover_v2.3k_r3330.pkg`?
 
If not, I will check out and build.
 
 
Also using Clover Configurator go to 'Install Drivers' and  from the 'Extra Drivers' section add in "HFSPlus UEFI".
 
I was hoping to avoid using the Clover Configurator, but will look at this, thanks.
 

NOTE: I've also found it important to ensure the mapped Clover image is set as boot device for qemu to use i.e. bootindex=1, without this I observed OVMF failing to load anything and in some cases not being able to see the Clover image itself.
 
I have Clover loading (albet the older one), but will keep this in mind.
 
Thanks again.
Link to comment
Share on other sites

Hey Gordo, here you go...

 

 

 

Do you know where the source for those builds came from?  I would prefer to build myself if possible.

 

The repo is Gerd Hoffmann's, he's one of the main dev's who works on qemu and associated projects so is a trust worthy source and I've been using that same repo myself now for quite some time.  That said I can understand your wanting to build yourself for other reasons which is cool, you just have options right!

 

 I then selected a theme and selected "Drivers64UEFI, OsxAptioDrv-64", I will also select "DataHubDxe-64"

 

 

Have you confirmed your need for the "OsxAptioDrv-64"?  I was only trying scenarios myself but I found that unless they were to address a specific problem these were more harmful than useful.

 

I was under the impression that this change was checked in?  Or is this not part of the `Clover_v2.3k_r3330.pkg`?

 

 

So my understanding here is that all Hackintosh's need to have a DSDT in place that is representative to the hardware being used and that Clover isn't integrating all DSDT variants as there are too many because of all of the possible combination of hardware platforms at play. Qemu has a DSDT applicable to the virtual hardware platform it provides which is what the OP was referring to, nothing to build here just download...a quick google search puts you to the Git master where you can dl the file needed.

 

I was hoping to avoid using the Clover Configurator, but will look at this, thanks.

 

 

Fail play, I believe the same file can be found here (https://github.com/JrCs/CloverGrowerPro/blob/master/Files/HFSPlus/X64/HFSPlus.efi?raw=true), just manually add this EFI/CLOVER/drivers64UEFI/

Link to comment
Share on other sites

Hi, I tried using something very similar to the script you posted

@KillerKelvUK

 

 

qemu-system-x86_64 \
-name Mac_tester \
-enable-kvm \
-bios OVMF.fd \
-m 4096 \
-cpu core2duo,vendor=GenuineIntel \
-smp 4,sockets=1,cores=2,threads=2 \
-machine pc-q35-2.5,accel=kvm,usb=off,vmport=off \
-rtc base=localtime \
-device isa-applesmc,osk="xxx" \
-smbios type=2 \
-vga qxl \
-spice port=5905,disable-ticketing \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-device ahci,id=sata0,bus=pci.2,addr=0x5 \
-device ich9-usb-uhci1,id=usb,bus=pci.2,addr=0x3 \
-drive file=/mnt/share/Filestorage/Software/Drivers/Clover.img,if=none,id=drive-sata0-0-2,format=raw \
-device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
-drive file=./Macintosh_HD.qcow2,if=none,media=disk,id=drive-sata0-0-0,format=qcow2 \
-device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 \
-netdev tap,id=hostnet0,ifname=tap0,script=./qemu_br0_ifup.sh,downscript=./qemu_br0_ifdown.sh \
-device e1000-82545em,netdev=hostnet0,id=tap0,mac=`source ./genmac.sh` \
-drive file="/mnt/share/Filestorage/Images/Mac OS X 10.11.2 El Capitan.iso",if=none,media=cdrom,id=drive-sata0-0-1,readonly=on,format=raw \
-device ide-cd,bus=ide.0,drive=drive-sata0-0-1,id=sata0-0-1

 

I changed it up a bit, first i removed the line with -netdev and the one after it since i dont have the scripts. (Are these mandotary for booting?)

I also changed the loations of the ISO to suit my file structure.

Created a new dump of clover from USB where DTDS file was added, clover configurator settings were applied and added the HFS efi driver as well.

 

In the end when i try to boot, it still hangs on a black screen. No output text shown regardless of booting with "-v"

Link to comment
Share on other sites

@ThatGordo

Thanks for writing a guide to get this thing to work. It is ok to avoid Clover Configurator, but I don't think you get away without configuring Clover. Your guide doesn't mention configuring Clover at all. While the Patch was included in Clover, it still needs to be activated by setting the appropriate flag. Since most of the fixes applied by Clover by default aren't necessary for the QEMU-setup I would recommend to disable them. 

 

Feel free to test the Clover image posted here earlier. 

http://www.insanelymac.com/forum/topic/309087-insanely-fast-virtual-mac-qemu-ovmf-clover-and-native-graphics/page-4?do=findComment&comment=2185771

 

It should work and hopefully everything needed to replicated it, is documented within this thread. Furthermore I also pointed out how to redirect the kernel debug output to the host's terminal ("-serial stdio" on qemu host, "debug=0x08" on guest kernel). Maybe that will help you debugging your boot.

 

@Maclarentosh

To create a bootable usb drive using createinstallmedia, I used a real usb drive and dumped it using dd.

Link to comment
Share on other sites

Hi, I tried using something very similar to the script you posted

@KillerKelvUK

 

 

I changed it up a bit, first i removed the line with -netdev and the one after it since i dont have the scripts. (Are these mandotary for booting?)

I also changed the loations of the ISO to suit my file structure.

Created a new dump of clover from USB where DTDS file was added, clover configurator settings were applied and added the HFS efi driver as well.

 

In the end when i try to boot, it still hangs on a black screen. No output text shown regardless of booting with "-v"

Please can you confirm a little more about your overall setup, what is the host your running the vm within?  Assuming its a linux distro...which one and version?  Any host logs that may point to a problem?  Are you using kvm or just pure qemu?  One process I went through to get the first bit of life out of my hack was to use USB devices for hard disk, cd rom and clover...this was more a debugging OVMF process but I think it has the added benefit of removing most supportability challenges although the end guest runs slowly...stepping stone perhaps?

Link to comment
Share on other sites

@waschbenzin I will test out your Clover tonight, let you know how that goes.

While the Patch was included in Clover, it still needs to be activated by setting the appropriate flag. Since most of the fixes applied by Clover by default aren't necessary for the QEMU-setup I would recommend to disable them. 

I added a 'Configure Clover' section in the gist, I see the qemu change, but I am having difficulty locating the other changes in the threads that should be made.  Could you point them out? 

 

- cpu, qemu

- HFS efi driver

 

Thanks!

Link to comment
Share on other sites

Check if my image works for you. If it does you can extract the configuration from the image by mounting the EFI partition. Than you can make a diff between your configuration and mine.

 

Otherwise have a look at page 2 of this thread. I basically disabled all the ACPI-Fixes Clover applies and created an SMBIOS-Profile.

Link to comment
Share on other sites

 

Please can you confirm a little more about your overall setup, what is the host your running the vm within?  Assuming its a linux distro...which one and version?

Linux Distro: Arch linux

Kernel: 4.2.5-1-ARCH (Arch is rolling release so i can't really give you a version)

Qemu verison 2.4.1

libVirt: 1.3.0

 

 

 Any host logs that may point to a problem?  Are you using kvm or just pure qemu?

 

I checked the system logs for but didnt seem to find anything. I am using qemu and KVM. I check this through the "-monitor stdio" option and typing "info kvm" which printed out enabled.

 

I then added the option "-serial stdio" which gave me the following error:

(This happens after i boot clover and press enter on the OSX installer)

!!!! X64 Exception Type - 0D(#GP - General Protection)  CPU Apic ID - 00000000 !!!!
RIP  - 000000007E01091E, CS  - 0000000000000038, RFLAGS - 0000000000010246
ExceptionData - 0000000000000000
RAX  - 0000000000000002, RCX - 00000000000000EE, RDX - 0000000000000006
RBX  - 000000007DFFC311, RSP - 000000007FF593B0, RBP - 00000000000000EE
RSI  - 000000007DFFC311, RDI - 000000007E074980
R8   - 0000000000000001, R9  - 0000000000000000, R10 - 0000000000000001
R11  - 000000007E11061D, R12 - 000000007DFFC311, R13 - 0000000000000000
R14  - 000000007E02098F, R15 - 000000007DC75000
DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
GS   - 0000000000000030, SS  - 0000000000000030
CR0  - 0000000080000033, CR2 - 0000000000000000, CR3 - 000000007FEF8000
CR4  - 0000000000000668, CR8 - 0000000000000000
DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
GDTR - 000000007FED6F18 0000000000000047, LDTR - 0000000000000000
IDTR - 000000007F689018 0000000000000FFF,   TR - 0000000000000000
FXSAVE_STATE - 000000007FF59010
!!!! Find PE image /Users/slice/src/edk2/Build/Clover/RELEASE_GCC49/X64/Clover/rEFIt_UEFI/refit/DEBUG/CLOVERX64.dll (ImageBase=000000007DFEA000, EntryPoint=000000007DFEF4C3) !!!!

Here is the exact script i am using

qemu-system-x86_64 \
-enable-kvm \
-bios OVMF-pure-efi.fd \
-m 4096 \
-cpu core2duo,vendor=GenuineIntel \
-smp 4,sockets=1,cores=2,threads=2 \
-machine q35,accel=kvm,usb=off,vmport=off \
-rtc base=localtime \
-device isa-applesmc,osk="derp" \
-smbios type=2 \
-vga qxl \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-device ahci,id=sata0,bus=pci.2,addr=0x5 \
-device ich9-usb-uhci1,id=usb,bus=pci.2,addr=0x3 \
-drive file=clover-new.dd,if=none,id=drive-sata0-0-2,format=raw \
-device ide-hd,bus=ide.2,drive=drive-sata0-0-2,id=sata0-0-2,bootindex=1 \
-drive file=./mac_hdd.img,if=none,media=disk,id=drive-sata0-0-0,format=raw \
-device ide-hd,bus=sata0.0,drive=drive-sata0-0-0,id=sata0-0-0 \
-drive file="OSX.iso",if=none,media=cdrom,id=drive-sata0-0-1,readonly=on,format=raw \
-device ide-cd,bus=ide.0,drive=drive-sata0-0-1,id=sata0-0-1 \
-serial stdio

Link to comment
Share on other sites

@Maclarentosh

Are you trying with the provided Clover debug image? Have you checked dmesg for errors from kvm? Have you enabled ignoring MSR?

echo 1 > /sys/module/kvm/parameters/ignore_msrs

I haven't been lucky using ISO-images much. I would recommend creating an bootable usb drive, dumping it and using that.  

Link to comment
Share on other sites

@waschbenzin

 

No i am not using the clover debug image. I am using clover version 3330 and matched it as closely to the config posted on page of this forum. I believe it was your post.

 

Is there a specific way you had in mind for making a live USB? I was planning on using unibeat and taking a dd dump of it.

 

Is there a way to mount a file as a disk? for example using qemu i create some file myLiveboot.img (extension dosent matter) and mount this file as a USB in the VM?

 

@KillerKelvUK

I think this is the latest version of clover. At the time i looked the latest version was 3330 which is the one i am using.

 

I am not using any kexts. Since that was posted in the first post of this thread.

Should i be using any kexts? If so do you know which ones or perhaps a link to help.

 

One problem i did have was the location of DSDT file. The directory EFI/CLOVER/BOOT/ACPI/origin/ did not exist. (I assume this is because i selected the option install for UEFI only)

However the directory EFI/ClOVER/ACPI/origin did exist and i put the file in there.

Link to comment
Share on other sites

@KillerKelvUK

I think this is the latest version of clover. At the time i looked the latest version was 3330 which is the one i am using.

 

I am not using any kexts. Since that was posted in the first post of this thread.

Should i be using any kexts? If so do you know which ones or perhaps a link to help.

 

One problem i did have was the location of DSDT file. The directory EFI/CLOVER/BOOT/ACPI/origin/ did not exist. (I assume this is because i selected the option install for UEFI only)

However the directory EFI/ClOVER/ACPI/origin did exist and i put the file in there.

3330 is what I'm using as well so no issues with that and the DSDT for qemu goes in the folder you've called out so thats all fine.  Did you use Clover Configuration to add in the DSDT file name as well?

 

I asked about the kext's as I noted that when I put a kext into Clover but didn't configure for auto injection and didn't select manual injection from the prompt that OSX wouldn't boot...it was an odd problem and only by chance I selected to boot with injections that I identified and understood this, quick update to my config.plist to always inject and I have a near 100% consistent boot now.

Link to comment
Share on other sites

@Maclarentosh... Struggling to find suggestions to help you further sorry. If your OVMF and Clover images and setup are all comparable then this should work which kinda does point back to the installed media which is obviously why you've been asking about the build process for that. Do you have any older images at all such as Yosemite or Mavericks? If so you could confirm these boot using the simpler seabios and chameleon images, would confirm qemu isn't a potential culprit. (Did you install your binaries from a repo or build yourself?)

Just for clarification guy. Is this a Linux distro running a VM, but a very fast VM with passthough options compared to VMWare?

 

Thanks

Varies as some of the guys aren't passing through Gfx hardware but yes, Linux distro virtualising OSX passing GFX hardware to achieve near native performance with as little modification to OSX as possible.

  • Like 1
Link to comment
Share on other sites

@NSCXP2005:

The "insanely fast" part in the thread topic is due to a misconfigured busspeed that makes Mac OS X run at up to 40 times the normal speed. This can be fixed with the new Clover version and the information available in the thread.

 

Who should and who shouldn't use this solution?

The way to boot a virtual Mac OSX presented here is rather special and thus only relevant to a minority of users. Using it on Windows or Mac OSX hosts doesn't make much sense, since without KVM the QEMU virtualisation is slow compared to VMware/Parallels/VirtualBox. Even with a Linux host you will have less trouble booting Mac OSX with VirtualBox. So this is most interesting for Linux Users with KVM and PCI passthrough, since none of the other solutions offers that. You could also go one step further and virtualise your whole system with ESXi and use PCI passthrough there...

 

Though its not easy, what you get is huge (in my opinion). I'm running a Linux server (encrypted raid, file server, media server ...) and in cases where I'm not satisfied with the Linux Desktop experience I can fire up Windows or Mac OSX having almost the full power of my machine available in those VMs without rebooting or interrupting the server. 

 

My recommendation: Don't use this solution, unless you have a good reason to do so. It's a pretty hard way to go...

Link to comment
Share on other sites

@waschbenzin

 

I've not used virtualbox on Linux (only Windows) and can't as like you call out, KVM is the way to go for performance so VB for me is out. However how does VB handle the OSK requirements for booting OSX? Partly a leading question as looking back at this, that and the smbios settings are the only "custom" parts in terms of guest creation the rest is standard. As such using virt-manager (which I am now doing) makes this a very simple deployment, the only complication left is really Clover which once you understand the purpose is pretty logical in itself.

 

Not disagreeing that this is probably a little niche due to the scenario but I do think the whole approach to virtualisation is becoming simpler and its undoubtedly due to the hard work of people like yourself figuring out the blocks and building the house first.

Link to comment
Share on other sites

@waschbenzin,

 

I find it hard to run OSX natively on my system due to issues with my internal screen and my mouse glitches a lot. I do find that running OSX in a VM does work a lot better but I do miss the absence of QE/CI in a VM.

 

I would love to do this and get it working under a Linux environment and get the most native speed out of OSX and pass through my Intel HD 4000.

 

I will try and follow the guide in the op and if I get stuck I will ask for feedback.

 

Thanks.

Link to comment
Share on other sites

@NSCXP2005

 

If you're already aware of this then please disregard but if that's your onboard GFX which is also you're primary GFX then you will need to take more customisation activity that what is offered for guidance in this thread.  If this would be the first time you've attempted such a passthrough I'd suggest you simplify the initial approach to virtualising a linux guest so as not to complicate the challenges of primary GFX passthrough.

Link to comment
Share on other sites

@NSCXP2005

I completely agree with KillerKelvUK: Get Linux and Windows running first in a Linux hosted QEMU-VM with passthrough. Then try Mac OSX.

 

@KillerKelvUK

In Virtualbox the vm needs to be modified to run OSX from command line. It's a few commands and it pretty much works out of the box. Googling things like EfiGopMode, SmcDeviceKey and cpuidset should get you to a working Virtualbox VM - I don't have the commands at hand and I'd rather not spam this thread with an alternative method. Though VirtualBox offers PCI passthrough on Linux, I couldn't manage to attach my graphics card to the VM (vaguly remembering that the machine configuration for PCI passthrough and running OSX are incompatible)

Link to comment
Share on other sites

I used Ozmosis+OVMF for Yosemite, but it didn't work with El Capitan out of the box, when I started this thread. Also it was problematic because of hardware support, but that was because I used an older version of OVMF. I still plan on giving it another try with the new Ozmosis, although I prefer the Clover solution now. Clover seems to be more widely used, is open source and seems to be updated faster to new versions of OSX. 

  • Like 1
Link to comment
Share on other sites

@KillerKelvUK

 

After trying some other stuff and taking a dd dump of [url="http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/"]#####[/url] created USB stick i was able to get another error. But googling it lead me no where. here is what happens when i press enter on the OSX installer

KVM internal error. Suberror: 1
emulation failure
RAX=0000000000000000 RBX=000000007d712018 RCX=0000000000000000 RDX=000000007dc8bb20
RSI=000000007dc8bb20 RDI=000000000000373a RBP=000000007dc7a332 RSP=000000007ff597c8
R8 =000000007dc91180 R9 =0000000000000004 R10=000000007dc4ad36 R11=000000007dd40752
R12=000000007dd3d018 R13=000000007dc81d79 R14=000000007dc506c9 R15=000000007dc3ed5d
RIP=00000000000affff RFL=00010202 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0030 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
CS =0038 0000000000000000 ffffffff 00a09b00 DPL=0 CS64 [-RA]
SS =0030 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
DS =0030 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
FS =0030 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
GS =0030 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT
TR =0000 0000000000000000 0000ffff 00008b00 DPL=0 TSS64-busy
GDT=     000000007fed6f18 00000047
IDT=     000000007f689018 00000fff
CR0=80000033 CR2=0000000000000000 CR3=000000007fef8000 CR4=00000668
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000500
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <00> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

As far as Yosemite goes, i was not able find my vanilla ISO, but an iso created by hackintosh-zone boots just fine, using the exact script provided on this page (same bootloader as well):

http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/

 

Would it be possible to vanilla install yosmite? then upgrade to El- Capitan

 

Changing Host to Ubuntu 15.10 did not change any outcomes

Link to comment
Share on other sites

Yeah found that link back in the Mavericks days, the author is one of the devs on Qemu but it hasn't been updated past Yosemite and is all about legacy seabios boot.

 

Regards Yosemite and then upgrade, do a quick search at tonyx86. From recollection whilst El Cap has new security routines I believe an in situ upgrade from Yosemite is possible but it might need some prep and if you need custom kext's that might be more challenging if your not using Clover.

Link to comment
Share on other sites

Good news:

 

Everything works, no need for Yosemite. Installer fully boots up, without issues.

 

Bad news: Screen tearing to the point i cannot make out the text on the screen or the installer its self.

(Hard to explain, but yes the installer is working from what i can make out from the screen tearing)

Note: There is no screen tearing during clover. Only after the installer is booting/booted.

 

Edit: Fixed

Make sure clover GUI reslution is set to 800x600 or else screen tearing will happen

 

Special thanks to the following people for helping me getting this done.

 

@KillerKelvUK

@waschbenzin

Link to comment
Share on other sites

 Share

×
×
  • Create New...