mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
Merge branch 'main' into vmm
This commit is contained in:
2
.github/workflows/build-app-offline.yml
vendored
2
.github/workflows/build-app-offline.yml
vendored
@@ -28,6 +28,6 @@ jobs:
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-TUI.app.zip
|
||||
file: OpenCore-Patcher-TUI-Offline.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
- Mainly applicable for iMac12,x and iGPU-only MacBooks
|
||||
- Add EFICheckDisabler
|
||||
- Based off stripped RestrictEvents.kext
|
||||
- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks
|
||||
|
||||
## 0.2.5
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments
|
||||
from data import model_array
|
||||
|
||||
|
||||
class OpenCoreLegacyPatcher:
|
||||
def __init__(self):
|
||||
print("- Loading...")
|
||||
@@ -17,7 +18,7 @@ class OpenCoreLegacyPatcher:
|
||||
self.generate_base_data()
|
||||
if utilities.check_cli_args() is None:
|
||||
self.main_menu()
|
||||
|
||||
|
||||
def generate_base_data(self):
|
||||
self.constants.detected_os = os_probe.detect_kernel_major()
|
||||
self.constants.detected_os_minor = os_probe.detect_kernel_minor()
|
||||
@@ -28,7 +29,7 @@ class OpenCoreLegacyPatcher:
|
||||
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
|
||||
if utilities.check_cli_args() is not None:
|
||||
print("- Detected arguments, switching to CLI mode")
|
||||
self.constants.gui_mode = True # Assumes no user interaction is required
|
||||
self.constants.gui_mode = True # Assumes no user interaction is required
|
||||
self.constants.current_path = Path.cwd()
|
||||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
||||
print("- Rerouting payloads location")
|
||||
|
||||
@@ -65,6 +65,8 @@ Nightly builds can be found here courteous of nightly.link:
|
||||
* Development of previous patchers, laying out much of what needs to be patched
|
||||
* [mario_bros_tech](https://github.com/mariobrostech) and the rest of the Unsupported Mac Discord
|
||||
* Catalyst that started OpenCore Legacy Patcher
|
||||
* [arter97](https://github.com/arter97/)
|
||||
* [SimpleMSR](https://github.com/arter97/SimpleMSR/) to disable firmware throttling in Nehalem+ MacBooks without batteries
|
||||
* MacRumors and Unsupported Mac Communities
|
||||
* Endless testing, reporting issues
|
||||
* Apple
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import enum
|
||||
|
||||
|
||||
class bluetooth_data(enum.IntEnum):
|
||||
# Bluetooth Chipsets
|
||||
NonApplicable = 0
|
||||
BRCM2045 = 1 # TODO: Rename chipset, currently guessing MacPro1,1-3,1 name
|
||||
BRCM2046 = 2 # BT 2.1
|
||||
BRCM2070 = 3 # BT 2.1
|
||||
BRCM20702_v1 = 4 # BT 4.0 - 2012
|
||||
BRCM20702_v2 = 5 # BT 4.0 - 2013+
|
||||
BRCM20703 = 6 # BT 4.2
|
||||
BRCM20703_UART = 9 # BRCM20703 over UART, BT 4.2
|
||||
UART = 10 # T2
|
||||
PCIe = 20 # Apple Silicon
|
||||
BRCM2045 = 1 # TODO: Rename chipset, currently guessing MacPro1,1-3,1 name
|
||||
BRCM2046 = 2 # BT 2.1
|
||||
BRCM2070 = 3 # BT 2.1
|
||||
BRCM20702_v1 = 4 # BT 4.0 - 2012
|
||||
BRCM20702_v2 = 5 # BT 4.0 - 2013+
|
||||
BRCM20703 = 6 # BT 4.2
|
||||
BRCM20703_UART = 9 # BRCM20703 over UART, BT 4.2
|
||||
UART = 10 # T2
|
||||
PCIe = 20 # Apple Silicon
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import enum
|
||||
|
||||
|
||||
class cpu_data(enum.IntEnum):
|
||||
pentium_4 = 0
|
||||
yonah = 1
|
||||
conroe = 2
|
||||
penryn = 3
|
||||
nehalem = 4 # (Westmere included)
|
||||
nehalem = 4 # (Westmere included)
|
||||
sandy_bridge = 5 # 2000
|
||||
ivy_bridge = 6 # 3000
|
||||
haswell = 7 # 4000
|
||||
broadwell = 8 # 5000
|
||||
skylake = 9 # 6000
|
||||
haswell = 7 # 4000
|
||||
broadwell = 8 # 5000
|
||||
skylake = 9 # 6000
|
||||
kaby_lake = 10 # 7000
|
||||
coffee_lake = 11 # 8000
|
||||
comet_lake = 12 # 9000
|
||||
comet_lake = 12 # 9000
|
||||
ice_lake = 13 # 10000
|
||||
|
||||
|
||||
apple_dtk = 112 # A12
|
||||
apple_m1 = 114 # A14
|
||||
apple_m2 = 115 # A15
|
||||
apple_dtk = 112 # A12
|
||||
apple_m1 = 114 # A14
|
||||
apple_m2 = 115 # A15
|
||||
|
||||
@@ -392,4 +392,4 @@ Missing_USB_Map = [
|
||||
"MacPro4,1",
|
||||
"Xserve2,1",
|
||||
"Xserve3,1",
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import enum
|
||||
|
||||
|
||||
class os_data(enum.IntEnum):
|
||||
# OS Versions, Based off Major Kernel Version
|
||||
tiger = 8
|
||||
@@ -16,4 +17,4 @@ class os_data(enum.IntEnum):
|
||||
catalina = 19
|
||||
big_sur = 20
|
||||
monterey = 21
|
||||
max_os = 99
|
||||
max_os = 99
|
||||
|
||||
@@ -699,8 +699,8 @@ class amd_ids:
|
||||
0x6898, # HD 5870
|
||||
0x6899, # HD 5850
|
||||
0x68B8, # HD 5770
|
||||
0x68B0, # Unknown
|
||||
0x68B1, # Unknown
|
||||
0x68B0, # Unknown
|
||||
0x68B1, # Unknown
|
||||
0x68A0, # HD 5870 (mobile)
|
||||
0x68A1, # HD 5850 (mobile)
|
||||
0x6840, # HD 7500M/7600M
|
||||
@@ -714,7 +714,7 @@ class amd_ids:
|
||||
0x6759, # HD 6570/7570/8550
|
||||
0x6740, # HD 6730M/6770M/7690M XT
|
||||
0x6741, # HD 6630M/6650M/6750M/7670M/7690M
|
||||
0x6745, # Unknown
|
||||
0x6745, # Unknown
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -32,4 +32,4 @@ class system_integrity_protection:
|
||||
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200
|
||||
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE", # 0x400
|
||||
"CSR_ALLOW_UNAUTHENTICATED_ROOT", # 0x800
|
||||
]
|
||||
]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1025,7 +1025,7 @@
|
||||
<key>BundlePath</key>
|
||||
<string>CSLVFixup.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Fix Music.app</string>
|
||||
<string>Fix Music</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
@@ -1037,6 +1037,24 @@
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>SimpleMSR.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>Disable firmware based battery throttling</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/SimpleMSR</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string></string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Block</key>
|
||||
<array/>
|
||||
|
||||
BIN
payloads/Kexts/Misc/SimpleMSR-v1.0.0.zip
Normal file
BIN
payloads/Kexts/Misc/SimpleMSR-v1.0.0.zip
Normal file
Binary file not shown.
@@ -6,7 +6,7 @@ from data import model_array
|
||||
class arguments:
|
||||
def __init__(self):
|
||||
self.args = utilities.check_cli_args()
|
||||
|
||||
|
||||
def parse_arguments(self, settings):
|
||||
if self.args.model:
|
||||
if self.args.model:
|
||||
@@ -33,7 +33,7 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
||||
print("- Set verbose configuration")
|
||||
settings.verbose_debug = True
|
||||
else:
|
||||
settings.verbose_debug = False # Override Defaults detected
|
||||
settings.verbose_debug = False # Override Defaults detected
|
||||
if self.args.debug_oc:
|
||||
print("- Set OpenCore DEBUG configuration")
|
||||
settings.opencore_debug = True
|
||||
@@ -48,12 +48,12 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
||||
print("- Set Disable SIP configuration")
|
||||
settings.sip_status = False
|
||||
else:
|
||||
settings.sip_status = True # Override Defaults detected
|
||||
settings.sip_status = True # Override Defaults detected
|
||||
if self.args.disable_smb:
|
||||
print("- Set Disable SecureBootModel configuration")
|
||||
settings.secure_status = False
|
||||
else:
|
||||
settings.secure_status = True # Override Defaults detected
|
||||
settings.secure_status = True # Override Defaults detected
|
||||
if self.args.vault:
|
||||
print("- Set Vault configuration")
|
||||
settings.vault = True
|
||||
@@ -104,4 +104,4 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
||||
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings).start_patch()
|
||||
elif self.args.unpatch_sys_vol:
|
||||
print("- Set System Volume unpatching")
|
||||
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings).start_unpatch()
|
||||
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings).start_unpatch()
|
||||
|
||||
@@ -106,7 +106,12 @@ class BuildOpenCore:
|
||||
# CPU patches
|
||||
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: (self.model.startswith("MacPro") or self.model.startswith("Xserve")) and self.constants.serial_settings != "None"),
|
||||
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
|
||||
("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
|
||||
(
|
||||
"telemetrap.kext",
|
||||
self.constants.telemetrap_version,
|
||||
self.constants.telemetrap_path,
|
||||
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value,
|
||||
),
|
||||
(
|
||||
"CPUFriend.kext",
|
||||
self.constants.cpufriend_version,
|
||||
@@ -117,11 +122,21 @@ class BuildOpenCore:
|
||||
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"),
|
||||
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell"),
|
||||
# Legacy audio
|
||||
("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True),
|
||||
(
|
||||
"AppleALC.kext",
|
||||
self.constants.applealc_version,
|
||||
self.constants.applealc_path,
|
||||
lambda: (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True,
|
||||
),
|
||||
# IDE patch
|
||||
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in model_array.IDEPatch),
|
||||
# Misc
|
||||
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake.value),
|
||||
(
|
||||
"FeatureUnlock.kext",
|
||||
self.constants.featureunlock_version,
|
||||
self.constants.featureunlock_path,
|
||||
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake.value,
|
||||
),
|
||||
("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path, lambda: self.constants.kext_debug is True),
|
||||
("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path, lambda: self.model in ["MacBook4,1", "MacBook5,2"]),
|
||||
]:
|
||||
@@ -158,7 +173,7 @@ class BuildOpenCore:
|
||||
# Required due to Big Sur's BCM5701 requiring VT-x support
|
||||
# Applicable for pre-Ivy Bridge models
|
||||
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
||||
|
||||
|
||||
if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
|
||||
if (smbios_data.smbios_dictionary[generate_smbios.set_smbios_model_spoof(self.model) or self.constants.override_smbios]["SecureBootModel"]) != None:
|
||||
# Monterey T2 SMBIOS don't get OS updates without a T2 SBM
|
||||
@@ -439,7 +454,6 @@ class BuildOpenCore:
|
||||
# Used to enable Audio support for non-standard dGPUs
|
||||
self.enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
||||
|
||||
|
||||
def check_firewire(model):
|
||||
# MacBooks never supported FireWire
|
||||
# Pre-Thunderbolt MacBook Airs as well
|
||||
@@ -745,6 +759,11 @@ class BuildOpenCore:
|
||||
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
|
||||
# Lets us check in sys_patch.py if config supports FileVault
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
|
||||
if self.constants.disable_msr_power_ctl is True and self.model.startswith("MacBook"):
|
||||
print("- Disabling Battery Throttling")
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
|
||||
# Nehalem and newer MacBooks force firmware throttling via MSR_POWER_CTL
|
||||
self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
|
||||
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
|
||||
# Ensure this is done at the end so all previous RestrictEvents patches are applied
|
||||
# RestrictEvents and EFICheckDisabler will confilict if both are injected
|
||||
@@ -783,12 +802,12 @@ class BuildOpenCore:
|
||||
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeaturesMask"] = fw_feature
|
||||
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeatures"] = fw_feature
|
||||
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeaturesMask"] = fw_feature
|
||||
|
||||
|
||||
# Board ID
|
||||
self.config["PlatformInfo"]["DataHub"]["BoardProduct"] = self.spoofed_board
|
||||
self.config["PlatformInfo"]["PlatformNVRAM"]["BID"] = self.spoofed_board
|
||||
self.config["PlatformInfo"]["SMBIOS"]["BoardProduct"] = self.spoofed_board
|
||||
|
||||
|
||||
# Model (ensures tables are not mismatched, even if we're not spoofing)
|
||||
self.config["PlatformInfo"]["DataHub"]["SystemProductName"] = self.model
|
||||
self.config["PlatformInfo"]["SMBIOS"]["SystemProductName"] = self.model
|
||||
@@ -905,7 +924,7 @@ class BuildOpenCore:
|
||||
for gpu in ["Vendor10deDevice0a34", "Vendor10deDevice0a29"]:
|
||||
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostPState"] = [2, 2, 2, 2]
|
||||
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostTime"] = [2, 2, 2, 2]
|
||||
|
||||
|
||||
for entry in list(agpm_config["IOKitPersonalities"]["AGPM"]["Machines"]):
|
||||
if not entry.startswith(self.spoofed_board):
|
||||
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"].pop(entry)
|
||||
|
||||
@@ -635,7 +635,7 @@ handle acceleration tasks.
|
||||
print("")
|
||||
print(self.constants.computer)
|
||||
input("\nPress [ENTER] to exit: ")
|
||||
|
||||
|
||||
def applealc_support(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Set AppleALC usage"])
|
||||
@@ -659,7 +659,7 @@ If AppleALC is detected, the Patcher will not install AppleHDA.
|
||||
print("Returning to previous menu")
|
||||
else:
|
||||
self.applealc_support()
|
||||
|
||||
|
||||
def dGPU_switch_support(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Set Windows GMUX support"])
|
||||
@@ -681,6 +681,35 @@ for Windows may prefer to only work with the dGPU and eGPU active.
|
||||
else:
|
||||
self.dGPU_switch_support()
|
||||
|
||||
def set_battery_throttle(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Disable Firmware Throttling"])
|
||||
print(
|
||||
"""
|
||||
By default on Nehalem and newer Macs, the firmware will throttle if
|
||||
the battery is either dead or missing. The firmware will set
|
||||
'BD PROCHOT' to notify the OS the machine needs to run in an extreme
|
||||
low power mode.
|
||||
|
||||
Enabling this option will patch 'MSR_POWER_CTL' to be unset allowing
|
||||
proper CPU behaviour as if battery is present. Note that this can cause
|
||||
instability in situations where the CPU is being taxed and pulls more
|
||||
power than the PSU can supply.
|
||||
|
||||
Note: Only supported on Nehalem and newer MacBooks (2010+)
|
||||
"""
|
||||
)
|
||||
|
||||
change_menu = input("Disable Firmware Throttling?(y/n/q): ")
|
||||
if change_menu in {"y", "Y", "yes", "Yes"}:
|
||||
self.constants.disable_msr_power_ctl = True
|
||||
elif change_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.disable_msr_power_ctl = False
|
||||
elif change_menu in {"q", "Q", "Quit", "quit"}:
|
||||
print("Returning to previous menu")
|
||||
else:
|
||||
self.set_battery_throttle()
|
||||
|
||||
def set_surplus(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Override SurPlus MaxKernel"])
|
||||
@@ -706,7 +735,7 @@ the event there's issues.
|
||||
print("Returning to previous menu")
|
||||
else:
|
||||
self.set_surplus()
|
||||
|
||||
|
||||
def credits(self):
|
||||
utilities.TUIOnlyPrint(
|
||||
["Credits"],
|
||||
@@ -752,7 +781,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
input("\nPress [ENTER] to continue")
|
||||
else:
|
||||
defaults.generate_defaults.probe(self.constants.custom_model, False, self.constants)
|
||||
|
||||
|
||||
def PatchVolume(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Patching System Volume"])
|
||||
@@ -774,7 +803,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
|
||||
else:
|
||||
print("Returning to main menu")
|
||||
|
||||
|
||||
def advanced_patcher_settings(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
@@ -794,7 +823,6 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
|
||||
def patcher_settings(self):
|
||||
response = None
|
||||
@@ -834,9 +862,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
[f"Enable OpenCore DEBUG:\tCurrently {self.constants.opencore_debug}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_oc],
|
||||
[f"Enable Kext DEBUG:\t\tCurrently {self.constants.kext_debug}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_kext],
|
||||
] + (
|
||||
[
|
||||
[f"Set SurPlus Settings:\tCurrently {self.constants.force_surplus}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_surplus]
|
||||
]
|
||||
[[f"Set SurPlus Settings:\tCurrently {self.constants.force_surplus}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_surplus]]
|
||||
if (smbios_data.smbios_dictionary[self.constants.custom_model or self.constants.computer.real_model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge)
|
||||
else []
|
||||
)
|
||||
@@ -912,13 +938,20 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
[f"Set ShowPicker Mode:\tCurrently {self.constants.showpicker}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_showpicker],
|
||||
[f"Set Wake on WLAN:\t\tCurrently {self.constants.enable_wake_on_wlan}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_wowl],
|
||||
[f"Set Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_ivy],
|
||||
[f"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).terascale_2_accel],
|
||||
[
|
||||
f"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).terascale_2_accel,
|
||||
],
|
||||
[
|
||||
f"Disable Thunderbolt:\tCurrently {self.constants.disable_tb}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).disable_tb,
|
||||
],
|
||||
[f"Set AppleALC Usage:\t\tCurrently {self.constants.set_alc_usage}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).applealc_support],
|
||||
[f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support],
|
||||
[
|
||||
f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support,
|
||||
],
|
||||
[f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
@@ -946,9 +979,6 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
|
||||
response = menu.start()
|
||||
|
||||
|
||||
|
||||
|
||||
big_sur = """Patches Root volume to fix misc issues such as:
|
||||
|
||||
- Non-Metal Graphics Acceleration
|
||||
@@ -1015,4 +1045,4 @@ install that requires root patches such as macOS Big Sur or Monterey
|
||||
Supported Options:
|
||||
|
||||
B. Exit
|
||||
"""
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ from resources import device_probe
|
||||
class Constants:
|
||||
def __init__(self):
|
||||
# Patcher Versioning
|
||||
self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher
|
||||
self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher
|
||||
self.patcher_support_pkg_version = "0.1.6" # PatcherSupportPkg
|
||||
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
||||
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
|
||||
@@ -72,6 +72,10 @@ class Constants:
|
||||
## https://github.com/cdf/Innie
|
||||
self.innie_version = "1.3.0" # Innie
|
||||
|
||||
## arter97
|
||||
## https://github.com/arter97/SimpleMSR/
|
||||
self.simplemsr_version = "1.0.0" # SimpleMSR
|
||||
|
||||
# Get resource path
|
||||
self.current_path = Path(__file__).parent.parent.resolve()
|
||||
self.payload_path = self.current_path / Path("payloads")
|
||||
@@ -140,14 +144,14 @@ class Constants:
|
||||
self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support
|
||||
|
||||
## Miscellaneous
|
||||
self.disallow_cpufriend = False # Disable CPUFriend
|
||||
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
|
||||
self.disable_tb = 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
|
||||
self.set_kext_usage = True # Set Kext usage
|
||||
self.force_latest_psp = False # Force latest PatcherSupportPkg
|
||||
self.disallow_cpufriend = False # Disable CPUFriend
|
||||
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
|
||||
self.disable_tb = 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
|
||||
self.force_latest_psp = False # Force latest PatcherSupportPkg
|
||||
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
|
||||
|
||||
# OS Versions
|
||||
## Based off Major Kernel Version
|
||||
@@ -166,33 +170,6 @@ class Constants:
|
||||
self.big_sur = 20
|
||||
self.monterey = 21
|
||||
|
||||
# Vendor IDs
|
||||
self.pci_nvidia = "10DE"
|
||||
self.pci_amd_ati = "1002"
|
||||
self.pci_intel = "8086"
|
||||
self.pci_broadcom = "14E4"
|
||||
self.pci_atheros = "168C"
|
||||
self.pci_apple = "106B"
|
||||
self.pci_aquantia = "1D6A"
|
||||
self.pci_marvell = "11AB"
|
||||
self.pci_syskonnect = "1148"
|
||||
|
||||
# Class Codes
|
||||
## https://pci-ids.ucw.cz/read/PD
|
||||
self.classcode_sata = "01060100"
|
||||
self.classcode_nvme = "02080100"
|
||||
self.classcode_nvme_generic = "02800100"
|
||||
self.classcode_wifi = "00800200"
|
||||
self.classcode_gpu = "00000300"
|
||||
self.classcode_gpu_variant = "00800300"
|
||||
self.classcode_xhci = "30030C00"
|
||||
self.classcode_ethernet = "00000200"
|
||||
|
||||
# Nvidia GPU Architecture
|
||||
self.arch_tesla = "NV50"
|
||||
self.arch_fermi = "GF100"
|
||||
self.arch_kepler = "GK100"
|
||||
|
||||
self.legacy_accel_support = [
|
||||
self.mojave,
|
||||
self.catalina,
|
||||
@@ -257,7 +234,7 @@ class Constants:
|
||||
@property
|
||||
def restrictevents_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-v{self.restrictevents_version}.zip")
|
||||
|
||||
|
||||
@property
|
||||
def efi_disabler_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/EFICheckDisabler-v{self.restrictevents_version}.zip")
|
||||
@@ -353,6 +330,10 @@ class Constants:
|
||||
@property
|
||||
def innie_path(self):
|
||||
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
|
||||
|
||||
@property
|
||||
def simplemsr_path(self):
|
||||
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
|
||||
|
||||
@property
|
||||
def latebloom_path(self):
|
||||
@@ -570,7 +551,7 @@ class Constants:
|
||||
@property
|
||||
def payload_apple_private_frameworks_path_brightness(self):
|
||||
return self.payload_apple_private_frameworks_path / Path("Brightness-Control")
|
||||
|
||||
|
||||
@property
|
||||
def payload_apple_private_frameworks_path_legacy_drm(self):
|
||||
return self.payload_apple_private_frameworks_path / Path("Legacy-GVA")
|
||||
@@ -627,7 +608,7 @@ class Constants:
|
||||
@property
|
||||
def legacy_brightness(self):
|
||||
return self.payload_apple_kexts_path / Path("Brightness-Control")
|
||||
|
||||
|
||||
@property
|
||||
def legacy_mux_path(self):
|
||||
return self.payload_apple_kexts_path / Path("Legacy-Mux")
|
||||
@@ -675,8 +656,11 @@ class Constants:
|
||||
"Mac-942459F5819B171B", # MacBookPro8,3
|
||||
"Mac-C08A6BB70A942AC2", # MacBookAir4,1
|
||||
"Mac-742912EFDBEE19B3", # MacBookAir4,2
|
||||
"Mac-8ED6AF5B48C039E1", # Macmini5,1
|
||||
"Mac-7BA5B2794B2CDB12", # Macmini5,3
|
||||
"Mac-942B5BF58194151B", # iMac12,1
|
||||
"Mac-942B59F58194171B", # iMac12,2
|
||||
]
|
||||
"Mac-8ED6AF5B48C039E1", # Macmini5,1
|
||||
"Mac-4BC72D62AD45599E", # Macmini5,2
|
||||
"Mac-7BA5B2794B2CDB12", # Macmini5,3
|
||||
"Mac-942B5BF58194151B", # iMac12,1
|
||||
"Mac-942B59F58194171B", # iMac12,2
|
||||
"Mac-94245AF5819B141B", # AppleInternal MacBookPro8,3
|
||||
"Mac-942B5B3A40C91381", # AppleInternal iMac12,2
|
||||
]
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
from resources import utilities, device_probe
|
||||
from data import model_array
|
||||
|
||||
class generate_defaults():
|
||||
|
||||
class generate_defaults:
|
||||
def probe(model, host_is_target, settings):
|
||||
# Generate Default Data
|
||||
# Takes in Settings data set, and returns updated Settings
|
||||
@@ -59,7 +60,6 @@ class generate_defaults():
|
||||
settings.secure_status = False # Modified root volume
|
||||
settings.allow_fv_root = True # Allow FileVault on broken seal
|
||||
# settings.amfi_status = True # Signed bundles, Don't need to explicitly set currently
|
||||
|
||||
|
||||
if model == "MacBook8,1":
|
||||
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
|
||||
@@ -83,4 +83,4 @@ class generate_defaults():
|
||||
settings.allow_ts2_accel = False
|
||||
|
||||
# Check if running in RecoveryOS
|
||||
settings.recovery_status = utilities.check_recovery()
|
||||
settings.recovery_status = utilities.check_recovery()
|
||||
|
||||
@@ -26,7 +26,7 @@ class PCIDevice:
|
||||
|
||||
vendor_id: int # The vendor ID of this PCI device
|
||||
device_id: int # The device ID of this PCI device
|
||||
class_code: int # The class code of this PCI device
|
||||
class_code: int # The class code of this PCI device - https://pci-ids.ucw.cz/read/PD
|
||||
|
||||
# ioregistryentry: Optional[ioreg.IORegistryEntry] = None
|
||||
name: Optional[str] = None # Name of IORegistryEntry
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from data import smbios_data, os_data
|
||||
from resources import utilities
|
||||
|
||||
|
||||
def set_smbios_model_spoof(model):
|
||||
try:
|
||||
smbios_data.smbios_dictionary[model]["Screen Size"]
|
||||
@@ -12,7 +13,7 @@ def set_smbios_model_spoof(model):
|
||||
return "MacBookAir7,1"
|
||||
else:
|
||||
# Unknown Model
|
||||
raise Exception
|
||||
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
|
||||
elif model.startswith("MacBookPro"):
|
||||
if smbios_data.smbios_dictionary[model]["Screen Size"] == 13:
|
||||
return "MacBookPro12,1"
|
||||
@@ -25,7 +26,7 @@ def set_smbios_model_spoof(model):
|
||||
return "MacBookPro11,4"
|
||||
else:
|
||||
# Unknown Model
|
||||
raise Exception
|
||||
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
|
||||
elif model.startswith("MacBook"):
|
||||
if smbios_data.smbios_dictionary[model]["Screen Size"] == 13:
|
||||
return "MacBookAir7,2"
|
||||
@@ -33,10 +34,10 @@ def set_smbios_model_spoof(model):
|
||||
return "MacBook9,1"
|
||||
else:
|
||||
# Unknown Model
|
||||
raise Exception
|
||||
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
|
||||
else:
|
||||
# Unknown Model
|
||||
raise Exception
|
||||
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
|
||||
except KeyError:
|
||||
# Found desktop model
|
||||
if model.startswith("MacPro") or model.startswith("Xserve"):
|
||||
@@ -51,7 +52,8 @@ def set_smbios_model_spoof(model):
|
||||
return "iMac17,1"
|
||||
else:
|
||||
# Unknown Model
|
||||
raise Exception
|
||||
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
|
||||
|
||||
|
||||
def update_firmware_features(firmwarefeature):
|
||||
# Adjust FirmwareFeature to support everything macOS requires
|
||||
@@ -62,7 +64,8 @@ def update_firmware_features(firmwarefeature):
|
||||
firmwarefeature |= 2 ** 20 # FW_FEATURE_SUPPORTS_APFS_EXTRA
|
||||
firmwarefeature |= 2 ** 35 # FW_FEATURE_SUPPORTS_LARGE_BASESYSTEM
|
||||
return firmwarefeature
|
||||
|
||||
|
||||
|
||||
def generate_fw_features(model, custom):
|
||||
if not custom:
|
||||
firmwarefeature = utilities.get_rom("firmware-features")
|
||||
@@ -72,4 +75,26 @@ def generate_fw_features(model, custom):
|
||||
else:
|
||||
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
|
||||
firmwarefeature = update_firmware_features(firmwarefeature)
|
||||
return firmwarefeature
|
||||
return firmwarefeature
|
||||
|
||||
|
||||
def find_model_off_board(board):
|
||||
# Find model based off Board ID provided
|
||||
# Return none if unknown
|
||||
|
||||
# Strip extra data from Target Types (ap, uppercase)
|
||||
if not (board.startswith("Mac-") or board.startswith("VMM-")):
|
||||
if board.lower().endswith("ap"):
|
||||
board = board[:-2]
|
||||
board = board.lower()
|
||||
|
||||
for key in smbios_data.smbios_dictionary:
|
||||
if board in [smbios_data.smbios_dictionary[key]["Board ID"], smbios_data.smbios_dictionary[key]["SecureBootModel"]]:
|
||||
if key.endswith("_v2") or key.endswith("_v3") or key.endswith("_v4"):
|
||||
# smbios_data has duplicate SMBIOS to handle multiple board IDs
|
||||
key = key[:-3]
|
||||
if key == "MacPro4,1":
|
||||
# 4,1 and 5,1 have the same board ID, best to return the newer ID
|
||||
key = "MacPro5,1"
|
||||
return key
|
||||
return None
|
||||
|
||||
@@ -7,13 +7,13 @@ from typing import NewType, Union
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
import objc
|
||||
import objc
|
||||
except ImportError:
|
||||
subprocess.run(["pip3", "install", "pyobjc"], stdout=subprocess.PIPE)
|
||||
try:
|
||||
import objc
|
||||
except ImportError:
|
||||
raise Exception("Missing PyObjc library!\nPlease run the following before starting OCLP:\npip3 install pyobjc")
|
||||
subprocess.run(["pip3", "install", "pyobjc"], stdout=subprocess.PIPE)
|
||||
try:
|
||||
import objc
|
||||
except ImportError:
|
||||
raise Exception("Missing PyObjc library!\nPlease run the following before starting OCLP:\npip3 install pyobjc")
|
||||
|
||||
from CoreFoundation import CFRelease, kCFAllocatorDefault # type: ignore # pylint: disable=no-name-in-module
|
||||
from Foundation import NSBundle # type: ignore # pylint: disable=no-name-in-module
|
||||
|
||||
@@ -3,17 +3,20 @@
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
|
||||
def detect_kernel_major():
|
||||
# Return Major Kernel Version
|
||||
# Example Output: 21 (integer)
|
||||
return int(platform.uname().release.partition(".")[0])
|
||||
|
||||
|
||||
def detect_kernel_minor():
|
||||
# Return Minor Kernel Version
|
||||
# Example Output: 1 (integer)
|
||||
return int(platform.uname().release.partition(".")[2].partition(".")[0])
|
||||
|
||||
|
||||
def detect_kernel_build():
|
||||
# Return OS build
|
||||
# Example Output: 21A5522h (string)
|
||||
return subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
return subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
|
||||
@@ -10,8 +10,9 @@ import shutil
|
||||
import subprocess
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
from resources import constants, device_probe, utilities
|
||||
from resources import constants, device_probe, utilities, generate_smbios
|
||||
from data import sip_data, sys_patch_data, model_array
|
||||
|
||||
|
||||
@@ -236,8 +237,18 @@ class PatchSysVolume:
|
||||
input("Press [ENTER] to continue with kernel and dyld cache merging")
|
||||
if self.constants.detected_os > self.constants.catalina:
|
||||
print("- Creating new APFS snapshot")
|
||||
utilities.elevated(["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
self.unmount_drive()
|
||||
bless = utilities.elevated(
|
||||
["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
if bless.returncode != 0:
|
||||
print("- Unable to create new snapshot")
|
||||
print("Reason for snapshot failure:")
|
||||
print(bless.stdout.decode())
|
||||
if "Can't use last-sealed-snapshot or create-snapshot on non system volume" in bless.stdout.decode():
|
||||
print("- This is an APFS bug with Monterey! Perform a clean installation to ensure your APFS volume is built correctly")
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.unmount_drive()
|
||||
else:
|
||||
if self.constants.detected_os == self.constants.catalina:
|
||||
print("- Merging kernel cache")
|
||||
@@ -259,7 +270,7 @@ set million colour before rebooting"""
|
||||
def unmount_drive(self):
|
||||
print("- Unmounting Root Volume (Don't worry if this fails)")
|
||||
utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
|
||||
|
||||
def delete_old_binaries(self, vendor_patch):
|
||||
for delete_current_kext in vendor_patch:
|
||||
delete_path = Path(self.mount_extensions) / Path(delete_current_kext)
|
||||
@@ -280,7 +291,6 @@ set million colour before rebooting"""
|
||||
utilities.process_status(utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
utilities.process_status(utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
|
||||
def add_brightness_patch(self):
|
||||
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
|
||||
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
|
||||
@@ -304,11 +314,13 @@ set million colour before rebooting"""
|
||||
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_libexec}/", self.mount_libexec], stdout=subprocess.PIPE)
|
||||
utilities.process_status(utilities.elevated(["chmod", "755", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
utilities.process_status(utilities.elevated(["chown", "root:wheel", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
|
||||
def add_legacy_mux_patch(self):
|
||||
self.delete_old_binaries(sys_patch_data.DeleteDemux)
|
||||
print("- Merging Legacy Mux Kext patches")
|
||||
utilities.process_status(utilities.elevated(["cp", "-R", f"{self.constants.legacy_mux_path}/AppleMuxControl.kext", self.mount_extensions_mux], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
utilities.process_status(
|
||||
utilities.elevated(["cp", "-R", f"{self.constants.legacy_mux_path}/AppleMuxControl.kext", self.mount_extensions_mux], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
)
|
||||
|
||||
def gpu_accel_legacy(self):
|
||||
if self.constants.detected_os == self.constants.mojave:
|
||||
@@ -402,17 +414,40 @@ set million colour before rebooting"""
|
||||
print("- Installing basic Sandy Bridge Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
self.gpu_accel_legacy_sandybridge_board_id()
|
||||
|
||||
|
||||
def gpu_accel_legacy_sandybridge_board_id(self):
|
||||
if self.computer.reported_board_id in self.constants.sandy_board_id_stock:
|
||||
if self.constants.computer.reported_board_id in self.constants.sandy_board_id_stock:
|
||||
print("- Using stock AppleIntelSNBGraphicsFB")
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2AccelStock, self.constants.legacy_intel_gen2_path)
|
||||
# TODO: Clean this function up
|
||||
# add_new_binaries() and delete_old_binaries() have a bug when the passed array has a single element
|
||||
# 'TypeError: expected str, bytes or os.PathLike object, not list'
|
||||
# This is a temporary workaround to fix that
|
||||
utilities.elevated(["rm", "-r", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB-Clean.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
utilities.elevated(["rm", "-r", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# Add kext
|
||||
print("- Adding AppleIntelSNBGraphicsFB.kext")
|
||||
utilities.elevated(
|
||||
["cp", "-r", f"{self.constants.legacy_intel_gen2_path}/AppleIntelSNBGraphicsFB-Clean.kext", f"{self.mount_extensions}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
# Rename kext
|
||||
utilities.process_status(utilities.elevated(["mv", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB-Clean.kext", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
utilities.elevated(
|
||||
["mv", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB-Clean.kext", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
# Fix permissions
|
||||
utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
else:
|
||||
# Adjust board ID for spoofs
|
||||
print("- Installing modified AppleIntelSNBGraphicsFB")
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2AccelPatched, self.constants.legacy_intel_gen2_path)
|
||||
print("- Using Board ID patched AppleIntelSNBGraphicsFB")
|
||||
utilities.elevated(["rm", "-r", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB-Clean.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
utilities.elevated(["rm", "-r", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# Add kext
|
||||
print("- Adding AppleIntelSNBGraphicsFB.kext")
|
||||
utilities.elevated(["cp", "-r", f"{self.constants.legacy_intel_gen2_path}/AppleIntelSNBGraphicsFB.kext", f"{self.mount_extensions}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# Fix permissions
|
||||
utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
def gpu_framebuffer_ivybridge_master(self):
|
||||
if self.constants.detected_os == self.constants.monterey:
|
||||
@@ -436,7 +471,7 @@ set million colour before rebooting"""
|
||||
else:
|
||||
print("- Installing Kepler Kext patches for generic OS")
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||
|
||||
|
||||
def gpu_accel_legacy_gva(self):
|
||||
print("- Merging AppleGVA Hardware Accel patches for non-Metal")
|
||||
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_legacy_drm}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
|
||||
@@ -562,7 +597,7 @@ set million colour before rebooting"""
|
||||
if self.legacy_wifi is True:
|
||||
print("- Installing legacy Wireless support")
|
||||
self.add_wifi_patch()
|
||||
|
||||
|
||||
if self.legacy_gmux is True:
|
||||
print("- Installing Legacy Mux Brightness support")
|
||||
self.add_legacy_mux_patch()
|
||||
@@ -686,7 +721,7 @@ set million colour before rebooting"""
|
||||
self.amd_ts2 = False
|
||||
self.iron_gpu = False
|
||||
self.sandy_gpu = False
|
||||
|
||||
|
||||
def detect_demux(self):
|
||||
# If GFX0 is missing, assume machine was demuxed
|
||||
# -wegnoegpu would also trigger this, so ensure arg is not present
|
||||
@@ -696,7 +731,6 @@ set million colour before rebooting"""
|
||||
if igpu and not dgpu:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def detect_patch_set(self):
|
||||
self.detect_gpus()
|
||||
@@ -716,7 +750,7 @@ set million colour before rebooting"""
|
||||
) or (isinstance(self.constants.computer.wifi, device_probe.Atheros) and self.constants.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
|
||||
if self.constants.detected_os > self.constants.big_sur:
|
||||
self.legacy_wifi = True
|
||||
|
||||
|
||||
if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
|
||||
# Sierra uses a legacy GMUX control method needed for dGPU switching on MacBookPro5,x
|
||||
# Same method is also used for demuxed machines
|
||||
@@ -799,15 +833,15 @@ set million colour before rebooting"""
|
||||
print("\nCannot patch! Please disable AMFI.")
|
||||
print("For Hackintoshes, please add amfi_get_out_of_my_way=1 to boot-args")
|
||||
|
||||
if self.check_board_id is True and (
|
||||
self.computer.reported_board_id not in self.constants.sandy_board_id and
|
||||
self.computer.reported_board_id not in self.constants.sandy_board_id_stock
|
||||
):
|
||||
if self.check_board_id is True and (self.computer.reported_board_id not in self.constants.sandy_board_id and self.computer.reported_board_id not in self.constants.sandy_board_id_stock):
|
||||
print("\nCannot patch! Board ID not supported by AppleIntelSNBGraphicsFB")
|
||||
print(f"Detected Board ID: {self.computer.reported_board_id}")
|
||||
print("Please ensure your Board ID is listed below:")
|
||||
print("\n".join(self.constants.sandy_board_id))
|
||||
print("\n".join(self.constants.sandy_board_id_stock))
|
||||
for board in self.constants.sandy_board_id:
|
||||
print(f"- {board} ({generate_smbios.find_model_off_board(board)})")
|
||||
for board in self.constants.sandy_board_id_stock:
|
||||
print(f"- {board} ({generate_smbios.find_model_off_board(board)})")
|
||||
|
||||
self.bad_board_id = True
|
||||
|
||||
if self.dosdude_patched is True:
|
||||
|
||||
@@ -129,6 +129,7 @@ def amfi_status():
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def check_kext_loaded(kext_name, os_version):
|
||||
if os_version > constants.Constants().catalina:
|
||||
kext_loaded = subprocess.run(["kmutil", "showloaded", "--list-only", "--variant-suffix", "release"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
@@ -139,6 +140,7 @@ def check_kext_loaded(kext_name, os_version):
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def check_oclp_boot():
|
||||
if get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True):
|
||||
return True
|
||||
@@ -194,7 +196,10 @@ def patching_status(os_sip, os):
|
||||
# Catalina and older supports individually disabling Library Validation
|
||||
amfi_enabled = False
|
||||
|
||||
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in constants.Constants.sbm_values:
|
||||
if (
|
||||
get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False)
|
||||
and get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in constants.Constants().sbm_values
|
||||
):
|
||||
sbm_enabled = False
|
||||
|
||||
if get_nvram("csr-active-config", decode=False) and csr_decode(get_nvram("csr-active-config", decode=False), os_sip) is False:
|
||||
@@ -233,6 +238,7 @@ def cls():
|
||||
else:
|
||||
print("\u001Bc")
|
||||
|
||||
|
||||
def get_nvram(variable: str, uuid: str = None, *, decode: bool = False):
|
||||
# TODO: Properly fix for El Capitan, which does not print the XML representation even though we say to
|
||||
|
||||
@@ -299,6 +305,7 @@ def download_file(link, location):
|
||||
chunk = file.read(1024 * 1024 * 16)
|
||||
return checksum
|
||||
|
||||
|
||||
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
|
||||
# When runnign through our GUI, we run as root, however we do not get uid 0
|
||||
# Best to assume CLI is running as root
|
||||
@@ -307,6 +314,7 @@ def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
|
||||
else:
|
||||
return subprocess.run(["sudo"] + [args[0][0]] + args[0][1:], **kwargs)
|
||||
|
||||
|
||||
def check_cli_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--build", help="Build OpenCore", action="store_true", required=False)
|
||||
@@ -339,16 +347,12 @@ def check_cli_args():
|
||||
# validation args
|
||||
parser.add_argument("--validate", help="Runs Validation Tests for CI", action="store_true", required=False)
|
||||
args = parser.parse_args()
|
||||
if not(
|
||||
args.build or
|
||||
args.patch_sys_vol or
|
||||
args.unpatch_sys_vol or
|
||||
args.validate
|
||||
):
|
||||
if not (args.build or args.patch_sys_vol or args.unpatch_sys_vol or args.validate):
|
||||
return None
|
||||
else:
|
||||
return args
|
||||
|
||||
|
||||
# def menu(title, prompt, menu_options, add_quit=True, auto_number=False, in_between=[], top_level=False):
|
||||
# return_option = ["Q", "Quit", None] if top_level else ["B", "Back", None]
|
||||
# if add_quit: menu_options.append(return_option)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import subprocess
|
||||
from resources import build
|
||||
from data import example_data, model_array
|
||||
@@ -22,8 +21,9 @@ def validate(settings):
|
||||
example_data.MacPro.MacPro41_Modern_AMD,
|
||||
example_data.MacPro.MacPro41_51__Flashed_Modern_AMD,
|
||||
]
|
||||
|
||||
|
||||
settings.validate = True
|
||||
|
||||
def build_prebuilt():
|
||||
for model in model_array.SupportedSMBIOS:
|
||||
print(f"Validating predefined model: {model}")
|
||||
@@ -36,7 +36,7 @@ def validate(settings):
|
||||
raise Exception(f"Validation failed for predefined model: {model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {model}")
|
||||
|
||||
|
||||
def build_dumps():
|
||||
for model in valid_dumps:
|
||||
settings.computer = model
|
||||
@@ -50,7 +50,7 @@ def validate(settings):
|
||||
raise Exception(f"Validation failed for predefined model: {settings.computer.real_model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {settings.computer.real_model}")
|
||||
|
||||
|
||||
# First run is with default settings
|
||||
build_prebuilt()
|
||||
build_dumps()
|
||||
@@ -68,4 +68,4 @@ def validate(settings):
|
||||
settings.disable_tb = True
|
||||
settings.force_surplus = True
|
||||
build_prebuilt()
|
||||
build_dumps()
|
||||
build_dumps()
|
||||
|
||||
Reference in New Issue
Block a user