Add force load option for kexts on unsupported macOS versions

This commit is contained in:
Hoang Hong Quan
2024-10-14 03:06:37 +07:00
parent 9fe99058fd
commit 4b47757440
3 changed files with 76 additions and 19 deletions

View File

@@ -410,8 +410,10 @@ class ConfigProdigy:
boot_args.append("-vi2c-force-polling")
break
if "Beta" in os_data.get_macos_name_by_darwin(macos_version):
boot_args.append("-lilubetaall")
for kext in kexts:
if kext.checked and "Lilu" in kext.requires_kexts and not self.utils.parse_darwin_version(kext.min_darwin_version) <= self.utils.parse_darwin_version(macos_version) <= self.utils.parse_darwin_version(kext.max_darwin_version):
boot_args.append("-lilubetaall")
break
if list(hardware_report.get("GPU").items())[0][-1].get("Device ID") in pci_data.SpoofGPUIDs:
boot_args.append("-radcodec")

View File

@@ -30,6 +30,7 @@ kexts = [
description = "Advanced Apple SMC emulator in the kernel",
category = "Required",
required = True,
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "VirtualSMC"
@@ -39,32 +40,32 @@ kexts = [
name = "SMCBatteryManager",
description = "Manages, monitors, and reports on battery status",
category = "VirtualSMC Plugins",
requires_kexts = ["VirtualSMC"]
requires_kexts = ["Lilu", "VirtualSMC"]
),
KextInfo(
name = "SMCDellSensors",
description = "Enables fan monitoring and control on Dell computers",
category = "VirtualSMC Plugins",
requires_kexts = ["VirtualSMC"]
requires_kexts = ["Lilu", "VirtualSMC"]
),
KextInfo(
name = "SMCLightSensor",
description = "Allows system utilize ambient light sensor device",
category = "VirtualSMC Plugins",
requires_kexts = ["VirtualSMC"]
requires_kexts = ["Lilu", "VirtualSMC"]
),
KextInfo(
name = "SMCProcessor",
description = "Manages Intel CPU temperature sensors",
category = "VirtualSMC Plugins",
requires_kexts = ["VirtualSMC"]
requires_kexts = ["Lilu", "VirtualSMC"]
),
KextInfo(
name = "SMCRadeonSensors",
description = "Provides temperature readings for AMD GPUs",
category = "VirtualSMC Plugins",
min_darwin_version = "18.0.0",
requires_kexts = ["VirtualSMC"],
requires_kexts = ["Lilu", "VirtualSMC"],
github_repo = {
"owner": "ChefKissInc",
"repo": "SMCRadeonSensors"
@@ -74,13 +75,14 @@ kexts = [
name = "SMCSuperIO",
description = "Monitoring hardware sensors and controlling fan speeds",
category = "VirtualSMC Plugins",
requires_kexts = ["VirtualSMC"]
requires_kexts = ["Lilu", "VirtualSMC"]
),
KextInfo(
name = "NootRX",
description = "The rDNA 2 dGPU support patch kext",
category = "Graphics",
min_darwin_version = "20.5.0",
requires_kexts = ["Lilu"],
conflict_group_id = "GPU",
github_repo = {
"owner": "ChefKissInc",
@@ -92,6 +94,7 @@ kexts = [
description = "The AMD Vega iGPU support kext",
category = "Graphics",
min_darwin_version = "19.0.0",
requires_kexts = ["Lilu"],
conflict_group_id = "GPU",
github_repo = {
"owner": "ChefKissInc",
@@ -102,6 +105,7 @@ kexts = [
name = "WhateverGreen",
description = "Various patches necessary for GPUs are pre-supported",
category = "Graphics",
requires_kexts = ["Lilu"],
conflict_group_id = "GPU",
github_repo = {
"owner": "acidanthera",
@@ -112,6 +116,7 @@ kexts = [
name = "AppleALC",
description = "Native macOS HD audio for not officially supported codecs",
category = "Audio",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "AppleALC"
@@ -125,6 +130,7 @@ kexts = [
name = "AirportBrcmFixup",
description = "Patches required for non-native Broadcom Wi-Fi cards",
category = "Wi-Fi",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "AirportBrcmFixup"
@@ -178,6 +184,7 @@ kexts = [
description = "Patches Bluetooth stack to support third-party cards",
category = "Bluetooth",
min_darwin_version = "21.0.0",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "BrcmPatchRAM"
@@ -240,7 +247,7 @@ kexts = [
name = "IntelBTPatcher",
description = "Fixes Intel Bluetooth bugs for better connectivity",
category = "Bluetooth",
requires_kexts = ["BlueToolFixup", "IntelBluetoothFirmware", "IntelBluetoothInjector"]
requires_kexts = ["Lilu", "BlueToolFixup", "IntelBluetoothFirmware", "IntelBluetoothInjector"]
),
KextInfo(
name = "IntelBluetoothInjector",
@@ -460,6 +467,7 @@ kexts = [
description = "Supports ALS, keyboard backlight, and Fn keys on ASUS laptops",
category = "Brand Specific",
max_darwin_version = "23.99.99",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "hieplpvip",
"repo": "AsusSMC"
@@ -469,6 +477,7 @@ kexts = [
name = "BigSurface",
description = "A fully intergrated kext for all Surface related hardwares",
category = "Brand Specific",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "Xiashangning",
"repo": "BigSurface"
@@ -489,6 +498,7 @@ kexts = [
category = "Storage",
max_darwin_version = "23.99.99",
min_darwin_version = "18.0.0",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "NVMeFix"
@@ -513,7 +523,7 @@ kexts = [
category = "Card Reader",
min_darwin_version = "18.0.0",
max_darwin_version = "22.99.99",
requires_kexts = ["RealtekCardReader"],
requires_kexts = ["Lilu", "RealtekCardReader"],
github_repo = {
"owner": "0xFireWolf",
"repo": "RealtekCardReaderFriend"
@@ -533,7 +543,8 @@ kexts = [
name = "AMFIPass",
description = "A replacement for amfi=0x80 boot argument",
category = "Extras",
min_darwin_version = "20.0.0",
min_darwin_version = "20.0.0",
requires_kexts = ["Lilu"],
download_info = {
"id": 926491527,
"url": "https://github.com/dortania/OpenCore-Legacy-Patcher/raw/main/payloads/Kexts/Acidanthera/AMFIPass-v1.4.1-RELEASE.zip"
@@ -552,6 +563,7 @@ kexts = [
name = "BrightnessKeys",
description = "Handler for brightness keys without DSDT patches",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "BrightnessKeys"
@@ -561,6 +573,7 @@ kexts = [
name = "CpuTopologyRebuild",
description = "Optimizes the core configuration of Intel Alder Lake CPUs+",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "b00t0x",
"repo": "CpuTopologyRebuild"
@@ -571,6 +584,7 @@ kexts = [
description = "Various patches to install Rosetta cryptex",
category = "Extras",
min_darwin_version = "22.0.0",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "CryptexFixup"
@@ -580,6 +594,7 @@ kexts = [
name = "ECEnabler",
description = "Allows reading Embedded Controller fields over 1 byte long",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "1Revenger1",
"repo": "ECEnabler"
@@ -589,6 +604,7 @@ kexts = [
name = "FeatureUnlock",
description = "Enable additional features on unsupported hardware",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "FeatureUnlock"
@@ -598,6 +614,7 @@ kexts = [
name = "ForgedInvariant",
description = "The plug & play kext for syncing the TSC on AMD & Intel",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "ChefKissInc",
"repo": "ForgedInvariant"
@@ -607,6 +624,7 @@ kexts = [
name = "HibernationFixup",
description = "Fixes hibernation compatibility issues",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "HibernationFixup"
@@ -616,6 +634,7 @@ kexts = [
name = "RestrictEvents",
description = "Blocking unwanted processes and unlocking features",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "RestrictEvents"
@@ -625,6 +644,7 @@ kexts = [
name = "RTCMemoryFixup",
description = "Emulate some offsets in your CMOS (RTC) memory",
category = "Extras",
requires_kexts = ["Lilu"],
github_repo = {
"owner": "acidanthera",
"repo": "RTCMemoryFixup"

View File

@@ -1,6 +1,7 @@
from Scripts.datasets import cpu_data
from Scripts.datasets import kext_data
from Scripts.datasets import os_data
from Scripts.datasets import pci_data
from Scripts import codec_layouts
from Scripts import utils
@@ -78,10 +79,10 @@ class KextMaestro:
return index
return None
def check_kext(self, index, target_darwin_version):
def check_kext(self, index, target_darwin_version, allow_unsupported_kexts=False):
kext = self.kexts[index]
if kext.checked or not self.utils.parse_darwin_version(kext.min_darwin_version) <= self.utils.parse_darwin_version(target_darwin_version) <= self.utils.parse_darwin_version(kext.max_darwin_version):
if kext.checked or not (allow_unsupported_kexts or self.utils.parse_darwin_version(kext.min_darwin_version) <= self.utils.parse_darwin_version(target_darwin_version) <= self.utils.parse_darwin_version(kext.max_darwin_version)):
return
kext.checked = True
@@ -89,7 +90,7 @@ class KextMaestro:
for requires_kext_name in kext.requires_kexts:
requires_kext_index = self.get_kext_index(requires_kext_name)
if requires_kext_index:
self.check_kext(requires_kext_index, target_darwin_version)
self.check_kext(requires_kext_index, target_darwin_version, allow_unsupported_kexts)
if kext.conflict_group_id:
for other_kext in self.kexts:
@@ -241,7 +242,7 @@ class KextMaestro:
selected_kexts.append("XHCI-unsupported")
for name in selected_kexts:
self.check_kext(self.get_kext_index(name), macos_version)
self.check_kext(self.get_kext_index(name), macos_version, "Beta" in os_data.get_macos_name_by_darwin(macos_version))
def install_kexts_to_efi(self, macos_version, kexts_directory):
for kext in self.kexts:
@@ -376,6 +377,38 @@ class KextMaestro:
if other_kext.name in kext.requires_kexts and not other_kext.required:
other_kext.checked = False
def verify_kext_compatibility(self, selected_kexts, target_darwin_version):
incompatible_kexts = [
(self.kexts[index].name, "Lilu" in self.kexts[index].requires_kexts)
for index in selected_kexts
if not self.utils.parse_darwin_version(self.kexts[index].min_darwin_version)
<= self.utils.parse_darwin_version(target_darwin_version)
<= self.utils.parse_darwin_version(self.kexts[index].max_darwin_version)
]
if not incompatible_kexts:
return False
while True:
self.utils.head("Kext Compatibility Check")
print("\nIncompatible kexts for the current macOS version ({}):\n".format(target_darwin_version))
for index, (kext_name, is_lilu_dependent) in enumerate(incompatible_kexts, start=1):
print("{:2}. {:25}{}".format(index, kext_name, " - Lilu Plugin" if is_lilu_dependent else ""))
print("\n\033[1;36m")
print("Note:")
print("- With Lilu plugins, using the \"-lilubetaall\" boot argument will force them to load.")
print("- Forcing unsupported kexts can cause system instability. \033[0;31mProceed with caution.\033[0m")
print("\033[0m")
option = self.utils.request_input("Do you want to force load {} on the unsupported macOS version? (Y/n): ".format("these kexts" if len(incompatible_kexts) > 1 else "this kext"))
if option.lower() == "y":
return True
elif option.lower() == "n":
return False
def kext_configuration_menu(self, hardware_report, smbios_model, macos_version, acpi_patches):
current_category = None
@@ -391,10 +424,10 @@ class KextMaestro:
checkbox = "[*]" if kext.checked else "[ ]"
line = "{} {:2}. {:25} - {:60}".format(checkbox, index, kext.name, kext.description)
if not self.utils.parse_darwin_version(kext.min_darwin_version) <= self.utils.parse_darwin_version(macos_version) <= self.utils.parse_darwin_version(kext.max_darwin_version):
line = "\033[90m{}\033[0m".format(line)
elif kext.checked:
if kext.checked:
line = "\033[1;32m{}\033[0m".format(line)
elif not self.utils.parse_darwin_version(kext.min_darwin_version) <= self.utils.parse_darwin_version(macos_version) <= self.utils.parse_darwin_version(kext.max_darwin_version):
line = "\033[90m{}\033[0m".format(line)
contents.append(line)
contents.append("\033[1;36m")
contents.append("Note:")
@@ -420,6 +453,8 @@ class KextMaestro:
if option.lower() == "q":
self.utils.exit_program()
indices = [int(i.strip()) -1 for i in option.split(",") if i.strip().isdigit()]
allow_unsupported_kexts = "Beta" in os_data.get_macos_name_by_darwin(macos_version) or self.verify_kext_compatibility(indices, macos_version)
for index in indices:
if index >= 0 and index < len(self.kexts):
@@ -427,4 +462,4 @@ class KextMaestro:
if kext.checked and not kext.required:
self.uncheck_kext(index)
else:
self.check_kext(index, macos_version)
self.check_kext(index, macos_version, allow_unsupported_kexts)