Skip to content

Commit

Permalink
OSX-KVM - March 2021 - Batch Update 1
Browse files Browse the repository at this point in the history
Changes:

- Upgrade to OpenCore 0.6.7-RELEASE

- Big Sur image building script updates (Nick)
  - See kholia#169 for details.

- Removed history to reduce repository size
  • Loading branch information
kholia committed Apr 16, 2021
0 parents commit ca219f5
Show file tree
Hide file tree
Showing 109 changed files with 20,573 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#### Notes

- Please, DO NOT create a new issue if your issue is already known.
- Carefully read the documentation included in the repository.
- Look closely at the closed and open issues.

- Attach details about your host OS (distribution, kernel, QEMU version) and
host CPU (vendor and model number).

- Remove this template message after reading it ;)
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iso
mac_hdd.img
mac_hdd_ng.img
*.sha256sum
*.sucatalog
*.img
*.dmg
*.dist
*.smd
*.dmg
OVMF_VARS-1024x768.fd
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "resources/OcBinaryData"]
path = resources/OcBinaryData
url = https://github.com/acidanthera/OcBinaryData.git
119 changes: 119 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
### Credits

- [UPSTREAM] https://github.com/acidanthera/OpenCorePkg + https://dortania.github.io/ - for making all this possible!

* RehabMan, th3joker and others - FakeSMC.kext, https://bitbucket.org/RehabMan

* Chuck Remes (chuckremes) - better documentation

* Meissa - better networking documentation

* PJ Meyer (pjmeyer) - compatibility with modern versions of GNU mktemp

* Robert DeRose (RobertDeRose) and Dirk Bajohr (isolution-de) - macOS support

* Fritz Elfert (felfert) - cleanups, better documentation, and nicer ISO creation script

* Ian McDowell (IMcD23) - more documentation, and better ISO creation script

* voobscout - libvirt XML file

* Evgeny Grin (Karlson2k) - for the original ISO creation script

* Gabriel L. Somlo - for getting things started and going

* http://www.insanelymac.com/ - Enoch bootloader

* Nicholas Sherlock - UEFI, Clover, and other hacks

* Phil Dennis-Jordan - virtio-net-osx, usb-tablet and other hacks

* Nikolay Dimitrov (nikidim) - Docker for Mac

* Francisco de la Peña - libvirt XML file for macOS High Sierra

* Christian Giliberto - libvirt XML tweaks

* José Roberto Meza Cabrera - AMD Ryzen testing

* Paweł BB Drozd - UEFI resolution

* Jan Kuri (jkuri) - Mojave ISO creation fixes

* Mike Hardy (mikehardy) - Network documentation improvements

* CuriousTommy + pickled_monkey - Information on vmxnet3 network adapter

* Povilas Kanapickas (p12tic) - Flexible ISO generation

* Dick Marinus (meeuw) - Allow usage of latest Clover

* Foxlet (foxlet) - Allow installation without existing macOS

* Ralph Kühnert (redradrat) - Debug fetch-macOS.py script

* Pellegrino Prevete (tallero) - Better documentation

* Niklas Korz (niklaskorz) - Stop using brctl

* Mike Bybee (stereoplegic) - Higher resolution documentation

* Yarkhan - Passthrough for making iDevices work

* Yu-Chen Lin (npes87184) - Virtio and qemu-img notes

* Wen-He - Catalina related fixes

* Alexander Galato (alet) - OVMF build documentation fixes

* zimbatm - portability enhancements, cool crazy ideas (thanks!)

* https://github.com/Leoyzen/KVM-Opencore - OpenCore support

* Kyle Dayton - UEFI, Clover, and GPU passthrough notes

- foxtrotdragon - OpenCore language fixes

- hoshsadiq (Hosh) - fetch-macOS.py improvements

- philffm - Typo fix in `Big-Sur.md`

- jviotti - Headless mode fixes

- offlinehacker - libvirt support

- hellodeibu - Big Sur support

- kittywhiskers - Large number of changes - thank you!

- zimbatm - Thank you!

- Peter Asanov (ink-splatters) - Fixes for the OS-fetch script

- Sangwhan "fish" Moon - Big Sur doc enhancements

- ADawesomeguy - Big Sur doc enhancements, Xcode + OSX-KVM tutorial

- shmsh9 - Python 3.9.x support

- Gelma (Andrea Gelmini) - Typo fixes

- ivy-rew (Reguel) - Greatly improved Big-Sur notes

- Broly1 - Greatly improved Big-Sur notes

- mikkeyboi (Michael Leung) - Greatly improved Big-Sur notes

- CyberShadow (Vladimir Panteleev) - Documentation fixes

- mikehardy (Mike Hardy) - Docker on macOS notes, CPU support notes

- Dogr95 - macOS-libvirt-Catalina.xml fixes

- headkaze - AppleVirtualGraphics.kext tip

- aydenbottos - macOS-libvirt-Catalina.xml fixes

- mikkeyboi - Unraid OS stuff

Note: Individual files have more specific 'credits' in them.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
clean:
rm -rf content || true
30 changes: 30 additions & 0 deletions OVMF-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Current OVMF blobs are borrowed from the following URL,

http://download.proxmox.com/debian/dists/buster/pve-no-subscription/binary-amd64/pve-edk2-firmware_2.20200531-1_all.deb

OVMF for non-OpenCore boot loaders: https://github.com/kholia/edk2/tree/macOS-NG-v3.

Building OVMF
-------------

# Add tools and build dependencies:
apt-get update
apt-get install build-essential git lintian debhelper iasl nasm \
python uuid-dev -y


git clone https://github.com/tianocore/edk2
cd edk2
git submodule update --init
make -C BaseTools
. edksetup.sh BaseTools
build -a X64 -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc -b RELEASE

References
----------

* https://www.contrib.andrew.cmu.edu/~somlo/OSXKVM/

* https://www.nicksherlock.com/2018/04/patch-ovmf-to-support-macos-in-proxmox-5-1/

* https://github.com/thenickdude/edk2 (macos-support branch)
Binary file added OVMF_CODE.fd
Binary file not shown.
Binary file added OVMF_VARS-1024x768.fd
Binary file not shown.
58 changes: 58 additions & 0 deletions OpenCore-Boot-CD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

# Special thanks to:
# https://github.com/Leoyzen/KVM-Opencore
# https://github.com/thenickdude/KVM-Opencore/
# https://github.com/qemu/qemu/blob/master/docs/usb2.txt
#
# qemu-img create -f qcow2 mac_hdd_ng.img 128G
#
# echo 1 > /sys/module/kvm/parameters/ignore_msrs (this is required)

############################################################################
# NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems!
############################################################################

MY_OPTIONS="+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"

# This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with
# macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6

ALLOCATED_RAM="3072" # MiB
CPU_SOCKETS="1"
CPU_CORES="2"
CPU_THREADS="4"

REPO_PATH="./"
OVMF_DIR="."

# shellcheck disable=SC2054
args=(
-enable-kvm -m "$ALLOCATED_RAM" -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS"
-machine q35
-usb -device usb-kbd -device usb-tablet
-smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS"
-device usb-ehci,id=ehci
# -device usb-kbd,bus=ehci.0
# -device usb-mouse,bus=ehci.0
# -device nec-usb-xhci,id=xhci
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
-drive if=pflash,format=raw,readonly,file="$REPO_PATH/$OVMF_DIR/OVMF_CODE.fd"
-drive if=pflash,format=raw,file="$REPO_PATH/$OVMF_DIR/OVMF_VARS-1024x768.fd"
-smbios type=2
-device ich9-intel-hda -device hda-duplex
-device ich9-ahci,id=sata
# -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore-nopicker.qcow2"
-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore.qcow2"
-device ide-hd,bus=sata.2,drive=OpenCoreBoot
-device ide-hd,bus=sata.3,drive=InstallMedia
-drive id=InstallMedia,if=none,file="$REPO_PATH/os.dmg",format=raw
-drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2
-device ide-hd,bus=sata.4,drive=MacHDD
# -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27
-netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27
-monitor stdio
-device VGA,vgamem_mb=128
)

qemu-system-x86_64 "${args[@]}"
61 changes: 61 additions & 0 deletions OpenCore-Boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

# Special thanks to:
# https://github.com/Leoyzen/KVM-Opencore
# https://github.com/thenickdude/KVM-Opencore/
# https://github.com/qemu/qemu/blob/master/docs/usb2.txt
#
# qemu-img create -f qcow2 mac_hdd_ng.img 128G
#
# echo 1 > /sys/module/kvm/parameters/ignore_msrs (this is required)

############################################################################
# NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems!
############################################################################

MY_OPTIONS="+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"

# This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with
# macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6

ALLOCATED_RAM="3072" # MiB
CPU_SOCKETS="1"
CPU_CORES="2"
CPU_THREADS="4"

REPO_PATH="."
OVMF_DIR="."

# This causes high cpu usage on the *host* side
# qemu-system-x86_64 -enable-kvm -m 3072 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,hypervisor=off,vmx=on,kvm=off,$MY_OPTIONS\

# shellcheck disable=SC2054
args=(
-enable-kvm -m "$ALLOCATED_RAM" -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS"
-machine q35
-usb -device usb-kbd -device usb-tablet
-smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS"
-device usb-ehci,id=ehci
# -device usb-kbd,bus=ehci.0
# -device usb-mouse,bus=ehci.0
# -device nec-usb-xhci,id=xhci
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
-drive if=pflash,format=raw,readonly,file="$REPO_PATH/$OVMF_DIR/OVMF_CODE.fd"
-drive if=pflash,format=raw,file="$REPO_PATH/$OVMF_DIR/OVMF_VARS-1024x768.fd"
-smbios type=2
-device ich9-intel-hda -device hda-duplex
-device ich9-ahci,id=sata
# -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore-nopicker.qcow2"
-drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore-Catalina/OpenCore.qcow2"
-device ide-hd,bus=sata.2,drive=OpenCoreBoot
-device ide-hd,bus=sata.3,drive=InstallMedia
-drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",format=raw
-drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2
-device ide-hd,bus=sata.4,drive=MacHDD
# -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27
-netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27
-monitor stdio
-device VGA,vgamem_mb=128
)

qemu-system-x86_64 "${args[@]}"
Binary file added OpenCore-Catalina/EFI/BOOT/BOOTx64.efi
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/ACPI/SSDT-DTGP.aml
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/ACPI/SSDT-EC.aml
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/ACPI/SSDT-EHCI.aml
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/ACPI/SSDT-PLUG.aml
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/Drivers/AudioDxe.efi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/Drivers/VBoxHfs.efi
Binary file not shown.
Binary file added OpenCore-Catalina/EFI/OC/Drivers/XhciDxe.efi
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18A391011</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>111.1.18, Copyright 2008-2016 Apple Inc. All rights reserved.</string>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AGPMInjector</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AGPMInjector</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>2.7.3-AGPMInjector</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>111.1.18</string>
<key>IOKitPersonalities</key>
<dict>
<key>AGPM</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AGPM</string>
<key>IOClass</key>
<string>AGPMController</string>
<key>IONameMatch</key>
<string>AGPMEnabler</string>
<key>IOProviderClass</key>
<string>IOPlatformPluginDevice</string>
<key>Machines</key>
<dict>
<key>iMacPro1,1</key>
<dict>
<key>GFX0</key>
<dict>
<key>AGDCEnabled</key>
<integer>1</integer>
<key>Heuristic</key>
<dict>
<key>ID</key>
<integer>4</integer>
</dict>
<key>control-id</key>
<integer>17</integer>
<key>max-power-state</key>
<integer>15</integer>
<key>min-power-state</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2008-2016 Apple Inc. All rights reserved.</string>
<key>OSBundleRequired</key>
<string>Safe Boot</string>
</dict>
</plist>
Loading

0 comments on commit ca219f5

Please sign in to comment.