diff --git a/.gitignore b/.gitignore index 7801c93..5447db8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,68 +1,54 @@ -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## User settings -xcuserdata/ - -## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) -*.xcscmblueprint -*.xccheckout - -## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) -build/ -DerivedData/ -*.moved-aside -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 - -## Obj-C/Swift specific -*.hmap - -## App packaging -*.ipa -*.dSYM.zip -*.dSYM - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ -# -# Add this line if you want to avoid checking in source code from the Xcode workspace -# *.xcworkspace - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build/ - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. -# Instead, use fastlane to re-generate the screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output - -# Code Injection -# -# After new code Injection tools there's a generated folder /iOSInjectionProject -# https://github.com/johnno1962/injectionforxcode - -iOSInjectionProject/ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf +.* +*~ diff --git a/EFI/BOOT/BOOTx64.efi b/EFI/BOOT/BOOTx64.efi new file mode 100755 index 0000000..5e2e88b Binary files /dev/null and b/EFI/BOOT/BOOTx64.efi differ diff --git a/EFI/OC/ACPI/SSDT-DTGP.aml b/EFI/OC/ACPI/SSDT-DTGP.aml new file mode 100755 index 0000000..f9d0887 Binary files /dev/null and b/EFI/OC/ACPI/SSDT-DTGP.aml differ diff --git a/EFI/OC/ACPI/SSDT-EC.aml b/EFI/OC/ACPI/SSDT-EC.aml new file mode 100755 index 0000000..57fe798 Binary files /dev/null and b/EFI/OC/ACPI/SSDT-EC.aml differ diff --git a/EFI/OC/ACPI/SSDT-EHCI.aml b/EFI/OC/ACPI/SSDT-EHCI.aml new file mode 100755 index 0000000..5d4c09b Binary files /dev/null and b/EFI/OC/ACPI/SSDT-EHCI.aml differ diff --git a/EFI/OC/ACPI/SSDT-PLUG.aml b/EFI/OC/ACPI/SSDT-PLUG.aml new file mode 100755 index 0000000..96591c2 Binary files /dev/null and b/EFI/OC/ACPI/SSDT-PLUG.aml differ diff --git a/EFI/OC/Drivers/ApfsDriverLoader.efi b/EFI/OC/Drivers/ApfsDriverLoader.efi new file mode 100755 index 0000000..9d0ac17 Binary files /dev/null and b/EFI/OC/Drivers/ApfsDriverLoader.efi differ diff --git a/EFI/OC/Drivers/FwRuntimeServices.efi b/EFI/OC/Drivers/FwRuntimeServices.efi new file mode 100755 index 0000000..7f337e6 Binary files /dev/null and b/EFI/OC/Drivers/FwRuntimeServices.efi differ diff --git a/EFI/OC/Drivers/VBoxHfs.efi b/EFI/OC/Drivers/VBoxHfs.efi new file mode 100755 index 0000000..06a74a9 Binary files /dev/null and b/EFI/OC/Drivers/VBoxHfs.efi differ diff --git a/EFI/OC/Drivers/apfs-nolog.efi b/EFI/OC/Drivers/apfs-nolog.efi new file mode 100755 index 0000000..63a38d4 Binary files /dev/null and b/EFI/OC/Drivers/apfs-nolog.efi differ diff --git a/EFI/OC/Kexts/AGPMInjector.kext/Contents/Info.plist b/EFI/OC/Kexts/AGPMInjector.kext/Contents/Info.plist new file mode 100755 index 0000000..873ecd0 --- /dev/null +++ b/EFI/OC/Kexts/AGPMInjector.kext/Contents/Info.plist @@ -0,0 +1,66 @@ + + + + + BuildMachineOSBuild + 18A391011 + CFBundleDevelopmentRegion + English + CFBundleGetInfoString + 111.1.18, Copyright 2008-2016 Apple Inc. All rights reserved. + CFBundleIdentifier + com.apple.driver.AGPMInjector + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + AGPMInjector + CFBundlePackageType + KEXT + CFBundleShortVersionString + 2.7.3-AGPMInjector + CFBundleSignature + ???? + CFBundleVersion + 111.1.18 + IOKitPersonalities + + AGPM + + CFBundleIdentifier + com.apple.driver.AGPM + IOClass + AGPMController + IONameMatch + AGPMEnabler + IOProviderClass + IOPlatformPluginDevice + Machines + + iMacPro1,1 + + GFX0 + + AGDCEnabled + 1 + Heuristic + + ID + 4 + + control-id + 17 + max-power-state + 15 + min-power-state + 0 + + + + + + NSHumanReadableCopyright + Copyright © 2008-2016 Apple Inc. All rights reserved. + OSBundleRequired + Safe Boot + + diff --git a/EFI/OC/Kexts/USBPorts.kext/Contents/Info.plist b/EFI/OC/Kexts/USBPorts.kext/Contents/Info.plist new file mode 100755 index 0000000..0d32a5d --- /dev/null +++ b/EFI/OC/Kexts/USBPorts.kext/Contents/Info.plist @@ -0,0 +1,245 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleGetInfoString + 1.0 Copyright © 2018-2020 Headsoft. All rights reserved. + CFBundleIdentifier + com.Headsoft.USBPorts + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + USBPorts + CFBundlePackageType + KEXT + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + IOKitPersonalities + + iMacPro1,1-EH01 + + CFBundleIdentifier + com.apple.driver.AppleUSBMergeNub + IOClass + AppleUSBMergeNub + IONameMatch + EH01 + IOPCIPrimaryMatch + 0x293a8086 + IOProbeScore + 5000 + IOProviderClass + AppleUSBEHCIPCI + IOProviderMergeProperties + + port-count + + BgAAAA== + + ports + + HS11 + + UsbConnector + 0 + port + + AQAAAA== + + + HS12 + + UsbConnector + 0 + port + + AgAAAA== + + + HS13 + + UsbConnector + 0 + port + + AwAAAA== + + + HS14 + + UsbConnector + 0 + port + + BAAAAA== + + + HS15 + + UsbConnector + 0 + port + + BQAAAA== + + + HS16 + + UsbConnector + 0 + port + + BgAAAA== + + + + + model + iMacPro1,1 + + iMacPro1,1-UHC1 + + CFBundleIdentifier + com.apple.driver.AppleUSBMergeNub + IOClass + AppleUSBMergeNub + IONameMatch + UHC1 + IOPCIPrimaryMatch + 0x29348086 + IOProbeScore + 5000 + IOProviderClass + AppleUSBUHCIPCI + IOProviderMergeProperties + + port-count + + AgAAAA== + + ports + + LS01 + + UsbConnector + 0 + port + + AQAAAA== + + + LS02 + + UsbConnector + 0 + port + + AgAAAA== + + + + + model + iMacPro1,1 + + iMacPro1,1-UHC2 + + CFBundleIdentifier + com.apple.driver.AppleUSBMergeNub + IOClass + AppleUSBMergeNub + IONameMatch + UHC2 + IOPCIPrimaryMatch + 0x29358086 + IOProbeScore + 5000 + IOProviderClass + AppleUSBUHCIPCI + IOProviderMergeProperties + + port-count + + AgAAAA== + + ports + + LS03 + + UsbConnector + 0 + port + + AQAAAA== + + + LS04 + + UsbConnector + 0 + port + + AgAAAA== + + + + + model + iMacPro1,1 + + iMacPro1,1-UHC3 + + CFBundleIdentifier + com.apple.driver.AppleUSBMergeNub + IOClass + AppleUSBMergeNub + IONameMatch + UHC3 + IOPCIPrimaryMatch + 0x29368086 + IOProbeScore + 5000 + IOProviderClass + AppleUSBUHCIPCI + IOProviderMergeProperties + + port-count + + AgAAAA== + + ports + + LS05 + + UsbConnector + 0 + port + + AQAAAA== + + + LS06 + + UsbConnector + 0 + port + + AgAAAA== + + + + + model + iMacPro1,1 + + + OSBundleRequired + Root + + diff --git a/EFI/OC/OpenCore.efi b/EFI/OC/OpenCore.efi new file mode 100755 index 0000000..6590171 Binary files /dev/null and b/EFI/OC/OpenCore.efi differ diff --git a/EFI/OC/config.plist b/EFI/OC/config.plist new file mode 100755 index 0000000..6a3859d --- /dev/null +++ b/EFI/OC/config.plist @@ -0,0 +1,673 @@ + + + + + ACPI + + Add + + + Comment + + Enabled + + Path + SSDT-DTGP.aml + + + Comment + + Enabled + + Path + SSDT-EC.aml + + + Comment + + Enabled + + Path + SSDT-EHCI.aml + + + Comment + + Enabled + + Path + SSDT-PLUG.aml + + + Block + + + All + + Comment + Drop CpuPm + Enabled + + OemTableId + Q3B1UG0AAAA= + TableLength + 0 + TableSignature + U1NEVA== + + + All + + Comment + Drop Cpu0Ist + Enabled + + OemTableId + Q3B1MElzdAA= + TableLength + 0 + TableSignature + U1NEVA== + + + Patch + + + Comment + _Q11 to XQ11 + Count + 1 + Enabled + + Find + X1ExMQ== + Limit + 0 + Mask + + OemTableId + + Replace + WFExMQ== + ReplaceMask + + Skip + 0 + TableLength + 0 + TableSignature + + + + Comment + _Q12 to XQ12 + Count + 1 + Enabled + + Find + X1ExMg== + Limit + 0 + Mask + + OemTableId + + Replace + WFExMg== + ReplaceMask + + Skip + 0 + TableLength + 0 + TableSignature + + + + Quirks + + FadtEnableReset + + NormalizeHeaders + + RebaseRegions + + ResetHwSig + + ResetLogoStatus + + + + Booter + + MmioWhitelist + + Quirks + + AvoidRuntimeDefrag + + DevirtualiseMmio + + DisableSingleUser + + DisableVariableWrite + + DiscardHibernateMap + + EnableSafeModeSlide + + EnableWriteUnprotector + + ForceExitBootServices + + ProtectCsmRegion + + ProtectSecureBoot + + ProvideCustomSlide + + SetupVirtualMap + + ShrinkMemoryMap + + SignalAppleOS + + + + DeviceProperties + + Add + + PciRoot(0x1)/Pci(0x1F,0x0) + + compatible + pci8086,2916 + device-id + FikA + name + pci8086,2916 + + + Block + + PciRoot(0x0)/Pci(0x1b,0x0) + + MaximumBootBeepVolume + + + + Kernel + + Add + + + BundlePath + Lilu.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/Lilu + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + BundlePath + WhateverGreen.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/WhateverGreen + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + BundlePath + AppleALC.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/AppleALC + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + BundlePath + AGPMInjector.kext + Comment + + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + BundlePath + USBPorts.kext + Comment + + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + Block + + + Comment + + Enabled + + Identifier + com.apple.driver.AppleTyMCEDriver + MaxKernel + + MinKernel + + + + Emulate + + Cpuid1Data + + Cpuid1Mask + + + Patch + + + Base + + Comment + algrey - cpuid_set_generic_info - disable check to allow leaf7 + Count + 1 + Enabled + + Find + ADoPgg== + Identifier + kernel + Limit + 0 + Mask + + MaxKernel + 19.99.99 + MinKernel + 17.0.0 + Replace + AAAPgg== + ReplaceMask + + Skip + 0 + + + Quirks + + AppleCpuPmCfgLock + + AppleXcpmCfgLock + + AppleXcpmExtraMsrs + + AppleXcpmForceBoost + + CustomSMBIOSGuid + + DisableIoMapper + + DummyPowerManagement + + ExternalDiskIcons + + IncreasePciBarSize + + LapicKernelPanic + + PanicNoKextDump + + PowerTimeoutKernelPanic + + ThirdPartyDrives + + XhciPortLimit + + + + Misc + + BlessOverride + + Boot + + HibernateMode + Auto + PickerMode + Builtin + HideAuxiliary + + HideSelf + + PickerAttributes + 0 + PickerAudioAssist + + PollAppleHotKeys + + ShowPicker + + TakeoffDelay + 10000 + Timeout + 10 + + Debug + + DisableWatchDog + + DisplayDelay + 0 + DisplayLevel + 2147483650 + Target + 83 + + Entries + + Security + + AllowNvramReset + + AllowSetDefault + + AuthRestart + + ExposeSensitiveData + 6 + HaltLevel + 2147483648 + Vault + Optional + ScanPolicy + 257 + + Tools + + + Arguments + + Auxiliary + + Comment + Not signed for security reasons + Enabled + + Name + UEFI Shell + Path + Shell.efi + + + Arguments + + Auxiliary + + Comment + Memory testing utility + Enabled + + Name + memcheck + Path + memcheck/memcheck.efi + + + + NVRAM + + Add + + 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 + + DefaultBackgroundColor + AAAAAA== + UIScale + Ag== + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + SystemAudioVolume + Rg== + boot-args + keepsyms=1 debug=0x100 + csr-active-config + 5wMAAA== + nvda_drv + MQ== + prev-lang:kbd + emgtSGFuczoyNTI= + + + Block + + 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 + + UIScale + DefaultBackgroundColor + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + boot-args + + + LegacyEnable + + LegacyOverwrite + + LegacySchema + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + EFILoginHiDPI + EFIBluetoothDelay + LocationServicesEnabled + SystemAudioVolume + SystemAudioVolumeDB + SystemAudioVolumeSaved + bluetoothActiveControllerInfo + bluetoothInternalControllerInfo + flagstate + fmm-computer-name + nvda_drv + prev-lang:kbd + + 8BE4DF61-93CA-11D2-AA0D-00E098032B8C + + Boot0080 + Boot0081 + Boot0082 + BootNext + BootOrder + + + WriteFlash + + + PlatformInfo + + Automatic + + Generic + + MLB + C02717306J9JG361M + ROM + m7zhIYfl + SpoofVendor + + SystemProductName + iMacPro1,1 + SystemSerialNumber + C02TM2ZBHX87 + SystemUUID + 007076A6-F2A2-4461-BBE5-BAD019F8025A + + UpdateDataHub + + UpdateNVRAM + + UpdateSMBIOS + + UpdateSMBIOSMode + Create + + UEFI + + ConnectDrivers + + Drivers + + apfs-nolog.efi + #ApfsDriverLoader.efi + FwRuntimeServices.efi + VBoxHfs.efi + + Audio + + AudioSupport + + AudioDevice + PciRoot(0x1)/Pci(0x1,0x0)/Pci(0x0,0x1) + AudioCodec + 0 + AudioOut + 0 + MinimumVolume + 20 + PlayChime + + VolumeAmplifier + 0 + + Input + + KeyForgetThreshold + 5 + KeyMergeThreshold + 2 + KeySupport + + KeySupportMode + Auto + KeySwap + + PointerSupport + + PointerSupportMode + + TimerResolution + 50000 + + Output + + TextRenderer + BuiltinGraphics + ConsoleMode + + Resolution + Max + ClearScreenOnModeSwitch + + IgnoreTextInGraphics + + ProvideConsoleGop + + DirectGopRendering + + ReconnectOnResChange + + ReplaceTabWithSpace + + SanitiseClearScreen + + + Protocols + + AppleAudio + + AppleBootPolicy + + AppleEvent + + AppleImageConversion + + AppleKeyMap + + AppleSmcIo + + AppleUserInterfaceTheme + + DataHub + + DeviceProperties + + FirmwareVolume + + HashServices + + OSInfo + + UnicodeCollation + + + Quirks + + ExitBootServicesDelay + 0 + IgnoreInvalidFlexRatio + + ReleaseUsbOwnership + + RequestBootVarFallback + + RequestBootVarRouting + + UnblockFsConnect + + + + + \ No newline at end of file diff --git a/README.md b/README.md index ba2dddd..aff0ac8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,100 @@ # KVM-Opencore Opencore Configuration of KVM Hackintosh with tweaks + +# Status + +* OS: tested in Catalina 10.15.x +* Opencore: 0.5.6 + * NVRAM: native + * AppleHotKey: works + * FileVault: un-tested + * Boot-Audio: works with onboard audio passthrough + * OVMF: you can use latest version other than the old way(patched one). see issues. +* SMBIOS: iMacPro1,1 +* NIC: vmxnet3/e1000-82545em/passthrough +* CPU: + * Penryn: works, using patches to enable leaf7 support for better performance + * Intel Host-Passthrough: works, but with patches and remove topology line + * AMD Host-PassThrough: works, but with AMD-Vanilla patches +* GPU Passthrough: works + * HDMI/DP Audio: works + * Metal Support: works + * H264 Hardware Decoding: works + * H265 Hardware Decoding: works +* Handoff: works with specific Wifi/Bluetooth +* USB(Passthrough): works +* Power Manages + * Sleep: works, see details below. + * EC: faked one + * USB Power: works even with USB3 passthrough + * CPU AGPM: wo don't need CPU AGPM because hypervisor handled it well, this is for GPU AGPM + * GPU AGPM: works + +# Usage +1. Download the repository and put the EFI under your EFI disk +2. Download latest Lilu/WhatEverGreen/AppleALC and put them into kext folder, also add them to config.plist + +# Tips +## SMBios +Comparing with normal hackintosh setup, we only have limited choices here(because we don't have iGPU) +* iMacPro1,1(Prefer) +* MacPro7,1 +## CPU +You have two options to choose: Penryn, Passthrough +### Penryn +Penryn is the safest choice in Hackintosh VM, it is classic, and Apple wrote native code to support it. +But we should do something to make it work more than that: + +1. You should passthrough some important cpuid features which don't included in Penryn Model, such as: + * invtsc: latest MacOS won't boot without it + * AVX: latest MacOS won't boot without it + * FMA: metal support needs this + * AVX2 + * BMI1 + * BMI2 + * kvm=on: QEMU use it to expose Hypervisor leaf node, which MacOS use it to determine the invtsc frequency from hypervisor node. + * ~~vmware-cpu-freq=on~~: no more need, QEMU enabled it by default. +2. Add patch(from AMD-Vanilla) to support leaf7 cpuid features support + * otherwise App won't use some important feature like AVX + * can be check with `sysctl -a|grep machdep.cpu.leaf7_features` to see whether AVX/AVX2 is included. + +__NOTES__: Topology/Hyper-Threading is working well with Penryn, but you can't not use odd num(like 3/5/7 and greater than 8) cores. + +### Passthrough +We can't use topology when using cpu passthrough, detail/discussion can be found in issues. +So remove the line(``) from your libvirt xml. +#### Intel +If you are using most recent generation Intel CPU(newer than Penryn), then you can just just passthrough you cpu type with `mode='host-passthrough'`. + +#### AMD +You can passthrough amd process too, but with AMD-Vanilla patches like bare metal hackintosh. + +## GPU +GPU passthrough is a good way to gain smooth experience in MacOS.If you do so, make sure you doing things right. +__You have to make sure you put the gfx and graphic audio in the same bus but different function, otherwise DP/HDMI audio, Metal Support, HW Accuration won't work__. +```xml + + + + +
+ + +
+ + + + +
+ + +
+ +``` +If you did it right, then there is no much differeces between VM and normal setup procedure, just adding Lilu/WEG/AppleALC then the Metal/H264/H265 HW/HDMI Audio will work well in most case. + +## USB +We use EHC/UHC from qemu now(XHCI(nec/qemu) can't be recognized by MacOS now).USB port mapping(EHC) and USB Power injection(with fake EC ioreg) already included. + +# Known Problems/Help +see issues. diff --git a/libvirt.xml b/libvirt.xml new file mode 100644 index 0000000..9fc0da9 --- /dev/null +++ b/libvirt.xml @@ -0,0 +1,161 @@ + + + Catalina + 4450a55c-1669-da0e-d0bd-3ab45fef0398 + + + + 8388608 + 8388608 + + + + 8 + 1 + + + + + + + + + + + + + hvm + /usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd + /etc/libvirt/qemu/nvram/4450a55c-1669-da0e-d0bd-3ab45fef0398_VARS-pure-efi.fd + + + + + + + + + + + + + destroy + restart + restart + + /usr/local/sbin/qemu + + + + + +
+ + + + + + +
+ + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + +
+ + +
+ + + +
+ + + +
+ + + +
+ + + + + +
+ + + + + + + + + + + +
+ + + + + + +
+ + +
+ + + + +
+ +
+ + + + + + + + + +