mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 22:00:00 +10:00
Depreciate dedicated OCLP-CLI binary
OpenCore-Patcher now supports both CLI and TUI mode
This commit is contained in:
+3
-2
@@ -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
|
||||
|
||||
+157
-5
@@ -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
|
||||
"""
|
||||
@@ -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
|
||||
|
||||
@@ -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}")
|
||||
|
||||
@@ -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()
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user