Depreciate dedicated OCLP-CLI binary

OpenCore-Patcher now supports both CLI and TUI mode
This commit is contained in:
Mykola Grymalyuk
2021-10-03 10:44:13 -06:00
parent 426c572ce2
commit a5f489d48b
14 changed files with 543 additions and 619 deletions

View File

@@ -12,7 +12,6 @@ jobs:
runs-on: x86_64_mojave
steps:
- uses: actions/checkout@v2
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'

View File

@@ -13,11 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OCLP-CLI.spec
- run: cd dist; cp OCLP-CLI ../; cd ..
- run: zip OCLP-CLI.zip OCLP-CLI
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: cd dist; cp OpenCore-Patcher ../; cd ..; mv OpenCore-Patcher OCLP-CLI
- name: Download latest nightly OCLP-GUI
run: curl -S -L https://nightly.link/dortania/OCLP-GUI/workflows/build-app/master/OpenCore-Patcher-GUI.app.zip --output ./OpenCore-Patcher-GUI.app.zip
run: curl -S -L https://nightly.link/dortania/OCLP-GUI/workflows/build-app/master/OpenCore-Patcher-GUI.app.zip --output ./OpenCore-Patcher-GUI.app.zip --insecure
- run: unzip -o OpenCore-Patcher-GUI.app.zip
- run: unzip OpenCore-Patcher-GUI.app.zip; rm OpenCore-Patcher-GUI.app.zip
- name: Merge new GUI
@@ -37,7 +36,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: OCLP-CLI
path: OCLP-CLI.zip
path: OCLP-CLI
- name: Upload to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d

View File

@@ -13,4 +13,5 @@ class os_data:
mojave = 18
catalina = 19
big_sur = 20
monterey = 21
monterey = 21
max_os = 99

View File

@@ -130,7 +130,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE13F",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 12,
@@ -142,7 +142,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE13F",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 12,
@@ -286,7 +286,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFF0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.broadwell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Screen Size": 11,
@@ -298,7 +298,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFF0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.broadwell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Screen Size": 13,
@@ -310,7 +310,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF42E",
"SecureBootModel": "j140kap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -322,7 +322,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF42E",
"SecureBootModel": "j140aap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -334,7 +334,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFFAFF06E",
"SecureBootModel": "j230kap",
"CPU Generation": cpu_data.cpu_data.ice_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -676,7 +676,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xEB0FF577",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.haswell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Screen Size": 15,
@@ -688,7 +688,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xEB0FF577",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.haswell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Screen Size": 15,
@@ -701,7 +701,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.broadwell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Screen Size": 13,
@@ -713,7 +713,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 13,
@@ -725,7 +725,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 13,
@@ -737,7 +737,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 15,
@@ -750,7 +750,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFF0FF57E",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 13,
@@ -762,7 +762,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFF0FF57E",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 13,
@@ -774,7 +774,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFF0FF57E",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703_UART,
"Screen Size": 15,
@@ -787,7 +787,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF426",
"SecureBootModel": "j680ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 15,
@@ -800,7 +800,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF426",
"SecureBootModel": "j132ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -812,7 +812,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF426",
"SecureBootModel": "j780ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 15,
@@ -825,7 +825,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF426",
"SecureBootModel": "j213ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -837,7 +837,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFDAFF066",
"SecureBootModel": "j152fap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 16,
@@ -850,7 +850,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFFAFF06E",
"SecureBootModel": "j214kap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -862,7 +862,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFDAFF066",
"SecureBootModel": "j223ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 13,
@@ -874,7 +874,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFDAFF066",
"SecureBootModel": "j215ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Screen Size": 16,
@@ -993,7 +993,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xE00DE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.haswell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Ethernet Chipset": "Broadcom",
@@ -1004,7 +1004,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF466",
"SecureBootModel": "j174ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1283,7 +1283,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.broadwell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Ethernet Chipset": "Broadcom",
@@ -1294,7 +1294,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.broadwell,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Ethernet Chipset": "Broadcom",
@@ -1307,7 +1307,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFC0FE137",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Ethernet Chipset": "Broadcom",
@@ -1318,7 +1318,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703,
"Ethernet Chipset": "Broadcom",
@@ -1329,7 +1329,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703,
"Ethernet Chipset": "Broadcom",
@@ -1340,7 +1340,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD0FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.kaby_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20703,
"Ethernet Chipset": "Broadcom",
@@ -1351,7 +1351,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1362,7 +1362,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1373,7 +1373,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF576",
"SecureBootModel": "j185ap",
"CPU Generation": cpu_data.cpu_data.comet_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1384,7 +1384,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF576",
"SecureBootModel": "j185fap",
"CPU Generation": cpu_data.cpu_data.comet_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1395,7 +1395,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFD8FF53E",
"SecureBootModel": "j137ap",
"CPU Generation": cpu_data.cpu_data.skylake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",
@@ -1466,7 +1466,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xE90FF576",
"SecureBootModel": None,
"CPU Generation": cpu_data.cpu_data.ivy_bridge,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AirportBrcmNIC,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM20702_v2,
"Ethernet Chipset": "Broadcom",
@@ -1477,7 +1477,7 @@ smbios_dictionary = {
"FirmwareFeatures": "0xFDAFF066",
"SecureBootModel": "j160ap",
"CPU Generation": cpu_data.cpu_data.coffee_lake,
"Max OS Supported": None,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Broadcom",

View File

@@ -1,313 +0,0 @@
#!/usr/bin/env python3
# Copyright (C) 2020-2021 Mykola Grymalyuk
from __future__ import print_function
import subprocess
import sys
import platform
import argparse
from pathlib import Path
from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities, ModelExample
class OpenCoreLegacyPatcher:
def __init__(self):
print("Loading...")
Utilities.disable_cls()
self.constants = Constants.Constants()
self.constants.computer = device_probe.Computer.probe()
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.constants.detected_os_minor = int(platform.uname().release.partition(".")[2].partition(".")[0])
detected_os_build: str = subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
self.constants.detected_os_build = detected_os_build
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()
parser = argparse.ArgumentParser()
# Generic building args
parser.add_argument("--build", help="Build OpenCore", action="store_true", required=False)
parser.add_argument("--verbose", help="Enable verbose boot", action="store_true", required=False)
parser.add_argument("--debug_oc", help="Enable OpenCore DEBUG", action="store_true", required=False)
parser.add_argument("--debug_kext", help="Enable kext DEBUG", action="store_true", required=False)
parser.add_argument("--hide_picker", help="Hide OpenCore picker", action="store_true", required=False)
parser.add_argument("--disable_sip", help="Disable SIP", action="store_true", required=False)
parser.add_argument("--disable_smb", help="Disable SecureBootModel", action="store_true", required=False)
parser.add_argument("--vault", help="Enable OpenCore Vaulting", action="store_true", required=False)
parser.add_argument("--support_all", help="Allow OpenCore on natively supported Models", action="store_true", required=False)
parser.add_argument("--firewire", help="Enable FireWire Booting", action="store_true", required=False)
parser.add_argument("--nvme", help="Enable NVMe Booting", action="store_true", required=False)
parser.add_argument("--wlan", help="Enable Wake on WLAN support", action="store_true", required=False)
# 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)
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)
# SysPatch args
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
# parser.add_argument("--patch_disk", action="store", help="Specifies disk to root patch", required=False)
parser.add_argument("--validate", help="Validate", action="store_true", required=False)
args = parser.parse_args()
self.constants.gui_mode = True
self.constants.current_path = Path.cwd()
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
print("- Rerouting payloads location")
self.constants.payload_path = sys._MEIPASS / Path("payloads")
else:
print("- Using default payloads location")
if args.disk:
print(f"- Install Disk set: {args.disk}")
self.constants.disk = args.disk
if args.validate:
self.validate()
# if args.patch_disk:
# print(f"- Patch Disk set: {args.patch_disk}")
# self.constants.patch_disk = args.patch_disk
if args.verbose:
print("- Set verbose configuration")
self.constants.verbose_debug = True
if args.debug_oc:
print("- Set OpenCore DEBUG configuration")
self.constants.opencore_debug = True
self.constants.opencore_build = "DEBUG"
if args.debug_kext:
print("- Set kext DEBUG configuration")
self.constants.kext_debug = True
if args.hide_picker:
print("- Set HidePicker configuration")
self.constants.showpicker = False
if args.disable_sip:
print("- Set Disable SIP configuration")
self.constants.sip_status = False
if args.disable_smb:
print("- Set Disable SecureBootModel configuration")
self.constants.secure_status = False
if args.vault:
print("- Set Vault configuration")
self.constants.vault = True
if args.firewire:
print("- Set FireWire Boot configuration")
self.constants.firewire_boot = True
if args.nvme:
print("- Set NVMe Boot configuration")
self.constants.nvme_boot = True
# if args.disable_amfi:
# print("- Set Disable AMFI configuration")
# self.constants.amfi_status = False
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.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"
if args.smbios_spoof:
if args.smbios_spoof == "Minimal":
self.constants.serial_settings = "Minimal"
elif args.smbios_spoof == "Moderate":
self.constants.serial_settings = "Moderate"
elif args.smbios_spoof == "Advanced":
self.constants.serial_settings = "Advanced"
else:
print(f"- Unknown SMBIOS arg passed: {args.smbios_spoof}")
# if args.lb_delay:
# try:
# self.constants.latebloom_delay = int(args.lb_delay)
# print(f"- Set LateBloom delay: {args.lb_delay}")
# except ValueError:
# print(f"- Invalid LateBloom delay: {args.lb_delay}")
# if args.lb_range:
# try:
# self.constants.latebloom_range = int(args.lb_range)
# print(f"- Set LateBloom range: {args.lb_range}")
# except ValueError:
# print(f"- Invalid LateBloom range: {args.lb_range}")
# if args.lb_debug:
# try:
# self.constants.latebloom_debug = int(args.lb_debug)
# if self.constants.latebloom_debug in [0, 1]:
# print(f"- Set LateBloom debug: {args.lb_debug}")
# else:
# print(f"- Invalid LateBloom debug: {args.lb_debug}")
# except ValueError:
# print(f"- Invalid LateBloom range: {args.lb_debug}")
if args.support_all:
print("- Building for natively supported model")
self.constants.allow_oc_everywhere = True
self.constants.serial_settings = "None"
if args.build:
if args.model:
print(f"- Using custom model: {args.model}")
self.constants.custom_model = args.model
self.set_defaults(self.constants.custom_model, False)
self.build_opencore()
elif self.computer.real_model not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
)
sys.exit(1)
else:
print(f"- Using detected model: {self.constants.computer.real_model}")
self.set_defaults(self.constants.custom_model, True)
self.build_opencore()
if args.patch_sys_vol:
if args.moj_cat_accel:
print("- Set Mojave/Catalina root patch configuration")
self.constants.moj_cat_accel = True
print("- Set System Volume patching")
self.patch_vol()
elif args.unpatch_sys_vol:
print("- Set System Volume unpatching")
self.unpatch_vol()
def set_defaults(self, model, host_is_target):
if host_is_target:
if Utilities.check_metal_support(device_probe, self.computer) is False:
self.constants.disable_cs_lv = True
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
self.constants.amfi_status = True
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if (
isinstance(self.computer.wifi, device_probe.Broadcom)
and self.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
self.constants.sip_status = False
self.constants.allow_fv_root = True # Allow FileVault on broken seal
elif model in ModelArray.LegacyGPU:
self.constants.disable_cs_lv = True
if model in ModelArray.LegacyGPU:
if host_is_target and Utilities.check_metal_support(device_probe, self.computer) is True:
# Building on device and we have a native, supported GPU
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
self.constants.allow_fv_root = True # Allow FileVault on broken seal
else:
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Root volume modified
self.constants.amfi_status = False # Unsigned binaries
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
self.constants.allow_fv_root = True # Allow FileVault on broken seal
# self.constants.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
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 Utilities.get_nvram("gpu-power-prefs", "FA4CE28D-B62F-4C99-9CC3-6815686E30F9", decode=True):
self.constants.allow_ts2_accel = False
def patch_vol(self):
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
def unpatch_vol(self):
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def validate(self):
# Runs through ocvalidate to check for errors
valid_dumps = [
ModelExample.MacBookPro.MacBookPro92_Stock,
# ModelExample.MacBookPro.MacBookPro171_Stock,
# ModelExample.Macmini.Macmini91_Stock,
ModelExample.iMac.iMac81_Stock,
ModelExample.iMac.iMac112_Stock,
ModelExample.iMac.iMac122_Upgraded,
ModelExample.MacPro.MacPro31_Stock,
ModelExample.MacPro.MacPro31_Upgrade,
ModelExample.MacPro.MacPro31_Modern_AMD,
ModelExample.MacPro.MacPro31_Modern_Kepler,
ModelExample.MacPro.MacPro41_Upgrade,
ModelExample.MacPro.MacPro41_Modern_AMD,
ModelExample.MacPro.MacPro41_51__Flashed_Modern_AMD,
]
self.constants.validate = True
for model in ModelArray.SupportedSMBIOS:
print(f"Validating predefined model: {model}")
self.constants.custom_model = model
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {model}")
else:
print(f"Validation succeeded for predefined model: {model}")
for model in valid_dumps:
self.constants.computer = model
self.computer = self.constants.computer
self.constants.custom_model = ""
print(f"Validating dumped model: {self.computer.real_model}")
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {self.computer.real_model}")
else:
print(f"Validation succeeded for predefined model: {self.computer.real_model}")
OpenCoreLegacyPatcher()
# Example arg for OCLP command line
# ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2

View File

@@ -1,35 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os
sys.path.append(os.path.abspath(os.getcwd()))
from Resources import Constants
block_cipher = None
a = Analysis(['OCLP-CLI.command'],
pathex=['Resources', 'Data'],
binaries=[],
datas=[('payloads', 'payloads')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[('u', None, 'OPTION')],
name='OCLP-CLI',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )

View File

@@ -3,97 +3,39 @@
from __future__ import print_function
import platform
import subprocess
import sys
from pathlib import Path
from Resources import Build, CliMenu, Constants, ModelArray, SysPatch, Utilities, device_probe
from Resources import Build, CliMenu, Constants, ModelArray, SysPatch, Utilities, device_probe, os_probe, defaults, arguments
from Data import smbios_data, cpu_data
class OpenCoreLegacyPatcher:
def __init__(self):
print("Loading...")
print("- Loading...")
self.constants = Constants.Constants()
self.constants.computer = device_probe.Computer.probe()
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.constants.detected_os_minor = int(platform.uname().release.partition(".")[2].partition(".")[0])
detected_os_build: str = subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
self.constants.detected_os_build = detected_os_build
self.set_defaults(self.computer.real_model, True)
def set_defaults(self, model, host_is_target):
# Defaults
self.constants.sip_status = True
self.constants.secure_status = False # Default false for Monterey
self.constants.amfi_status = True
if host_is_target:
if Utilities.check_metal_support(device_probe, self.computer) is False:
self.constants.disable_cs_lv = True
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
self.constants.amfi_status = True
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if (
isinstance(self.computer.wifi, device_probe.Broadcom)
and self.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
self.constants.sip_status = False
self.constants.allow_fv_root = True # Allow FileVault on broken seal
elif model in ModelArray.LegacyGPU:
self.constants.disable_cs_lv = True
if model in ModelArray.LegacyGPU:
if host_is_target and Utilities.check_metal_support(device_probe, self.computer) is True:
# Building on device and we have a native, supported GPU
if self.computer.dgpu and self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
self.constants.sip_status = False
# self.constants.secure_status = True # Monterey
self.constants.allow_fv_root = True # Allow FileVault on broken seal
else:
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.amfi_status = True
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Root volume modified
self.constants.amfi_status = False # Unsigned binaries
self.constants.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
# Systems with Ivy or Kepler GPUs, Monterey requires root patching for accel
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
self.constants.allow_fv_root = True # Allow FileVault on broken seal
# self.constants.amfi_status = True # Signed bundles, Don't need to explicitly set currently
self.generate_base_data()
if arguments.arguments().check_cli() is False:
self.main_menu()
if model == "MacBook8,1":
# 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
if Utilities.amfi_status() is False:
self.constants.amfi_status = False
if Utilities.get_nvram("gpu-power-prefs", "FA4CE28D-B62F-4C99-9CC3-6815686E30F9"):
# Users disabling TS2 most likely have a faulty dGPU
# 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)
# Check if running in RecoveryOS
def generate_base_data(self):
self.constants.detected_os = os_probe.detect_kernel_major()
self.constants.detected_os_minor = os_probe.detect_kernel_minor()
self.constants.detected_os_build = os_probe.detect_kernel_build()
self.constants.computer = device_probe.Computer.probe()
self.constants.recovery_status = Utilities.check_recovery()
self.computer = self.constants.computer
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
if arguments.arguments().check_cli() is True:
print("- Detected arguments, switching to CLI mode")
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")
self.constants.payload_path = sys._MEIPASS / Path("payloads")
arguments.arguments().parse_arguments(self.constants)
else:
print("- No arguments present, loading TUI")
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
@@ -101,30 +43,6 @@ class OpenCoreLegacyPatcher:
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def change_model(self):
Utilities.cls()
Utilities.header(["Select Different Model"])
print(
"""
Tip: Run the following command on the target machine to find the model identifier:
system_profiler SPHardwareDataType | grep 'Model Identifier'
"""
)
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
if self.constants.custom_model not in ModelArray.SupportedSMBIOS:
print(
f"""
{self.constants.custom_model} is not a valid SMBIOS Identifier for macOS {self.constants.os_support}!
"""
)
print_models = input(f"Print list of valid options for macOS {self.constants.os_support}? (y/n)")
if print_models.lower() in {"y", "yes"}:
print("\n".join(ModelArray.SupportedSMBIOS))
input("\nPress [ENTER] to continue")
else:
self.set_defaults(self.constants.custom_model, False)
def patcher_settings(self):
response = None
while not (response and response == -1):
@@ -145,7 +63,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
f"Allow OpenCore on native Models:\tCurrently {self.constants.allow_oc_everywhere}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_native_models,
],
["Advanced Settings, for developers only", self.advanced_patcher_settings],
["Advanced Settings, for developers only", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).advanced_patcher_settings],
]
for option in options:
@@ -243,8 +161,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Set 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"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).terascale_2_accel],
[
f"Disable Thunderbolt:\tCurrently {self.constants.disable_thunderbolt}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_thunderbolt,
f"Disable Thunderbolt:\tCurrently {self.constants.disable_tb}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_tb,
],
[f"Set AppleALC Usage:\t\tCurrently {self.constants.set_alc_usage}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).applealc_support],
[f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).dGPU_switch_support],
@@ -275,111 +193,6 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
response = menu.start()
def credits(self):
Utilities.TUIOnlyPrint(
["Credits"],
"Press [Enter] to go back.\n",
[
"""Many thanks to the following:
- Acidanthera:\tOpenCore, kexts and other tools
- Khronokernel:\tWriting and maintaining this patcher
- DhinakG:\t\tWriting and maintaining this patcher
- ASentientBot:\tLegacy Acceleration Patches
- Ausdauersportler:\tLinking fixes for SNBGraphicsFB and AMDX3000
- Syncretic:\t\tAAAMouSSE and telemetrap
- cdf:\t\tNightShiftEnabler and Innie"""
],
).start()
def PatchVolume(self):
Utilities.cls()
Utilities.header(["Patching System Volume"])
big_sur = """Patches Root volume to fix misc issues such as:
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
monterey = """Patches Root volume to fix misc issues such as:
- Metal Graphics Acceleration
- Intel: Ivy Bridge (4000 series iGPUs)
- Nvidia: Kepler (600-700)
- Non-Metal Graphics Accelertation
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
- Wifi support for BCM94328, BCM94322 and Atheros cards
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
mojave_catalina = """Patches Root volume to fix misc issues such as:
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
default = """
This OS has no root patches available to apply, please ensure you're patching a booted
install that requires root patches such as macOS Big Sur or Monterey
Supported Options:
B. Exit
"""
no_patch = False
if self.constants.detected_os == self.constants.monterey:
print(monterey)
elif self.constants.detected_os == self.constants.big_sur:
print(big_sur)
elif self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.moj_cat_accel == True:
print(mojave_catalina)
else:
print(default)
no_patch = True
change_menu = input("Patch System Volume?: ")
if no_patch is not True and change_menu == "1":
SysPatch.PatchSysVolume(self.constants.custom_model or self.computer.real_model, self.constants).start_patch()
elif no_patch is not True and change_menu == "2":
SysPatch.PatchSysVolume(self.constants.custom_model or self.computer.real_model, self.constants).start_unpatch()
else:
print("Returning to main menu")
def main_menu(self):
response = None
while not (response and response == -1):
@@ -415,10 +228,10 @@ B. Exit
else []
) + [
["Install OpenCore to USB/internal drive", self.install_opencore],
["Post-Install Volume Patch", self.PatchVolume],
["Change Model", self.change_model],
["Post-Install Volume Patch", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).PatchVolume],
["Change Model", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_model],
["Patcher Settings", self.patcher_settings],
["Credits", self.credits],
["Credits", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).credits],
]
for option in options:
@@ -430,4 +243,4 @@ B. Exit
subprocess.run("""osascript -e 'tell application "Terminal" to close first window' & exit""", shell=True)
OpenCoreLegacyPatcher().main_menu()
OpenCoreLegacyPatcher()

View File

@@ -219,6 +219,7 @@ class BuildOpenCore:
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
print(f"- Using known DevicePath {arpt_path}")
# self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba"}
if not self.constants.custom_model and self.computer.wifi and self.constants.validate is False and self.computer.wifi.country_code:
print(f"- Applying fake ID for WiFi, setting Country Code: {self.computer.wifi.country_code}")
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.country_code}
@@ -426,7 +427,7 @@ class BuildOpenCore:
else:
return True
if self.constants.firewire_boot is True and check_firewire() is True:
if self.constants.firewire_boot is True and check_firewire(self.model) is True:
# Enable FireWire Boot Support
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
print("- Enabling FireWire Boot Support")
@@ -571,7 +572,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.constants.disable_thunderbolt is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
if self.constants.disable_tb 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

View File

@@ -3,7 +3,7 @@
from __future__ import print_function
import subprocess
from Resources import Constants, Utilities
from Resources import Constants, Utilities, defaults, ModelArray, SysPatch
class MenuOptions:
@@ -574,7 +574,7 @@ Note: for the average user, we recommend using dosdude1's legacy patcher:
else:
self.allow_moj_cat_patch()
def disable_thunderbolt(self):
def disable_tb(self):
Utilities.cls()
Utilities.header(["Disable Thunderbolt on 2013-14 MacBook Pros"])
print(
@@ -592,13 +592,13 @@ other devices that benefit from this fix.
change_menu = input("Disable Thunderbolt?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_thunderbolt = True
self.constants.disable_tb = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_thunderbolt = False
self.constants.disable_tb = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.disable_thunderbolt()
self.disable_tb()
def terascale_2_accel(self):
Utilities.cls()
@@ -702,3 +702,155 @@ the event there's issues.
print("Returning to previous menu")
else:
self.set_surplus()
def credits(self):
Utilities.TUIOnlyPrint(
["Credits"],
"Press [Enter] to go back.\n",
[
"""Many thanks to the following:
- Acidanthera:\tOpenCore, kexts and other tools
- Khronokernel:\tWriting and maintaining this patcher
- DhinakG:\t\tWriting and maintaining this patcher
- ASentientBot:\tLegacy Acceleration Patches
- Ausdauersportler:\tLinking fixes for SNBGraphicsFB and AMDX3000
- Syncretic:\t\tAAAMouSSE and telemetrap
- cdf:\t\tNightShiftEnabler and Innie"""
],
).start()
def change_model(self):
Utilities.cls()
Utilities.header(["Select Different Model"])
print(
"""
Tip: Run the following command on the target machine to find the model identifier:
system_profiler SPHardwareDataType | grep 'Model Identifier'
"""
)
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
if self.constants.custom_model not in ModelArray.SupportedSMBIOS:
print(
f"""
{self.constants.custom_model} is not a valid SMBIOS Identifier for macOS {self.constants.os_support}!
"""
)
print_models = input(f"Print list of valid options for macOS {self.constants.os_support}? (y/n)")
if print_models.lower() in {"y", "yes"}:
print("\n".join(ModelArray.SupportedSMBIOS))
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"])
no_patch = False
if self.constants.detected_os == self.constants.monterey:
print(MenuOptions.monterey)
elif self.constants.detected_os == self.constants.big_sur:
print(MenuOptions.big_sur)
elif self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.moj_cat_accel == True:
print(MenuOptions.mojave_catalina)
else:
print(MenuOptions.default)
no_patch = True
change_menu = input("Patch System Volume?: ")
if no_patch is not True and change_menu == "1":
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
elif no_patch is not True and change_menu == "2":
SysPatch.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):
title = ["Adjust Advanced Patcher Settings, for developers ONLY"]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [
[f"Set Metal GPU Status:\t\tCurrently {self.constants.imac_vendor}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_metal],
[f"Set DRM Preferences:\t\tCurrently {self.constants.drm_support}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).bootstrap_setting],
[
f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}",
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).disable_cpufriend,
],
]
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
big_sur = """Patches Root volume to fix misc issues such as:
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
monterey = """Patches Root volume to fix misc issues such as:
- Metal Graphics Acceleration
- Intel: Ivy Bridge (4000 series iGPUs)
- Nvidia: Kepler (600-700)
- Non-Metal Graphics Accelertation
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
- Wifi support for BCM94328, BCM94322 and Atheros cards
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
mojave_catalina = """Patches Root volume to fix misc issues such as:
- Non-Metal Graphics Acceleration
- Intel: Ironlake - Sandy Bridge
- Nvidia: Tesla - Fermi (8000-500 series)
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
default = """
This OS has no root patches available to apply, please ensure you're patching a booted
install that requires root patches such as macOS Big Sur or Monterey
Supported Options:
B. Exit
"""

View File

@@ -140,7 +140,7 @@ class Constants:
## Miscellaneous
self.disallow_cpufriend = False # Disable CPUFriend
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
self.disable_thunderbolt = False # Disable Thunderbolt Controller
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

195
Resources/arguments.py Normal file
View File

@@ -0,0 +1,195 @@
import argparse
import sys
import subprocess
from Resources import ModelArray, defaults, Build, ModelExample
# Generic building args
class arguments:
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("--build", help="Build OpenCore", action="store_true", required=False)
parser.add_argument("--verbose", help="Enable verbose boot", action="store_true", required=False)
parser.add_argument("--debug_oc", help="Enable OpenCore DEBUG", action="store_true", required=False)
parser.add_argument("--debug_kext", help="Enable kext DEBUG", action="store_true", required=False)
parser.add_argument("--hide_picker", help="Hide OpenCore picker", action="store_true", required=False)
parser.add_argument("--disable_sip", help="Disable SIP", action="store_true", required=False)
parser.add_argument("--disable_smb", help="Disable SecureBootModel", action="store_true", required=False)
parser.add_argument("--vault", help="Enable OpenCore Vaulting", action="store_true", required=False)
parser.add_argument("--support_all", help="Allow OpenCore on natively supported Models", action="store_true", required=False)
parser.add_argument("--firewire", help="Enable FireWire Booting", action="store_true", required=False)
parser.add_argument("--nvme", help="Enable NVMe Booting", action="store_true", required=False)
parser.add_argument("--wlan", help="Enable Wake on WLAN support", action="store_true", required=False)
# 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_tb", 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)
# SysPatch args
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
parser.add_argument("--validate", help="Runs Validation Tests for CI", action="store_true", required=False)
self.args = parser.parse_args()
def check_cli(self):
# If no core arguments are present, assume we're running in TUI
# - build
# - patch_sys_vol
# - unpatch_sys_vol
# - validate
if not(
self.args.build or self.args.patch_sys_vol or self.args.unpatch_sys_vol or self.args.validate
):
return False
else:
return True
def parse_arguments(self, settings):
if self.args.disk:
print(f"- Install Disk set: {self.args.disk}")
settings.disk = self.args.disk
if self.args.validate:
self.validate(settings)
if self.args.verbose:
print("- Set verbose configuration")
settings.verbose_debug = True
if self.args.debug_oc:
print("- Set OpenCore DEBUG configuration")
settings.opencore_debug = True
settings.opencore_build = "DEBUG"
if self.args.debug_kext:
print("- Set kext DEBUG configuration")
settings.kext_debug = True
if self.args.hide_picker:
print("- Set HidePicker configuration")
settings.showpicker = False
if self.args.disable_sip:
print("- Set Disable SIP configuration")
settings.sip_status = False
if self.args.disable_smb:
print("- Set Disable SecureBootModel configuration")
settings.secure_status = False
if self.args.vault:
print("- Set Vault configuration")
settings.vault = True
if self.args.firewire:
print("- Set FireWire Boot configuration")
settings.firewire_boot = True
if self.args.nvme:
print("- Set NVMe Boot configuration")
settings.nvme_boot = True
# if self.args.disable_amfi:
# print("- Set Disable AMFI configuration")
# settings.amfi_status = False
if self.args.wlan:
print("- Set Wake on WLAN configuration")
settings.enable_wake_on_wlan = True
if self.args.disable_tb:
print("- Set Disable Thunderbolt configuration")
settings.disable_tb = True
if self.args.force_surplus:
print("- Forcing SurPlus override configuration")
settings.force_surplus = True
if self.args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
settings.serial_settings = "Moderate"
if self.args.smbios_spoof:
if self.args.smbios_spoof == "Minimal":
settings.serial_settings = "Minimal"
elif self.args.smbios_spoof == "Moderate":
settings.serial_settings = "Moderate"
elif self.args.smbios_spoof == "Advanced":
settings.serial_settings = "Advanced"
else:
print(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}")
if self.args.support_all:
print("- Building for natively supported model")
settings.allow_oc_everywhere = True
settings.serial_settings = "None"
if self.args.build:
if self.args.model:
print(f"- Using custom model: {self.args.model}")
settings.custom_model = self.args.model
#self.set_defaults(settings.custom_model, False)
defaults.generate_defaults.probe(settings.custom_model, False, settings)
#self.build_opencore()
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
elif settings.computer.real_model not in ModelArray.SupportedSMBIOS and settings.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
)
sys.exit(1)
else:
print(f"- Using detected model: {settings.computer.real_model}")
#self.set_defaults(settings.custom_model, True)
defaults.generate_defaults.probe(settings.custom_model, True, settings)
# self.build_opencore()
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
if self.args.patch_sys_vol:
if self.args.moj_cat_accel:
print("- Set Mojave/Catalina root patch configuration")
settings.moj_cat_accel = True
print("- Set System Volume patching")
self.patch_vol()
elif self.args.unpatch_sys_vol:
print("- Set System Volume unpatching")
self.unpatch_vol()
def validate(self, settings):
# Runs through ocvalidate to check for errors
valid_dumps = [
# ModelExample.MacBookPro.MacBookPro92_Stock,
# ModelExample.MacBookPro.MacBookPro171_Stock,
# ModelExample.Macmini.Macmini91_Stock,
#ModelExample.iMac.iMac81_Stock,
ModelExample.iMac.iMac112_Stock,
#ModelExample.iMac.iMac122_Upgraded,
ModelExample.MacPro.MacPro31_Stock,
ModelExample.MacPro.MacPro31_Upgrade,
ModelExample.MacPro.MacPro31_Modern_AMD,
ModelExample.MacPro.MacPro31_Modern_Kepler,
ModelExample.MacPro.MacPro41_Upgrade,
ModelExample.MacPro.MacPro41_Modern_AMD,
ModelExample.MacPro.MacPro41_51__Flashed_Modern_AMD,
]
settings.validate = True
for model in ModelArray.SupportedSMBIOS:
print(f"Validating predefined model: {model}")
settings.custom_model = model
# self.build_opencore()
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {model}")
else:
print(f"Validation succeeded for predefined model: {model}")
for model in valid_dumps:
settings.computer = model
# self.computer = settings.computer
settings.custom_model = ""
print(f"Validating dumped model: {settings.computer.real_model}")
# self.build_opencore()
Build.BuildOpenCore(settings.computer.real_model, settings).build_opencore()
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {settings.computer.real_model}")
else:
print(f"Validation succeeded for predefined model: {settings.computer.real_model}")

74
Resources/defaults.py Normal file
View File

@@ -0,0 +1,74 @@
# Generate Default Data
from Resources import Utilities, device_probe, ModelArray
class generate_defaults():
def probe(model, host_is_target, settings):
# Generate Default Data
# Takes in Settings data set, and returns updated Settings
settings.sip_status = True
settings.secure_status = False # Default false for Monterey
settings.amfi_status = True
if host_is_target:
if Utilities.check_metal_support(device_probe, settings.computer) is False:
settings.disable_cs_lv = True
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
settings.sip_status = False
settings.amfi_status = True
settings.allow_fv_root = True # Allow FileVault on broken seal
if (
isinstance(settings.computer.wifi, device_probe.Broadcom)
and settings.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(settings.computer.wifi, device_probe.Atheros) and settings.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal
elif model in ModelArray.LegacyGPU:
settings.disable_cs_lv = True
if model in ModelArray.LegacyGPU:
if host_is_target and Utilities.check_metal_support(device_probe, settings.computer) is True:
# Building on device and we have a native, supported GPU
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
settings.sip_status = False
# settings.secure_status = True # Monterey
settings.allow_fv_root = True # Allow FileVault on broken seal
else:
settings.sip_status = True
# settings.secure_status = True # Monterey
settings.amfi_status = True
else:
settings.sip_status = False # Unsigned kexts
settings.secure_status = False # Root volume modified
settings.amfi_status = False # Unsigned binaries
settings.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
# Systems with Ivy or Kepler GPUs, Monterey requires root patching for accel
settings.sip_status = False # Unsigned kexts
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
settings.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
settings.custom_cpu_model = 1
settings.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
if "-v" in (Utilities.get_nvram("boot-args") or ""):
settings.verbose_debug = True
if Utilities.amfi_status() is False:
settings.amfi_status = False
if Utilities.get_nvram("gpu-power-prefs", "FA4CE28D-B62F-4C99-9CC3-6815686E30F9"):
# Users disabling TS2 most likely have a faulty dGPU
# users can override this in settings
settings.allow_ts2_accel = False
# Check if running in RecoveryOS
settings.recovery_status = Utilities.check_recovery()

19
Resources/mount_root.py Normal file
View File

@@ -0,0 +1,19 @@
# Logic for mounting root volume
from Data import os_data
from Resources import Utilities
import plistlib
import subprocess
def mount_root_volume(os_version, root_disk):
if os_version >= os_data.os_data.big_sur:
mount_location = "/System/Volumes/Update/mnt1/"
else:
mount_location = "/"
def find_root_volume():
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
root_mount_path = root_partition_info["DeviceIdentifier"]
root_mount_path = root_mount_path[:-2] if root_mount_path.count("s") > 1 else root_mount_path
return root_mount_path

19
Resources/os_probe.py Normal file
View File

@@ -0,0 +1,19 @@
# Probe for OS data
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()