mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 04:38:20 +10:00
Add backend to support latebloom
Kext currently not enabled until ready for mass community usage
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
@@ -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"
|
||||
|
||||
@@ -940,7 +940,7 @@
|
||||
<key>BundlePath</key>
|
||||
<string>DebugEnhancer.kext</string>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<string>Enhance DEBUG output in system logs</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
@@ -952,6 +952,24 @@
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>latebloom.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Work-around PCI race condition</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/latebloom</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>20.4.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Block</key>
|
||||
<array/>
|
||||
|
||||
BIN
payloads/Kexts/Misc/latebloom-v0.17.zip
Normal file
BIN
payloads/Kexts/Misc/latebloom-v0.17.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user