mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-22 02:50:15 +10:00
build: Implement pythonic formatting
This commit is contained in:
@@ -183,4 +183,4 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
|||||||
self.constants.allow_oc_everywhere = True
|
self.constants.allow_oc_everywhere = True
|
||||||
self.constants.serial_settings = "None"
|
self.constants.serial_settings = "None"
|
||||||
|
|
||||||
build.build_opencore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
|
build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants)
|
||||||
|
|||||||
@@ -1,34 +1,44 @@
|
|||||||
# Class for handling Bluetooth Patches, invocation from build.py
|
# Class for handling Bluetooth Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from resources import constants, device_probe
|
from resources import constants, device_probe
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import smbios_data, bluetooth_data
|
from data import smbios_data, bluetooth_data
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class build_bluetooth:
|
class BuildBluetooth:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
self.computer = self.constants.computer
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
# Bluetooth patches
|
"""
|
||||||
|
Kick off Bluetooth Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
||||||
self.on_model()
|
self._on_model()
|
||||||
else:
|
else:
|
||||||
self.prebuilt_assumption()
|
self._prebuilt_assumption()
|
||||||
|
|
||||||
|
|
||||||
def on_model(self):
|
def _on_model(self) -> None:
|
||||||
|
"""
|
||||||
|
On-Model Hardware Detection Handling
|
||||||
|
"""
|
||||||
|
|
||||||
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
||||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
||||||
elif self.computer.bluetooth_chipset == "BRCM20702 Hub":
|
elif self.computer.bluetooth_chipset == "BRCM20702 Hub":
|
||||||
# BCM94331 can include either BCM2070 or BRCM20702 v1 Bluetooth chipsets
|
# BCM94331 can include either BCM2070 or BRCM20702 v1 Bluetooth chipsets
|
||||||
@@ -37,15 +47,19 @@ class build_bluetooth:
|
|||||||
if self.computer.wifi:
|
if self.computer.wifi:
|
||||||
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
elif self.computer.bluetooth_chipset == "3rd Party Bluetooth 4.0 Hub":
|
elif self.computer.bluetooth_chipset == "3rd Party Bluetooth 4.0 Hub":
|
||||||
logging.info("- Detected 3rd Party Bluetooth Chipset")
|
logging.info("- Detected 3rd Party Bluetooth Chipset")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
logging.info("- Enabling Bluetooth FeatureFlags")
|
logging.info("- Enabling Bluetooth FeatureFlags")
|
||||||
self.config["Kernel"]["Quirks"]["ExtendBTFeatureFlags"] = True
|
self.config["Kernel"]["Quirks"]["ExtendBTFeatureFlags"] = True
|
||||||
|
|
||||||
|
|
||||||
def prebuilt_assumption(self):
|
def _prebuilt_assumption(self) -> None:
|
||||||
|
"""
|
||||||
|
Fall back to pre-built assumptions
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "Bluetooth Model" in smbios_data.smbios_dictionary[self.model]:
|
if not "Bluetooth Model" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -53,7 +67,7 @@ class build_bluetooth:
|
|||||||
|
|
||||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
|
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
|
||||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value:
|
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value:
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||||
@@ -6,52 +6,60 @@ import pickle
|
|||||||
import plistlib
|
import plistlib
|
||||||
import shutil
|
import shutil
|
||||||
import zipfile
|
import zipfile
|
||||||
|
import logging
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import logging
|
|
||||||
|
|
||||||
from resources import constants, utilities
|
from resources import constants, utilities
|
||||||
from resources.build import bluetooth, firmware, graphics_audio, support, storage, smbios, security, misc
|
from resources.build import bluetooth, firmware, graphics_audio, support, storage, smbios, security, misc
|
||||||
from resources.build.networking import wired, wireless
|
from resources.build.networking import wired, wireless
|
||||||
|
|
||||||
|
|
||||||
def rmtree_handler(func, path, exc_info):
|
def rmtree_handler(func, path, exc_info) -> None:
|
||||||
if exc_info[0] == FileNotFoundError:
|
if exc_info[0] == FileNotFoundError:
|
||||||
return
|
return
|
||||||
raise # pylint: disable=misplaced-bare-raise
|
raise # pylint: disable=misplaced-bare-raise
|
||||||
|
|
||||||
|
|
||||||
class build_opencore:
|
class BuildOpenCore:
|
||||||
def __init__(self, model, versions):
|
|
||||||
self.model = model
|
def __init__(self, model: str, global_constants: constants.Constants) -> None:
|
||||||
self.config = None
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = None
|
||||||
|
self.constants: constants.Constants = global_constants
|
||||||
|
|
||||||
|
self._build_opencore()
|
||||||
|
|
||||||
|
|
||||||
def build_efi(self):
|
def _build_efi(self) -> None:
|
||||||
|
"""
|
||||||
|
Build EFI folder
|
||||||
|
"""
|
||||||
|
|
||||||
utilities.cls()
|
utilities.cls()
|
||||||
if not self.constants.custom_model:
|
logging.info(f"Building Configuration {'for external' if self.constants.custom_model else 'on model'}: {self.model}")
|
||||||
logging.info(f"Building Configuration on model: {self.model}")
|
|
||||||
else:
|
|
||||||
logging.info(f"Building Configuration for external model: {self.model}")
|
|
||||||
|
|
||||||
self.generate_base()
|
self._generate_base()
|
||||||
self.set_revision()
|
self._set_revision()
|
||||||
|
|
||||||
# Set Lilu and co.
|
# Set Lilu and co.
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path)
|
||||||
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
|
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
|
||||||
|
|
||||||
# Call support functions
|
# Call support functions
|
||||||
firmware.build_firmware(self.model, self.constants, self.config).build()
|
for function in [
|
||||||
wired.build_wired(self.model, self.constants, self.config).build()
|
firmware.BuildFirmware,
|
||||||
wireless.build_wireless(self.model, self.constants, self.config).build()
|
wired.BuildWiredNetworking,
|
||||||
graphics_audio.build_graphics_audio(self.model, self.constants, self.config).build()
|
wireless.BuildWirelessNetworking,
|
||||||
bluetooth.build_bluetooth(self.model, self.constants, self.config).build()
|
graphics_audio.BuildGraphicsAudio,
|
||||||
storage.build_storage(self.model, self.constants, self.config).build()
|
bluetooth.BuildBluetooth,
|
||||||
smbios.build_smbios(self.model, self.constants, self.config).build()
|
storage.BuildStorage,
|
||||||
security.build_security(self.model, self.constants, self.config).build()
|
smbios.BuildSMBIOS,
|
||||||
misc.build_misc(self.model, self.constants, self.config).build()
|
security.BuildSecurity,
|
||||||
|
misc.BuildMiscellaneous
|
||||||
|
]:
|
||||||
|
function(self.model, self.constants, self.config)
|
||||||
|
|
||||||
# Work-around ocvalidate
|
# Work-around ocvalidate
|
||||||
if self.constants.validate is False:
|
if self.constants.validate is False:
|
||||||
@@ -59,8 +67,11 @@ class build_opencore:
|
|||||||
self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"]
|
self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"]
|
||||||
|
|
||||||
|
|
||||||
def generate_base(self):
|
def _generate_base(self) -> None:
|
||||||
# Generate OpenCore base folder and config
|
"""
|
||||||
|
Generate OpenCore base folder and config
|
||||||
|
"""
|
||||||
|
|
||||||
if not Path(self.constants.build_path).exists():
|
if not Path(self.constants.build_path).exists():
|
||||||
logging.info("Creating build folder")
|
logging.info("Creating build folder")
|
||||||
Path(self.constants.build_path).mkdir()
|
Path(self.constants.build_path).mkdir()
|
||||||
@@ -85,8 +96,11 @@ class build_opencore:
|
|||||||
self.config = plistlib.load(Path(self.constants.plist_path).open("rb"))
|
self.config = plistlib.load(Path(self.constants.plist_path).open("rb"))
|
||||||
|
|
||||||
|
|
||||||
def set_revision(self):
|
def _set_revision(self) -> None:
|
||||||
# Set revision in config
|
"""
|
||||||
|
Set revision information in config.plist
|
||||||
|
"""
|
||||||
|
|
||||||
self.config["#Revision"]["Build-Version"] = f"{self.constants.patcher_version} - {date.today()}"
|
self.config["#Revision"]["Build-Version"] = f"{self.constants.patcher_version} - {date.today()}"
|
||||||
if not self.constants.custom_model:
|
if not self.constants.custom_model:
|
||||||
self.config["#Revision"]["Build-Type"] = "OpenCore Built on Target Machine"
|
self.config["#Revision"]["Build-Type"] = "OpenCore Built on Target Machine"
|
||||||
@@ -101,21 +115,35 @@ class build_opencore:
|
|||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Model"] = self.model
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Model"] = self.model
|
||||||
|
|
||||||
|
|
||||||
def save_config(self):
|
def _save_config(self) -> None:
|
||||||
|
"""
|
||||||
|
Save config.plist to disk
|
||||||
|
"""
|
||||||
|
|
||||||
plistlib.dump(self.config, Path(self.constants.plist_path).open("wb"), sort_keys=True)
|
plistlib.dump(self.config, Path(self.constants.plist_path).open("wb"), sort_keys=True)
|
||||||
|
|
||||||
|
|
||||||
def build_opencore(self):
|
def _build_opencore(self) -> None:
|
||||||
|
"""
|
||||||
|
Kick off the build process
|
||||||
|
|
||||||
|
This is the main function:
|
||||||
|
- Generates the OpenCore configuration
|
||||||
|
- Cleans working directory
|
||||||
|
- Signs files
|
||||||
|
- Validates generated EFI
|
||||||
|
"""
|
||||||
|
|
||||||
# Generate OpenCore Configuration
|
# Generate OpenCore Configuration
|
||||||
self.build_efi()
|
self._build_efi()
|
||||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True or (self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != ""):
|
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True or (self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != ""):
|
||||||
smbios.build_smbios(self.model, self.constants, self.config).set_smbios()
|
smbios.BuildSMBIOS(self.model, self.constants, self.config)._set_smbios()
|
||||||
support.build_support(self.model, self.constants, self.config).cleanup()
|
support.BuildSupport(self.model, self.constants, self.config).cleanup()
|
||||||
self.save_config()
|
self._save_config()
|
||||||
|
|
||||||
# Post-build handling
|
# Post-build handling
|
||||||
support.build_support(self.model, self.constants, self.config).sign_files()
|
support.BuildSupport(self.model, self.constants, self.config).sign_files()
|
||||||
support.build_support(self.model, self.constants, self.config).validate_pathing()
|
support.BuildSupport(self.model, self.constants, self.config).validate_pathing()
|
||||||
|
|
||||||
logging.info("")
|
logging.info("")
|
||||||
logging.info(f"Your OpenCore EFI for {self.model} has been built at:")
|
logging.info(f"Your OpenCore EFI for {self.model} has been built at:")
|
||||||
|
|||||||
@@ -1,31 +1,41 @@
|
|||||||
# Class for handling CPU and Firmware Patches, invocation from build.py
|
# Class for handling CPU and Firmware Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
from resources import constants, generate_smbios
|
import shutil
|
||||||
|
import logging
|
||||||
|
import binascii
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from resources import constants, generate_smbios, device_probe
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import smbios_data, cpu_data
|
from data import smbios_data, cpu_data
|
||||||
|
|
||||||
import binascii, shutil, logging
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
class build_firmware:
|
class BuildFirmware:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
self.computer = self.constants.computer
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
self.cpu_compatibility_handling()
|
"""
|
||||||
self.power_management_handling()
|
Kick off CPU and Firmware Build Process
|
||||||
self.acpi_handling()
|
"""
|
||||||
self.firmware_driver_handling()
|
|
||||||
self.firmware_compatibility_handling()
|
self._cpu_compatibility_handling()
|
||||||
|
self._power_management_handling()
|
||||||
|
self._acpi_handling()
|
||||||
|
self._firmware_driver_handling()
|
||||||
|
self._firmware_compatibility_handling()
|
||||||
|
|
||||||
|
|
||||||
def power_management_handling(self):
|
def _power_management_handling(self) -> None:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -51,8 +61,8 @@ class build_firmware:
|
|||||||
#
|
#
|
||||||
# To resolve, we patched AICPUPM to attach regardless of the value of 'intel_cpupm_matching'
|
# To resolve, we patched AICPUPM to attach regardless of the value of 'intel_cpupm_matching'
|
||||||
logging.info("- Enabling legacy power management support")
|
logging.info("- Enabling legacy power management support")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagement.kext", self.constants.aicpupm_version, self.constants.aicpupm_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagement.kext", self.constants.aicpupm_version, self.constants.aicpupm_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagementClient.kext", self.constants.aicpupm_version, self.constants.aicpupm_client_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagementClient.kext", self.constants.aicpupm_version, self.constants.aicpupm_client_path)
|
||||||
|
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value or self.constants.disable_xcpm is True:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value or self.constants.disable_xcpm is True:
|
||||||
# With macOS 12.3 Beta 1, Apple dropped the 'plugin-type' check within X86PlatformPlugin
|
# With macOS 12.3 Beta 1, Apple dropped the 'plugin-type' check within X86PlatformPlugin
|
||||||
@@ -61,18 +71,18 @@ class build_firmware:
|
|||||||
# power management tables provided.
|
# power management tables provided.
|
||||||
# This patch will simply increase ASPP's 'IOProbeScore' to outmatch X86PP
|
# This patch will simply increase ASPP's 'IOProbeScore' to outmatch X86PP
|
||||||
logging.info("- Overriding ACPI SMC matching")
|
logging.info("- Overriding ACPI SMC matching")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("ASPP-Override.kext", self.constants.aspp_override_version, self.constants.aspp_override_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("ASPP-Override.kext", self.constants.aspp_override_version, self.constants.aspp_override_path)
|
||||||
if self.constants.disable_xcpm is True:
|
if self.constants.disable_xcpm is True:
|
||||||
# Only inject on older OSes if user requests
|
# Only inject on older OSes if user requests
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
|
||||||
|
|
||||||
if self.constants.disable_msr_power_ctl is True and smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
|
if self.constants.disable_msr_power_ctl is True and smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
|
||||||
logging.info("- Disabling Firmware Throttling")
|
logging.info("- Disabling Firmware Throttling")
|
||||||
# Nehalem and newer systems force firmware throttling via MSR_POWER_CTL
|
# Nehalem and newer systems force firmware throttling via MSR_POWER_CTL
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
|
||||||
|
|
||||||
|
|
||||||
def acpi_handling(self):
|
def _acpi_handling(self) -> None:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -83,19 +93,19 @@ class build_firmware:
|
|||||||
# IOPCIFamily will error when enumerating this device, thus we'll power it off via _STA (has no effect in older OSes)
|
# IOPCIFamily will error when enumerating this device, thus we'll power it off via _STA (has no effect in older OSes)
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem.value and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem.value and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
|
||||||
logging.info("- Adding SSDT-CPBG.aml")
|
logging.info("- Adding SSDT-CPBG.aml")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True
|
||||||
shutil.copy(self.constants.pci_ssdt_path, self.constants.acpi_path)
|
shutil.copy(self.constants.pci_ssdt_path, self.constants.acpi_path)
|
||||||
|
|
||||||
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value and self.model != "MacPro6,1":
|
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value and self.model != "MacPro6,1":
|
||||||
# Based on: https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/
|
# Based on: https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/
|
||||||
# Applicable for Sandy and Ivy Bridge Macs
|
# Applicable for Sandy and Ivy Bridge Macs
|
||||||
logging.info("- Enabling Windows 10 UEFI Audio support")
|
logging.info("- Enabling Windows 10 UEFI Audio support")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-PCI.aml")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-PCI.aml")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True
|
||||||
shutil.copy(self.constants.windows_ssdt_path, self.constants.acpi_path)
|
shutil.copy(self.constants.windows_ssdt_path, self.constants.acpi_path)
|
||||||
|
|
||||||
|
|
||||||
def cpu_compatibility_handling(self):
|
def _cpu_compatibility_handling(self) -> None:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -104,14 +114,14 @@ class build_firmware:
|
|||||||
# SSE4,1 support (ie. Penryn)
|
# SSE4,1 support (ie. Penryn)
|
||||||
# Required for macOS Mojave and newer
|
# Required for macOS Mojave and newer
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path)
|
||||||
|
|
||||||
# Force Rosetta Cryptex installation in macOS Ventura
|
# Force Rosetta Cryptex installation in macOS Ventura
|
||||||
# Restores support for CPUs lacking AVX2.0 support
|
# Restores support for CPUs lacking AVX2.0 support
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
|
||||||
logging.info("- Enabling Rosetta Cryptex support in Ventura")
|
logging.info("- Enabling Rosetta Cryptex support in Ventura")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CryptexFixup.kext", self.constants.cryptexfixup_version, self.constants.cryptexfixup_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CryptexFixup.kext", self.constants.cryptexfixup_version, self.constants.cryptexfixup_path)
|
||||||
|
|
||||||
# i3 Ivy Bridge iMacs don't support RDRAND
|
# i3 Ivy Bridge iMacs don't support RDRAND
|
||||||
# However for prebuilt, assume they do
|
# However for prebuilt, assume they do
|
||||||
@@ -120,14 +130,14 @@ class build_firmware:
|
|||||||
# Ref: https://github.com/reenigneorcim/SurPlus
|
# Ref: https://github.com/reenigneorcim/SurPlus
|
||||||
# Enable for all systems missing RDRAND support
|
# Enable for all systems missing RDRAND support
|
||||||
logging.info("- Adding SurPlus Patch for Race Condition")
|
logging.info("- Adding SurPlus Patch for Race Condition")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["Enabled"] = True
|
||||||
if self.constants.force_surplus is True:
|
if self.constants.force_surplus is True:
|
||||||
# Syncretic forces SurPlus to only run on Beta 7 and older by default for saftey reasons
|
# Syncretic forces SurPlus to only run on Beta 7 and older by default for saftey reasons
|
||||||
# If users desires, allow forcing in newer OSes
|
# If users desires, allow forcing in newer OSes
|
||||||
logging.info("- Allowing SurPlus on all newer OSes")
|
logging.info("- Allowing SurPlus on all newer OSes")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
|
||||||
|
|
||||||
# In macOS 12.4 and 12.5 Beta 1, Apple added AVX1.0 usage in AppleFSCompressionTypeZlib
|
# In macOS 12.4 and 12.5 Beta 1, Apple added AVX1.0 usage in AppleFSCompressionTypeZlib
|
||||||
# Pre-Sandy Bridge CPUs don't support AVX1.0, thus we'll downgrade the kext to 12.3.1's
|
# Pre-Sandy Bridge CPUs don't support AVX1.0, thus we'll downgrade the kext to 12.3.1's
|
||||||
@@ -138,16 +148,16 @@ class build_firmware:
|
|||||||
|
|
||||||
# To verify the non-AVX kext is used, check IOService for 'com_apple_AppleFSCompression_NoAVXCompressionTypeZlib'
|
# To verify the non-AVX kext is used, check IOService for 'com_apple_AppleFSCompression_NoAVXCompressionTypeZlib'
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("NoAVXFSCompressionTypeZlib.kext", self.constants.apfs_zlib_version, self.constants.apfs_zlib_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("NoAVXFSCompressionTypeZlib.kext", self.constants.apfs_zlib_version, self.constants.apfs_zlib_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("NoAVXFSCompressionTypeZlib-AVXpel.kext", self.constants.apfs_zlib_v2_version, self.constants.apfs_zlib_v2_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("NoAVXFSCompressionTypeZlib-AVXpel.kext", self.constants.apfs_zlib_v2_version, self.constants.apfs_zlib_v2_path)
|
||||||
|
|
||||||
# HID patches
|
# HID patches
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
||||||
logging.info("- Adding IOHIDFamily patch")
|
logging.info("- Adding IOHIDFamily patch")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
|
||||||
|
|
||||||
|
|
||||||
def firmware_driver_handling(self):
|
def _firmware_driver_handling(self) -> None:
|
||||||
# Firmware Drivers (Drivers/*.efi)
|
# Firmware Drivers (Drivers/*.efi)
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
@@ -159,13 +169,13 @@ class build_firmware:
|
|||||||
# Sandy Bridge and newer Macs natively support ExFat
|
# Sandy Bridge and newer Macs natively support ExFat
|
||||||
logging.info("- Adding ExFatDxeLegacy.efi")
|
logging.info("- Adding ExFatDxeLegacy.efi")
|
||||||
shutil.copy(self.constants.exfat_legacy_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.exfat_legacy_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("ExFatDxeLegacy.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("ExFatDxeLegacy.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
# NVMe check
|
# NVMe check
|
||||||
if self.constants.nvme_boot is True:
|
if self.constants.nvme_boot is True:
|
||||||
logging.info("- Enabling NVMe boot support")
|
logging.info("- Enabling NVMe boot support")
|
||||||
shutil.copy(self.constants.nvme_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.nvme_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("NvmExpressDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("NvmExpressDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
# USB check
|
# USB check
|
||||||
if self.constants.xhci_boot is True:
|
if self.constants.xhci_boot is True:
|
||||||
@@ -173,18 +183,18 @@ class build_firmware:
|
|||||||
logging.info("- Adding XhciDxe.efi and UsbBusDxe.efi")
|
logging.info("- Adding XhciDxe.efi and UsbBusDxe.efi")
|
||||||
shutil.copy(self.constants.xhci_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.xhci_driver_path, self.constants.drivers_path)
|
||||||
shutil.copy(self.constants.usb_bus_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.usb_bus_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("XhciDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("XhciDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("UsbBusDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("UsbBusDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
# PCIe Link Rate check
|
# PCIe Link Rate check
|
||||||
if self.model == "MacPro3,1":
|
if self.model == "MacPro3,1":
|
||||||
logging.info("- Adding PCIe Link Rate Patch")
|
logging.info("- Adding PCIe Link Rate Patch")
|
||||||
shutil.copy(self.constants.link_rate_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.link_rate_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("FixPCIeLinkRate.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("FixPCIeLinkRate.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
|
|
||||||
def firmware_compatibility_handling(self):
|
def _firmware_compatibility_handling(self) -> None:
|
||||||
self.dual_dp_handling()
|
self._dual_dp_handling()
|
||||||
|
|
||||||
# Force VMM as a temporary solution to getting the MacPro6,1 booting in Ventura
|
# Force VMM as a temporary solution to getting the MacPro6,1 booting in Ventura
|
||||||
# With macOS Ventura, Apple removed AppleIntelCPUPowerManagement.kext and assumed XCPM support across all Macs
|
# With macOS Ventura, Apple removed AppleIntelCPUPowerManagement.kext and assumed XCPM support across all Macs
|
||||||
@@ -228,21 +238,24 @@ class build_firmware:
|
|||||||
if self.model not in affected_smbios:
|
if self.model not in affected_smbios:
|
||||||
# If MacPro6,1 host spoofs, we can safely enable it
|
# If MacPro6,1 host spoofs, we can safely enable it
|
||||||
if self.constants.override_smbios in affected_smbios or generate_smbios.set_smbios_model_spoof(self.model) in affected_smbios:
|
if self.constants.override_smbios in affected_smbios or generate_smbios.set_smbios_model_spoof(self.model) in affected_smbios:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path)
|
||||||
|
|
||||||
|
|
||||||
def dual_dp_handling(self):
|
def _dual_dp_handling(self) -> None:
|
||||||
# Check if model has 5K display
|
"""
|
||||||
# Apple has 2 modes for display handling on 5K iMacs and iMac Pro
|
Dual DisplayPort Stream Handler (ex. 5k iMac)
|
||||||
# If at any point in the boot chain an "unsupported" entry is loaded, the firmware will tell the
|
|
||||||
# Display Controller to enter a 4K compatible mode that only uses a single DisplayPort 1.2 stream internally.
|
|
||||||
# This is to prevent situations where the system would boot into an enviroment that cannot handle the custom
|
|
||||||
# dual DisplayPort 1.2 streams the 5k Display uses
|
|
||||||
|
|
||||||
# To work around this issue, we trick the firmware into loading OpenCore through Apple's Hardware Diagnostic Tests
|
Apple has 2 modes for display handling on 5K iMacs and iMac Pro
|
||||||
# Specifically hiding as Product.efi under '/System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi'
|
If at any point in the boot chain an "unsupported" entry is loaded, the firmware will tell the
|
||||||
# The reason chainloading via ./Drivers/HardwareDrivers is possible is thanks to it being loaded via an encrypted file buffer
|
Display Controller to enter a 4K compatible mode that only uses a single DisplayPort 1.2 stream internally.
|
||||||
# whereas other drivers like ./qa_logger.efi is invoked via Device Path.
|
This is to prevent situations where the system would boot into an enviroment that cannot handle the custom
|
||||||
|
dual DisplayPort 1.2 streams the 5k Display uses
|
||||||
|
|
||||||
|
To work around this issue, we trick the firmware into loading OpenCore through Apple's Hardware Diagnostic Tests
|
||||||
|
Specifically hiding as Product.efi under '/System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi'
|
||||||
|
The reason chainloading via ./Drivers/HardwareDrivers is possible is thanks to it being loaded via an encrypted file buffer
|
||||||
|
whereas other drivers like ./qa_logger.efi is invoked via Device Path.
|
||||||
|
"""
|
||||||
|
|
||||||
if "5K Display" not in smbios_data.smbios_dictionary[self.model]:
|
if "5K Display" not in smbios_data.smbios_dictionary[self.model]:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
# Class for handling Graphics and Audio Patches, invocation from build.py
|
# Class for handling Graphics and Audio Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
import shutil, binascii, logging
|
import shutil
|
||||||
|
import logging
|
||||||
|
import binascii
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -10,30 +12,36 @@ from resources.build import support
|
|||||||
from data import smbios_data, model_array, os_data, cpu_data, video_bios_data
|
from data import smbios_data, model_array, os_data, cpu_data, video_bios_data
|
||||||
|
|
||||||
|
|
||||||
class build_graphics_audio:
|
class BuildGraphicsAudio:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
self.computer = self.constants.computer
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
self.gfx0_path = None
|
self.gfx0_path = None
|
||||||
|
|
||||||
|
self._build()
|
||||||
def build(self):
|
|
||||||
self.imac_mxm_patching()
|
|
||||||
self.graphics_handling()
|
|
||||||
self.audio_handling()
|
|
||||||
self.firmware_handling()
|
|
||||||
self.spoof_handling()
|
|
||||||
self.ioaccel_workaround()
|
|
||||||
|
|
||||||
|
|
||||||
def graphics_handling(self):
|
def _build(self) -> None:
|
||||||
|
"""
|
||||||
|
Kick off Graphics and Audio Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._imac_mxm_patching()
|
||||||
|
self._graphics_handling()
|
||||||
|
self._audio_handling()
|
||||||
|
self._firmware_handling()
|
||||||
|
self._spoof_handling()
|
||||||
|
self._ioaccel_workaround()
|
||||||
|
|
||||||
|
|
||||||
|
def _graphics_handling(self) -> None:
|
||||||
if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
|
if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
|
||||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
if not support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||||
|
|
||||||
# Mac Pro handling
|
# Mac Pro handling
|
||||||
if self.model in model_array.MacPro:
|
if self.model in model_array.MacPro:
|
||||||
@@ -77,8 +85,8 @@ class build_graphics_audio:
|
|||||||
logging.info("- Adding Mac Pro, Xserve DRM patches")
|
logging.info("- Adding Mac Pro, Xserve DRM patches")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
|
||||||
|
|
||||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
if not support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||||
|
|
||||||
# Web Driver specific
|
# Web Driver specific
|
||||||
if not self.constants.custom_model:
|
if not self.constants.custom_model:
|
||||||
@@ -94,19 +102,19 @@ class build_graphics_audio:
|
|||||||
self.config["DeviceProperties"]["Add"][device.pci_path].update({"disable-metal": 1, "force-compat": 1})
|
self.config["DeviceProperties"]["Add"][device.pci_path].update({"disable-metal": 1, "force-compat": 1})
|
||||||
else:
|
else:
|
||||||
self.config["DeviceProperties"]["Add"][device.pci_path] = {"disable-metal": 1, "force-compat": 1}
|
self.config["DeviceProperties"]["Add"][device.pci_path] = {"disable-metal": 1, "force-compat": 1}
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
|
||||||
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
|
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
|
||||||
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
|
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
|
||||||
else:
|
else:
|
||||||
if "ngfxgl=1 ngfxcompat=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
|
if "ngfxgl=1 ngfxcompat=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " ngfxgl=1 ngfxcompat=1"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " ngfxgl=1 ngfxcompat=1"
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"].update({"nvda_drv": binascii.unhexlify("31")})
|
||||||
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
|
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
|
||||||
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
|
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
|
||||||
|
|
||||||
def backlight_path_detection(self):
|
def _backlight_path_detection(self) -> None:
|
||||||
|
|
||||||
# self.constants.custom_model: iMac has been modded with new dGPU
|
# self.constants.custom_model: iMac has been modded with new dGPU
|
||||||
# self.computer.dgpu: dGPU has been found using the GFX0 path
|
# self.computer.dgpu: dGPU has been found using the GFX0 path
|
||||||
@@ -144,10 +152,10 @@ class build_graphics_audio:
|
|||||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||||
|
|
||||||
|
|
||||||
def nvidia_mxm_patch(self, backlight_path):
|
def _nvidia_mxm_patch(self, backlight_path) -> None:
|
||||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
if not support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||||
# Ensure WEG is enabled as we need if for Backlight patching
|
# Ensure WEG is enabled as we need if for Backlight patching
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
||||||
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3", "iMac10,1"]:
|
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3", "iMac10,1"]:
|
||||||
logging.info("- Adding Nvidia Brightness Control and DRM patches")
|
logging.info("- Adding Nvidia Brightness Control and DRM patches")
|
||||||
self.config["DeviceProperties"]["Add"][backlight_path] = {
|
self.config["DeviceProperties"]["Add"][backlight_path] = {
|
||||||
@@ -182,20 +190,20 @@ class build_graphics_audio:
|
|||||||
"class-code": binascii.unhexlify("FFFFFFFF"),
|
"class-code": binascii.unhexlify("FFFFFFFF"),
|
||||||
}
|
}
|
||||||
shutil.copy(self.constants.backlight_injector_path, self.constants.kexts_path)
|
shutil.copy(self.constants.backlight_injector_path, self.constants.kexts_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("BacklightInjector.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("BacklightInjector.kext")["Enabled"] = True
|
||||||
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
|
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
|
||||||
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
|
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
|
||||||
|
|
||||||
|
|
||||||
def amd_mxm_patch(self, backlight_path):
|
def _amd_mxm_patch(self, backlight_path) -> None:
|
||||||
logging.info("- Adding AMD DRM patches")
|
logging.info("- Adding AMD DRM patches")
|
||||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
if not support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||||
# Ensure WEG is enabled as we need if for Backlight patching
|
# Ensure WEG is enabled as we need if for Backlight patching
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
||||||
|
|
||||||
if self.model == "iMac9,1":
|
if self.model == "iMac9,1":
|
||||||
logging.info("- Adding iMac9,1 Brightness Control and DRM patches")
|
logging.info("- Adding iMac9,1 Brightness Control and DRM patches")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BacklightInjector.kext", self.constants.backlight_injectorA_version, self.constants.backlight_injectorA_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BacklightInjector.kext", self.constants.backlight_injectorA_version, self.constants.backlight_injectorA_path)
|
||||||
|
|
||||||
if not self.constants.custom_model:
|
if not self.constants.custom_model:
|
||||||
if self.computer.dgpu.device_id == 0x7340:
|
if self.computer.dgpu.device_id == 0x7340:
|
||||||
@@ -222,7 +230,7 @@ class build_graphics_audio:
|
|||||||
"class-code": binascii.unhexlify("FFFFFFFF"),
|
"class-code": binascii.unhexlify("FFFFFFFF"),
|
||||||
}
|
}
|
||||||
elif self.model in ["iMac9,1", "iMac10,1"]:
|
elif self.model in ["iMac9,1", "iMac10,1"]:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
|
||||||
if self.computer and self.computer.dgpu:
|
if self.computer and self.computer.dgpu:
|
||||||
if self.computer.dgpu.arch == device_probe.AMD.Archs.Legacy_GCN_7000:
|
if self.computer.dgpu.arch == device_probe.AMD.Archs.Legacy_GCN_7000:
|
||||||
logging.info("- Adding Legacy GCN Power Gate Patches")
|
logging.info("- Adding Legacy GCN Power Gate Patches")
|
||||||
@@ -269,9 +277,9 @@ class build_graphics_audio:
|
|||||||
"enable-gva-support": 1
|
"enable-gva-support": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
def audio_handling(self):
|
def _audio_handling(self) -> None:
|
||||||
if (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True:
|
if (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
||||||
|
|
||||||
# Audio Patch
|
# Audio Patch
|
||||||
if self.constants.set_alc_usage is True:
|
if self.constants.set_alc_usage is True:
|
||||||
@@ -297,16 +305,16 @@ class build_graphics_audio:
|
|||||||
"use-apple-layout-id": 1,
|
"use-apple-layout-id": 1,
|
||||||
"use-layout-id": 1,
|
"use-layout-id": 1,
|
||||||
}
|
}
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
||||||
elif (self.model.startswith("MacPro") and self.model != "MacPro6,1") or self.model.startswith("Xserve"):
|
elif (self.model.startswith("MacPro") and self.model != "MacPro6,1") or self.model.startswith("Xserve"):
|
||||||
# Used to enable Audio support for non-standard dGPUs
|
# Used to enable Audio support for non-standard dGPUs
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
|
||||||
|
|
||||||
# Due to regression in AppleALC 1.6.4+, temporarily use 1.6.3 and set override
|
# Due to regression in AppleALC 1.6.4+, temporarily use 1.6.3 and set override
|
||||||
if support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleALC.kext")["Enabled"] is True:
|
if support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleALC.kext")["Enabled"] is True:
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -lilubetaall"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -lilubetaall"
|
||||||
|
|
||||||
def firmware_handling(self):
|
def _firmware_handling(self) -> None:
|
||||||
# Add UGA to GOP layer
|
# Add UGA to GOP layer
|
||||||
if "UGA Graphics" in smbios_data.smbios_dictionary[self.model]:
|
if "UGA Graphics" in smbios_data.smbios_dictionary[self.model]:
|
||||||
logging.info("- Adding UGA to GOP Patch")
|
logging.info("- Adding UGA to GOP Patch")
|
||||||
@@ -316,8 +324,8 @@ class build_graphics_audio:
|
|||||||
if self.constants.software_demux is True and self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
if self.constants.software_demux is True and self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||||
logging.info("- Enabling software demux")
|
logging.info("- Enabling software demux")
|
||||||
# Add ACPI patches
|
# Add ACPI patches
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-DGPU.aml")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-DGPU.aml")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "_INI to XINI")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "_INI to XINI")["Enabled"] = True
|
||||||
shutil.copy(self.constants.demux_ssdt_path, self.constants.acpi_path)
|
shutil.copy(self.constants.demux_ssdt_path, self.constants.acpi_path)
|
||||||
# Disable dGPU
|
# Disable dGPU
|
||||||
# IOACPIPlane:/_SB/PCI0@0/P0P2@10000/GFX0@0
|
# IOACPIPlane:/_SB/PCI0@0/P0P2@10000/GFX0@0
|
||||||
@@ -329,7 +337,7 @@ class build_graphics_audio:
|
|||||||
}
|
}
|
||||||
self.config["DeviceProperties"]["Delete"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = ["class-code", "device-id", "IOName", "name"]
|
self.config["DeviceProperties"]["Delete"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = ["class-code", "device-id", "IOName", "name"]
|
||||||
# Add AMDGPUWakeHandler
|
# Add AMDGPUWakeHandler
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AMDGPUWakeHandler.kext", self.constants.gpu_wake_version, self.constants.gpu_wake_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AMDGPUWakeHandler.kext", self.constants.gpu_wake_version, self.constants.gpu_wake_path)
|
||||||
|
|
||||||
if self.constants.dGPU_switch is True and "Switchable GPUs" in smbios_data.smbios_dictionary[self.model]:
|
if self.constants.dGPU_switch is True and "Switchable GPUs" in smbios_data.smbios_dictionary[self.model]:
|
||||||
logging.info("- Allowing GMUX switching in Windows")
|
logging.info("- Allowing GMUX switching in Windows")
|
||||||
@@ -345,16 +353,16 @@ class build_graphics_audio:
|
|||||||
if self.constants.amd_gop_injection is True:
|
if self.constants.amd_gop_injection is True:
|
||||||
logging.info("- Adding AMDGOP.efi")
|
logging.info("- Adding AMDGOP.efi")
|
||||||
shutil.copy(self.constants.amd_gop_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.amd_gop_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("AMDGOP.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("AMDGOP.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
# Nvidia Kepler GOP VBIOS injection
|
# Nvidia Kepler GOP VBIOS injection
|
||||||
if self.constants.nvidia_kepler_gop_injection is True:
|
if self.constants.nvidia_kepler_gop_injection is True:
|
||||||
logging.info("- Adding NVGOP_GK.efi")
|
logging.info("- Adding NVGOP_GK.efi")
|
||||||
shutil.copy(self.constants.nvidia_kepler_gop_driver_path, self.constants.drivers_path)
|
shutil.copy(self.constants.nvidia_kepler_gop_driver_path, self.constants.drivers_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("NVGOP_GK.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("NVGOP_GK.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
|
|
||||||
def spoof_handling(self):
|
def _spoof_handling(self) -> None:
|
||||||
if self.constants.serial_settings == "None":
|
if self.constants.serial_settings == "None":
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -366,7 +374,7 @@ class build_graphics_audio:
|
|||||||
Path(self.constants.amc_kext_folder).mkdir()
|
Path(self.constants.amc_kext_folder).mkdir()
|
||||||
Path(self.constants.amc_contents_folder).mkdir()
|
Path(self.constants.amc_contents_folder).mkdir()
|
||||||
shutil.copy(amc_map_path, self.constants.amc_contents_folder)
|
shutil.copy(amc_map_path, self.constants.amc_contents_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
|
||||||
|
|
||||||
if self.model not in model_array.NoAGPMSupport:
|
if self.model not in model_array.NoAGPMSupport:
|
||||||
logging.info("- Adding AppleGraphicsPowerManagement Override")
|
logging.info("- Adding AppleGraphicsPowerManagement Override")
|
||||||
@@ -374,7 +382,7 @@ class build_graphics_audio:
|
|||||||
Path(self.constants.agpm_kext_folder).mkdir()
|
Path(self.constants.agpm_kext_folder).mkdir()
|
||||||
Path(self.constants.agpm_contents_folder).mkdir()
|
Path(self.constants.agpm_contents_folder).mkdir()
|
||||||
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
|
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
|
||||||
|
|
||||||
if self.model in model_array.AGDPSupport:
|
if self.model in model_array.AGDPSupport:
|
||||||
logging.info("- Adding AppleGraphicsDevicePolicy Override")
|
logging.info("- Adding AppleGraphicsDevicePolicy Override")
|
||||||
@@ -382,7 +390,7 @@ class build_graphics_audio:
|
|||||||
Path(self.constants.agdp_kext_folder).mkdir()
|
Path(self.constants.agdp_kext_folder).mkdir()
|
||||||
Path(self.constants.agdp_contents_folder).mkdir()
|
Path(self.constants.agdp_contents_folder).mkdir()
|
||||||
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
|
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
|
||||||
|
|
||||||
# AGPM Patch
|
# AGPM Patch
|
||||||
if self.model in model_array.DualGPUPatch:
|
if self.model in model_array.DualGPUPatch:
|
||||||
@@ -412,15 +420,15 @@ class build_graphics_audio:
|
|||||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"agdpmod": "vit9696"}
|
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"agdpmod": "vit9696"}
|
||||||
|
|
||||||
|
|
||||||
def imac_mxm_patching(self):
|
def _imac_mxm_patching(self) -> None:
|
||||||
self.backlight_path_detection()
|
self._backlight_path_detection()
|
||||||
# Check GPU Vendor
|
# Check GPU Vendor
|
||||||
if self.constants.metal_build is True:
|
if self.constants.metal_build is True:
|
||||||
logging.info("- Adding Metal GPU patches on request")
|
logging.info("- Adding Metal GPU patches on request")
|
||||||
if self.constants.imac_vendor == "AMD":
|
if self.constants.imac_vendor == "AMD":
|
||||||
self.amd_mxm_patch(self.gfx0_path)
|
self._amd_mxm_patch(self.gfx0_path)
|
||||||
elif self.constants.imac_vendor == "Nvidia":
|
elif self.constants.imac_vendor == "Nvidia":
|
||||||
self.nvidia_mxm_patch(self.gfx0_path)
|
self._nvidia_mxm_patch(self.gfx0_path)
|
||||||
else:
|
else:
|
||||||
logging.info("- Failed to find vendor")
|
logging.info("- Failed to find vendor")
|
||||||
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
|
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
|
||||||
@@ -434,11 +442,11 @@ class build_graphics_audio:
|
|||||||
device_probe.AMD.Archs.Vega,
|
device_probe.AMD.Archs.Vega,
|
||||||
device_probe.AMD.Archs.Navi,
|
device_probe.AMD.Archs.Navi,
|
||||||
]:
|
]:
|
||||||
self.amd_mxm_patch(self.gfx0_path)
|
self._amd_mxm_patch(self.gfx0_path)
|
||||||
elif self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
|
elif self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
|
||||||
self.nvidia_mxm_patch(self.gfx0_path)
|
self._nvidia_mxm_patch(self.gfx0_path)
|
||||||
|
|
||||||
def ioaccel_workaround(self):
|
def _ioaccel_workaround(self) -> None:
|
||||||
# Handle misc IOAccelerator issues
|
# Handle misc IOAccelerator issues
|
||||||
|
|
||||||
# When MTL bundles are missing from disk, WindowServer will repeatedly crash
|
# When MTL bundles are missing from disk, WindowServer will repeatedly crash
|
||||||
@@ -503,7 +511,7 @@ class build_graphics_audio:
|
|||||||
|
|
||||||
if has_kdkless_gpu is True and has_kdk_gpu is False:
|
if has_kdkless_gpu is True and has_kdk_gpu is False:
|
||||||
# KDKlessWorkaround is required for KDKless GPUs
|
# KDKlessWorkaround is required for KDKless GPUs
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
# KDKlessWorkaround supports disabling native AMD stack on Ventura for pre-AVX2.0 CPUs
|
# KDKlessWorkaround supports disabling native AMD stack on Ventura for pre-AVX2.0 CPUs
|
||||||
@@ -519,5 +527,5 @@ class build_graphics_audio:
|
|||||||
device_probe.AMD.Archs.Vega,
|
device_probe.AMD.Archs.Vega,
|
||||||
device_probe.AMD.Archs.Navi,
|
device_probe.AMD.Archs.Navi,
|
||||||
]:
|
]:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,47 +1,52 @@
|
|||||||
# Class for handling Misc Patches, invocation from build.py
|
# Class for handling Misc Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
import logging
|
||||||
|
import binascii
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from resources import constants, device_probe, generate_smbios, utilities
|
from resources import constants, device_probe, generate_smbios, utilities
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import model_array, smbios_data, cpu_data
|
from data import model_array, smbios_data, cpu_data
|
||||||
|
|
||||||
import binascii, shutil, logging
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
class BuildMiscellaneous:
|
||||||
|
|
||||||
class build_misc:
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
|
self.model: str = model
|
||||||
|
self.config: dict = config
|
||||||
|
self.constants: constants.Constants = global_constants
|
||||||
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
self._build()
|
||||||
self.model = model
|
|
||||||
self.constants: constants.Constants = versions
|
|
||||||
self.config = config
|
|
||||||
self.computer = self.constants.computer
|
|
||||||
|
|
||||||
def rmtree_handler(func, path, exc_info):
|
def rmtree_handler(func, path, exc_info) -> None:
|
||||||
if exc_info[0] == FileNotFoundError:
|
if exc_info[0] == FileNotFoundError:
|
||||||
return
|
return
|
||||||
raise # pylint: disable=misplaced-bare-raise
|
raise # pylint: disable=misplaced-bare-raise
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
self.feature_unlock_handling()
|
self._feature_unlock_handling()
|
||||||
self.restrict_events_handling()
|
self._restrict_events_handling()
|
||||||
self.firewire_handling()
|
self._firewire_handling()
|
||||||
self.trackpad_handling()
|
self._trackpad_handling()
|
||||||
self.thunderbolt_handling()
|
self._thunderbolt_handling()
|
||||||
self.webcam_handling()
|
self._webcam_handling()
|
||||||
self.usb_handling()
|
self._usb_handling()
|
||||||
self.debug_handling()
|
self._debug_handling()
|
||||||
self.cpu_friend_handling()
|
self._cpu_friend_handling()
|
||||||
self.general_oc_handling()
|
self._general_oc_handling()
|
||||||
|
|
||||||
def feature_unlock_handling(self):
|
def _feature_unlock_handling(self) -> None:
|
||||||
if self.constants.fu_status is True:
|
if self.constants.fu_status is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
|
||||||
if self.constants.fu_arguments is not None:
|
if self.constants.fu_arguments is not None:
|
||||||
logging.info(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
|
logging.info(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
|
||||||
|
|
||||||
def restrict_events_handling(self):
|
def _restrict_events_handling(self) -> None:
|
||||||
# RestrictEvents handling
|
# RestrictEvents handling
|
||||||
# - revpatch: Process patching
|
# - revpatch: Process patching
|
||||||
# - revblock: Process blocking
|
# - revblock: Process blocking
|
||||||
@@ -73,11 +78,11 @@ class build_misc:
|
|||||||
|
|
||||||
if block_args != "":
|
if block_args != "":
|
||||||
logging.info(f"- Setting RestrictEvents block arguments: {block_args}")
|
logging.info(f"- Setting RestrictEvents block arguments: {block_args}")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revblock"] = block_args
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revblock"] = block_args
|
||||||
|
|
||||||
patch_args = ""
|
patch_args = ""
|
||||||
if support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True and self.constants.set_content_caching is True:
|
if support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True and self.constants.set_content_caching is True:
|
||||||
logging.info("- Fixing Content Caching support")
|
logging.info("- Fixing Content Caching support")
|
||||||
patch_args += "asset,"
|
patch_args += "asset,"
|
||||||
|
|
||||||
@@ -90,7 +95,7 @@ class build_misc:
|
|||||||
|
|
||||||
if patch_args != "":
|
if patch_args != "":
|
||||||
logging.info(f"- Setting RestrictEvents patch arguments: {patch_args}")
|
logging.info(f"- Setting RestrictEvents patch arguments: {patch_args}")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revpatch"] = patch_args
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revpatch"] = patch_args
|
||||||
|
|
||||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||||
@@ -100,17 +105,17 @@ class build_misc:
|
|||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpuname"] = self.constants.custom_cpu_model_value
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpuname"] = self.constants.custom_cpu_model_value
|
||||||
else:
|
else:
|
||||||
logging.info("- Adding CPU Name Patch")
|
logging.info("- Adding CPU Name Patch")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||||
|
|
||||||
if support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
|
if support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
|
||||||
# Ensure this is done at the end so all previous RestrictEvents patches are applied
|
# Ensure this is done at the end so all previous RestrictEvents patches are applied
|
||||||
# RestrictEvents and EFICheckDisabler will conflict if both are injected
|
# RestrictEvents and EFICheckDisabler will conflict if both are injected
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("EFICheckDisabler.kext", "", self.constants.efi_disabler_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("EFICheckDisabler.kext", "", self.constants.efi_disabler_path)
|
||||||
|
|
||||||
|
|
||||||
def cpu_friend_handling(self):
|
def _cpu_friend_handling(self) -> None:
|
||||||
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
|
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CPUFriend.kext", self.constants.cpufriend_version, self.constants.cpufriend_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CPUFriend.kext", self.constants.cpufriend_version, self.constants.cpufriend_path)
|
||||||
|
|
||||||
# CPUFriendDataProvider handling
|
# CPUFriendDataProvider handling
|
||||||
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
|
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
|
||||||
@@ -119,34 +124,34 @@ class build_misc:
|
|||||||
Path(self.constants.pp_kext_folder).mkdir()
|
Path(self.constants.pp_kext_folder).mkdir()
|
||||||
Path(self.constants.pp_contents_folder).mkdir()
|
Path(self.constants.pp_contents_folder).mkdir()
|
||||||
shutil.copy(pp_map_path, self.constants.pp_contents_folder)
|
shutil.copy(pp_map_path, self.constants.pp_contents_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("CPUFriendDataProvider.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("CPUFriendDataProvider.kext")["Enabled"] = True
|
||||||
|
|
||||||
def firewire_handling(self):
|
def _firewire_handling(self) -> None:
|
||||||
if self.constants.firewire_boot is True and generate_smbios.check_firewire(self.model) is True:
|
if self.constants.firewire_boot is True and generate_smbios.check_firewire(self.model) is True:
|
||||||
# Enable FireWire Boot Support
|
# Enable FireWire Boot Support
|
||||||
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
|
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
|
||||||
logging.info("- Enabling FireWire Boot Support")
|
logging.info("- Enabling FireWire Boot Support")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireFamily.kext", self.constants.fw_kext, self.constants.fw_family_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireFamily.kext", self.constants.fw_kext, self.constants.fw_family_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IOFireWireFamily.kext/Contents/PlugIns/AppleFWOHCI.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IOFireWireFamily.kext/Contents/PlugIns/AppleFWOHCI.kext")["Enabled"] = True
|
||||||
|
|
||||||
def trackpad_handling(self):
|
def _trackpad_handling(self) -> None:
|
||||||
# Pre-Force Touch trackpad support for macOS Ventura
|
# Pre-Force Touch trackpad support for macOS Ventura
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.skylake.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.skylake.value:
|
||||||
if self.model.startswith("MacBook"):
|
if self.model.startswith("MacBook"):
|
||||||
# These units got force touch early, so ignore them
|
# These units got force touch early, so ignore them
|
||||||
if self.model not in ["MacBookPro11,4", "MacBookPro11,5", "MacBookPro12,1", "MacBook8,1"]:
|
if self.model not in ["MacBookPro11,4", "MacBookPro11,5", "MacBookPro12,1", "MacBook8,1"]:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleUSBTopCase.kext", self.constants.topcase_version, self.constants.top_case_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleUSBTopCase.kext", self.constants.topcase_version, self.constants.top_case_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCButtons.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCButtons.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyEventDriver.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyEventDriver.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleUSBMultitouch.kext", self.constants.multitouch_version, self.constants.multitouch_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleUSBMultitouch.kext", self.constants.multitouch_version, self.constants.multitouch_path)
|
||||||
# Legacy Trackpad support
|
# Legacy Trackpad support
|
||||||
if self.model in ["MacBook4,1", "MacBook5,2"]:
|
if self.model in ["MacBook4,1", "MacBook5,2"]:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path)
|
||||||
|
|
||||||
def thunderbolt_handling(self):
|
def _thunderbolt_handling(self) -> None:
|
||||||
if self.constants.disable_tb 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"]:
|
||||||
logging.info("- Disabling 2013-2014 laptop Thunderbolt Controller")
|
logging.info("- Disabling 2013-2014 laptop Thunderbolt Controller")
|
||||||
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
|
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
|
||||||
@@ -158,13 +163,13 @@ class build_misc:
|
|||||||
|
|
||||||
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
|
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
|
||||||
|
|
||||||
def webcam_handling(self):
|
def _webcam_handling(self) -> None:
|
||||||
# Legacy iSight patches
|
# Legacy iSight patches
|
||||||
if "Legacy iSight" in smbios_data.smbios_dictionary[self.model]:
|
if "Legacy iSight" in smbios_data.smbios_dictionary[self.model]:
|
||||||
if smbios_data.smbios_dictionary[self.model]["Legacy iSight"] is True:
|
if smbios_data.smbios_dictionary[self.model]["Legacy iSight"] is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("LegacyUSBVideoSupport.kext", self.constants.apple_isight_version, self.constants.apple_isight_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("LegacyUSBVideoSupport.kext", self.constants.apple_isight_version, self.constants.apple_isight_path)
|
||||||
|
|
||||||
def usb_handling(self):
|
def _usb_handling(self) -> None:
|
||||||
# USB Map
|
# USB Map
|
||||||
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
|
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
|
||||||
if (
|
if (
|
||||||
@@ -179,9 +184,9 @@ class build_misc:
|
|||||||
Path(self.constants.map_kext_folder).mkdir()
|
Path(self.constants.map_kext_folder).mkdir()
|
||||||
Path(self.constants.map_contents_folder).mkdir()
|
Path(self.constants.map_contents_folder).mkdir()
|
||||||
shutil.copy(usb_map_path, self.constants.map_contents_folder)
|
shutil.copy(usb_map_path, self.constants.map_contents_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
|
||||||
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
|
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"
|
||||||
|
|
||||||
# Add UHCI/OHCI drivers
|
# Add UHCI/OHCI drivers
|
||||||
# All Penryn Macs lack an internal USB hub to route USB 1.1 devices to the EHCI controller
|
# All Penryn Macs lack an internal USB hub to route USB 1.1 devices to the EHCI controller
|
||||||
@@ -198,12 +203,12 @@ class build_misc:
|
|||||||
):
|
):
|
||||||
logging.info("- Adding UHCI/OHCI USB support")
|
logging.info("- Adding UHCI/OHCI USB support")
|
||||||
shutil.copy(self.constants.apple_usb_11_injector_path, self.constants.kexts_path)
|
shutil.copy(self.constants.apple_usb_11_injector_path, self.constants.kexts_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCI.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCI.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCIPCI.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCIPCI.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCI.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCI.kext")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCIPCI.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCIPCI.kext")["Enabled"] = True
|
||||||
|
|
||||||
def debug_handling(self):
|
def _debug_handling(self) -> None:
|
||||||
# DEBUG Settings (OpenCorePkg and Kernel Space)
|
# DEBUG Settings (OpenCorePkg and Kernel Space)
|
||||||
|
|
||||||
if self.constants.verbose_debug is True:
|
if self.constants.verbose_debug is True:
|
||||||
@@ -216,24 +221,27 @@ class build_misc:
|
|||||||
# Disabled due to macOS Monterey crashing shortly after kernel init
|
# Disabled due to macOS Monterey crashing shortly after kernel init
|
||||||
# Use DebugEnhancer.kext instead
|
# Use DebugEnhancer.kext instead
|
||||||
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " msgbuf=1048576"
|
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " msgbuf=1048576"
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path)
|
||||||
|
|
||||||
if self.constants.opencore_debug is True:
|
if self.constants.opencore_debug is True:
|
||||||
logging.info("- Enabling DEBUG OpenCore")
|
logging.info("- Enabling DEBUG OpenCore")
|
||||||
self.config["Misc"]["Debug"]["Target"] = 0x43
|
self.config["Misc"]["Debug"]["Target"] = 0x43
|
||||||
self.config["Misc"]["Debug"]["DisplayLevel"] = 0x80000042
|
self.config["Misc"]["Debug"]["DisplayLevel"] = 0x80000042
|
||||||
|
|
||||||
def general_oc_handling(self):
|
def _general_oc_handling(self) -> None:
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
# OpenCorePkg Settings
|
# OpenCorePkg Settings
|
||||||
|
|
||||||
# OpenCanopy Settings (GUI)
|
# OpenCanopy Settings (GUI)
|
||||||
logging.info("- Adding OpenCanopy GUI")
|
logging.info("- Adding OpenCanopy GUI")
|
||||||
shutil.rmtree(self.constants.resources_path, onerror=self.rmtree_handler)
|
shutil.rmtree(self.constants.resources_path, onerror=self.rmtree_handler)
|
||||||
shutil.copy(self.constants.gui_path, self.constants.oc_folder)
|
shutil.copy(self.constants.gui_path, self.constants.oc_folder)
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenCanopy.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenCanopy.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenRuntime.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenRuntime.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenLinuxBoot.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenLinuxBoot.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("ResetNvramEntry.efi", "UEFI", "Drivers")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("ResetNvramEntry.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||||
|
|
||||||
if self.constants.showpicker is False:
|
if self.constants.showpicker is False:
|
||||||
logging.info("- Hiding OpenCore picker")
|
logging.info("- Hiding OpenCore picker")
|
||||||
@@ -246,4 +254,4 @@ class build_misc:
|
|||||||
if self.constants.vault is True and utilities.check_command_line_tools() is True:
|
if self.constants.vault is True and utilities.check_command_line_tools() is True:
|
||||||
logging.info("- Setting Vault configuration")
|
logging.info("- Setting Vault configuration")
|
||||||
self.config["Misc"]["Security"]["Vault"] = "Secure"
|
self.config["Misc"]["Security"]["Vault"] = "Secure"
|
||||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
|
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
|
||||||
@@ -5,25 +5,35 @@ from resources import constants, device_probe
|
|||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import smbios_data, cpu_data
|
from data import smbios_data, cpu_data
|
||||||
|
|
||||||
class build_wired:
|
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
class BuildWiredNetworking:
|
||||||
self.model = model
|
|
||||||
self.constants: constants.Constants = versions
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.config = config
|
self.model: str = model
|
||||||
self.computer = self.constants.computer
|
self.config: dict = config
|
||||||
|
self.constants: constants.Constants = global_constants
|
||||||
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
|
"""
|
||||||
|
Kick off Wired Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
# Check if Ethernet was detected, otherwise fall back to assumptions (mainly for 2011 MacBook Airs and TB Ethernet)
|
# Check if Ethernet was detected, otherwise fall back to assumptions (mainly for 2011 MacBook Airs and TB Ethernet)
|
||||||
if not self.constants.custom_model and self.constants.computer.ethernet:
|
if not self.constants.custom_model and self.constants.computer.ethernet:
|
||||||
self.on_model()
|
self._on_model()
|
||||||
else:
|
else:
|
||||||
self.prebuilt_assumption()
|
self._prebuilt_assumption()
|
||||||
|
|
||||||
|
|
||||||
def on_model(self):
|
def _on_model(self) -> None:
|
||||||
# On-model hardware detection
|
"""
|
||||||
|
On-Model Hardware Detection Handling
|
||||||
|
"""
|
||||||
|
|
||||||
for controller in self.constants.computer.ethernet:
|
for controller in self.constants.computer.ethernet:
|
||||||
if isinstance(controller, device_probe.BroadcomEthernet) and controller.chipset == device_probe.BroadcomEthernet.Chipsets.AppleBCM5701Ethernet:
|
if isinstance(controller, device_probe.BroadcomEthernet) and controller.chipset == device_probe.BroadcomEthernet.Chipsets.AppleBCM5701Ethernet:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
@@ -31,7 +41,7 @@ class build_wired:
|
|||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
||||||
# Required due to Big Sur's BCM5701 requiring VT-D support
|
# Required due to Big Sur's BCM5701 requiring VT-D support
|
||||||
# Applicable for pre-Ivy Bridge models
|
# Applicable for pre-Ivy Bridge models
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
||||||
elif isinstance(controller, device_probe.IntelEthernet):
|
elif isinstance(controller, device_probe.IntelEthernet):
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
continue
|
continue
|
||||||
@@ -39,19 +49,22 @@ class build_wired:
|
|||||||
# Apple's IOSkywalkFamily in DriverKit requires VT-D support
|
# Apple's IOSkywalkFamily in DriverKit requires VT-D support
|
||||||
# Applicable for pre-Ivy Bridge models
|
# Applicable for pre-Ivy Bridge models
|
||||||
if controller.chipset == device_probe.IntelEthernet.Chipsets.AppleIntelI210Ethernet:
|
if controller.chipset == device_probe.IntelEthernet.Chipsets.AppleIntelI210Ethernet:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CatalinaIntelI210Ethernet.kext", self.constants.i210_version, self.constants.i210_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CatalinaIntelI210Ethernet.kext", self.constants.i210_version, self.constants.i210_path)
|
||||||
elif controller.chipset == device_probe.IntelEthernet.Chipsets.AppleIntel8254XEthernet:
|
elif controller.chipset == device_probe.IntelEthernet.Chipsets.AppleIntel8254XEthernet:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntel8254XEthernet.kext", self.constants.intel_8254x_version, self.constants.intel_8254x_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleIntel8254XEthernet.kext", self.constants.intel_8254x_version, self.constants.intel_8254x_path)
|
||||||
elif controller.chipset == device_probe.IntelEthernet.Chipsets.Intel82574L:
|
elif controller.chipset == device_probe.IntelEthernet.Chipsets.Intel82574L:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Intel82574L.kext", self.constants.intel_82574l_version, self.constants.intel_82574l_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Intel82574L.kext", self.constants.intel_82574l_version, self.constants.intel_82574l_path)
|
||||||
elif isinstance(controller, device_probe.NVIDIAEthernet):
|
elif isinstance(controller, device_probe.NVIDIAEthernet):
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
|
||||||
elif isinstance(controller, device_probe.Marvell) or isinstance(controller, device_probe.SysKonnect):
|
elif isinstance(controller, device_probe.Marvell) or isinstance(controller, device_probe.SysKonnect):
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
|
||||||
|
|
||||||
|
|
||||||
def prebuilt_assumption(self):
|
def _prebuilt_assumption(self) -> None:
|
||||||
# Stock hardware assumptions
|
"""
|
||||||
|
Fall back to pre-built assumptions
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "Ethernet Chipset" in smbios_data.smbios_dictionary[self.model]:
|
if not "Ethernet Chipset" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -61,12 +74,12 @@ class build_wired:
|
|||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
||||||
# Required due to Big Sur's BCM5701 requiring VT-D support
|
# Required due to Big Sur's BCM5701 requiring VT-D support
|
||||||
# Applicable for pre-Ivy Bridge models
|
# Applicable for pre-Ivy Bridge models
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia":
|
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia":
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell":
|
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell":
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Intel 80003ES2LAN":
|
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Intel 80003ES2LAN":
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntel8254XEthernet.kext", self.constants.intel_8254x_version, self.constants.intel_8254x_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleIntel8254XEthernet.kext", self.constants.intel_8254x_version, self.constants.intel_8254x_path)
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Intel 82574L":
|
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Intel 82574L":
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Intel82574L.kext", self.constants.intel_82574l_version, self.constants.intel_82574l_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Intel82574L.kext", self.constants.intel_82574l_version, self.constants.intel_82574l_path)
|
||||||
@@ -1,38 +1,48 @@
|
|||||||
# Class for handling Wireless Networking Patches, invocation from build.py
|
# Class for handling Wireless Networking Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from resources import constants, device_probe, utilities
|
from resources import constants, device_probe, utilities
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import smbios_data
|
from data import smbios_data
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class build_wireless:
|
class BuildWirelessNetworking:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
self.computer = self.constants.computer
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
# WiFi patches
|
"""
|
||||||
|
Kick off Wireless Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.constants.custom_model and self.constants.computer.wifi:
|
if not self.constants.custom_model and self.constants.computer.wifi:
|
||||||
self.on_model()
|
self._on_model()
|
||||||
else:
|
else:
|
||||||
self.prebuilt_assumption()
|
self._prebuilt_assumption()
|
||||||
self.wowl_handling()
|
self._wowl_handling()
|
||||||
|
|
||||||
|
|
||||||
def on_model(self):
|
def _on_model(self) -> None:
|
||||||
|
"""
|
||||||
|
On-Model Hardware Detection Handling
|
||||||
|
"""
|
||||||
|
|
||||||
logging.info(f"- Found Wireless Device {utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}")
|
logging.info(f"- Found Wireless Device {utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}")
|
||||||
self.config["#Revision"]["Hardware-Wifi"] = f"{utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}"
|
self.config["#Revision"]["Hardware-Wifi"] = f"{utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}"
|
||||||
|
|
||||||
if isinstance(self.computer.wifi, device_probe.Broadcom):
|
if isinstance(self.computer.wifi, device_probe.Broadcom):
|
||||||
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
|
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
|
||||||
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
|
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||||
logging.info(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
logging.info(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
||||||
if self.computer.wifi.pci_path:
|
if self.computer.wifi.pci_path:
|
||||||
arpt_path = self.computer.wifi.pci_path
|
arpt_path = self.computer.wifi.pci_path
|
||||||
@@ -44,65 +54,69 @@ class build_wireless:
|
|||||||
logging.info("- Enabling Wake on WLAN support")
|
logging.info("- Enabling Wake on WLAN support")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
||||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||||
self.wifi_fake_id()
|
self._wifi_fake_id()
|
||||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
|
||||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
|
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
|
||||||
elif isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40:
|
elif isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
||||||
|
|
||||||
|
|
||||||
def prebuilt_assumption(self):
|
def _prebuilt_assumption(self) -> None:
|
||||||
|
"""
|
||||||
|
Fall back to pre-built assumptions
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "Wireless Model" in smbios_data.smbios_dictionary[self.model]:
|
if not "Wireless Model" in smbios_data.smbios_dictionary[self.model]:
|
||||||
return
|
return
|
||||||
if smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
if smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||||
logging.info("- Enabling BCM943224 and BCM94331 Networking Support")
|
logging.info("- Enabling BCM943224 and BCM94331 Networking Support")
|
||||||
self.wifi_fake_id()
|
self._wifi_fake_id()
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
||||||
logging.info("- Enabling BCM94328 Networking Support")
|
logging.info("- Enabling BCM94328 Networking Support")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
|
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
|
||||||
logging.info("- Enabling BCM94328 Networking Support")
|
logging.info("- Enabling BCM94328 Networking Support")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Atheros.Chipsets.AirPortAtheros40:
|
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Atheros.Chipsets.AirPortAtheros40:
|
||||||
logging.info("- Enabling Atheros Networking Support")
|
logging.info("- Enabling Atheros Networking Support")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
||||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirportBrcmNIC:
|
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirportBrcmNIC:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||||
|
|
||||||
|
|
||||||
def wowl_handling(self):
|
def _wowl_handling(self) -> None:
|
||||||
# To avoid reduced networking performance from wake, AirPortBrcmFixup is used to disable wake on WLAN by default.
|
# To avoid reduced networking performance from wake, AirPortBrcmFixup is used to disable wake on WLAN by default.
|
||||||
# However some users may want to enable wake on WLAN, so enable if requested.
|
# However some users may want to enable wake on WLAN, so enable if requested.
|
||||||
if self.constants.enable_wake_on_wlan is False:
|
if self.constants.enable_wake_on_wlan is False:
|
||||||
return
|
return
|
||||||
if support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext")["Enabled"] is False:
|
if support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext")["Enabled"] is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
logging.info("- Enabling Wake on WLAN support")
|
logging.info("- Enabling Wake on WLAN support")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
||||||
|
|
||||||
|
|
||||||
def wifi_fake_id(self):
|
def _wifi_fake_id(self) -> None:
|
||||||
# BCM94331 and BCM943224 are both partially supported within Big Sur's native AirPortBrcmNIC stack
|
# BCM94331 and BCM943224 are both partially supported within Big Sur's native AirPortBrcmNIC stack
|
||||||
# Simply adding the Device IDs and usage of AirPortBrcmFixup will restore full functionality
|
# Simply adding the Device IDs and usage of AirPortBrcmFixup will restore full functionality
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext/Contents/PlugIns/AirPortBrcmNIC_Injector.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext/Contents/PlugIns/AirPortBrcmNIC_Injector.kext")["Enabled"] = True
|
||||||
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.pci_path:
|
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.pci_path:
|
||||||
arpt_path = self.computer.wifi.pci_path
|
arpt_path = self.computer.wifi.pci_path
|
||||||
logging.info(f"- Found ARPT device at {arpt_path}")
|
logging.info(f"- Found ARPT device at {arpt_path}")
|
||||||
|
|||||||
@@ -1,23 +1,29 @@
|
|||||||
# Class for handling macOS Security Patches, invocation from build.py
|
# Class for handling macOS Security Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
from resources import constants, utilities
|
import logging
|
||||||
|
import binascii
|
||||||
|
|
||||||
|
from resources import constants, utilities, device_probe
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
|
|
||||||
import binascii
|
|
||||||
import logging
|
class BuildSecurity:
|
||||||
|
|
||||||
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
|
self.model: str = model
|
||||||
|
self.config: dict = config
|
||||||
|
self.constants: constants.Constants = global_constants
|
||||||
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
class build_security:
|
def _build(self) -> None:
|
||||||
|
"""
|
||||||
|
Kick off Security Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
|
||||||
self.model = model
|
|
||||||
self.constants: constants.Constants = versions
|
|
||||||
self.config = config
|
|
||||||
self.computer = self.constants.computer
|
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
if self.constants.sip_status is False or self.constants.custom_sip_value:
|
if self.constants.sip_status is False or self.constants.custom_sip_value:
|
||||||
# Work-around 12.3 bug where Electron apps no longer launch with SIP lowered
|
# Work-around 12.3 bug where Electron apps no longer launch with SIP lowered
|
||||||
# Unknown whether this is intended behavior or not, revisit with 12.4
|
# Unknown whether this is intended behavior or not, revisit with 12.4
|
||||||
@@ -26,7 +32,7 @@ class build_security:
|
|||||||
# Adds AutoPkgInstaller for Automatic OpenCore-Patcher installation
|
# Adds AutoPkgInstaller for Automatic OpenCore-Patcher installation
|
||||||
# Only install if running the GUI (AutoPkg-Assets.pkg requires the GUI)
|
# Only install if running the GUI (AutoPkg-Assets.pkg requires the GUI)
|
||||||
if self.constants.wxpython_variant is True:
|
if self.constants.wxpython_variant is True:
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AutoPkgInstaller.kext", self.constants.autopkg_version, self.constants.autopkg_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AutoPkgInstaller.kext", self.constants.autopkg_version, self.constants.autopkg_path)
|
||||||
if self.constants.custom_sip_value:
|
if self.constants.custom_sip_value:
|
||||||
logging.info(f"- Setting SIP value to: {self.constants.custom_sip_value}")
|
logging.info(f"- Setting SIP value to: {self.constants.custom_sip_value}")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = utilities.string_to_hex(self.constants.custom_sip_value.lstrip("0x"))
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = utilities.string_to_hex(self.constants.custom_sip_value.lstrip("0x"))
|
||||||
@@ -38,7 +44,7 @@ class build_security:
|
|||||||
# This is however hidden behind kern.development, thus we patch _apfs_filevault_allowed to always return true
|
# This is however hidden behind kern.development, thus we patch _apfs_filevault_allowed to always return true
|
||||||
# Note this function was added in 11.3 (20E232, 20.4), older builds do not support this (ie. 11.2.3)
|
# Note this function was added in 11.3 (20E232, 20.4), older builds do not support this (ie. 11.2.3)
|
||||||
logging.info("- Allowing FileVault on Root Patched systems")
|
logging.info("- Allowing FileVault on Root Patched systems")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Force FileVault on Broken Seal")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Force FileVault on Broken Seal")["Enabled"] = True
|
||||||
# Lets us check in sys_patch.py if config supports FileVault
|
# Lets us check in sys_patch.py if config supports FileVault
|
||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
|
||||||
|
|
||||||
@@ -46,7 +52,7 @@ class build_security:
|
|||||||
# - Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1019
|
# - Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1019
|
||||||
logging.info("- Enabling KC UUID mismatch patch")
|
logging.info("- Enabling KC UUID mismatch patch")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -nokcmismatchpanic"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -nokcmismatchpanic"
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("RSRHelper.kext", self.constants.rsrhelper_version, self.constants.rsrhelper_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RSRHelper.kext", self.constants.rsrhelper_version, self.constants.rsrhelper_path)
|
||||||
|
|
||||||
if self.constants.disable_cs_lv is True:
|
if self.constants.disable_cs_lv is True:
|
||||||
# In Ventura, LV patch broke. For now, add AMFI arg
|
# In Ventura, LV patch broke. For now, add AMFI arg
|
||||||
@@ -56,18 +62,18 @@ class build_security:
|
|||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
|
||||||
else:
|
else:
|
||||||
logging.info("- Disabling Library Validation")
|
logging.info("- Disabling Library Validation")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable Library Validation Enforcement")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable Library Validation Enforcement")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable _csr_check() in _vnode_check_signature")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable _csr_check() in _vnode_check_signature")["Enabled"] = True
|
||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_amfi"
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_amfi"
|
||||||
# CSLVFixup simply patches out __RESTRICT and __restrict out of the Music.app Binary
|
# CSLVFixup simply patches out __RESTRICT and __restrict out of the Music.app Binary
|
||||||
# Ref: https://pewpewthespells.com/blog/blocking_code_injection_on_ios_and_os_x.html
|
# Ref: https://pewpewthespells.com/blog/blocking_code_injection_on_ios_and_os_x.html
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("CSLVFixup.kext", self.constants.cslvfixup_version, self.constants.cslvfixup_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("CSLVFixup.kext", self.constants.cslvfixup_version, self.constants.cslvfixup_path)
|
||||||
|
|
||||||
if self.constants.secure_status is False:
|
if self.constants.secure_status is False:
|
||||||
logging.info("- Disabling SecureBootModel")
|
logging.info("- Disabling SecureBootModel")
|
||||||
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
|
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
|
||||||
if self.constants.force_vmm is True:
|
if self.constants.force_vmm is True:
|
||||||
logging.info("- Forcing VMM patchset to support OTA updates")
|
logging.info("- Forcing VMM patchset to support OTA updates")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
||||||
|
|||||||
@@ -1,48 +1,62 @@
|
|||||||
# Class for handling SMBIOS Patches, invocation from build.py
|
# Class for handling SMBIOS Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
|
import ast
|
||||||
|
import uuid
|
||||||
|
import logging
|
||||||
|
import binascii
|
||||||
|
import plistlib
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from resources import constants, utilities, generate_smbios
|
from resources import constants, utilities, generate_smbios
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import smbios_data, cpu_data, model_array
|
from data import smbios_data, cpu_data, model_array
|
||||||
|
|
||||||
import subprocess, plistlib, binascii, uuid, ast, logging
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
class build_smbios:
|
class BuildSMBIOS:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
|
def _build(self) -> None:
|
||||||
|
"""
|
||||||
|
Kick off SMBIOS Build Process
|
||||||
|
"""
|
||||||
|
|
||||||
def build(self):
|
|
||||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
||||||
if self.constants.serial_settings == "None":
|
if self.constants.serial_settings == "None":
|
||||||
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
|
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
|
||||||
logging.info("- Enabling Board ID exemption patch")
|
logging.info("- Enabling Board ID exemption patch")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
|
||||||
|
|
||||||
logging.info("- Enabling VMM exemption patch")
|
logging.info("- Enabling VMM exemption patch")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
||||||
else:
|
else:
|
||||||
logging.info("- Enabling SMC exemption patch")
|
logging.info("- Enabling SMC exemption patch")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path)
|
||||||
|
|
||||||
if self.constants.serial_settings in ["Moderate", "Advanced"]:
|
if self.constants.serial_settings in ["Moderate", "Advanced"]:
|
||||||
logging.info("- Enabling USB Rename Patches")
|
logging.info("- Enabling USB Rename Patches")
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "XHC1 to SHC1")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "XHC1 to SHC1")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC1 to EH01")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC1 to EH01")["Enabled"] = True
|
||||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC2 to EH02")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC2 to EH02")["Enabled"] = True
|
||||||
|
|
||||||
if self.model == self.constants.override_smbios:
|
if self.model == self.constants.override_smbios:
|
||||||
logging.info("- Adding -no_compat_check")
|
logging.info("- Adding -no_compat_check")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
||||||
|
|
||||||
|
|
||||||
def set_smbios(self):
|
def _set_smbios(self) -> None:
|
||||||
spoofed_model = self.model
|
spoofed_model = self.model
|
||||||
|
|
||||||
if self.constants.override_smbios == "Default":
|
if self.constants.override_smbios == "Default":
|
||||||
@@ -70,14 +84,14 @@ class build_smbios:
|
|||||||
|
|
||||||
if self.constants.serial_settings == "Moderate":
|
if self.constants.serial_settings == "Moderate":
|
||||||
logging.info("- Using Moderate SMBIOS patching")
|
logging.info("- Using Moderate SMBIOS patching")
|
||||||
self.moderate_serial_patch()
|
self._moderate_serial_patch()
|
||||||
elif self.constants.serial_settings == "Advanced":
|
elif self.constants.serial_settings == "Advanced":
|
||||||
logging.info("- Using Advanced SMBIOS patching")
|
logging.info("- Using Advanced SMBIOS patching")
|
||||||
self.advanced_serial_patch()
|
self._advanced_serial_patch()
|
||||||
elif self.constants.serial_settings == "Minimal":
|
elif self.constants.serial_settings == "Minimal":
|
||||||
logging.info("- Using Minimal SMBIOS patching")
|
logging.info("- Using Minimal SMBIOS patching")
|
||||||
self.spoofed_model = self.model
|
self.spoofed_model = self.model
|
||||||
self.minimal_serial_patch()
|
self._minimal_serial_patch()
|
||||||
else:
|
else:
|
||||||
# Update DataHub to resolve Lilu Race Condition
|
# Update DataHub to resolve Lilu Race Condition
|
||||||
# macOS Monterey will sometimes not present the boardIdentifier in the DeviceTree on UEFI 1.2 or older Mac,
|
# macOS Monterey will sometimes not present the boardIdentifier in the DeviceTree on UEFI 1.2 or older Mac,
|
||||||
@@ -178,7 +192,7 @@ class build_smbios:
|
|||||||
plistlib.dump(agdp_config, Path(new_agdp_ls).open("wb"), sort_keys=True)
|
plistlib.dump(agdp_config, Path(new_agdp_ls).open("wb"), sort_keys=True)
|
||||||
|
|
||||||
|
|
||||||
def minimal_serial_patch(self):
|
def _minimal_serial_patch(self) -> None:
|
||||||
# Generate Firmware Features
|
# Generate Firmware Features
|
||||||
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
|
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
|
||||||
# fw_feature = self.patch_firmware_feature()
|
# fw_feature = self.patch_firmware_feature()
|
||||||
@@ -233,7 +247,7 @@ class build_smbios:
|
|||||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-MLB"] = mlb
|
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-MLB"] = mlb
|
||||||
|
|
||||||
|
|
||||||
def moderate_serial_patch(self):
|
def _moderate_serial_patch(self) -> None:
|
||||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||||
@@ -251,7 +265,7 @@ class build_smbios:
|
|||||||
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model
|
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model
|
||||||
|
|
||||||
|
|
||||||
def advanced_serial_patch(self):
|
def _advanced_serial_patch(self) -> None:
|
||||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||||
if self.constants.custom_serial_number == "" or self.constants.custom_board_serial_number == "":
|
if self.constants.custom_serial_number == "" or self.constants.custom_board_serial_number == "":
|
||||||
|
|||||||
@@ -1,29 +1,37 @@
|
|||||||
# Class for handling Storage Controller Patches, invocation from build.py
|
# Class for handling Storage Controller Patches, invocation from build.py
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from resources import constants, device_probe, utilities
|
from resources import constants, device_probe, utilities
|
||||||
from resources.build import support
|
from resources.build import support
|
||||||
from data import model_array, smbios_data, cpu_data
|
from data import model_array, smbios_data, cpu_data
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class build_storage:
|
class BuildStorage:
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
self.model = model
|
self.model: str = model
|
||||||
self.constants: constants.Constants = versions
|
self.config: dict = config
|
||||||
self.config = config
|
self.constants: constants.Constants = global_constants
|
||||||
self.computer = self.constants.computer
|
self.computer: device_probe.Computer = self.constants.computer
|
||||||
|
|
||||||
|
self._build()
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def _build(self) -> None:
|
||||||
self.ahci_handling()
|
"""
|
||||||
self.pata_handling()
|
Kick off Storage Build Process
|
||||||
self.misc_handling()
|
"""
|
||||||
self.pcie_handling()
|
|
||||||
self.trim_handling()
|
|
||||||
|
|
||||||
def ahci_handling(self):
|
self._ahci_handling()
|
||||||
|
self._pata_handling()
|
||||||
|
self._misc_handling()
|
||||||
|
self._pcie_handling()
|
||||||
|
self._trim_handling()
|
||||||
|
|
||||||
|
|
||||||
|
def _ahci_handling(self) -> None:
|
||||||
# MacBookAir6,x ship with an AHCI over PCIe SSD model 'APPLE SSD TS0128F' and 'APPLE SSD TS0256F'
|
# MacBookAir6,x ship with an AHCI over PCIe SSD model 'APPLE SSD TS0128F' and 'APPLE SSD TS0256F'
|
||||||
# This controller is not supported properly in macOS Ventura, instead populating itself as 'Media' with no partitions
|
# This controller is not supported properly in macOS Ventura, instead populating itself as 'Media' with no partitions
|
||||||
# To work-around this, use Monterey's AppleAHCI driver to force support
|
# To work-around this, use Monterey's AppleAHCI driver to force support
|
||||||
@@ -33,11 +41,11 @@ class build_storage:
|
|||||||
# https://linux-hardware.org/?id=pci:1179-010b-1b4b-9183
|
# https://linux-hardware.org/?id=pci:1179-010b-1b4b-9183
|
||||||
if controller.vendor_id == 0x1179 and controller.device_id == 0x010b:
|
if controller.vendor_id == 0x1179 and controller.device_id == 0x010b:
|
||||||
logging.info("- Enabling AHCI SSD patch")
|
logging.info("- Enabling AHCI SSD patch")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
||||||
break
|
break
|
||||||
elif self.model in ["MacBookAir6,1", "MacBookAir6,2"]:
|
elif self.model in ["MacBookAir6,1", "MacBookAir6,2"]:
|
||||||
logging.info("- Enabling AHCI SSD patch")
|
logging.info("- Enabling AHCI SSD patch")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
||||||
|
|
||||||
# ThirdPartyDrives Check
|
# ThirdPartyDrives Check
|
||||||
if self.constants.allow_3rd_party_drives is True:
|
if self.constants.allow_3rd_party_drives is True:
|
||||||
@@ -58,7 +66,7 @@ class build_storage:
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def pata_handling(self):
|
def _pata_handling(self) -> None:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "Stock Storage" in smbios_data.smbios_dictionary[self.model]:
|
if not "Stock Storage" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -66,10 +74,10 @@ class build_storage:
|
|||||||
if not "PATA" in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
|
if not "PATA" in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path)
|
||||||
|
|
||||||
|
|
||||||
def pcie_handling(self):
|
def _pcie_handling(self) -> None:
|
||||||
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in model_array.MacPro):
|
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in model_array.MacPro):
|
||||||
# Use Innie's same logic:
|
# Use Innie's same logic:
|
||||||
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
|
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
|
||||||
@@ -79,7 +87,7 @@ class build_storage:
|
|||||||
self.config["DeviceProperties"]["Add"][controller.pci_path] = {"built-in": 1}
|
self.config["DeviceProperties"]["Add"][controller.pci_path] = {"built-in": 1}
|
||||||
else:
|
else:
|
||||||
logging.info(f"- Failed to find Device path for PCIe Storage Controller {i}, falling back to Innie")
|
logging.info(f"- Failed to find Device path for PCIe Storage Controller {i}, falling back to Innie")
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path)
|
||||||
|
|
||||||
if not self.constants.custom_model and self.constants.allow_nvme_fixing is True:
|
if not self.constants.custom_model and self.constants.allow_nvme_fixing is True:
|
||||||
nvme_devices = [i for i in self.computer.storage if isinstance(i, device_probe.NVMeController)]
|
nvme_devices = [i for i in self.computer.storage if isinstance(i, device_probe.NVMeController)]
|
||||||
@@ -102,7 +110,7 @@ class build_storage:
|
|||||||
if (controller.vendor_id != 0x144D and controller.device_id != 0xA804):
|
if (controller.vendor_id != 0x144D and controller.device_id != 0xA804):
|
||||||
# Avoid injecting NVMeFix when a native Apple NVMe drive is present
|
# Avoid injecting NVMeFix when a native Apple NVMe drive is present
|
||||||
# https://github.com/acidanthera/NVMeFix/blob/1.0.9/NVMeFix/NVMeFix.cpp#L220-L225
|
# https://github.com/acidanthera/NVMeFix/blob/1.0.9/NVMeFix/NVMeFix.cpp#L220-L225
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path)
|
||||||
|
|
||||||
# Apple RAID Card check
|
# Apple RAID Card check
|
||||||
if not self.constants.custom_model:
|
if not self.constants.custom_model:
|
||||||
@@ -110,15 +118,15 @@ class build_storage:
|
|||||||
for storage_controller in self.computer.storage:
|
for storage_controller in self.computer.storage:
|
||||||
if storage_controller.vendor_id == 0x106b and storage_controller.device_id == 0x008A:
|
if storage_controller.vendor_id == 0x106b and storage_controller.device_id == 0x008A:
|
||||||
# AppleRAIDCard.kext only supports pci106b,8a
|
# AppleRAIDCard.kext only supports pci106b,8a
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
|
||||||
break
|
break
|
||||||
elif self.model.startswith("Xserve"):
|
elif self.model.startswith("Xserve"):
|
||||||
# For Xserves, assume RAID is present
|
# For Xserves, assume RAID is present
|
||||||
# Namely due to Xserve2,1 being limited to 10.7, thus no hardware detection
|
# Namely due to Xserve2,1 being limited to 10.7, thus no hardware detection
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
|
||||||
|
|
||||||
|
|
||||||
def misc_handling(self):
|
def _misc_handling(self) -> None:
|
||||||
if not self.model in smbios_data.smbios_dictionary:
|
if not self.model in smbios_data.smbios_dictionary:
|
||||||
return
|
return
|
||||||
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
if not "CPU Generation" in smbios_data.smbios_dictionary[self.model]:
|
||||||
@@ -128,10 +136,10 @@ class build_storage:
|
|||||||
# However pre-Ivy Bridge don't support this feature
|
# However pre-Ivy Bridge don't support this feature
|
||||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:
|
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:
|
||||||
if (self.constants.computer.sdxc_controller and not self.constants.custom_model) or (self.model.startswith("MacBookPro8") or self.model.startswith("Macmini5")):
|
if (self.constants.computer.sdxc_controller and not self.constants.custom_model) or (self.model.startswith("MacBookPro8") or self.model.startswith("Macmini5")):
|
||||||
support.build_support(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path)
|
support.BuildSupport(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path)
|
||||||
|
|
||||||
|
|
||||||
def trim_handling(self):
|
def _trim_handling(self) -> None:
|
||||||
if self.constants.apfs_trim_timeout is False:
|
if self.constants.apfs_trim_timeout is False:
|
||||||
logging.info(f"- Disabling APFS TRIM timeout")
|
logging.info(f"- Disabling APFS TRIM timeout")
|
||||||
self.config["Kernel"]["Quirks"]["SetApfsTrimTimeout"] = 0
|
self.config["Kernel"]["Quirks"]["SetApfsTrimTimeout"] = 0
|
||||||
@@ -1,18 +1,23 @@
|
|||||||
# Utility class for build functions
|
# Utility class for build functions
|
||||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||||
|
|
||||||
from resources import constants, utilities
|
import shutil
|
||||||
|
import logging
|
||||||
|
import plistlib
|
||||||
|
import zipfile
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import shutil, plistlib, subprocess, zipfile
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class build_support:
|
from resources import constants, utilities
|
||||||
|
|
||||||
def __init__(self, model, versions, config):
|
|
||||||
self.model = model
|
class BuildSupport:
|
||||||
self.constants: constants.Constants = versions
|
|
||||||
self.config = config
|
def __init__(self, model: str, global_constants: constants.Constants, config: dict) -> None:
|
||||||
|
self.model: str = model
|
||||||
|
self.config: dict = config
|
||||||
|
self.constants: constants.Constants = global_constants
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ class wx_python_gui:
|
|||||||
while self.is_unpack_finished() is False:
|
while self.is_unpack_finished() is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
build.build_opencore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
|
build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants)
|
||||||
# Once finished, change build_opencore button to "Install OpenCore"
|
# Once finished, change build_opencore button to "Install OpenCore"
|
||||||
self.build_opencore.SetLabel("🔩 Install OpenCore")
|
self.build_opencore.SetLabel("🔩 Install OpenCore")
|
||||||
self.build_opencore.Bind(wx.EVT_BUTTON, self.install_menu)
|
self.build_opencore.Bind(wx.EVT_BUTTON, self.install_menu)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class PatcherValidation:
|
|||||||
for model in model_array.SupportedSMBIOS:
|
for model in model_array.SupportedSMBIOS:
|
||||||
logging.info(f"Validating predefined model: {model}")
|
logging.info(f"Validating predefined model: {model}")
|
||||||
self.constants.custom_model = model
|
self.constants.custom_model = model
|
||||||
build.build_opencore(self.constants.custom_model, self.constants).build_opencore()
|
build.BuildOpenCore(self.constants.custom_model, self.constants)
|
||||||
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
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:
|
if result.returncode != 0:
|
||||||
logging.info("Error on build!")
|
logging.info("Error on build!")
|
||||||
@@ -83,7 +83,7 @@ class PatcherValidation:
|
|||||||
self.constants.computer = model
|
self.constants.computer = model
|
||||||
self.constants.custom_model = ""
|
self.constants.custom_model = ""
|
||||||
logging.info(f"Validating dumped model: {self.constants.computer.real_model}")
|
logging.info(f"Validating dumped model: {self.constants.computer.real_model}")
|
||||||
build.build_opencore(self.constants.computer.real_model, self.constants).build_opencore()
|
build.BuildOpenCore(self.constants.computer.real_model, self.constants)
|
||||||
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
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:
|
if result.returncode != 0:
|
||||||
logging.info("Error on build!")
|
logging.info("Error on build!")
|
||||||
|
|||||||
Reference in New Issue
Block a user