Add Legacy GMUX patch sets

This commit is contained in:
Mykola Grymalyuk
2021-09-29 11:29:05 -06:00
parent 11e795026b
commit 61281f597a
4 changed files with 58 additions and 3 deletions

View File

@@ -21,6 +21,12 @@
- Apply `agdpmod=vit9696` patch - Apply `agdpmod=vit9696` patch
- Add Syncretic's SurPlus 11.3+ Race Condition Patch - Add Syncretic's SurPlus 11.3+ Race Condition Patch
- [Source](https://github.com/reenigneorcim/SurPlus) - [Source](https://github.com/reenigneorcim/SurPlus)
- Downgrade Nvidia Kepler Bundles to 11.0 Beta 3
- Resolves crashing at high loads, credit to [Jackluke](https://github.com/jacklukem) for discovery
- Add Legacy GMUX patchsets
- Applicable for dual GPU MacBookPro5,x and demuxed MacBookPro8,x
- Increment Binaries:
- PatcherSupportPkg 0.1.5 release
## 0.2.5 ## 0.2.5

View File

@@ -14,7 +14,7 @@ class Constants:
def __init__(self): def __init__(self):
# Patcher Versioning # Patcher Versioning
self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.4" # PatcherSupportPkg self.patcher_support_pkg_version = "0.1.5" # PatcherSupportPkg
# OpenCore Versioning # OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg # https://github.com/acidanthera/OpenCorePkg
@@ -619,6 +619,10 @@ class Constants:
def legacy_brightness(self): def legacy_brightness(self):
return self.payload_apple_kexts_path / Path("Brightness-Control") return self.payload_apple_kexts_path / Path("Brightness-Control")
@property
def legacy_mux_path(self):
return self.payload_apple_kexts_path / Path("Legacy-Mux")
@property @property
def legacy_wifi_coreservices(self): def legacy_wifi_coreservices(self):
return self.payload_apple_coreservices_path / Path("Legacy-Wifi") return self.payload_apple_coreservices_path / Path("Legacy-Wifi")

View File

@@ -35,6 +35,7 @@ class PatchSysVolume:
self.brightness_legacy = False self.brightness_legacy = False
self.legacy_audio = False self.legacy_audio = False
self.legacy_wifi = False self.legacy_wifi = False
self.legacy_gmux = False
self.added_legacy_kexts = False self.added_legacy_kexts = False
self.amfi_must_disable = False self.amfi_must_disable = False
self.check_board_id = False self.check_board_id = False
@@ -57,6 +58,7 @@ class PatchSysVolume:
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons" self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks" self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks"
self.mount_libexec = f"{self.mount_location}/usr/libexec" self.mount_libexec = f"{self.mount_location}/usr/libexec"
self.mount_extensions_mux = f"{self.mount_location}/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns/"
def elevated(self, *args, **kwargs) -> subprocess.CompletedProcess: def elevated(self, *args, **kwargs) -> subprocess.CompletedProcess:
if os.getuid() == 0 or self.constants.gui_mode is True: if os.getuid() == 0 or self.constants.gui_mode is True:
@@ -310,6 +312,11 @@ set million colour before rebooting"""
Utilities.process_status(self.elevated(["chmod", "755", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) Utilities.process_status(self.elevated(["chmod", "755", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
Utilities.process_status(self.elevated(["chown", "root:wheel", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)) Utilities.process_status(self.elevated(["chown", "root:wheel", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def add_legacy_mux_patch(self):
self.delete_old_binaries(SysPatchArray.DeleteDemux)
print("- Merging Legacy Mux Kext patches")
Utilities.process_status(self.elevated(["cp", "-R", f"{self.constants.legacy_mux_path}/AppleMuxControl.kext", self.mount_extensions_mux], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def gpu_accel_legacy(self): def gpu_accel_legacy(self):
if self.constants.detected_os == self.constants.mojave: if self.constants.detected_os == self.constants.mojave:
print("- Installing General Acceleration Kext patches for Mojave") print("- Installing General Acceleration Kext patches for Mojave")
@@ -414,7 +421,7 @@ set million colour before rebooting"""
print("- Installing basic Ivy Bridge Kext patches for generic OS") print("- Installing basic Ivy Bridge Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path) self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
def gpu_franevuffer_kepler_master(self): def gpu_framebuffer_kepler_master(self):
if self.constants.detected_os == self.constants.monterey: if self.constants.detected_os == self.constants.monterey:
print("- Installing Kepler Acceleration Kext patches for Monterey") print("- Installing Kepler Acceleration Kext patches for Monterey")
self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path) self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
@@ -476,7 +483,7 @@ set million colour before rebooting"""
print("- Detected supported OS, installing Acceleration Patches") print("- Detected supported OS, installing Acceleration Patches")
else: else:
print("- Detected unsupported OS, installing Basic Framebuffer") print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_franevuffer_kepler_master() self.gpu_framebuffer_kepler_master()
elif self.amd_ts1 is True: elif self.amd_ts1 is True:
print("- Installing legacy TeraScale 1 Patches") print("- Installing legacy TeraScale 1 Patches")
@@ -544,6 +551,10 @@ set million colour before rebooting"""
print("- Installing legacy Wireless support") print("- Installing legacy Wireless support")
self.add_wifi_patch() self.add_wifi_patch()
if self.legacy_gmux is True:
print("- Installing Legacy Mux Brightness support")
self.add_legacy_mux_patch()
if self.validate is False: if self.validate is False:
self.rebuild_snapshot() self.rebuild_snapshot()
@@ -664,6 +675,16 @@ set million colour before rebooting"""
self.iron_gpu = False self.iron_gpu = False
self.sandy_gpu = False self.sandy_gpu = False
def detect_demux(self):
# If GFX0 is missing, assume machine was demuxed
# -wegnoegpu would also trigger this, so ensure arg is not present
if not "-wegnoegpu" in (Utilities.get_nvram("boot-args") or ""):
igpu = self.constants.computer.igpu
dgpu = self.constants.computer.dgpu
if igpu and not dgpu:
return True
return False
def detect_patch_set(self): def detect_patch_set(self):
self.detect_gpus() self.detect_gpus()
@@ -684,6 +705,17 @@ set million colour before rebooting"""
if self.constants.detected_os > self.constants.big_sur: if self.constants.detected_os > self.constants.big_sur:
self.legacy_wifi = True self.legacy_wifi = True
if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
# Sierra uses a legacy GMUX control method needed for dGPU switching on MacBookPro5,x
# Same method is also used for demuxed machines
if self.constants.detected_os > self.constants.high_sierra:
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Ref: https://doslabelectronics.com/Demux.html
if self.detect_demux() is True:
self.legacy_gmux = True
else:
self.legacy_gmux = True
Utilities.cls() Utilities.cls()
print("The following patches will be applied:") print("The following patches will be applied:")
if self.nvidia_legacy is True: if self.nvidia_legacy is True:
@@ -706,6 +738,8 @@ set million colour before rebooting"""
print("- Add legacy Audio Control") print("- Add legacy Audio Control")
if self.legacy_wifi is True: if self.legacy_wifi is True:
print("- Add legacy WiFi Control") print("- Add legacy WiFi Control")
if self.legacy_gmux is True:
print("- Add Legacy Mux Brightness Control")
self.no_patch = not any( self.no_patch = not any(
[ [
@@ -719,6 +753,7 @@ set million colour before rebooting"""
self.brightness_legacy, self.brightness_legacy,
self.legacy_audio, self.legacy_audio,
self.legacy_wifi, self.legacy_wifi,
self.legacy_gmux,
] ]
) )

View File

@@ -177,6 +177,16 @@ AddGeneralAccel = ["IOAcceleratorFamily2.kext", "IOSurface.kext"]
DeleteBrightness = ["AppleGraphicsControl.kext/Contents/PlugIns/AGDCBacklightControl.kext"] DeleteBrightness = ["AppleGraphicsControl.kext/Contents/PlugIns/AGDCBacklightControl.kext"]
DeleteDemux = [
"AppleGraphicsControl.kext/Contents/PlugIns/AGDCBacklightControl.kext",
"AppleGraphicsControl.kext/Contents/PlugIns/AppleMuxControl.kext",
"AppleBacklight.kext",
]
AddDemux = [
"AppleMuxControl.kext",
]
AddBrightness = [ AddBrightness = [
"AppleBacklight.kext", "AppleBacklight.kext",
"AppleBacklightExpert.kext", "AppleBacklightExpert.kext",