Add Kepler Acceleration for Monterey Beta 7

This commit is contained in:
Mykola Grymalyuk
2021-09-21 21:25:49 -06:00
parent 53ea72ed93
commit b34239fb8e
6 changed files with 83 additions and 39 deletions

View File

@@ -42,6 +42,7 @@
- Applicable for BRCM2046 and BRCM2070 chipsets
- Disable Library Validation allowing for AMFI usage
- Remove reliance on amfi_get_out_of_my_way=1
- Add Kepler Accleration Patches for Monterey Beta 7 and newer
## 0.2.4

View File

@@ -20,6 +20,9 @@ class OpenCoreLegacyPatcher:
self.constants.computer = device_probe.Computer.probe()
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.constants.detected_os_minor = int(platform.uname().release.partition(".")[2].partition(".")[0])
detected_os_build: str = subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
self.constants.detected_os_build = detected_os_build
custom_cpu_model_value = Utilities.get_nvram("revcpuname", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
if custom_cpu_model_value is not None:
@@ -200,22 +203,23 @@ If you plan to create the USB for another machine, please select the "Change Mod
elif model in ModelArray.LegacyGPU:
self.constants.disable_cs_lv = True
if model in ModelArray.LegacyGPU:
if Utilities.check_metal_support(device_probe, self.computer) is True:
print("- Detected Metal GPU, overriding default configuration")
if host_is_target and Utilities.check_metal_support(device_probe, self.computer) is True:
# Building on device and we have a native, supported GPU
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
self.constants.allow_fv_root = True # Allow FileVault on broken seal
else:
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
elif host_is_target:
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Root volume modified
self.constants.amfi_status = False # Unsigned binaries
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
if host_is_target and model in ["iMac13,1", "iMac13,3"] and self.computer.dgpu:
# Some models have a supported dGPU, others don't
print("- Detected Metal dGPU, overriding default configuration")
self.constants.sip_status = True
elif host_is_target:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
self.constants.allow_fv_root = True # Allow FileVault on broken seal

View File

@@ -18,6 +18,8 @@ class OpenCoreLegacyPatcher:
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.constants.detected_os_minor = int(platform.uname().release.partition(".")[2].partition(".")[0])
detected_os_build: str = subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
self.constants.detected_os_build = detected_os_build
self.set_defaults(self.computer.real_model, True)
def set_defaults(self, model, host_is_target):
@@ -35,6 +37,12 @@ class OpenCoreLegacyPatcher:
if model in ModelArray.LegacyGPU:
if host_is_target and Utilities.check_metal_support(device_probe, self.computer) is True:
# Building on device and we have a native, supported GPU
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
self.constants.allow_fv_root = True # Allow FileVault on broken seal
else:
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
@@ -44,12 +52,6 @@ class OpenCoreLegacyPatcher:
self.constants.amfi_status = False # Unsigned binaries
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
if host_is_target and model in ["iMac13,1", "iMac13,3"] and self.computer.dgpu:
# Some models have a supported dGPU, others don't
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
# self.constants.amfi_status = True # Signed bundles, Don't need to explicitly set currently
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
self.constants.allow_fv_root = True # Allow FileVault on broken seal
@@ -305,6 +307,7 @@ B. Exit
- Metal Graphics Acceleration
- Intel: Ivy Bridge (4000 series iGPUs)
- Nvidia: Kepler (600-700)
- Non-Metal Graphics Accelertation
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)

View File

@@ -14,7 +14,7 @@ class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.2.5" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.2" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.1.3" # PatcherSupportPkg
# OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg
@@ -121,6 +121,7 @@ class Constants:
self.os_support = 12.0
self.detected_os = 0 # Major Kernel Version
self.detected_os_minor = 0 # Minor Kernel Version
self.detected_os_build = "" # OS Build
self.allow_fv_root = False # Allow FileVault on broken sealed snapshots
## Boot Volume Settings

View File

@@ -271,10 +271,15 @@ ModernGPU = [
"MacBookPro9,2", # Intel 4000
"MacBookPro10,1", # Intel 4000 + Nvidia 650M
"MacBookPro10,2", # Intel 4000
"MacBookPro11,3", # Intel 5000 + Nvidia Kepler
"Macmini6,1", # Intel 4000
"Macmini6,2", # Intel 4000
"iMac13,1", # Intel 4000
"iMac13,2", # Intel 4000 + Nvidia Kepler
"iMac13,3", # Intel 4000
"iMac14,1", # Intel 5000 + Nvidia Kepler
"iMac14,2", # Intel 5000 + Nvidia Kepler
"iMac14,3", # Intel 5000 + Nvidia Kepler
]
LegacyGPU = [

View File

@@ -26,6 +26,7 @@ class PatchSysVolume:
self.fv_enabled = True
self.dosdude_patched = True
self.nvidia_legacy = False
self.kepler_gpu = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
@@ -406,6 +407,14 @@ set million colour before rebooting"""
print("- Installing basic Ivy Bridge Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
def gpu_franevuffer_kepler_master(self):
if self.constants.detected_os == self.constants.monterey:
print("- Installing Kepler Acceleration Kext patches for Monterey")
self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
else:
print("- Installing Kepler Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
def gpu_accel_legacy_extended(self):
print("- Merging general legacy Frameworks")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -426,7 +435,11 @@ set million colour before rebooting"""
# Assume non-OCLP Macs don't have _cs_require_lv
print("- Disabling Library Validation")
Utilities.process_status(
self.elevated(["defaults", "write", "/Library/Preferences/com.apple.security.libraryvalidation.plist", "DisableLibraryValidation", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.elevated(
["defaults", "write", "/Library/Preferences/com.apple.security.libraryvalidation.plist", "DisableLibraryValidation", "-bool", "true"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
def gpu_accel_legacy_extended_ts2(self):
@@ -451,6 +464,14 @@ set million colour before rebooting"""
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_nvidia_master()
elif self.kepler_gpu is True:
print("- Installing Kepler Patches")
if self.constants.detected_os == self.constants.monterey:
print("- Detected supported OS, installing Acceleration Patches")
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_franevuffer_kepler_master()
elif self.amd_ts1 is True:
print("- Installing legacy TeraScale 1 Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
@@ -495,11 +516,7 @@ set million colour before rebooting"""
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_ivybridge_master()
if (
self.amd_ts2 is True
and self.constants.detected_os in self.constants.legacy_accel_support
and self.constants.allow_ts2_accel is True
):
if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support and self.constants.allow_ts2_accel is True:
# TeraScale 2 patches must be installed after Intel HD3000
self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
@@ -599,6 +616,15 @@ set million colour before rebooting"""
if self.constants.detected_os > non_metal_os:
self.nvidia_legacy = True
self.amfi_must_disable = True
elif dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
if self.constants.detected_os > self.constants.big_sur:
# Kepler drivers were dropped with Beta 7
# 12.0 Beta 5: 21.0.0 - 21A5304g
# 12.0 Beta 6: 21.1.0 - 21A5506j
# 12.0 Beta 7: 21.1.0 - 21A5522h
if self.constants.detected_os == self.constants.monterey and self.constants.detected_os_minor > 0:
if "21A5506j" not in self.constants.detected_os_build:
self.kepler_gpu = True
elif dgpu.arch == device_probe.AMD.Archs.TeraScale_1:
if self.constants.detected_os > non_metal_os:
self.amd_ts1 = True
@@ -647,6 +673,8 @@ set million colour before rebooting"""
print("The following patches will be applied:")
if self.nvidia_legacy is True:
print("- Add Legacy Nvidia Tesla Graphics Patch")
elif self.kepler_gpu is True:
print("- Add Legacy Nvidia Kepler Graphics Patch")
elif self.amd_ts1 is True:
print("- Add Legacy ATI TeraScale 1 Graphics Patch")
elif self.amd_ts2 is True:
@@ -667,6 +695,7 @@ set million colour before rebooting"""
self.no_patch = not any(
[
self.nvidia_legacy,
self.kepler_gpu,
self.amd_ts1,
self.amd_ts2,
self.iron_gpu,
@@ -701,7 +730,8 @@ set million colour before rebooting"""
if self.fv_enabled is True:
print("\nCannot patch! Please disable FileVault.")
print("Go to System Preferences -> Security and disable FileVault")
print("For OCLP Macs, please rebuild your config with 0.2.5 or newer")
print("For others, Go to System Preferences -> Security and disable FileVault")
if self.amfi_enabled is True and self.amfi_must_disable is True:
print("\nCannot patch! Please disable AMFI.")