Clean up SysPatch

This commit is contained in:
Mykola Grymalyuk
2021-06-09 18:50:32 -06:00
parent d3de15b594
commit 3c6d0de2e3
3 changed files with 51 additions and 25 deletions

View File

@@ -119,11 +119,11 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True) menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [ options = [
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_metal], [f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_metal],
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi], #[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi],
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial], [f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial],
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting], [f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting], [f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
[f"Assume Legacy GPU:\t\t\tCurrently {self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting], #[f"Assume Legacy GPU:\t\t\tCurrently {self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting],
[f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).disable_cpufriend], [f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).disable_cpufriend],
[f"Override SMBIOS Spoof:\t\tCurrently {self.constants.override_smbios}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).set_smbios], [f"Override SMBIOS Spoof:\t\tCurrently {self.constants.override_smbios}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).set_smbios],
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu], [f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu],
@@ -150,12 +150,12 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
def PatchVolume(self): def PatchVolume(self):
Utilities.cls() Utilities.cls()
Utilities.header(["Patching System Volume"]) Utilities.header(["Patching System Volume"])
print("""Patches Root volume to fix misc issues such as: big_sur = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration for non-Metal GPUs - Graphics Acceleration for non-Metal GPUs
- Nvidia: Tesla - Fermi (8000-500 series) - Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge - Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 (2000-4000 series) - AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1 - Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please WARNING: Root Volume Patching is still in active development, please
@@ -168,7 +168,30 @@ Supported Options:
1. Patch System Volume 1. Patch System Volume
2. Unpatch System Volume (Experimental) 2. Unpatch System Volume (Experimental)
B. Exit B. Exit
""") """
monterey = """Patches Root volume to fix misc issues such as:
- Basic Framebuffer and brightness Control (No acceleration)
- Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates or have FileVault
enabled.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
if self.constants.detected_os > self.constants.big_sur:
print(monterey)
else:
print(big_sur)
change_menu = input("Patch System Volume?: ") change_menu = input("Patch System Volume?: ")
if change_menu == "1": if change_menu == "1":
SysPatch.PatchSysVolume(self.constants.custom_model or self.current_model, self.constants).start_patch() SysPatch.PatchSysVolume(self.constants.custom_model or self.current_model, self.constants).start_patch()
@@ -184,7 +207,6 @@ B. Exit
title = [ title = [
f"OpenCore Legacy Patcher v{self.constants.patcher_version}", f"OpenCore Legacy Patcher v{self.constants.patcher_version}",
f"Selected Model: {self.constants.custom_model or self.current_model}", f"Selected Model: {self.constants.custom_model or self.current_model}",
f"Target OS: macOS {self.constants.os_support}",
] ]
if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False: if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:

View File

@@ -38,7 +38,11 @@ class PatchSysVolume:
self.amfi_must_disable = False self.amfi_must_disable = False
self.no_patch = True self.no_patch = True
self.mount_location = "/System/Volumes/Update/mnt1" if self.constants.detected_os > self.constants.catalina:
# Big Sur and newer use APFS snapshots
self.mount_location = "/System/Volumes/Update/mnt1"
else:
self.mount_location = "/"
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions" self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks" self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks"
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons" self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
@@ -336,28 +340,28 @@ class PatchSysVolume:
print(f"- Found GFX0: {dgpu_vendor}:{dgpu_device}") print(f"- Found GFX0: {dgpu_vendor}:{dgpu_device}")
if dgpu_vendor == self.constants.pci_nvidia: if dgpu_vendor == self.constants.pci_nvidia:
if dgpu_device in PCIIDArray.nvidia_ids().tesla_ids or dgpu_device in PCIIDArray.nvidia_ids().fermi_ids: if dgpu_device in PCIIDArray.nvidia_ids().tesla_ids or dgpu_device in PCIIDArray.nvidia_ids().fermi_ids:
if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
self.nvidia_legacy = True self.nvidia_legacy = True
self.amfi_must_disable = True self.amfi_must_disable = True
elif dgpu_vendor == self.constants.pci_amd_ati: elif dgpu_vendor == self.constants.pci_amd_ati:
if dgpu_device in PCIIDArray.amd_ids().terascale_1_ids: if dgpu_device in PCIIDArray.amd_ids().terascale_1_ids:
if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
self.amd_ts1 = True self.amd_ts1 = True
self.amfi_must_disable = True self.amfi_must_disable = True
# TODO: Enable TS2 support # TODO: Enable TS2 support
#elif dgpu_device in PCIIDArray.amd_ids().terascale_2_ids: elif dgpu_device in PCIIDArray.amd_ids().terascale_2_ids:
# if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
# self.amd_ts2 = True self.amd_ts2 = True
# self.amfi_must_disable = True self.amfi_must_disable = True
if igpu_vendor: if igpu_vendor:
print(f"- Found IGPU: {igpu_vendor}:{igpu_device}") print(f"- Found IGPU: {igpu_vendor}:{igpu_device}")
if igpu_vendor == self.constants.pci_intel: if igpu_vendor == self.constants.pci_intel:
if igpu_device in PCIIDArray.intel_ids().iron_ids: if igpu_device in PCIIDArray.intel_ids().iron_ids:
if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
self.iron_gpu = True self.iron_gpu = True
self.amfi_must_disable = True self.amfi_must_disable = True
elif igpu_device in PCIIDArray.intel_ids().sandy_ids: elif igpu_device in PCIIDArray.intel_ids().sandy_ids:
if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
self.sandy_gpu = True self.sandy_gpu = True
self.amfi_must_disable = True self.amfi_must_disable = True
# TODO: Re-enable when Accel Patches are ready # TODO: Re-enable when Accel Patches are ready
@@ -365,34 +369,34 @@ class PatchSysVolume:
# if self.constants.detected_os > self.constants.big_sur: # if self.constants.detected_os > self.constants.big_sur:
# self.ivy_gpu = True # self.ivy_gpu = True
elif igpu_vendor == self.constants.pci_nvidia: elif igpu_vendor == self.constants.pci_nvidia:
if self.constants.detected_os > self.constants.high_sierra: if self.constants.detected_os > self.constants.catalina:
self.nvidia_legacy = True self.nvidia_legacy = True
self.amfi_must_disable = True self.amfi_must_disable = True
def detect_patch_set(self): def detect_patch_set(self):
self.detect_gpus() self.detect_gpus()
if self.model in ModelArray.LegacyBrightness: if self.model in ModelArray.LegacyBrightness:
if self.constants.detected_os > self.constants.el_capitan: if self.constants.detected_os > self.constants.catalina:
self.brightness_legacy = True self.brightness_legacy = True
if self.model in ["iMac7,1", "iMac8,1"]: if self.model in ["iMac7,1", "iMac8,1"]:
if self.constants.detected_os > self.constants.el_capitan: if self.constants.detected_os > self.constants.catalina:
self.legacy_audio = True self.legacy_audio = 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:
print("- Add Legacy Nvidia Tesla Acceleration") print("- Add Legacy Nvidia Tesla Graphics Patch")
elif self.amd_ts1 is True: elif self.amd_ts1 is True:
print("- Add Legacy ATI TeraScale 1 Acceleration") print("- Add Legacy ATI TeraScale 1 Graphics Patch")
elif self.amd_ts2 is True: elif self.amd_ts2 is True:
print("- Add Legacy ATI TeraScale 2 Acceleration") print("- Add Legacy ATI TeraScale 2 Graphics Patch")
if self.iron_gpu is True: if self.iron_gpu is True:
print("- Add Legacy Intel IronLake Acceleration") print("- Add Legacy Intel IronLake Graphics Patch")
elif self.sandy_gpu is True: elif self.sandy_gpu is True:
print("- Add Legacy Intel Sandy Bridge Acceleration") print("- Add Legacy Intel Sandy Bridge Graphics Patch")
elif self.ivy_gpu is True: elif self.ivy_gpu is True:
print("- Add Legacy Intel Ivy Bridge Acceleration") print("- Add Legacy Intel Ivy Bridge Graphics Patch")
if self.brightness_legacy is True: if self.brightness_legacy is True:
print("- Add Legacy Brightness Control") print("- Add Legacy Brightness Control")
if self.legacy_audio is True: if self.legacy_audio is True:

View File

@@ -1218,7 +1218,7 @@
<key>SystemAudioVolume</key> <key>SystemAudioVolume</key>
<data>Rg==</data> <data>Rg==</data>
<key>boot-args</key> <key>boot-args</key>
<string>keepsyms=1 debug=0x100 -no_compat_check -lilubetaall</string> <string>keepsyms=1 debug=0x100 -lilubetaall</string>
<key>csr-active-config</key> <key>csr-active-config</key>
<data>AAAAAA==</data> <data>AAAAAA==</data>
</dict> </dict>