Jump to content
waschbenzin

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

511 posts in this topic

Recommended Posts

tl;dr Below is my virtual setup, but it's running way too fast (probably due to a wrong busspeed). It is fixed now with newer Clover versions. Read the whole thread to know how it's done. This is not a guide (yet)

 

Hardware:

--------------

CPU: i7-4790K

Board: Gigabyte Z97-UD5H

GPU: nVidia GTX 770

 

Software:

--------------

Ubuntu: 15.10 (no special kernel)

QEMU: 2.3.0 (as provided by ubuntu)

OVMF: compiled from source (on 2015-10-20)

Clover: 2.3 (something around 3292)

 

Installation:

--------------- 

Download El Capitan from the App Store


- Install ISO in VirtualBox

- Install Clover to virtual USB-Drive (for UEFI-Boot)

 

Configuration:

--------------

Bios:

VT-d enabled

 

Linux:

UEFI-Boot, IOMMU enabled

 

Graphics:

Needs to be disabled within Linux.  Blacklist nvidia module and assign to pci_stub.

 

Clover:

DSDT: q35-acpi-dsdt.aml (available from QEMU-repo)

Fixes: FixSBUS, NewWay, FixRegions, FIX_RTC, FIX_TMR, DeleteUnused, FIX_ADP1, AddPNLF, FIX_S3D, FIX_ACST

Boot-args: -v kex-dev-mode=1 rootless=0, debug=0x08 (<- serial logging)

SMBIOS: MacPro2,1

No Kexts

 

Running:

--------------

 

QEMU:

qemu-system-x86_64 \

# Use KVM for cpu virtualization

-enable-kvm \

# Use 8GB of Ram

-m 8192 \

# Fake a core2duo , disable kvm identification (nVidia need this on Windows)

-cpu core2duo,kvm=off,vendor=GenuineIntel \

# Use 3 cores with 2 threads each -> 6 threads

-smp 6,sockets=1,cores=3,threads=2 \

# Use QEMU's Q35 machine

-M q35 \

# disable regular VGA emulation

-vga none \

# use OVMF instead of standard SeaBios

-bios OVMF.fd \

# enable VM usb

-usb \

-smbios type=2 \

-net none \

# the emulated usb-bus ... might acually not really be used

-device piix4-usb-uhci,id=usbbus \

# attach the clover usb drive

-usbdevice disk:CloverDrive.dd \

# attach the el capitan image

-usbdevice disk:ElCapitanFromVirtualBox.dd \

# emulate apple's copyright device thingy

-device isa-applesmc,osk="AppleCopyrightsWhatYouHaveToPutHereToProtectTheirOS" \

# attach the graphics card to the vm

-device vfio-pci,host=01:00.0,bus=pcie.0,multifunction=on \

-device vfio-pci,host=01:00.1,bus=pcie.0 \

#enable serial logging

-serial stdio 

 

The usb drives should probably be replaced by something faster, but that's something I'll save for later. Probably some options should be cleaned up

 

Current Problems:

--------------

OSX detects a busspeed of 100MHz and seems to multiply it by 4 and thus assumes the cpu is running at 400MHz. Therefore it runs 10 times too fast (one can hardly enter text since the key repeation is kicking in too quickly, the clock counts up one minute every 6 secounds, animations too fast, ...). I tried to increase the BusRatioKHz to 1GHz, but that didn't work. On reddit someone suggested 490MHz which reduces the speed to twice the normal speed. I'm pretty sure this is a Clover issue, since an alternative boot method works for Mavericks (which unfortunatelly doesn't work for ElCapitan, Clover is too fast with Mavericks as well). Unfortunately I'm failing to compile Clover to provide a patch to fix this...

 

Any help is welcome :)

Share this post


Link to post
Share on other sites
Advertisement

Interesting! Looks like you're going for a similar set-up as I was planning, could you point me to the lines that needed to be changed? Maybe I can get it to compile.

 

Would setting the cpu to host help?

Share this post


Link to post
Share on other sites

does it make any sense to use qemu's ACPI table loading feature or is that for i386 arch only? The fsb / qpi going crazy is that perhaps related to other timing based settings such as HPET tsc or the like?

Share this post


Link to post
Share on other sites
Thanks for the offering uruviel2001, but I updated to the latest svn revision of edk2 and now Clover compiles happily. The revision given in the building instructions (http://clover-wiki.zetam.org/Development) is missing VarCheckLib (or something like that).
 
So I checked for the changes I had to make to the code to allow different BusSpeeds. I stumpled across a hidden setting. It's called "QEMU", so I think I'm not the first person to have this kind of problem. When setting QEMU to true, a differnt BusSpeed logic applies. 
 
I'm now running at normal speed (at least as far as I could tell from a short test) with the following settings:
 
 
    <key>CPU</key>
    <dict>
        <key>BusSpeedkHz</key>
        <string>1000000</string>
        <key>QEMU</key>
        <true/>
    </dict>
 
 
Warning: Using CloverConfigurator this setting is lost when saving :-(
 
 
@aphex6b: As far as I understood the Busspeed determins how values from the TSC are interpreted. Before using the above setting the mavericks kernel got me this (serial debugging):
EFI_FSB_frequency: read FSBFrequency value: 100000000
EFI_FSB_frequency: read InitialTSC value: 4000078008
 BUS: Frequency =    100.000000MHz, cvtt2n = 0000000A.00000000, cvtn2t = 00000000.19999999
 TSC: Frequency =    400.000000MHz, cvtt2n = 00000002.80000000, cvtn2t = 00000000.66666666, gran = 4
Now I get:
 
EFI_FSB_frequency: read FSBFrequency value: 1000000000
EFI_FSB_frequency: read InitialTSC value: 4000076222
 BUS: Frequency =   1000.000000MHz, cvtt2n = 00000001.00000000, cvtn2t = 00000000.FFFFFFFF
 TSC: Frequency =   4000.000000MHz, cvtt2n = 00000000.40000000, cvtn2t = 00000003.FFFFFFFF, gran = 4

These Messages are coming from this source (maybe another version): http://www.opensource.apple.com/source/xnu/xnu-2050.18.24/osfmk/i386/tsc.c...

gran is the TSC granularity which is read from MSR (https://en.wikipedia.org/wiki/Model-specific_register) which I needed to disable to get my virtual mac booting. See http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/ )

I'm not sure whether setting the Bus Frequency to this pretty high value is the best solution, but it works for now...

 
Next up: Trying different methods to connect the virtual hard disk to improve the speed (currently its connected to a virtual usb2.0 controller)

Share this post


Link to post
Share on other sites

Would setting the cpu to host help?

I can't boot with that setting.

 

I'm using the following settings for now to deal with the hard drive and network:

-netdev user,id=usr0,net=192.168.76.0/24,dhcpstart=192.168.76.9 \
-device e1000-82545em,netdev=usr0,id=vnet0,bus=pcie.0,addr=5 \
-drive id=MacHDD,if=none,file=ElCapitan.dd  \
-device ide-drive,bus=ide.2,drive=MacHDD \
-device ahci,id=hdbus,bus=pcie.0 \
-drive id=Clover,if=none,file=/raid/vm/mac/clover-boot.dd  \
-device ide-drive,bus=hdbus.0,drive=Clover \
So regarding networking, I'm just following http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/.  I assign the drives to different busses to avoid Mac OSX complaining about disk identifiers. For Sound I'm using an USB sound card, which works pretty fine. 
 
I've been playing with the system for a few hours now and I didn't notice any problems with the timing setting. I can watch 60 fps videos without stutter. Reboots work most of the time and I was even able to upgrade to 10.11.1 without changing anything :-).

Share this post


Link to post
Share on other sites

Could you upload your clover img? I'm having problems making a proper one.

 

 

Thanks for your work, seems like KVM + GPU passthrough is the way to go right now to solve skylake woes.

Share this post


Link to post
Share on other sites

Well It's time to upgrade my virtual setup... I am using vfio with i915 patch for qemu / q35/ chameleon /non Uefi setup...

I'll try your ovmf setup...(currently using ovmf for Windows 8.1)... Mind sharing a guide to compile correctly clover and ovmf?

Ovmf latest Svn? I saw that clover requires a specific version of ovmf...

 

Clover smbios settings? (Macpro3,1?)

 

 

And another thing... Is it possible to compile clover on linux?

Share this post


Link to post
Share on other sites

@nexx892: I'm not comfortable sharing the image (I have no idea what licenses are involved...hope you can respect that :-\... and if I shared it I would feel obligated to support it...). I'm really just creating a virtual hd, partition it,  installing clover with the standard installer (install in ESF, completely UEFI with drivers DataHub, EmuVariables, Partitions) and apply the settings mentioned above.

 

@evilsephiroth

I'm not compiling clover any more since I discovered the hidden setting. (Would just raise the maintainance on my side ;-) ). 

 

I'm using the latest OVMF version, because the prebuild binary is from 2014 and doesn't support USB3 (I'm passing my USB controller to the VM as well...). I just followed https://wiki.ubuntu.com/UEFI/EDK2using:

 TOOL_CHAIN_TAG = GCC49
 TARGET_ARCH    = X64 

to build the RELEASE versions of MdeModulePkg and finally OvmfPkgX64.dsc.

 

I prefer the OVMF+Clover to the chameleon+SeaBios, because it saves the trouble of dealing with the VGA patches (as you seem to be aware of :-) ). 

 

 

I'm using MacPro2,1 in smbios. I just guess this setting. Is it relevant? Any information on what works better (and why?).

Share this post


Link to post
Share on other sites

@nexx892: I'm not comfortable sharing the image (I have no idea what licenses are involved...hope you can respect that :-\... and if I shared it I would feel obligated to support it...). I'm really just creating a virtual hd, partition it,  installing clover with the standard installer (install in ESF, completely UEFI with drivers DataHub, EmuVariables, Partitions) and apply the settings mentioned above.

 

@evilsephiroth

I'm not compiling clover any more since I discovered the hidden setting. (Would just raise the maintainance on my side ;-) ). 

 

I'm using the latest OVMF version, because the prebuild binary is from 2014 and doesn't support USB3 (I'm passing my USB controller to the VM as well...). I just followed https://wiki.ubuntu.com/UEFI/EDK2using:

 TOOL_CHAIN_TAG = GCC49
 TARGET_ARCH    = X64 

to build the RELEASE versions of MdeModulePkg and finally OvmfPkgX64.dsc.

 

I prefer the OVMF+Clover to the chameleon+SeaBios, because it saves the trouble of dealing with the VGA patches (as you seem to be aware of :-) ). 

 

 

I'm using MacPro2,1 in smbios. I just guess this setting. Is it relevant? Any information on what works better (and why?).

so basically, you downloaded clover version 3292, modified the hidden parameter,installed in the virtual usb drive and built from source ovmf... Didn't kraxel have prebuilt ovmf binary up to date ?

 

https://www.kraxel.org/repos/jenkins/edk2/Latest binary is from yesterday... Or these 2 modules(  MdeModulePkg and finally OvmfPkgX64.dsc) should be compiled with GCC49 ?

Share this post


Link to post
Share on other sites

I didn't know about kraxel. Just tested it, works fine ( OVMF-pure-efi.fd ), though it seems to start a bit slower (seem to be the debug version since it's 2MB). Thanks for the hint. 

Share this post


Link to post
Share on other sites

I didn't know about kraxel. Just tested it, works fine ( OVMF-pure-efi.fd ), though it seems to start a bit slower (seem to be the debug version since it's 2MB). Thanks for the hint. 

 

Well, if this is working with pure ovmf, I should thank you :D I hate not having DRI on my host using i915 patch qemu + chameleon... Time to go UEFI.

 

I'm posting results later... Downloading El Capitan from my macbook air :D 

 

If all works without problems, I think I'll  write a guide for the setup and also converting the qemu commandline in a libvirt xml vm (here and also on Archlinux Wiki that is my distro :D)

Share this post


Link to post
Share on other sites

I also wanted to get rid of the kernel patches and switch to a completely UEFI system :-).

 

BTW: You don't need to go the way around installing in VirtualBox first. I successfully installed a version from a virtual hard disk I created using the createinstallmedia command inside the El Capitan.app. No modifications necessary :). After the first restart, just launch the installer again and it will resume the installation.

Share this post


Link to post
Share on other sites

I also wanted to get rid of the kernel patches and switch to a completely UEFI system :-).

 

BTW: You don't need to go the way around installing in VirtualBox first. I successfully installed a version from a virtual hard disk I created using the createinstallmedia command inside the El Capitan.app. No modifications necessary :). After the first restart, just launch the installer again and it will resume the installation.

Well, you lost me... :D I thought createinstallmedia targets only device... Did you use a .img file mounted with disk utility?

Share this post


Link to post
Share on other sites

I just wasn't clear. I created the install media using the createinstallmedia command. I than attach that image to the vm and was able to install from that media to another virtual hard disk (using the QEMU, OVMF, Clover VM described above). 

Share this post


Link to post
Share on other sites

I just wasn't clear. I created the install media using the createinstallmedia command. I than attach that image to the vm and was able to install from that media to another virtual hard disk (using the QEMU, OVMF, Clover VM described above). 

hmm so it's possibile to create an image from createinstallmedia instead of directing writes only to usb? RTFM for me by the way :D

Share this post


Link to post
Share on other sites

I'm not sure... I created a usb drive with createinstallmedia, dumped it, and attached the dump to the vm as a virtual machine to install El Capitan. Hope this resolves any confusion :) .

 

(If you are on a virtual mac already you can probably create a virtual install media to a virtual disk ;-) ) 

Share this post


Link to post
Share on other sites

I'm not sure... I created a usb drive with createinstallmedia, dumped it, and attached the dump to the vm as a virtual machine to install El Capitan. Hope this resolves any confusion :) .

 

(If you are on a virtual mac already you can probably create a virtual install media to a virtual disk ;-) ) 

 

Ok now it's clear. Create install media, dd to have the raw dump and attached to the vm resulting as usb drive. Perfect. Thanks 

Share this post


Link to post
Share on other sites

I hope it works! :) If you have any trouble just ask and I'll try to help. Looking forward to your explaintion for the libvirt thingy. Might that save me from running my Virtual machine as root? :unsure:

Share this post


Link to post
Share on other sites

well basically yes... The good thing around libvirt is that is managed with virt-manager... no more scripts, command line but only plain xml edited and viewed with virsh daemon... virsh edit vmName. 

Virt-Manager makes really easy to add devices,controllers,hard disk,cdrom,host device,host usb devices,etc because is graphical... Other than that, libvirt + virt-manager runs as a service so it's possible to run also vm at boot.

 

Compared to qemu scripts it's a cleaner solution...

 

this is the example from my win 8.1 ovmf.

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>win8.1</name>
  <uuid>6efc8a3c-5c45-4d51-9fc6-a086d3e267b2</uuid>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/win8.1_VARS.fd</nvram>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
    <kvm>
      <hidden state='on'/>
    </kvm>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Haswell</model>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/sbin/qemu-system-x86_64</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source dev='/dev/mapper/vgSSD-logicSSD'/>
      <target dev='vda' bus='virtio'/>
      <boot order='3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads'/>
      <source dev='/dev/mapper/vgData-logicVirtual'/>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:76:8a:69'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <video>
      <model type='vga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host,hv_vendor_id=deadbeef,kvm=off'/>
  </qemu:commandline>
</domain>

Share this post


Link to post
Share on other sites

I have manage to create a XML that boot OSX, but it seems more inconsistent and sometimes the VM is "overclocked" again. I'm mainly struggling with assigning the devices to the root pci-express bus. So I have to rely on the PCI-bridge which doesn't work so well...

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>ElCapitan</name>
  <uuid>0b83d059-3f7c-4c10-98ba-4c752e7817d6</uuid>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <vcpu placement='static' cpuset='2-7'>6</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
    <loader readonly='yes'  >/vm/mac/OVMF-pure-efi.fd</loader>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <hidden state='on'/>
    </kvm>


  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <topology sockets='1' cores='3' threads='2'/>
  </cpu>
  <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>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/vm/mac/Clover-3320.raw'/>
      <target dev='hdb' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/mapper/ubuntu--vg-el--capitan'/>
      <target dev='hda' bus='sata'/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
   <interface type='network'>
      <mac address='01:02:03:04:05:06'/>
      <source network='default'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
    </interface> 
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
    </hostdev>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=AppleCopyrightsWhatYouHaveToPutHereToProtectTheirOS'/>
  </qemu:commandline>
</domain>

Share this post


Link to post
Share on other sites

 

I have manage to create a XML that boot OSX, but it seems more inconsistent and sometimes the VM is "overclocked" again. I'm mainly struggling with assigning the devices to the root pci-express bus. So I have to rely on the PCI-bridge which doesn't work so well...

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>ElCapitan</name>
  <uuid>0b83d059-3f7c-4c10-98ba-4c752e7817d6</uuid>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <vcpu placement='static' cpuset='2-7'>6</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
    <loader readonly='yes'  >/vm/mac/OVMF-pure-efi.fd</loader>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <hidden state='on'/>
    </kvm>


  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <topology sockets='1' cores='3' threads='2'/>
  </cpu>
  <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>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/vm/mac/Clover-3320.raw'/>
      <target dev='hdb' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/mapper/ubuntu--vg-el--capitan'/>
      <target dev='hda' bus='sata'/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'/>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
   <interface type='network'>
      <mac address='01:02:03:04:05:06'/>
      <source network='default'/>
      <model type='e1000-82545em'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
    </interface> 
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
    </hostdev>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=AppleCopyrightsWhatYouHaveToPutHereToProtectTheirOS'/>
  </qemu:commandline>
</domain>

 

If you're unsatisfied with qemu generated command line from libvirt you can use this method http://vfio.blogspot.it/2015/05/vfio-gpu-how-to-series-part-5-vga-mode.html.

 

It's basically a wrapper script for the emulator that use sed to remove/modify parameters.

 

I've got another question. It's the first time I use clover... The settings that you used(DSDT,fixes) should be installed on the clover usb instance? Or it is possible to install el capitan and later install clover in uefi partition with correct settings? Clover has also a iso file. Isn't it simpler to use that attaching as a virtual drive on the vm?

Share this post


Link to post
Share on other sites

I haven't had success with booting the ISO image in QEMU. And while it would be simpler to use the ISO I don't see the point anymore. After all, the ISO doesn't contain the settings necessary for QEMU and it is probably read only. So I still would need my own custom ISO ...

 

I now have a Clover image file which is about 32MB in size containing just the EFI partition with clover on it. Using that I can use a USB installer medium created on a vanilla mac to install (and update) Mac OS X without any further modifications. The extra partition is not even visible inside Mac OS. Having a VM so close to a real mac is beyond what I initally hoped for.

Share this post


Link to post
Share on other sites

I haven't had success with booting the ISO image in QEMU. And while it would be simpler to use the ISO I don't see the point anymore. After all, the ISO doesn't contain the settings necessary for QEMU and it is probably read only. So I still would need my own custom ISO ...

 

I now have a Clover image file which is about 32MB in size containing just the EFI partition with clover on it. Using that I can use a USB installer medium created on a vanilla mac to install (and update) Mac OS X without any further modifications. The extra partition is not even visible inside Mac OS. Having a VM so close to a real mac is beyond what I initally hoped for.

did you change nvidia settings? like nvdia_disable and nvda_drv? or it just booted without problems?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×