From fc59cfffa126120f05299d29bc6263bd315a8c9a Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com> Date: Tue, 10 Aug 2021 10:06:45 -0600 Subject: [PATCH] Add configuration option for users --- OCLP-CLI.command | 4 ++++ OpenCore-Patcher.command | 1 + Resources/Build.py | 2 +- Resources/CliMenu.py | 26 +++++++++++++++++++++++++- Resources/Constants.py | 1 + 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/OCLP-CLI.command b/OCLP-CLI.command index 5ef12143e..c8911ef59 100755 --- a/OCLP-CLI.command +++ b/OCLP-CLI.command @@ -51,6 +51,7 @@ class OpenCoreLegacyPatcher: parser.add_argument("--disable_amfi", help="Disable AMFI", action="store_true", required=False) parser.add_argument("--moderate_smbios", help="Moderate SMBIOS Patching", action="store_true", required=False) parser.add_argument("--moj_cat_accel", help="Allow Root Patching on Mojave and Catalina", action="store_true", required=False) + parser.add_argument("--disable_thunderbolt", help="Disable Thunderbolt on 2013-2014 MacBook Pros", action="store_true", required=False) # Building args requiring value values (ie. --model iMac12,2) parser.add_argument("--model", action="store", help="Set custom model", required=False) @@ -120,6 +121,9 @@ class OpenCoreLegacyPatcher: if args.wlan: print("- Set Wake on WLAN configuration") self.constants.enable_wake_on_wlan = True + if args.disable_thunderbolt: + print("- Set Disable Thunderbolt configuration") + self.constants.disable_thunderbolt = True if args.moderate_smbios: print("- Set Moderate SMBIOS Patching configuration") self.constants.serial_settings = "Moderate" diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index ac9505285..fc14b259f 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -124,6 +124,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier' [f"Allow Wake on WLAN:\t\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl], [f"Allow Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy], [f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_moj_cat_patch], + [f"Disable Thunderbolt:\t\tCurrently {self.constants.disable_thunderbolt}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt], [f"Disable AMFI:\t\t\tCurrently {self.constants.disable_amfi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_amfi], [ f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", diff --git a/Resources/Build.py b/Resources/Build.py index f2a37aa3a..1648c02a7 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -574,7 +574,7 @@ class BuildOpenCore: print("- Adding Mac Pro, Xserve DRM patches") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree" - if self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]: + if self.constants.disable_thunderbolt is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]: print("- Disabling 2013-2014 laptop Thunderbolt Controller") if self.model in ["MacBookPro11,3", "MacBookPro11,5"]: # 15" dGPU models: IOACPIPlane:/_SB/PCI0@0/PEG1@10001/UPSB@0/DSB0@0/NHI0@0 diff --git a/Resources/CliMenu.py b/Resources/CliMenu.py index 6fd5cd3ea..4ebb6f74f 100644 --- a/Resources/CliMenu.py +++ b/Resources/CliMenu.py @@ -591,4 +591,28 @@ Note: for the average user, we recommend using dosdude1's legacy patcher: elif change_menu in {"n", "N", "no", "No"}: self.constants.moj_cat_accel = False else: - print("Invalid option") \ No newline at end of file + print("Invalid option") + + def disable_thunderbolt(self): + Utilities.cls() + Utilities.header(["Disable Thunderbolt on 2013-14 MacBook Pros"]) + print( + """ +Some 2013-14 MacBook Pro's have issues with the built-in thunderbolt, +resulting in kernel panics and random shutdowns. + +To alliviate, you can disable the thunderbolt controller on MacBookPro11,x +machines with this option. + +Note: This option only works on MacBookPro11,x, file an issue if you know of +other devices that benefit from this fix. + """ + ) + + change_menu = input("Disable Thunderbolt?(y/n): ") + if change_menu in {"y", "Y", "yes", "Yes"}: + self.constants.disable_thunderbolt = True + elif change_menu in {"n", "N", "no", "No"}: + self.constants.disable_thunderbolt = False + else: + print("Invalid option") diff --git a/Resources/Constants.py b/Resources/Constants.py index 70898e8cc..feff724af 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -97,6 +97,7 @@ class Constants: self.latebloom_range = 0 self.latebloom_debug = 0 self.validate = False + self.disable_thunderbolt = False # OS Versions self.tiger = 8