diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82e86c391..ab8ea58eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,8 @@
- `CSR_ALLOW_UNAUTHENTICATED_ROOT`
- Fix Kepler DisplayPort output
- Apply `agdpmod=vit9696` patch
+- Add Syncretic's SurPlus 11.3+ Race Condition Patch
+ - [Source](https://github.com/reenigneorcim/SurPlus)
## 0.2.5
diff --git a/OCLP-CLI.command b/OCLP-CLI.command
index a2065a08b..f9a61dbe2 100755
--- a/OCLP-CLI.command
+++ b/OCLP-CLI.command
@@ -55,14 +55,15 @@ class OpenCoreLegacyPatcher:
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)
+ parser.add_argument("--force_surplus", help="Force SurPlus in all newer OSes", 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)
parser.add_argument("--disk", action="store", help="Specifies disk to install to", required=False)
parser.add_argument("--smbios_spoof", action="store", help="Set SMBIOS patching mode", required=False)
- parser.add_argument("--lb_delay", action="store", help="Set Latebloom delay in ms", required=False)
- parser.add_argument("--lb_range", action="store", help="Set Latebloom range in ms", required=False)
- parser.add_argument("--lb_debug", action="store", help="Set Latebloom debug", required=False)
+ # parser.add_argument("--lb_delay", action="store", help="Set Latebloom delay in ms", required=False)
+ # parser.add_argument("--lb_range", action="store", help="Set Latebloom range in ms", required=False)
+ # parser.add_argument("--lb_debug", action="store", help="Set Latebloom debug", required=False)
# SysPatch args
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
@@ -127,6 +128,9 @@ class OpenCoreLegacyPatcher:
if args.disable_thunderbolt:
print("- Set Disable Thunderbolt configuration")
self.constants.disable_thunderbolt = True
+ if args.force_surplus:
+ print("- Forcing SurPlus override configuration")
+ self.constants.force_surplus = True
if args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
self.constants.serial_settings = "Moderate"
@@ -238,8 +242,8 @@ If you plan to create the USB for another machine, please select the "Change Mod
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
self.constants.serial_settings == "Moderate"
- if self.constants.latebloom_delay == 0:
- self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
+ # if self.constants.latebloom_delay == 0:
+ # self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
if Utilities.get_nvram("gpu-power-prefs", "FA4CE28D-B62F-4C99-9CC3-6815686E30F9", decode=True):
self.constants.allow_ts2_accel = False
diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command
index ab5092ce5..a27fe900c 100755
--- a/OpenCore-Patcher.command
+++ b/OpenCore-Patcher.command
@@ -89,8 +89,8 @@ class OpenCoreLegacyPatcher:
# users can override this in settings
self.constants.allow_ts2_accel = False
- if self.constants.latebloom_delay == 0:
- self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
+ # if self.constants.latebloom_delay == 0:
+ # self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
# Check if running in RecoveryOS
self.constants.recovery_status = Utilities.check_recovery()
@@ -164,10 +164,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Enable Kext DEBUG:\t\tCurrently {self.constants.kext_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_kext],
] + (
[
- [
- f"Set Latebloom args:\t\tDelay {self.constants.latebloom_delay}, Range {self.constants.latebloom_range}, Debug {self.constants.latebloom_debug}",
- CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).latebloom_settings,
- ]
+ [f"Set SurPlus Settings:\tCurrently {self.constants.force_surplus}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_surplus]
]
if ((self.constants.custom_model or self.computer.real_model) in ModelArray.PCIRaceCondition)
else []
diff --git a/Resources/Build.py b/Resources/Build.py
index 320b99547..260b59c8e 100644
--- a/Resources/Build.py
+++ b/Resources/Build.py
@@ -172,7 +172,7 @@ class BuildOpenCore:
# Misc
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: self.model in ModelArray.FeatureUnlockSupport),
("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path, lambda: self.constants.kext_debug is True),
- ("latebloom.kext", self.constants.latebloom_version, self.constants.latebloom_path, lambda: self.model in ModelArray.PCIRaceCondition),
+ # ("latebloom.kext", self.constants.latebloom_version, self.constants.latebloom_path, lambda: self.model in ModelArray.PCIRaceCondition),
("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path, lambda: self.model in ["MacBook4,1", "MacBook5,2"]),
]:
self.enable_kext(name, version, path, check)
@@ -180,11 +180,22 @@ class BuildOpenCore:
if self.constants.allow_oc_everywhere is False:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
- if self.get_kext_by_bundle_path("latebloom.kext")["Enabled"] is True:
- print(f"- Setting latebloom delay of {self.constants.latebloom_delay}ms, range {self.constants.latebloom_range}ms, debug {bool(self.constants.latebloom_debug)}")
- self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"][
- "boot-args"
- ] += f" latebloom={self.constants.latebloom_delay} lb_range={self.constants.latebloom_range} lb_debug={self.constants.latebloom_debug}"
+ # if self.get_kext_by_bundle_path("latebloom.kext")["Enabled"] is True:
+ # print(f"- Setting latebloom delay of {self.constants.latebloom_delay}ms, range {self.constants.latebloom_range}ms, debug {bool(self.constants.latebloom_debug)}")
+ # self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"][
+ # "boot-args"
+ # ] += f" latebloom={self.constants.latebloom_delay} lb_range={self.constants.latebloom_range} lb_debug={self.constants.latebloom_debug}"
+ if self.model in ModelArray.PCIRaceCondition:
+ # Ref: https://github.com/reenigneorcim/SurPlus
+ print("- Adding SurPlus Patch for Race Condition")
+ self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["Enabled"] = True
+ self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["Enabled"] = True
+ if self.constants.force_surplus is True:
+ # Syncretic forces SurPlus to only run on Beta 7 and older by default for saftey reasons
+ # If users desires, allow forcing in newer OSes
+ print("- Allowing SurPlus on all newer OSes")
+ self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
+ self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in ModelArray.MacPro):
# Use Innie's same logic:
diff --git a/Resources/CliMenu.py b/Resources/CliMenu.py
index ec8117c53..f3dd62d0f 100644
--- a/Resources/CliMenu.py
+++ b/Resources/CliMenu.py
@@ -676,3 +676,29 @@ for Windows may prefer to only work with the dGPU and eGPU active.
print("Returning to previous menu")
else:
self.dGPU_switch_support()
+
+ def set_surplus(self):
+ Utilities.cls()
+ Utilities.header(["Override SurPlus MaxKernel"])
+ print(
+ """
+By default OCLP will only allow SurPlus to be used on kernels 21.1.0
+and older (ie. Monterey beta 7 and older). This is for saftey reasons
+in the event newer OSes may break compatibility and result in boot loops.
+
+Enabling this option will allow SurPlus to have no MaxKernel set, and
+therefore allow it to run on anything newer than 11.2.3. However if you
+do toggle this setting, ensure you have a known-good OS to return to in
+the event there's issues.
+ """
+ )
+
+ change_menu = input("Force SurPlus on all newer OSes?(y/n/q): ")
+ if change_menu in {"y", "Y", "yes", "Yes"}:
+ self.constants.force_surplus = True
+ elif change_menu in {"n", "N", "no", "No"}:
+ self.constants.force_surplus = False
+ elif change_menu in {"q", "Q", "Quit", "quit"}:
+ print("Returning to previous menu")
+ else:
+ self.set_surplus()
diff --git a/Resources/Constants.py b/Resources/Constants.py
index e26317ad5..748226603 100644
--- a/Resources/Constants.py
+++ b/Resources/Constants.py
@@ -143,6 +143,7 @@ class Constants:
self.disable_thunderbolt = False # Disable Thunderbolt Controller
self.set_alc_usage = True # Set AppleALC usage
self.dGPU_switch = True # Set Display GPU Switching for Windows
+ self.force_surplus = False # Force SurPlus patch in newer OSes
# OS Versions
## Based off Major Kernel Version
diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist
index 68f1ce209..18daca1c3 100644
--- a/payloads/Config/config.plist
+++ b/payloads/Config/config.plist
@@ -1110,6 +1110,78 @@
Skip
0
+
+ Arch
+ x86_64
+ Base
+ _early_random
+ Comment
+ SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)
+ Count
+ 1
+ Enabled
+
+ Find
+
+ AHQjSIs=
+
+ Identifier
+ kernel
+ Limit
+ 800
+ Mask
+
+
+ MaxKernel
+ 21.1.0
+ MinKernel
+ 20.4.0
+ Replace
+
+ AOsjSIs=
+
+ ReplaceMask
+
+
+ Skip
+ 0
+
+
+ Arch
+ x86_64
+ Base
+ _register_and_init_prng
+ Comment
+ SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng
+ Count
+ 1
+ Enabled
+
+ Find
+
+ ukgBAAAx9g==
+
+ Identifier
+ kernel
+ Limit
+ 256
+ Mask
+
+
+ MaxKernel
+ 21.1.0
+ MinKernel
+ 20.4.0
+ Replace
+
+ ukgBAADrBQ==
+
+ ReplaceMask
+
+
+ Skip
+ 0
+
Quirks