From ca43374a9cde5fa2cfe3ceda3063d8ed2c20b67b Mon Sep 17 00:00:00 2001 From: Hoang Hong Quan Date: Thu, 24 Apr 2025 17:19:36 +0700 Subject: [PATCH] Add Intel WiFi kext selection --- OpCore-Simplify.py | 4 +- README.md | 1 - Scripts/config_prodigy.py | 98 ++++++++++++++++++-------------------- Scripts/gathering_files.py | 2 +- Scripts/kext_maestro.py | 67 ++++++++++++++++++++++---- Scripts/smbios.py | 3 +- 6 files changed, 110 insertions(+), 65 deletions(-) diff --git a/OpCore-Simplify.py b/OpCore-Simplify.py index 4a67722..88c772c 100644 --- a/OpCore-Simplify.py +++ b/OpCore-Simplify.py @@ -172,7 +172,7 @@ class OCPE: if patch.checked: if patch.name == "BATP": patch.checked = getattr(self.ac, patch.function_name)() - self.k.kexts[self.k.kext_data.kext_index_by_name("ECEnabler")].checked = patch.checked + self.k.kexts[kext_maestro.kext_data.kext_index_by_name.get("ECEnabler")].checked = patch.checked continue acpi_load = getattr(self.ac, patch.function_name)() @@ -256,7 +256,7 @@ class OCPE: print("") print("Your OpenCore EFI for {} has been built at:".format(hardware_report.get("Motherboard").get("Name"))) print("\t{}".format(self.result_dir)) - if self.k.kexts[self.k.kext_data.kext_index_by_name("USBInjectAll")].checked: + if self.k.kexts[kext_maestro.kext_data.kext_index_by_name.get("USBInjectAll")].checked: print("\033[0;31mNote: USBInjectAll is not recommended. Please use USBMap.kext instead.\033[0m") print("") print("To use USBMap.kext:") diff --git a/README.md b/README.md index b204621..9a77a2c 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ - Custom ACPI patches, kexts, and SMBIOS adjustments (**not recommended**). - Force load kexts on unsupported macOS versions. - - Support AirportItlwm on macOS Sequoia 15 with **temporary workaround**. Manually select AirportItlwm, IOSkywalkFamily IO80211FamilyLegacy and AMFIPass kexts, then apply the root patch from OpenCore Legacy Patcher. ## 🚀 **How To Use** diff --git a/Scripts/config_prodigy.py b/Scripts/config_prodigy.py index 5c1bbdd..86b40e3 100644 --- a/Scripts/config_prodigy.py +++ b/Scripts/config_prodigy.py @@ -316,53 +316,44 @@ class ConfigProdigy: deviceproperties_add[pci_path].update(properties) - for kext in kexts: - if kext.checked: - if kext.name == "AirportItlwm" and self.utils.parse_darwin_version("24.0.0") <= self.utils.parse_darwin_version(macos_version): - for network_name, network_props in hardware_report.get("Network", {}).items(): - device_id = network_props.get("Device ID") + if kexts[kext_data.kext_index_by_name.get("WhateverGreen")].checked: + for gpu_name, gpu_info in hardware_report.get("GPU", {}).items(): + if gpu_info.get("Device Type") == "Integrated GPU": + if "Intel" in gpu_info.get("Manufacturer"): + add_device_property(gpu_info.get("PCI Path", "PciRoot(0x0)/Pci(0x2,0x0)"), self.igpu_properties( + "NUC" if "NUC" in hardware_report.get("Motherboard").get("Name") else hardware_report.get("Motherboard").get("Platform"), + (gpu_name, gpu_info), + hardware_report.get("Monitor", {}), + macos_version + )) + if deviceproperties_add[gpu_info.get("PCI Path", "PciRoot(0x0)/Pci(0x2,0x0)")]: + if gpu_info.get("Codename") in ("Sandy Bridge", "Ivy Bridge"): + for device_name, device_info in hardware_report.get("System Devices", {}).items(): + device_id = device_info.get("Device ID") - if device_id in pci_data.IntelWiFiIDs and network_props.get("PCI Path"): - add_device_property(network_props.get("PCI Path"), {"IOName": "pci14e4,43a0"}) - elif kext.name == "WhateverGreen": - for gpu_name, gpu_info in hardware_report.get("GPU", {}).items(): - if gpu_info.get("Device Type") == "Integrated GPU": - if "Intel" in gpu_info.get("Manufacturer"): - add_device_property(gpu_info.get("PCI Path", "PciRoot(0x0)/Pci(0x2,0x0)"), self.igpu_properties( - "NUC" if "NUC" in hardware_report.get("Motherboard").get("Name") else hardware_report.get("Motherboard").get("Platform"), - (gpu_name, gpu_info), - hardware_report.get("Monitor", {}), - macos_version - )) - if deviceproperties_add[gpu_info.get("PCI Path", "PciRoot(0x0)/Pci(0x2,0x0)")]: - if gpu_info.get("Codename") in ("Sandy Bridge", "Ivy Bridge"): - for device_name, device_info in hardware_report.get("System Devices", {}).items(): - device_id = device_info.get("Device ID") + if not device_id in ("8086-1C3A", "8086-1E3A"): + continue - if not device_id in ("8086-1C3A", "8086-1E3A"): - continue + if "Sandy Bridge" in gpu_info.get("Codename") and device_id in "8086-1E3A": + add_device_property(device_info.get("PCI Path", "PciRoot(0x0)/Pci(0x16,0x0)"), {"device-id": "3A1C0000"}) + elif "Ivy Bridge" in gpu_info.get("Codename") and device_id in "8086-1C3A": + add_device_property(device_info.get("PCI Path", "PciRoot(0x0)/Pci(0x16,0x0)"), {"device-id": "3A1E0000"}) + elif gpu_info.get("Device Type") == "Discrete GPU": + if not gpu_info.get("Device ID") in pci_data.SpoofGPUIDs: + continue - if "Sandy Bridge" in gpu_info.get("Codename") and device_id in "8086-1E3A": - add_device_property(device_info.get("PCI Path", "PciRoot(0x0)/Pci(0x16,0x0)"), {"device-id": "3A1C0000"}) - elif "Ivy Bridge" in gpu_info.get("Codename") and device_id in "8086-1C3A": - add_device_property(device_info.get("PCI Path", "PciRoot(0x0)/Pci(0x16,0x0)"), {"device-id": "3A1E0000"}) - elif gpu_info.get("Device Type") == "Discrete GPU": - if not gpu_info.get("Device ID") in pci_data.SpoofGPUIDs: - continue + add_device_property(gpu_info.get("PCI Path"), { + "device-id": self.utils.to_little_endian_hex(pci_data.SpoofGPUIDs.get(gpu_info.get("Device ID")).split("-")[-1]), + "model": gpu_name + }) + + if kexts[kext_data.kext_index_by_name.get("AppleALC")].checked: + selected_layout_id, audio_controller_properties = self.select_audio_codec_layout(hardware_report, controller_required=True) - add_device_property(gpu_info.get("PCI Path"), { - "device-id": self.utils.to_little_endian_hex(pci_data.SpoofGPUIDs.get(gpu_info.get("Device ID")).split("-")[-1]), - "model": gpu_name - }) - elif kext.name == "AppleALC": - selected_layout_id, audio_controller_properties = self.select_audio_codec_layout(hardware_report, controller_required=True) + if selected_layout_id and audio_controller_properties: + add_device_property(audio_controller_properties.get("PCI Path"), {"layout-id": selected_layout_id}) - if selected_layout_id and audio_controller_properties: - add_device_property(audio_controller_properties.get("PCI Path"), {"layout-id": selected_layout_id}) - - network_items = hardware_report.get("Network", {}).items() - - for network_name, network_props in network_items: + for network_name, network_props in hardware_report.get("Network", {}).items(): device_id = network_props.get("Device ID") if device_id in pci_data.AtherosWiFiIDs[6:8]: @@ -383,10 +374,15 @@ class ConfigProdigy: add_device_property(network_props.get("PCI Path"), { "IOName": "1D6A-91B1" }) + elif device_id in pci_data.IntelWiFiIDs: + if all((kexts[kext_data.kext_index_by_name.get("AirportItlwm")].checked, self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"))): + if all((kexts[kext_data.kext_index_by_name.get("IOSkywalkFamily")].checked, kexts[kext_data.kext_index_by_name.get("IO80211FamilyLegacy")].checked)): + add_device_property(network_props.get("PCI Path"), {"IOName": "pci14e4,43a0"}) - storage_controllers_items = hardware_report.get("Storage Controllers", {}).items() + if not network_props.get("ACPI Path"): + add_device_property(device_props.get("PCI Path"), {"built-in": "01"}) - for device_name, device_props in list(network_items) + list(storage_controllers_items): + for device_name, device_props in hardware_report.get("Storage Controllers", {}).items(): if not device_props.get("ACPI Path"): add_device_property(device_props.get("PCI Path"), {"built-in": "01"}) @@ -404,7 +400,7 @@ class ConfigProdigy: def block_kext_bundle(self, kexts): kernel_block = [] - if kexts[kext_data.kext_index_by_name("IOSkywalkFamily")].checked: + if kexts[kext_data.kext_index_by_name.get("IOSkywalkFamily")].checked: kernel_block.append({ "Arch": "x86_64", "Comment": "Allow IOSkywalk Downgrade", @@ -453,12 +449,12 @@ class ConfigProdigy: if any(network_props.get("Device ID") in pci_data.AquantiaAqtionIDs for network_props in networks.values()): kernel_patch.extend(self.g.get_kernel_patches("Aquantia macOS Patches", self.g.aquantia_macos_patches_url)) - if kexts[kext_data.kext_index_by_name("CpuTopologyRebuild")].checked: + if kexts[kext_data.kext_index_by_name.get("CpuTopologyRebuild")].checked: kernel_patch.extend(self.g.get_kernel_patches("Hyper Threading Patches", self.g.hyper_threading_patches_url)) - elif kexts[kext_data.kext_index_by_name("ForgedInvariant")].checked: + elif kexts[kext_data.kext_index_by_name.get("ForgedInvariant")].checked: if not "AMD" in cpu_manufacturer: kernel_patch.extend(self.g.get_kernel_patches("AMD Vanilla Patches", self.g.amd_vanilla_patches_url)[-6:-4]) - elif kexts[kext_data.kext_index_by_name("CatalinaBCM5701Ethernet")].checked: + elif kexts[kext_data.kext_index_by_name.get("CatalinaBCM5701Ethernet")].checked: kernel_patch.append({ "Arch": "Any", "Base": "", @@ -687,14 +683,14 @@ class ConfigProdigy: config["UEFI"]["Quirks"]["UnblockFsConnect"] = "HP " in hardware_report.get("Motherboard").get("Name") config["UEFI"]["ReservedMemory"] = [] - if kexts[kext_data.kext_index_by_name("BlueToolFixup")].checked: + if kexts[kext_data.kext_index_by_name.get("BlueToolFixup")].checked: config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["bluetoothExternalDongleFailed"] = self.utils.hex_to_bytes("00") config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["bluetoothInternalControllerInfo"] = self.utils.hex_to_bytes("0000000000000000000000000000") - if kexts[kext_data.kext_index_by_name("USBInjectAll")].checked: + if kexts[kext_data.kext_index_by_name.get("USBInjectAll")].checked: config["Kernel"]["Quirks"]["XhciPortLimit"] = True - if kexts[kext_data.kext_index_by_name("RestrictEvents")].checked: + if kexts[kext_data.kext_index_by_name.get("RestrictEvents")].checked: revpatch = [] revblock = [] if self.utils.parse_darwin_version(macos_version) > self.utils.parse_darwin_version("23.0.0") or \ diff --git a/Scripts/gathering_files.py b/Scripts/gathering_files.py index 2a890f0..75836d1 100644 --- a/Scripts/gathering_files.py +++ b/Scripts/gathering_files.py @@ -164,7 +164,7 @@ class gatheringFiles: if product_name == "AirportItlwm": version = macos_version[:2] - if self.utils.parse_darwin_version("24.0.0") <= self.utils.parse_darwin_version(macos_version): + if all((kexts[kext_maestro.kext_data.kext_index_by_name.get("IOSkywalkFamily")].checked, kexts[kext_maestro.kext_data.kext_index_by_name.get("IO80211FamilyLegacy")].checked)) or self.utils.parse_darwin_version("24.0.0") <= self.utils.parse_darwin_version(macos_version): version = "22" elif self.utils.parse_darwin_version("23.4.0") <= self.utils.parse_darwin_version(macos_version): version = "23.4" diff --git a/Scripts/kext_maestro.py b/Scripts/kext_maestro.py index 7b2435f..10cb549 100644 --- a/Scripts/kext_maestro.py +++ b/Scripts/kext_maestro.py @@ -86,7 +86,7 @@ class KextMaestro: kext.checked = True for requires_kext_name in kext.requires_kexts: - requires_kext_index = kext_data.kext_index_by_name(requires_kext_name) + requires_kext_index = kext_data.kext_index_by_name.get(requires_kext_name) if requires_kext_index: self.check_kext(requires_kext_index, target_darwin_version, allow_unsupported_kexts) @@ -96,6 +96,10 @@ class KextMaestro: other_kext.checked = False def select_required_kexts(self, hardware_report, macos_version, needs_oclp, acpi_patches): + self.utils.head("Select Required Kernel Extensions") + print("") + print("Checking for required kernel extensions...") + for kext in self.kexts: kext.checked = kext.required @@ -162,7 +166,52 @@ class KextMaestro: elif device_id in pci_data.BroadcomWiFiIDs[16:18] and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("20.0.0"): selected_kexts.append("AirportBrcmFixup") elif device_id in pci_data.IntelWiFiIDs: - selected_kexts.append("AirportItlwm" if self.utils.parse_darwin_version(macos_version) < self.utils.parse_darwin_version("23.0.0") else "itlwm") + print("\n*** Found {} is Intel WiFi device.".format(network_name)) + print("") + print("\033[93mNote:\033[0m Intel WiFi devices have two available kext options:") + print("") + print("1. \033[1mAirportItlwm\033[0m - Uses native WiFi settings menu") + print(" • Provides Handoff, Universal Clipboard, Location Services, Instant Hotspot support") + print(" • Supports enterprise-level security") + + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("24.0.0"): + print(" • \033[91mSince macOS Sequoia 15\033[0m: Can work with OCLP root patch but may cause issues") + elif self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): + print(" • \033[91mOn macOS Sonoma 14\033[0m: iServices won't work unless using OCLP root patch") + + print("") + print("2. \033[1mitlwm\033[0m - More stable overall") + print(" • Works with HeliPort app instead of native WiFi settings menu") + print(" • No Apple Continuity features and enterprise-level security") + print(" • Can connect to Hidden Networks") + print("") + + recommended_option = 2 if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0") else 1 + recommended_name = "itlwm" if recommended_option == 2 else "AirportItlwm" + + kext_option = self.utils.request_input("Select kext for your Intel WiFi device (default: {}): ".format(recommended_name)).strip() or str(recommended_option) + + if kext_option.isdigit() and 0 < int(kext_option) < 3: + selected_option = int(kext_option) + else: + print("\033[91mInvalid selection, using recommended option: {}\033[0m".format(recommended_option)) + selected_option = recommended_option + + if selected_option == 2: + selected_kexts.append("itlwm") + else: + selected_kexts.append("AirportItlwm") + + if self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("24.0.0"): + selected_kexts.append("IOSkywalkFamily") + elif self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"): + print("") + print("\033[93mNote:\033[0m Since macOS Sonoma 14, iServices won't work with AirportItlwm without patches") + print("") + option = self.utils.request_input("Apply OCLP root patch to fix iServices? (y/N): ").strip().lower() or "n" + + if option == "y": + selected_kexts.append("IOSkywalkFamily") elif device_id in pci_data.AtherosWiFiIDs[:8]: selected_kexts.append("corecaptureElCap") if self.utils.parse_darwin_version(macos_version) > self.utils.parse_darwin_version("20.99.99"): @@ -270,7 +319,7 @@ class KextMaestro: selected_kexts.extend(("AppleIntelCPUPowerManagement", "AppleIntelCPUPowerManagementClient")) for name in selected_kexts: - self.check_kext(kext_data.kext_index_by_name(name), macos_version, "Beta" in os_data.get_macos_name_by_darwin(macos_version)) + self.check_kext(kext_data.kext_index_by_name.get(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: @@ -295,7 +344,7 @@ class KextMaestro: break else: main_kext = kext_path.split("/")[0] - main_kext_index = kext_data.kext_index_by_name(main_kext) + main_kext_index = kext_data.kext_index_by_name.get(main_kext) if not main_kext_index or self.kexts[main_kext_index].checked: if os.path.splitext(os.path.basename(kext_path))[0] in kext.name: source_kext_path = os.path.join(self.ock_files_dir, kext_path) @@ -365,15 +414,15 @@ class KextMaestro: kernel_add = [] unload_kext = [] - if self.kexts[kext_data.kext_index_by_name("IO80211ElCap")].checked: + if self.kexts[kext_data.kext_index_by_name.get("IO80211ElCap")].checked: unload_kext.extend(( "AirPortBrcm4331", "AppleAirPortBrcm43224" )) - elif self.kexts[kext_data.kext_index_by_name("VoodooSMBus")].checked: + elif self.kexts[kext_data.kext_index_by_name.get("VoodooSMBus")].checked: unload_kext.append("VoodooPS2Mouse") - elif self.kexts[kext_data.kext_index_by_name("VoodooRMI")].checked: - if not self.kexts[kext_data.kext_index_by_name("VoodooI2C")].checked: + elif self.kexts[kext_data.kext_index_by_name.get("VoodooRMI")].checked: + if not self.kexts[kext_data.kext_index_by_name.get("VoodooI2C")].checked: unload_kext.append("RMII2C") else: unload_kext.extend(( @@ -407,7 +456,7 @@ class KextMaestro: bundle["MaxKernel"] = os_data.get_latest_darwin_version() bundle["MinKernel"] = os_data.get_lowest_darwin_version() - kext_index = kext_data.kext_index_by_name(os.path.splitext(os.path.basename(bundle.get("BundlePath")))[0]) + kext_index = kext_data.kext_index_by_name.get(os.path.splitext(os.path.basename(bundle.get("BundlePath")))[0]) if kext_index: bundle["MaxKernel"] = self.kexts[kext_index].max_darwin_version diff --git a/Scripts/smbios.py b/Scripts/smbios.py index 0f6403e..b4aa194 100644 --- a/Scripts/smbios.py +++ b/Scripts/smbios.py @@ -1,4 +1,5 @@ from Scripts.datasets.mac_model_data import mac_devices +from Scripts.datasets import kext_data from Scripts.datasets import os_data from Scripts import gathering_files from Scripts import run @@ -73,7 +74,7 @@ class SMBIOS: selected_kexts.append("NoTouchID") for name in selected_kexts: - kext_maestro.check_kext(kext_maestro.kext_data.kext_index_by_name(name), macos_version, "Beta" in os_data.get_macos_name_by_darwin(macos_version)) + kext_maestro.check_kext(kext_data.kext_index_by_name.get(name), macos_version, "Beta" in os_data.get_macos_name_by_darwin(macos_version)) def select_smbios_model(self, hardware_report, macos_version): platform = "NUC" if "NUC" in hardware_report.get("Motherboard").get("Name") else hardware_report.get("Motherboard").get("Platform")