diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command
index 6edeb2a7a..f33f35da3 100755
--- a/OpenCore-Patcher.command
+++ b/OpenCore-Patcher.command
@@ -19,18 +19,6 @@ class OpenCoreLegacyPatcher:
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.set_defaults(self.computer.real_model, True)
- custom_cpu_model_value = Utilities.get_nvram("revcpuname", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
- if custom_cpu_model_value is not None:
- # TODO: Fix to not use two separate variables
- self.constants.custom_cpu_model = 1
- self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
-
- if "-v" in (Utilities.get_nvram("boot-args") or ""):
- self.constants.verbose_debug = True
-
- # Check if running in RecoveryOS
- self.constants.recovery_status = Utilities.check_recovery()
-
def set_defaults(self, model, host_is_target):
# Defaults
self.constants.sip_status = True
@@ -72,6 +60,20 @@ class OpenCoreLegacyPatcher:
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
self.constants.serial_settings == "Moderate"
+ custom_cpu_model_value = Utilities.get_nvram("revcpuname", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
+ if custom_cpu_model_value is not None:
+ # TODO: Fix to not use two separate variables
+ self.constants.custom_cpu_model = 1
+ self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
+
+ if "-v" in (Utilities.get_nvram("boot-args") or ""):
+ self.constants.verbose_debug = True
+
+ 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()
+
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
diff --git a/Resources/Build.py b/Resources/Build.py
index 0cb695d6b..7c9c3ad2e 100644
--- a/Resources/Build.py
+++ b/Resources/Build.py
@@ -189,12 +189,17 @@ class BuildOpenCore:
# Misc
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: self.model in ModelArray.SidecarPatch),
("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),
]:
self.enable_kext(name, version, path, check)
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}, range {self.constants.latebloom_range}, debug {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 not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in ModelArray.MacPro71):
# Use Innie's same logic:
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
diff --git a/Resources/Constants.py b/Resources/Constants.py
index 67576e55b..a87d0f730 100644
--- a/Resources/Constants.py
+++ b/Resources/Constants.py
@@ -42,6 +42,7 @@ class Constants:
self.debugenhancer_version = "1.0.3"
self.innie_version = "1.3.0"
self.fw_kext = "1.0.0"
+ self.latebloom_version = "0.17"
self.disk = ""
self.patch_disk = ""
self.patcher_support_pkg_version = "0.0.13" # PatcherSupportPkg
@@ -90,6 +91,10 @@ class Constants:
self.enable_wake_on_wlan = False
self.allow_ivy_igpu = False
self.moj_cat_accel = False
+ self.latebloom_status = False
+ self.latebloom_delay = 0
+ self.latebloom_range = 0
+ self.latebloom_debug = 0
# OS Versions
self.tiger = 8
@@ -284,6 +289,10 @@ class Constants:
@property
def innie_path(self):
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
+
+ @property
+ def latebloom_path(self):
+ return self.payload_kexts_path / Path(f"Misc/latebloom-v{self.latebloom_version}.zip")
@property
def plist_folder_path(self):
diff --git a/Resources/ModelArray.py b/Resources/ModelArray.py
index b8f3b68f5..6009b509e 100644
--- a/Resources/ModelArray.py
+++ b/Resources/ModelArray.py
@@ -994,4 +994,35 @@ NoFireWireSupport = [
"MacBookAir3,2",
]
-RecoveryIgnore = ["Update", "VM", "Recovery", "Preboot"]
+PCIRaceCondition = [
+ "MacBook4,1",
+ "MacBook5,1",
+ "MacBook5,2",
+ "MacBook6,1",
+ "MacBook7,1",
+ "MacBookAir2,1",
+ "MacBookAir3,1",
+ "MacBookAir3,2",
+ "MacBookPro4,1",
+ "MacBookPro5,1",
+ "MacBookPro5,2",
+ "MacBookPro5,3",
+ "MacBookPro5,4",
+ "MacBookPro5,5",
+ "MacBookPro6,1",
+ "MacBookPro6,2",
+ "MacBookPro7,1",
+ "Macmini3,1",
+ "Macmini4,1",
+ "Macmini5,1",
+ "Macmini5,2",
+ "Macmini5,3",
+ "iMac7,1",
+ "iMac8,1",
+ "iMac9,1",
+ "iMac10,1",
+ "iMac11,1",
+ "iMac11,2",
+ "iMac11,3",
+ "Dortania1,1",
+]
\ No newline at end of file
diff --git a/Resources/Utilities.py b/Resources/Utilities.py
index 3fa454cff..24ca2b3a2 100644
--- a/Resources/Utilities.py
+++ b/Resources/Utilities.py
@@ -7,6 +7,7 @@ import os
import plistlib
import subprocess
from pathlib import Path
+import re
import requests
@@ -49,6 +50,27 @@ def get_disk_path():
return root_mount_path
+def latebloom_detection(model):
+ if model in ["MacPro4,1", "MacPro5,1", "iMac7,1", "iMac8,1"]:
+ # These machines are more likely to experience boot hangs, increase delays to accomodate
+ lb_delay = "250"
+ else:
+ lb_delay = "100"
+ lb_range = "1"
+ lb_debug = "0"
+ if get_nvram("boot-args", decode=False):
+ if "latebloom=" in get_nvram("boot-args", decode=False):
+ lb_delay = re.search(r"(?:[, ])latebloom=(\d+)", get_nvram("boot-args", decode=False))
+ lb_delay = lb_delay[1]
+ if "lb_range=" in get_nvram("boot-args", decode=False):
+ lb_range = re.search(r"(?:[, ])lb_range=(\d+)", get_nvram("boot-args", decode=False))
+ lb_range = lb_range[1]
+ if "lb_debug=" in get_nvram("boot-args", decode=False):
+ lb_debug = re.search(r"(?:[, ])lb_debug=(\d+)", get_nvram("boot-args", decode=False))
+ lb_debug = lb_debug[1]
+ return int(lb_range), int(lb_range), int(lb_debug)
+
+
def csr_decode(csr_active_config, os_sip):
if csr_active_config is None:
csr_active_config = b"\x00\x00\x00\x00"
diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist
index dda43d9c7..de93fff23 100644
--- a/payloads/Config/config.plist
+++ b/payloads/Config/config.plist
@@ -940,7 +940,7 @@
BundlePath
DebugEnhancer.kext
Comment
-
+ Enhance DEBUG output in system logs
Enabled
ExecutablePath
@@ -952,6 +952,24 @@
PlistPath
Contents/Info.plist
+
+ Arch
+ x86_64
+ BundlePath
+ latebloom.kext
+ Comment
+ Work-around PCI race condition
+ Enabled
+
+ ExecutablePath
+ Contents/MacOS/latebloom
+ MaxKernel
+
+ MinKernel
+ 20.4.0
+ PlistPath
+ Contents/Info.plist
+
Block
diff --git a/payloads/Kexts/Misc/latebloom-v0.17.zip b/payloads/Kexts/Misc/latebloom-v0.17.zip
new file mode 100644
index 000000000..62f88be2f
Binary files /dev/null and b/payloads/Kexts/Misc/latebloom-v0.17.zip differ