diff --git a/Clover.qcow2 b/Clover.qcow2 new file mode 100644 index 0000000..438718f Binary files /dev/null and b/Clover.qcow2 differ diff --git a/HighSierra/Clover-v2.4k-4233-X64.iso b/HighSierra/Clover-v2.4k-4233-X64.iso new file mode 100644 index 0000000..0d8a574 Binary files /dev/null and b/HighSierra/Clover-v2.4k-4233-X64.iso differ diff --git a/HighSierra/README.md b/HighSierra/README.md new file mode 100644 index 0000000..9281d72 --- /dev/null +++ b/HighSierra/README.md @@ -0,0 +1,139 @@ +### Notes + +* Enoch bootloader is not used for macOS High Sierra. Clover is used instead. + + +### Host System Details + +Known to work on: + +* Fedora 25 running on i7-6600U CPU. + +* Ubuntu 17.04 running on i5-6500 CPU. + +Tested with QEMU >= 2.10 (with an out-of-tree patch) and Linux 4.10.x / 4.12.x. +A CPU with SSE4.1 support is required for macOS High Sierra. Intel VT-x / AMD +SVM is required. + + +### Installation Preparation + +#### Preparation steps on your current macOS installation + +* Download macOS High Sierra installer from Apple App Store. + +* Clone this repository. Files included in this repository are needed for ISO + creation. + + ``` + git clone https://github.com/kholia/OSX-KVM.git + ``` + +* Run the ISO creation script `create_iso_highsierra.sh` included in this + folder. Run it with `sudo`. + +* Copy the generated ISO image from your Mac's Desktop to your QEMU/KVM machine. + +#### Preparation steps on your QEMU system + +* Clone this repository again on your QEMU system. Files from this repository are used in the following steps. + +* Install required software packages. + + ``` + sudo apt-get install qemu uml-utilities libguestfs-tools + ``` + +* Build and use QEMU from source. See http://wiki.qemu-project.org/Hosts/Linux for help. + + ``` + # First edit /etc/apt/sources.list to add/uncomment deb-src lines + + sudo apt-get update + + sudo apt-get build-dep qemu + + git clone https://github.com/kholia/qemu.git + + cd qemu + + git checkout macOS + + git submodule init + + git submodule update --recursive + + ./configure --prefix=/home/$(whoami)/QEMU --target-list=x86_64-softmmu --audio-drv-list=pa + + $ make clean; make -j8; make install + ``` + + This step is not optional and is required. + +* See [networking notes](../networking-qemu-kvm-howto.txt) to setup guest networking. + +* Create a virtual HDD image where macOS will be installed. + + ``` + qemu-img create -f qcow2 mac_hdd.img 128G + ``` + +* Create bootable Clover disk. + + + ``` + sudo ./clover-image.sh --iso Clover-v2.4k-4233-X64.iso --cfg clover/config.plist.stripped.qemu --img Clover.qcow2 + ``` + + Instead of building your own bootable Clover disk, you may use the included `Clover.qcow2` disk image. + + +### Installation + +To install macOS High Sierra, use the included `boot-macOS-HS.sh` script. + +Note: Ensure that the OVMF resolution is set to 1024x768. This can be done via +the OVMF menu, which you can reach with a press of the ESC button during the +OVMF boot logo. In the OVMF menu settings, set Device Manager -> OVMF Platform +Configuration -> Change Preferred Resolution for Next Boot to 1024x768 . Commit +changes and exit the OVMF menu. Relaunch the `boot-macOS-HS.sh` script. + +#### Installer Steps + +* After booting, the initial language selection should show up. + +* After selecting the language, fire-up the Terminal program and prepare the + hard drive for installation. + + ``` + diskutil list + diskutil eraseDisk JHFS+ macOS disk0 # adapt this according to your system + ``` + + High Sierra's Disk Utility does not recognize unformatted disks, unless you + click View > Show All Devices, quit Disk Utility, then relaunch it. + + Thanks to https://tinyapps.org/blog/mac/ and xenadu02 for this tip. + +* When done, quit Terminal. + +* Now, you can continue with the installation as usual. + +* When finished, the VM will reboot automatically and the first time setup continues as usual. + +#### Post-Installation Recommendations + +* Install Clover to the main hard drive where macOS High Sierra was installed + in previous steps. See [UEFI notes](../UEFI/README.md) for details. + +* For debugging and general tips, see the main [README.md](../README.md) file + and [notes.md](../notes.md) file. + + +### Credits + +* Nicholas Sherlock (http://www.nicksherlock.com) + +* https://www.kraxel.org/blog/2017/09/running-macos-as-guest-in-kvm/ + +* https://sourceforge.net/projects/cloverefiboot/files/Bootable_ISO/ diff --git a/HighSierra/apfs.efi b/HighSierra/apfs.efi new file mode 100644 index 0000000..6e323c5 Binary files /dev/null and b/HighSierra/apfs.efi differ diff --git a/HighSierra/clover-image.sh b/HighSierra/clover-image.sh new file mode 100755 index 0000000..73e1dc8 --- /dev/null +++ b/HighSierra/clover-image.sh @@ -0,0 +1,160 @@ +#!/bin/bash + +# https://github.com/kraxel/imagefish + +###################################################################### +# defaults + +iso="" +img="" +cfg="" + +###################################################################### +# create work dir + +function msg() { + local txt="$1" + local bold="\x1b[1m" + local normal="\x1b[0m" + echo -e "${bold}### ${txt}${normal}" +} + +function do_cleanup() { + msg "cleaning up ..." + if test "$GUESTFISH_PID" != ""; then + guestfish --remote -- exit >/dev/null 2>&1 || true + fi + sudo rm -rf "$WORK" +} + +WORK="${TMPDIR-/var/tmp}/${0##*/}-$$" +mkdir "$WORK" || exit 1 +trap 'do_cleanup' EXIT + +BASE="$(dirname $0)" + +###################################################################### +# parse args + +function print_help() { +cat < + --img + --cfg +EOF +} + +while test "$1" != ""; do + case "$1" in + --iso) + iso="$2" + shift; shift + ;; + --img) + img="$2" + shift; shift + ;; + --cfg) + cfg="$2" + shift; shift + ;; + esac +done + +###################################################################### +# guestfish script helpers + +function fish() { + echo "#" "$@" + guestfish --remote -- "$@" || exit 1 +} + +function fish_init() { + local format + + case "$img" in + *.raw) format="raw" ;; + *) format="qcow2";; + esac + + msg "creating and adding disk image" + fish disk-create $img $format 256M + fish add $img + fish run +} + +function fish_fini() { + fish umount-all +} + +###################################################################### +# sanity checks + +if test ! -f "$iso"; then + echo "ERROR: iso not found: $iso" + exit 1 +fi +if test ! -f "$cfg"; then + echo "ERROR: cfg not found: $cfg" + exit 1 +fi +if test -f "$img"; then + if test "$allow_override" = "yes"; then + rm -f "$img" + else + echo "ERROR: image exists: $img" + exit 1 + fi +fi + +###################################################################### +# go! + +msg "copy files from iso" +guestfish -a "$iso" -m "/dev/sda:/:norock" < + + + + Boot + + Arguments + + DefaultVolume + system + Log + + Secure + + Timeout + 5 + + GUI + + Scan + + Entries + + Tool + + + ScreenResolution + 1920x1080 + Theme + embedded + + RtVariables + + BooterConfig + 0x28 + CsrActiveConfig + 0x3 + + SMBIOS + + BiosReleaseDate + 10/23/12 + BiosVendor + Apple Inc. + BiosVersion + MM61.88Z.0106.B00.1208091121 + Board-ID + Mac-F65AE981FFA204ED + BoardManufacturer + Apple Inc. + BoardType + 10 + ChassisAssetTag + Mini-Aluminum + ChassisManufacturer + Apple Inc. + ChassisType + 16 + Family + Mac mini + Manufacturer + Apple Inc. + Mobile + + ProductName + Macmini6,2 + SerialNumber + C02L5LZLDWYN + Trust + + Version + 1.0 + + SystemParameters + + InjectKexts + + InjectSystemID + + + + diff --git a/HighSierra/clover/config.plist.multibeast.good b/HighSierra/clover/config.plist.multibeast.good new file mode 100644 index 0000000..1f9153e --- /dev/null +++ b/HighSierra/clover/config.plist.multibeast.good @@ -0,0 +1,247 @@ + + + + + ACPI + + DSDT + + Debug + + DropOEM_DSM + + Fixes + + AddDTGP_0001 + + AddHDMI_8000000 + + AddIMEI_80000 + + AddMCHC_0008 + + AddPNLF_1000000 + + DeleteUnused_400000 + + FIX_ACST_4000000 + + FIX_ADP1_800000 + + FIX_INTELGFX_100000 + + FIX_RTC_20000 + + FIX_S3D_2000000 + + FakeLPC_0020 + + FiX_TMR_40000 + + FiX_WAK_200000 + + FixAirport_4000 + + FixDarwin_0002 + + FixDisplay_0100 + + FixFirewire_0800 + + FixHDA_8000 + + FixHPET_0010 + + FixIDE_0200 + + FixIPIC_0040 + + FixLAN_2000 + + FixRegions_10000000 + + FixSATA_0400 + + FixSBUS_0080 + + FixShutdown_0004 + + FixUSB_1000 + + NewWay_80000000 + + + Name + DSDT.aml + ReuseFFFF + + + HaltEnabler + + SSDT + + DropOem + + Generate + + CStates + + PStates + + + + + Boot + + Arguments + dart=0 + DefaultVolume + clover + Legacy + PBR + Log + + Secure + + Timeout + 3 + XMPDetection + NO + + Devices + + Audio + + Inject + 1 + + FakeID + + ATI + 0x0 + IMEI + 0x0 + IntelGFX + 0x0 + LAN + 0x0 + NVidia + 0x0 + SATA + 0x0 + WIFI + 0x0 + XHCI + 0x0 + + USB + + FixOwnership + + Inject + + + UseIntelHDMI + + + DisableDrivers + + Nothing + + GUI + + Hide + + Windows + \EFI\BOOT\BOOTX64.EFI + + Language + en:0 + Mouse + + Enabled + + Speed + 8 + + Scan + + Entries + + Legacy + First + Tool + + + ScreenResolution + 1024x768 + Theme + embedded + + Graphics + + Inject + + ATI + + Intel + + NVidia + + + + KernelAndKextPatches + + AppleRTC + + AsusAICPUPM + + KernelCpu + + KernelHaswellE + + KernelLapic + + KernelPm + + KextsToPatch + + + Comment + External icons patch + Find + + RXh0ZXJuYWw= + + Name + AppleAHCIPort + Replace + + SW50ZXJuYWw= + + + + + RtVariables + + BooterConfig + 0x28 + CsrActiveConfig + 0x3 + + SMBIOS + + Trust + + + SystemParameters + + InjectKexts + Detect + InjectSystemID + + NvidiaWeb + + + + diff --git a/HighSierra/clover/config.plist.smbios.macmini6 b/HighSierra/clover/config.plist.smbios.macmini6 new file mode 100644 index 0000000..fdb3608 --- /dev/null +++ b/HighSierra/clover/config.plist.smbios.macmini6 @@ -0,0 +1,35 @@ + SMBIOS + + BiosReleaseDate + 10/23/12 + BiosVendor + Apple Inc. + BiosVersion + MM61.88Z.0106.B00.1208091121 + Board-ID + Mac-F65AE981FFA204ED + BoardManufacturer + Apple Inc. + BoardType + 10 + ChassisAssetTag + Mini-Aluminum + ChassisManufacturer + Apple Inc. + ChassisType + 16 + Family + Mac mini + Manufacturer + Apple Inc. + Mobile + + ProductName + Macmini6,2 + SerialNumber + C02L5LZLDWYN + Trust + + Version + 1.0 + diff --git a/HighSierra/clover/config.plist.stripped.qemu b/HighSierra/clover/config.plist.stripped.qemu new file mode 100644 index 0000000..79f7d7b --- /dev/null +++ b/HighSierra/clover/config.plist.stripped.qemu @@ -0,0 +1,52 @@ + + + + + Boot + + Arguments + + DefaultVolume + clover + Log + + Secure + + Timeout + 3 + + GUI + + Scan + + Entries + + Tool + + + ScreenResolution + 1024x768 + Theme + embedded + + RtVariables + + BooterConfig + 0x28 + CsrActiveConfig + 0x3 + + SMBIOS + + Trust + + + SystemParameters + + InjectKexts + + InjectSystemID + + + + diff --git a/HighSierra/clover/server.plist b/HighSierra/clover/server.plist new file mode 100644 index 0000000..dc77e14 --- /dev/null +++ b/HighSierra/clover/server.plist @@ -0,0 +1,52 @@ + + + + + Boot + + Arguments + + DefaultVolume + system + Log + + Secure + + Timeout + 5 + + GUI + + Scan + + Entries + + Tool + + + ScreenResolution + 1280x800 + Theme + embedded + + RtVariables + + BooterConfig + 0x28 + CsrActiveConfig + 0x3 + + SMBIOS + + Trust + + + SystemParameters + + InjectKexts + + InjectSystemID + + + + diff --git a/HighSierra/create_iso_highsierra.sh b/HighSierra/create_iso_highsierra.sh new file mode 100755 index 0000000..2d265f3 --- /dev/null +++ b/HighSierra/create_iso_highsierra.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Bail at first High Sierra ISO creation error +set -e + +# Borrrowed from multiple internet sources +hdiutil create -o ~/Desktop/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J +hdiutil attach ~/Desktop/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build +sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction +hdiutil detach "/Volumes/Install macOS High Sierra" +hdiutil convert ~/Desktop/HighSierra.cdr.dmg -format UDTO -o ~/Desktop/HighSierra.iso +mv ~/Desktop/HighSierra.iso.cdr ~/Desktop/HighSierra.iso +rm ~/Desktop/HighSierra.cdr.dmg diff --git a/HighSierra/first-boot.png b/HighSierra/first-boot.png new file mode 100644 index 0000000..573d688 Binary files /dev/null and b/HighSierra/first-boot.png differ diff --git a/HighSierra/installation-in-progress.png b/HighSierra/installation-in-progress.png new file mode 100644 index 0000000..a0e40ea Binary files /dev/null and b/HighSierra/installation-in-progress.png differ diff --git a/OVMF-notes.txt b/OVMF-notes.txt index dd73a9f..1e68b83 100644 --- a/OVMF-notes.txt +++ b/OVMF-notes.txt @@ -12,7 +12,12 @@ The included blobs were built from commit 2913ebb2b550f50a. Host OS ------- -OVMF blobs were built on Ubuntu 14.04.5 LTS (Trusty Tahr) +OVMF blobs (OVMF_CODE.fd, OVMF_VARS.fd) were built on Ubuntu 14.04.5 LTS +(Trusty Tahr). + +OVMF_CODE-pure-efi.fd and OVMF_VARS-pure-efi.fd files come from the +"edk2.git-ovmf-x64-0-20170922.b3006.gfe4049471b.noarch.rpm" archive +downloaded from https://www.kraxel.org/repos/jenkins/edk2/ site. References ---------- diff --git a/OVMF_CODE-pure-efi.fd b/OVMF_CODE-pure-efi.fd new file mode 100644 index 0000000..5c9cd7a Binary files /dev/null and b/OVMF_CODE-pure-efi.fd differ diff --git a/OVMF_VARS-pure-efi-1024x768.fd b/OVMF_VARS-pure-efi-1024x768.fd new file mode 100644 index 0000000..2e4647e Binary files /dev/null and b/OVMF_VARS-pure-efi-1024x768.fd differ diff --git a/OVMF_VARS-pure-efi.fd b/OVMF_VARS-pure-efi.fd new file mode 100644 index 0000000..3b8bb9b Binary files /dev/null and b/OVMF_VARS-pure-efi.fd differ diff --git a/README.md b/README.md index 4d52d01..c6f13e7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ ### Note +For macOS High Sierra, follow [README.md for High Sierra](HighSierra/README.md). +Consult this document for debugging and general tips. + See the [debugging section below](https://github.com/kholia/OSX-KVM#debugging) and closed issues before opening a new issue. @@ -201,4 +204,6 @@ method or the following `virsh` method to install OS X / macOS. * http://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/ +* https://www.kraxel.org/blog/2017/09/running-macos-as-guest-in-kvm/ + * http://forge.voodooprojects.org/p/chameleon/source/changes/HEAD/ (Enoch source) diff --git a/UEFI/Clover_v2.4k_r4152.pkg.md5 b/UEFI/Clover_v2.4k_r4152.pkg.md5 deleted file mode 100644 index 1a0c32b..0000000 --- a/UEFI/Clover_v2.4k_r4152.pkg.md5 +++ /dev/null @@ -1 +0,0 @@ -MD5 (sym/Clover_v2.4k_r4152.pkg) = adf87b4a9aa182859216dee0722a4dff diff --git a/UEFI/Clover_v2.4k_r4152.pkg b/UEFI/Clover_v2.4k_r4233.pkg similarity index 66% rename from UEFI/Clover_v2.4k_r4152.pkg rename to UEFI/Clover_v2.4k_r4233.pkg index fa0bd00..88455a8 100644 Binary files a/UEFI/Clover_v2.4k_r4152.pkg and b/UEFI/Clover_v2.4k_r4233.pkg differ diff --git a/UEFI/Clover_v2.4k_r4233.pkg.md5 b/UEFI/Clover_v2.4k_r4233.pkg.md5 new file mode 100644 index 0000000..e9682c6 --- /dev/null +++ b/UEFI/Clover_v2.4k_r4233.pkg.md5 @@ -0,0 +1 @@ +MD5 (sym/Clover_v2.4k_r4233.pkg) = d9e1f55d0b10cf2ac3cfbe80ab54f45b diff --git a/boot-macOS-HS.sh b/boot-macOS-HS.sh new file mode 100755 index 0000000..b197ed0 --- /dev/null +++ b/boot-macOS-HS.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# See https://www.mail-archive.com/qemu-devel@nongnu.org/msg471657.html thread. +# +# The "pc-q35-2.4" machine type was changed to "pc-q35-2.9" on 06-August-2017. + +################################################################################## +# NOTE: Comment out the "MY_OPTIONS" line in case you are having booting problems! +################################################################################## + +MY_OPTIONS="+aes,+xsave,+avx,+xsaveopt,avx2,+smep" + +~/QEMU/bin/qemu-system-x86_64 -enable-kvm -m 3072 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS\ + -machine pc-q35-2.9 \ + -smp 4,cores=2 \ + -usb -device usb-kbd -device usb-tablet \ + -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \ + -drive if=pflash,format=raw,readonly,file=OVMF_CODE-pure-efi.fd \ + -drive if=pflash,format=raw,file=OVMF_VARS-pure-efi-1024x768.fd \ + -smbios type=2 \ + -device ich9-intel-hda -device hda-duplex \ + -device ide-drive,bus=ide.2,drive=Clover \ + -drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Clover.qcow2' \ + -device ide-drive,bus=ide.1,drive=MacHDD \ + -drive id=MacHDD,if=none,file=./mac_hdd.img,format=qcow2 \ + -device ide-drive,bus=ide.0,drive=MacDVD \ + -drive id=MacDVD,if=none,snapshot=on,media=cdrom,file=./'HighSierra.iso' \ + -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \ + -monitor stdio diff --git a/boot-macOS.sh b/boot-macOS.sh index 208a78e..a17b865 100755 --- a/boot-macOS.sh +++ b/boot-macOS.sh @@ -23,7 +23,7 @@ qemu-system-x86_64 -enable-kvm -m 3072 -cpu Penryn,kvm=off,vendor=GenuineIntel \ -smp 4,cores=2 \ -usb -device usb-kbd -device usb-mouse \ -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \ - -kernel ./enoch_rev2898_boot \ + -kernel ./enoch_rev2902_boot \ -smbios type=2 \ -device ich9-intel-hda -device hda-duplex \ -device ide-drive,bus=ide.2,drive=MacHDD \ diff --git a/enoch_rev2889_boot b/enoch_rev2889_boot deleted file mode 100644 index 3c35053..0000000 Binary files a/enoch_rev2889_boot and /dev/null differ diff --git a/enoch_rev2902_boot b/enoch_rev2902_boot new file mode 100644 index 0000000..c80e94a Binary files /dev/null and b/enoch_rev2902_boot differ diff --git a/notes.md b/notes.md index 3cc6629..606fcca 100644 --- a/notes.md +++ b/notes.md @@ -308,3 +308,9 @@ Release Date: October 21, 2015 Move 'InstallESD.dmg' to '/Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg' location. Move 'InstallESD.dmg' to '/Applications/Install macOS Sierra.app/Contents/SharedSupport/' location (for macOS Sierra). + +### Clover References + +* https://clover-wiki.zetam.org/Development + +* https://sourceforge.net/p/cloverefiboot/code/HEAD/log/?path=