-
Some notes about this approach:
- An OSX Installer USB drive for
Install OS X El Capitan
is created - Clover is then installed on the USB drive
- Clover Configurator is then run on the USB drive
- The USB drive contents are copied to the VM host
- VNC is used to connect to the guest UI
- The qxl virtual video device is used (part of the standard kvm qemu install)
- No video card PCI passthrough is used
- At then of the install OSX Screen Sharing is turned on
- An OSX Installer USB drive for
-
VM Host Ubuntu 15.10 (x86_64) server
-
Standard kvm, qemu packages installed
-
All Ubuntu updates applied (2016-03-06)
-
VM images and resources in
/vm/2016-03-06
-
Supporting MacBook Air running OSX 10.11.3 used to create USB drive
-
All OSX updated applied (2016-03-06)
- qemu documentation:
http://wiki.qemu.org/download/qemu-doc.html
- clover documentation:
http://clover-wiki.zetam.org/Configuration
A quick note about screen resolution:
- OVMF and Clover screen sizes must match otherwise the screen will appear mangeled or distorted.
- For purposes of these instructions a resolution of 800x600 will be used.
TODO: Change OVMF and Clover resolutions to 1024x768 or 1280x1024
- On Linux kvm host, build OVMF, please see:
https://gist.github.com/gordonturner/85dcc321d2099d610e67
- Copy bios.bin:
sudo cp ./Build/OvmfX64/DEBUG_GCC49/FV/OVMF.fd /vm/2016-03-06/bios.bin
- On OS X, running on Apple hardare, to get the SMC osk value please see:
https://gist.github.com/gordonturner/c33bcc935e32f9fa6695
-
NOTE: 2016-03-06 The value appears to be a constant string
-
Reference:
http://www.osxbook.com/book/bonus/chapter7/tpmdrmmyth/
-
On an Apple computer running OS X, create install USB drive.
-
Run
Disk Utilty
-
If on 10.11 or later:
- Select the USB device (not a partition of the device) in the left pane
- Click
Partition
tab, ensure there is a single partition, clickCancel
or create single partition - With the USB device selected, click
Erase
- Set Name to
Untitled
, Format toOS X Extended (Journaled)
, Scheme toGUID Partition Map
- Click
Erase
button - Confirm
Partition Map
is set toGUID Partition Map
-
If on 10.10 or earler:
- Select the USB device (not a partition of the device) in the left pane
- Click
Partition
tab - In
Partition Layout
, select1 Partition
- Confirm
Partition Map
is set toGUID Partition Map
- Click
Options
button, selectGUID Partition Table
, click OK - Change Name to
Untitled
- Change Format type to
Mac OS Extended (Journaled)
- Click Apply, then Partition
-
Once partitioning is complete, click
Done
-
Close Disk Utility
-
For El Capitan, default Application location, run:
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app \
--nointeraction
- For El Capitan, if you have moved the
Install OS X El Capitan.app
(which is common to prevent it being deleted) run:
export MOVED_LOCATION=~/Documents/Disk\ Images/Apple\ OS\ X/10.11\ El\ Capitan
sudo "$MOVED_LOCATION"/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath "$MOVED_LOCATION"/Install\ OS\ X\ El\ Capitan.app \
--nointeraction
- On an Apple computer running OS X, download Clover from:
https://sourceforge.net/projects/cloverefiboot/files/latest/download
-
NOTE: 2016-03-06 Current download was
Clover_v2.3k_r3354.zip
-
Download
Clover_v2.3k_r3354.zip
-
Unzip
Clover_v2.3k_r3354.zip
-
Run
Clover_v2.3k_r3354.pkg
-
Click
Continue
untilInstallation Type
screen -
On
Installation Type
screen, clickChange Install Location...
-
On
Destination Select
screen, select the Install USB drive as destination, clickContinue
-
Back on
Installation Type
screen, clickCustomize
-
On
Custom Install on "..."
screen selectInstall for UEFI booting only
- This should automatically select
Install Clover in the ESP
- This should automatically select
-
On
Custom Install on "..."
screen, selectThemes, BootCamp
(or your theme of choice) -
On
Custom Install on "..."
screen, selectDrivers64UEFI, DataHubDxe-64
-
On
Custom Install on "..."
screen, clickInstall
-
Install should take about 3 min on USB 3 device
-
When complete, click
Close
-
Two volumes should be mounted when complete:
EFI
Install OS X El Capitan
-
Leave volumes mounted
- Download
q35-acpi-dsdt.aml
(clickView Raw
):
- Copy to
EFI/CLOVER/ACPI/origin
on USB boot drive:
cp ~/Downloads/q35-acpi-dsdt.aml /Volumes/ESP/EFI/CLOVER/ACPI/origin/
- Download
HFSPlus.efi
(clickView Raw
):
- Copy to
EFI/EFI/CLOVER/drivers64UEFI/
on USB boot drive:
cp ~/Downloads/HFSPlus.efi /Volumes/ESP/EFI/CLOVER/drivers64UEFI/
- NOTE: No source, license is unclear, free to use
- Download:
http://mackie100projects.altervista.org/download/
-
NOTE: 2016-03-06 current version is 4.27.0
-
Download
CCV.zip
-
Unzip
CCV.zip
-
Run
Clover Configurator.app
and edit:EFI/EFI/CLOVER/config.plist
-
Clover Configurator, Acpi
-
Root/ACPI/DSDT
Dictionary-
NOTE: Select
New way
-
Fixes
DictionaryNewWay
Boolean YES (Default)FixRegions
Boolean YES (Default)FIX_RTC
Boolean YES (Default)FiX_TMR
Boolean YES (Default)AddIMEI
Boolean NO (Default)FIX_INTELGFX
Boolean NO (Default)DeleteUnused
Boolean YES (Default)FIX_ADP1
Boolean YES (Default)AddPNLF
Boolean YES (Default)FIX_WAK
Boolean NO (Default)FIX_S3D
Boolean YES (Default)FIX_ACST
Boolean YES (Default)AddHDMI
Boolean YES (Default)
-
Debug
Boolean YES (Changed) -
DSDT name
String q35-acpi-dsdt.aml (Changed) -
ReuseFFFF
Boolean NO (Deault) -
Root/ACPI/DropTables
Remove all
-
-
Clover Configurator, Boot
-
Root/Boot/Arguements
Dictionary- Uncheck all, including
kext-dev-mode=1
rootless=0
Custom Flags
String `` (Default)
- Uncheck all, including
-
Root/Boot/
Default Boot Volume
StringOSX
(Changed)Legacy
StringPBR
(Default)DefaultLoader
Stringboot.efi
(Default)XMPDetection
String YES (Changed)Timeout
Number 5 (Default)-1
Boolean NO (Default)Fast
Boolean NO (Default)Debug
Boolean NO (Default)NeverHibernate
Boolean NO (Default)CustomLogo
String `` (Default)NoEarlyProgress
Boolean NO (Default)
-
Root/Boot/Secure Boot
Whitelist
Empty (Default)Blacklist
Empty (Default)Secure
Boolean NO (Default)
-
Clover Configurator, Cpu
-
Root/Cpu
DictionaryQEMU
Boolean YES (Changed)- NOTE: All other values default to empty or NO
-
Clover Configurator, Devices
-
Root/Devices/Fake ID
Dictionary- NOTE: All values default to empty
-
Root/Devices/USB
Dictionary (All unchecked)Inject
Boolean NO (Changed)Add ClockID
Boolean NO (Changed)FixOwnership
Boolean NO (Changed)HighCurrent
Boolean NO (Default)- NOTE: All values set to NO
-
Root/Devices/Audio
Inject
String `` (Default)AFGlowPoweredState
Boolean NO (Default)ResetHDA
Boolean NO (Changed)
-
Root/Devices/
- NOTE:
Properties
andAdd Properties
are default to empty or NO
- NOTE:
-
Clover Configurator, Disabled Devices
-
NOTE: All default values, nothing configured
-
Clover Configurator, Gui
-
Root/Gui
DictionaryMouse
DictionaryDoubleClick
Number 500 (Default)Speed
Number 8 (Default)Enabled
Boolean NO (Default)Mirror
Boolean NO (Default)
Scan
Boolean YES (Default)Language
String `` (Default)ScreenResolution
String800x600
(Changed)Console Mode
String `` (Default)Theme
Stringbootcamp
(Default, set from Clover install)Custom Icons
Boolean NO (Default)Text Only
Boolean NO (Default)
-
NOTE: All default values, except ScreenResolution
-
Clover Configurator, Graphics
-
NOTE: All default values, nothing selected
-
Clover Configurator, Kernel and Kext Patches
-
Root/KernelAndKextPatches
DictionaryKernel CPU
Boolean NO (Default)Kernel LAPIC
Boolean NO (Default)Kernel Pm
Boolean NO (Default)Kernel HaswellE
Boolean NO (Default)Apple RTC
Boolean NO (Changed)Asus AICPUPM
Boolean NO (Default)Debug
Boolean NO (Default)
-
NOTE: All default values, except
Apple RTC
-
Clover Configurator, Rt Variables
-
Root/RtVariables
DictionaryROM
StringUseMacAddr0
(Default)MLB
String `` (Changed)BooterConfig
String0x28
(Default)CsrActiveConfig
String0x67
(Default)
-
NOTE: All default values, except
MLB
-
Clover Configurator, SMBIOS
-
NOTE: All default values
-
Clover Configurator, System Parameters
-
Root/SystemParameters
DictionaryCustom UUID
String `` (Default)Backlight Level
String `` (Default)Inject Kexts
StringDetect
(Default)No Caches
Boolean NO (Default)Inject System ID
Boolean YES (Default)
-
NOTE: All default values
-
Save and exit Clover Configrator
-
Manually edit
EFI/EFI/CLOVER/config.plist
:- Paste into
Root/ACPI
:
- Paste into
<key>ACPI</key>
<dict>
<key>DSDT</key>
<dict>
<key>Debug</key>
<false/>
<key>DropOEM_DSM</key>
<false/>
<key>Fixes</key>
<dict>
<key>AddPNLF_1000000</key>
<true/>
<key>DeleteUnused_400000</key>
<true/>
<key>FIX_ACST_4000000</key>
<true/>
<key>FIX_ADP1_800000</key>
<true/>
<key>FIX_RTC_20000</key>
<true/>
<key>FIX_S3D_2000000</key>
<true/>
<key>FiX_TMR_40000</key>
<true/>
<key>FixRegions_10000000</key>
<true/>
<key>FixSBUS_0080</key>
<true/>
</dict>
<key>Name</key>
<string>q35-acpi-dsdt.aml</string>
<key>ReuseFFFF</key>
<false/>
</dict>
<key>SSDT</key>
<dict>
<key>DropOem</key>
<false/>
<key>Generate</key>
<false/>
</dict>
</dict>
<key>Boot</key>
<dict>
<key>Arguments</key>
<string>-v</string>
- After complete, eject the USB drive.
-
Either dd the USB drive on OSX or use dd on the Linux KVM host, these instructions are for Linux.
-
Login to KVM host and run tail on the kernel log to determine device name:
tail -f /var/log/kern.log
- Plugin the USB drive
- Observe the device name:
Feb 20 14:40:58 kvm2 kernel: [13158.166032] usb 4-1.4: new high-speed USB device number 7 using ehci-pci
Feb 20 14:40:58 kvm2 kernel: [13158.261978] usb 4-1.4: New USB device found, idVendor=05dc, idProduct=a833
Feb 20 14:40:58 kvm2 kernel: [13158.261984] usb 4-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 20 14:40:58 kvm2 kernel: [13158.261989] usb 4-1.4: Product: USB Flash Drive
Feb 20 14:40:58 kvm2 kernel: [13158.261992] usb 4-1.4: Manufacturer: Lexar
Feb 20 14:40:58 kvm2 kernel: [13158.261995] usb 4-1.4: SerialNumber: AA7OY8PQBU1UVGRJ
Feb 20 14:40:58 kvm2 kernel: [13158.329307] usb-storage 4-1.4:1.0: USB Mass Storage device detected
Feb 20 14:40:58 kvm2 kernel: [13158.329475] scsi host6: usb-storage 4-1.4:1.0
Feb 20 14:40:58 kvm2 kernel: [13158.329639] usbcore: registered new interface driver usb-storage
Feb 20 14:40:58 kvm2 kernel: [13158.345857] usbcore: registered new interface driver uas
Feb 20 14:41:00 kvm2 kernel: [13159.878847] scsi 6:0:0:0: Direct-Access Lexar USB Flash Drive 1100 PQ: 0 ANSI: 6
Feb 20 14:41:00 kvm2 kernel: [13159.879522] sd 6:0:0:0: Attached scsi generic sg1 type 0
Feb 20 14:41:00 kvm2 kernel: [13159.881104] sd 6:0:0:0: [sdb] 31285248 512-byte logical blocks: (16.0 GB/14.9 GiB)
Feb 20 14:41:00 kvm2 kernel: [13159.882187] sd 6:0:0:0: [sdb] Write Protect is off
Feb 20 14:41:00 kvm2 kernel: [13159.882190] sd 6:0:0:0: [sdb] Mode Sense: 22 00 00 00
Feb 20 14:41:00 kvm2 kernel: [13159.883331] sd 6:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Feb 20 14:41:00 kvm2 kernel: [13159.902183] sdb: sdb1 sdb2
Feb 20 14:41:00 kvm2 kernel: [13159.908483] sd 6:0:0:0: [sdb] Attached SCSI removable disk
- In this example
sdb
is the device - Run
dd
, takes about 10 min on USB 3 device:
sudo dd if=/dev/sdb of=/vm/2016-03-06/clover-usb-disk.dd
- On Linux kvm host, create a disk image:
sudo qemu-img create -f qcow2 /vm/2016-03-06/osx-disk0.qcow2 200G
- Ignore MSR readout on host by VM:
sudo su -
echo 1 > /sys/module/kvm/parameters/ignore_msrs
- NOTE: This appears to reset after a hard reboot, may need to be run as part of a script.
-
NOTE: Due to expired certificates used to sign the installation packages, it is necessary during installation to set the date back and remove the network card. After installation is complete, the time can be set and network card added back.
-
NOTE: Set the
SMB_OSK_VALUE_HERE
with the value fromStep 2 Get Apple SMC osk Value
-
On Linux kvm host, start qemu:
sudo qemu-system-x86_64 \
\
-rtc clock=vm,base=2016-01-01T16:01:21 \
\
-m 4096 \
-enable-kvm \
-cpu core2duo,vendor=GenuineIntel \
-rtc base=localtime \
-smbios type=2 \
-machine q35,accel=kvm,usb=off,vmport=off \
-bios /vm/2016-03-06/bios.bin \
-smp 4,sockets=1,cores=2,threads=2 \
-device isa-applesmc,osk="SMB_OSK_VALUE_HERE" \
\
-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 \
\
-drive file=/vm/2016-03-06/clover-usb-disk.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=/vm/2016-03-06/osx-disk0.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 \
\
-usb \
-device usb-mouse \
-device usb-kbd \
-serial stdio \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16 \
-vnc :1
- Connect a VNC client to Linux kvm host
- Tunnel 5901 over ssh:
ssh -L 5910:127.0.0.1:5901 KVM_HOST
-
Connect a VNC client to 127.0.0.1 5710
-
At Clover boot screen, choose
Boot OS X Install from OS X Install OS X El Capitan
-
During install, first use
Disk Utility
to configure the QEMU drive. -
NOTE: Using vnc to perform the install, there is a frustrating bug with vnc and the OS X installer, the mouse.
-
It is possible to use the Tab key to select and Spacebar to select on most of the inputs, but in some situations it becomes a bit of a game to move the mouse in the guest to the button.
-
Once installed and connecting over vnc directly to the guest this is not an issue.
-
System Preferences
,Sharing
, enableScreen Sharing
and set password -
System Preferences
,Energy Saving
,Computer sleep
set toNever
-
System Preferences
,Energy Saving
,Display sleep
set toNever
-
Connect to the guest directly, rather then through the host.
-
Rather then constantly editing the USB drive then dd'ing and copying the image around, it is possible to directly edit the disk image
-
First, create a mount points, this step only has to happen once:
sudo mkdir /media/loop
sudo mkdir /media/efi
- Run fdisk to determine the offset of the efi partition:
parted /vm/clover-usb-disk.dd
WARNING: You are not superuser. Watch out for permissions.
GNU Parted 3.2
Using /vm/clover-usb-disk.dd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit
Unit? [compact]? B
(parted) print
Model: (file)
Disk /vm/clover-usb-disk.dd: 16018046976B
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 20480B 209735679B 209715200B fat32 EFI System Partition boot, esp
2 209735680B 15883808767B 15674073088B hfs+ Untitled
-
NOTE: The offset, in this case
20480
-
Next, mount the
EFI System Partition
:
sudo mount -o rw,loop,offset=20480 /vm/clover-usb-disk.dd /media/loop
- Make changes, ie to edit
config.plist
:
sudo vi /media/loop/EFI/CLOVER/config.plist
- Unmount the partition:
sudo umount /media/loop
- Reference: http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux https://major.io/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/
- Run fdisk to determine the offset of the efi partition:
fdisk -l /vm/clover-usb-disk.dd
- Output:
Disk /vm/clover-usb-disk.dd: 14.9 GiB, 16018046976 bytes, 31285248 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2FAED1FF-5343-4827-8FD8-5477D188EA2D
Device Start End Sectors Size Type
/vm/clover-usb-disk.dd1 40 409639 409600 200M EFI System
/vm/clover-usb-disk.dd2 409640 31023063 30613424 14.6G Apple HFS/HFS+
- FYI, possible to run
parted
on the disk image too:
sudo parted /vm/clover-usb-disk.dd print
- Output:
Model: (file)
Disk /vm/clover-usb-disk.dd: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot, esp
2 210MB 15.9GB 15.7GB hfs+ Untitled
hdiutil verify Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg
@AdamRabbit
I found another guide for unRAID that can easily be adoptable, actually the second comment in that guide gives you the exact xml and what to change for it to work on any linux with qemu-kvm.
Here is the guide: GUIDE: Mac OS X 10.11 El Capitan – VM on unRAID.
What I like about this guide: creates an iso of El Capitain install so no more need of dd. No need to edit config.plist and no custom dsdt.
What I dislike about this guide: uses direct kernel boot instead of UEFI.
Here is the pastebin of xml that will work on linux (I am using it with Debian Jessie with qemu-system-x86 and qemu-kvm from backports to have version 2.6, required by this guide in order to have a compatible chipset version).
I got it working on the first try, one problem that I am having is the mouse capture on spice, but it is flawless on vnc and mac screen sharing.