Add Legacy Wireless support for Monterey

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/365
This commit is contained in:
Mykola Grymalyuk
2021-09-17 22:17:41 -06:00
parent 45332d2cf9
commit d1726f95fc
7 changed files with 69 additions and 53 deletions

View File

@@ -37,6 +37,8 @@
- Requires macOS 11.3 (20E232) or newer
- Add offline TUI build
- Allows for root patching without network connection
- Add Legacy Wireless support for Monterey
- Applicable for BCM94328, BCM94322 and Atheros chipsets
## 0.2.4

View File

@@ -33,6 +33,7 @@ Nightly builds can be found here courteous of nightly.link:
* [Nightly OpenCore Patcher (GUI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OpenCore-Patcher-GUI.app.zip)
* [Nightly OpenCore Patcher (TUI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI.app.zip)
* [Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-offline/main/OpenCore-Patcher-TUI-Offline.app.zip) (No network connection needed on target Mac for Root Patching)
* [Nightly OpenCore Patcher (CLI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OCLP-CLI.zip)
## Credits

View File

@@ -278,28 +278,32 @@ class BuildOpenCore:
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
wifi_fake_id(self)
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
self.get_kext_by_bundle_path("IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.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:
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
else:
if self.model in ModelArray.WifiBCM94331:
wifi_fake_id(self)
elif self.model in ModelArray.WifiBCM94322:
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
self.get_kext_by_bundle_path("IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
elif self.model in ModelArray.WifiBCM94328:
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
elif self.model in ModelArray.WifiAtheros:
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
else:
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
# print(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")

View File

@@ -14,7 +14,7 @@ class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.2.5" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.0" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.1.1" # PatcherSupportPkg
# OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg
@@ -46,7 +46,7 @@ class Constants:
## Apple - Dortania Modified
self.bcm570_version = "1.0.1" # CatalinaBCM5701Ethernet
self.corecaptureelcap_version = "1.0.0" # corecaptureElCap
self.io80211elcap_version = "1.0.0" # IO80211ElCap
self.io80211elcap_version = "2.0.0" # IO80211ElCap
self.io80211high_sierra_version = "1.0.0" # IO80211HighSierra
self.io80211mojave_version = "1.0.0" # IO80211Mojave
@@ -490,6 +490,18 @@ class Constants:
def payload_apple_kexts_path(self):
return self.payload_apple_root_path / Path("Extensions")
@property
def payload_apple_coreservices_path(self):
return self.payload_apple_root_path / Path("CoreServices")
@property
def payload_apple_usr_path(self):
return self.payload_apple_root_path / Path("usr")
@property
def payload_apple_libexec_path(self):
return self.payload_apple_usr_path / Path("libexec")
@property
def payload_apple_frameworks_path(self):
return self.payload_apple_root_path / Path("Frameworks")
@@ -581,6 +593,14 @@ class Constants:
def legacy_brightness(self):
return self.payload_apple_kexts_path / Path("Brightness-Control")
@property
def legacy_wifi_coreservices(self):
return self.payload_apple_coreservices_path / Path("Legacy-Wifi")
@property
def legacy_wifi_libexec(self):
return self.payload_apple_libexec_path / Path("Legacy-Wifi")
csr_values = {
# Source: macOS 11.4 (XNU's csr.h)
# https://opensource.apple.com/source/xnu/xnu-7195.121.3/bsd/sys/csr.h.auto.html

View File

@@ -33,6 +33,7 @@ class PatchSysVolume:
self.ivy_gpu = False
self.brightness_legacy = False
self.legacy_audio = False
self.legacy_wifi = False
self.added_legacy_kexts = False
self.amfi_must_disable = False
self.check_board_id = False
@@ -48,10 +49,12 @@ class PatchSysVolume:
self.mount_location = "/System/Volumes/Update/mnt1"
else:
self.mount_location = ""
self.mount_coreservices = f"{self.mount_location}/System/Library/CoreServices"
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks"
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks"
self.mount_libexec = f"{self.mount_location}/usr/libexec"
def elevated(self, *args, **kwargs) -> subprocess.CompletedProcess:
if os.getuid() == 0 or self.constants.gui_mode is True:
@@ -292,6 +295,13 @@ set million colour before rebooting"""
self.delete_old_binaries(SysPatchArray.DeleteVolumeControl)
self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path)
def add_wifi_patch(self):
print("- Merging Wireless CoreSerices patches")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_coreservices}/", self.mount_coreservices], stdout=subprocess.PIPE)
print("- Merging Wireless usr/libexec patches")
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_libexec}/", self.mount_libexec], stdout=subprocess.PIPE)
def gpu_accel_legacy(self):
if self.constants.detected_os == self.constants.mojave:
print("- Installing General Acceleration Kext patches for Mojave")
@@ -503,6 +513,11 @@ set million colour before rebooting"""
if self.legacy_audio is True:
print("- Fixing Volume Control Support")
self.add_audio_patch()
if self.legacy_wifi is True:
print("- Installing legacy Wireless support")
self.add_wifi_patch()
if self.validate is False:
self.rebuild_snapshot()
@@ -618,6 +633,13 @@ set million colour before rebooting"""
if self.constants.detected_os > self.constants.catalina:
self.legacy_audio = True
if (
isinstance(self.constants.computer.wifi, device_probe.Broadcom)
and self.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
if self.constants.detected_os > self.constants.big_sur:
self.legacy_wifi = True
Utilities.cls()
print("The following patches will be applied:")
if self.nvidia_legacy is True:
@@ -636,6 +658,8 @@ set million colour before rebooting"""
print("- Add Legacy Brightness Control")
if self.legacy_audio is True:
print("- Add legacy Audio Control")
if self.legacy_wifi is True:
print("- Add legacy WiFi Control")
self.no_patch = not any(
[
@@ -647,6 +671,7 @@ set million colour before rebooting"""
self.ivy_gpu,
self.brightness_legacy,
self.legacy_audio,
self.legacy_wifi,
]
)

View File

@@ -456,7 +456,7 @@
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>16.0.0</string>
<key>BundlePath</key>
@@ -470,33 +470,15 @@
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Atheros Wifi Patch</string>
<string>Monterey Atheros Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>18.0.0</string>
<key>BundlePath</key>
<string>IO80211HighSierra.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/IO80211HighSierra</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Atheros Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<key>MinKernel</key>
<string>18.0.0</string>
<key>BundlePath</key>
<string>IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext</string>
<string>IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/AirPortAtheros40</string>
<key>PlistPath</key>
@@ -506,33 +488,15 @@
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Broadcom Wifi Patch</string>
<string>Monterey BCM94322 Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>BundlePath</key>
<string>IO80211Mojave.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/IO80211Mojave</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Broadcom Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>BundlePath</key>
<string>IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext</string>
<string>IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/AirPortBrcm4331</string>
<key>PlistPath</key>

Binary file not shown.