Compare commits

...

27 Commits
0.4.2 ... 0.4.3

Author SHA1 Message Date
Mykola Grymalyuk
c573a8a335 smbios_data.py: Add Mac Studio Model IDs
Ref: https://twitter.com/khronokernel/status/1501315940260016133?s=21
2022-03-08 15:55:31 -07:00
Mykola Grymalyuk
1393db72dd Add XCPM disabling 2022-03-02 09:19:41 -07:00
Mykola Grymalyuk
ba82b41cbd Sync PatcherSupportPkg 2022-03-02 08:56:33 -07:00
Mykola Grymalyuk
97a9853526 Resolve crash on Vendor detection 2022-02-24 11:25:44 -07:00
Mykola Grymalyuk
f1d67923c8 Resolve SDXC
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/978
2022-02-23 20:23:11 -07:00
Mykola Grymalyuk
0e526556e5 Update MONTEREY-DROP.md 2022-02-18 19:31:09 -07:00
Mykola Grymalyuk
9125b170ce bug_report: Clarify troubleshooting 2022-02-17 09:20:41 -07:00
Mykola Grymalyuk
cc5ed2396c Update issues 2022-02-17 08:52:01 -07:00
Mykola Grymalyuk
165526fbe2 docs: Fix TOC
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/956
2022-02-14 10:38:51 -07:00
Mykola Grymalyuk
c366680ad0 Sync FeatureUnlock
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/957
2022-02-14 10:38:15 -07:00
Mykola Grymalyuk
1237dc55e0 GUI.py: Add Dark Menubar configuration 2022-02-12 11:01:07 -07:00
Mykola Grymalyuk
ca61262228 docs: Add DisplayLink non-Metal information 2022-02-11 19:12:33 -07:00
Mykola Grymalyuk
2b4fdbb388 Resolve Non-Metal Keyboard Backlight support 2022-02-11 10:31:54 -07:00
Mykola Grymalyuk
23927a4e6a Resolve I210/I225 Sandy support
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/939
2022-02-09 19:29:59 -07:00
Mykola Grymalyuk
d5330555fc gui.py: Fix typo 2022-02-09 17:45:01 -07:00
Mykola Grymalyuk
8b1a46d8c4 Update ocvalidate binary 2022-02-08 08:59:35 -07:00
Mykola Grymalyuk
84bf2a9e18 sys_patch_detect.py: Fix backlight detection 2022-02-08 08:52:25 -07:00
Mykola Grymalyuk
4d244a5eee CHANGELOG: Add Cursor note 2022-02-07 14:40:47 -07:00
Mykola Grymalyuk
31ff4bbd0d Increment Binaries 2022-02-07 14:33:29 -07:00
Mykola Grymalyuk
cf4b2b2ad0 Update Credits 2022-02-06 14:23:20 -07:00
Mykola Grymalyuk
aa5e39f48a install.py: Add Safe Mode note 2022-02-06 12:19:00 -07:00
Mykola Grymalyuk
d1bd915ede install.py: Fix formatting in GUI 2022-02-06 10:31:13 -07:00
Mykola Grymalyuk
4d8aa1a541 install.py: Resolve error handling in GUI 2022-02-06 10:16:59 -07:00
Mykola Grymalyuk
e2aa6b4b48 utilities.py: Set checksum check to optional
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/915
2022-02-05 09:14:23 -07:00
Mykola Grymalyuk
3a9479a1d6 sys_patch: Add extra snapshot checks
Avoid issues on snapshot-less installs
2022-02-04 13:32:51 -07:00
Mykola Grymalyuk
39758fec20 gui: Strip unneeded print 2022-02-04 13:31:30 -07:00
Mykola Grymalyuk
2473daee2b Increment Build 2022-02-03 11:57:28 -07:00
43 changed files with 512 additions and 102 deletions

View File

@@ -125,7 +125,7 @@ body:
- type: dropdown
id: used-forums
attributes:
label: Have you already verified this is a patcher bug and not a macOS bug on our discord servers?
label: Have you already verified this is a patcher bug and not a macOS bug/user error on our discord servers?
description: If no, please do not use issues for this. We'd appreciate it if users check discuss with others before filing. Issues are for valid patcher issues only, not for personal troubleshooting scessions.
multiple: true
options:
@@ -183,4 +183,4 @@ body:
- type: textarea
id: extra-info
attributes:
label: What steps have you taken to troubleshoot this?
label: What steps have you taken to troubleshoot this? Please include messages from Discord, logs, and screenshots.

1
.gitignore vendored
View File

@@ -23,3 +23,4 @@ __pycache__/
/payloads/List.txt
/payloads/Installer.sh
/payloads/Info.plist
/payloads/seed.plist

View File

@@ -1,5 +1,29 @@
# OpenCore Legacy Patcher changelog
## 0.4.3
- Increment Binaries:
- PatcherSupportPkg 0.3.4 - release
- OpenCorePkg 0.7.8 - release
- Lilu 1.6.0 - release
- WhateverGreen 1.5.7 - release
- FeatureUnlock 1.0.7 - rolling (6a87f65)
- Resolve many non-Metal issues:
- Control Centre Sliders
- Shift/missing icons
- Hardware Cursor
- Note cursor images will be static (ie. beachball)
- Quicklook dismiss/expand
- Keyboard Backlight
- Drops reliance on LabTick
- Add Ethernet Controller detection to build
- Resolve i210/i225 NIC support on pre-Ivy Macs
- Resolve AirPlay to Mac support on Skylake+ Macs in 12.3 Beta 2+
- Resolve SDXC support in Monterey for Pre-Ivy Bridge Macs
- Rename Battery Throttling option to Firmware Throttling
- Expands support to desktops (ie. iMacs without Displays)
- Add XCPM disabling
- Forces `ACPI_SMC_PlatformPlugin` to outmatch `X86PlatformPlugin`
## 0.4.2
- Resolve app crashing on some 3rd party SAS/SATA controllers
- Add Beta identifier to macOS Installer menu

View File

@@ -45,7 +45,7 @@ To get aid with the patcher, we recommend joining the [OpenCore Patcher Paradise
* Great amounts of help debugging and code suggestions
* [vit9696](https://github.com/vit9696)
* Endless amount of help troubleshooting, determining fixes and writing patches
* [ASentientBot](https://github.com/ASentientBot)
* [ASentientBot](https://github.com/ASentientBot), [EduCovas](https://github.com/educovas) and [ASentientHedgehog](https://github.com/moosethegoose2213)
* Legacy Acceleration Patch set and documentation
* [cdf](https://github.com/cdf)
* Mac Pro on OpenCore Patch set and documentation

View File

@@ -15,7 +15,7 @@ For developers wishing to validate mainline changes, you may use these nightly l
## Getting Started
To start, ensure you have python 3.6 or newer installed. Additionally ensure that they were downloaded from the offical source, [python.org](https://www.python.org/downloads/macos/).
To start, ensure you have python 3.6 or newer installed. Additionally ensure that they were downloaded from the Official source, [python.org](https://www.python.org/downloads/macos/).
* Python installations either preinstalled or provided with Xcode/Xcode Tools are unsupported due to reliablility issues

View File

@@ -21,3 +21,4 @@ class cpu_data(enum.IntEnum):
apple_m1 = 114 # A14
apple_m1_pro = 115
apple_m1_max = 116
apple_m1_ultra = 117

View File

@@ -2721,6 +2721,36 @@ smbios_dictionary = {
"SATA 3.5",
],
},
# Mac Studio M1 Max
"Mac13,1": {
"Board ID": None,
"FirmwareFeatures": None,
"SecureBootModel": "j375c",
"CPU Generation": cpu_data.cpu_data.apple_m1_max.value,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.PCIe,
"Ethernet Chipset": "Aquantia",
"Stock GPUs": [],
"Stock Storage": [
"NVMe",
],
},
# Mac Studio M1 Ultra
"Mac13,2": {
"Board ID": None,
"FirmwareFeatures": None,
"SecureBootModel": "j375d",
"CPU Generation": cpu_data.cpu_data.apple_m1_ultra.value,
"Max OS Supported": os_data.os_data.max_os,
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.PCIe,
"Ethernet Chipset": "Aquantia",
"Stock GPUs": [],
"Stock Storage": [
"NVMe",
],
},
"ADP2,1": {
"Board ID": None,
"FirmwareFeatures": None,

View File

@@ -120,7 +120,11 @@ The best way to achieve this is to boot Recovery (or Single User Mode if the dGP
nvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%01%00%00%00
```
This will disable the dGPU and allow the iGPU to function in Big Sur. Note that external display outputs are directly routed to the dGPU and therefore can no longer be used. Solutions such as a [DisplayLink Adapters](https://www.displaylink.com/products/usb-adapters) can work around this limitation in theory. However, currently the proprietary DisplayLink driver refuses to function on legacy-patched systems, either resulting in a windowserver crash loop or no output at all.
This will disable the dGPU and allow the iGPU to function in Big Sur. Note that external display outputs are directly routed to the dGPU and therefore can no longer be used. Solutions such as a [DisplayLink Adapters](https://www.displaylink.com/products/usb-adapters) can work around this limitation, however note that you'll need to use older drivers (5.2.6):
* [DisplayLink USB Graphics Software for macOS - For Mojave and Catalina - 5.2.6](https://www.synaptics.com/products/displaylink-graphics/downloads/macos-5.2.6)
Note this driver only provides partial support in macOS, full graphics acceleration is not currently available on the displays driven by DisplayLink
## Erratic Colours on ATI TeraScale 2 GPUs (HD5000/HD6000)
@@ -149,7 +153,7 @@ This tool can be used to work-around this issue:
By default OpenCore Legacy Patcher will assume MacBookPro8,2/3 have a faulty dGPU and disable acceleration. This is the safest option for most users as enabling dGPU acceleration on faulty Macs will result in failed booting.
However if your machine does not have the dGPU disabled via NVRAM, you'll expereince a login loop. To work around this is quite simple:
However if your machine does not have the dGPU disabled via NVRAM, you'll experience a login loop. To work around this is quite simple:
1. Boot macOS in Single User Mode
* Press Cmd+S in OpenCore's menu when you turn the Mac on

View File

@@ -1,7 +1,6 @@
# Download and build macOS Installers
* [Downloading](#downloading)
* [Building](#building)
* [Creating the installer](#creating-the-installer)
This doc is centered around downloading and writing the macOS installer to a USB. If you're already familiar with how to do this, you can skip.
@@ -25,7 +24,6 @@ First we'll want to select the "Create macOS Installer" button. This will presen
For this example, we'll assume you'll need an installer. Selecting this option will download Apple's Installer Catalogs and build a list for you to choose:
| Downloading | Listed Installers |
| :--- | :--- |
| ![OCLP GUI Installer Download Catalog](../images/OCLP-GUI-Installer-Download-Catalog.png) | ![OCLP GUI Installer Download Listed Products](../images/OCLP-GUI-Installer-Download-Listed-Products.png) |
@@ -49,4 +47,5 @@ Now the patcher will start the installer flashing!
| Flashing | Success Prompt | Finished Flashing |
| :--- | :--- |
| ![](../images/OCLP-GUI-Installer-Flashing-Process.png) | ![](../images/OCLP-GUI-Installer-Sucess-Prompt.png) | ![](../images/OCLP-GUI-Installer-Finished-Script.png) |
# Once finished, head to [Building and installing OpenCore](./BUILD.md)

View File

@@ -47,13 +47,14 @@ sudo killall -9 BlueTool bluetoothd
* Broadcom BCM94328, BCM94322 and Atheros Wireless Chipsets lost support
The following models lost Bluetooth support in macOS Monterey due to their legacy Wireless chipset:
The following models lost Wifi support in macOS Monterey due to their legacy Wireless chipset:
* iMac12,x and older
* Macmini3,1 and older
* MacBook5,x and older
* MacBookAir2,1 and older
* MacBookPro7,1 and older
* MacBookPro6,x is exempt
* MacPro5,1 and older
Note: BCM943224, BCM94331, BCM94360 and BCM943602 are still fully support by OpenCore Legacy Patcher

View File

@@ -124,3 +124,14 @@ Head into the GUI, Patcher Settings and toggle the bits you need disabled from S
| SIP Enabled | SIP Lowered (Root Patching) | SIP Disabled |
| :--- | :--- | :--- |
| ![](../images/OCLP-GUI-Settings-SIP-Enabled.png) | ![](../images/OCLP-GUI-Settings-SIP-Root-Patch.png) | ![](../images/OCLP-GUI-Settings-SIP-Disabled.png) |
## Intermediate issues with USB 1.1 and Bluetooth on MacPro3,1 - MacPro5,1
For those experiencing issues with USB 1.1 devices (such as mice, keyboards and bluetooth chipsets), macOS Big Sur and newer have weakened OS-side reliability for the UHCI controller in older Mac Pros.
* UHCI is a USB 1.1 controller that is hooked together with the USB 2.0 ports in your system. Whenever a USB 1.1 device is detected, the UHCI controller is given ownership of the device at a hardware/firmware level.
* EHCI is the USB 2.0 controller in older Mac Pros
Because of this, we recommend placing a USB 2.0/3.0 hub between your devices and the port on the Mac Pro. UHCI and EHCI cannot both be used at once, so using a USB hub will always force the EHCI controller on.
* Alternatively, you can try cold starting the hardware and see if macOS recognizes the UHCI controller properly

View File

@@ -340,8 +340,8 @@ class wx_python_gui:
# Define Menu
# Header: Get help with OpenCore Legacy Patcher
# Subheader: Following resources are available:
# Button: Offical Guide
# Button: Offical Discord Server
# Button: Official Guide
# Button: Official Discord Server
self.frame.DestroyChildren()
@@ -362,8 +362,8 @@ class wx_python_gui:
self.subheader.Centre(wx.HORIZONTAL)
# Offical Guide
self.guide = wx.Button(self.frame, label="Offical Guide", size=(200,30))
# Official Guide
self.guide = wx.Button(self.frame, label="Official Guide", size=(200,30))
self.guide.SetPosition(
wx.Point(
self.subheader.GetPosition().x,
@@ -374,8 +374,8 @@ class wx_python_gui:
self.guide.Bind(wx.EVT_BUTTON, lambda event: webbrowser.open(self.constants.guide_link))
self.guide.Centre(wx.HORIZONTAL)
# Offical Discord Server
self.discord = wx.Button(self.frame, label="Offical Discord Server", size=(200,30))
# Official Discord Server
self.discord = wx.Button(self.frame, label="Official Discord Server", size=(200,30))
self.discord.SetPosition(
wx.Point(
self.guide.GetPosition().x,
@@ -386,7 +386,7 @@ class wx_python_gui:
self.discord.Centre(wx.HORIZONTAL)
# Overclock Button
self.overclock = wx.Button(self.frame, label="Offical Support Phone", size=(200,30))
self.overclock = wx.Button(self.frame, label="Official Support Phone", size=(200,30))
self.overclock.SetPosition(
wx.Point(
self.discord.GetPosition().x,
@@ -1394,7 +1394,6 @@ class wx_python_gui:
time.sleep(0.1)
output = float(utilities.monitor_disk_output(disk))
bytes_written = output - default_output
print(bytes_written)
if thread.is_alive():
self.progress_bar.SetValue(bytes_written)
self.progress_label.SetLabel(f"Bytes Written: {round(bytes_written, 2)}MB")
@@ -1762,21 +1761,30 @@ class wx_python_gui:
self.hibernation_checkbox.SetToolTip(wx.ToolTip("This will disable the ConnectDrivers in OpenCore\nRecommended to toggle if your machine is having issues with hibernation.\nMainly applicable for MacBookPro9,1 and MacBookPro10,1"))
# Disable Battery Throttling
self.disable_battery_throttling_checkbox = wx.CheckBox(self.frame, label="Disable Battery Throttling")
self.disable_battery_throttling_checkbox = wx.CheckBox(self.frame, label="Disable Firmware Throttling")
self.disable_battery_throttling_checkbox.SetValue(self.constants.disable_msr_power_ctl)
self.disable_battery_throttling_checkbox.Bind(wx.EVT_CHECKBOX, self.disable_battery_throttling_click)
self.disable_battery_throttling_checkbox.SetPosition(wx.Point(
self.hibernation_checkbox.GetPosition().x,
self.hibernation_checkbox.GetPosition().y + self.hibernation_checkbox.GetSize().height))
self.disable_battery_throttling_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable MSR Power Control on Arrendale and newer Laptops\nMainly applicable for systems with severe battery throttling"))
self.disable_battery_throttling_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable MSR Power Control on Arrendale and newer Macs\nMainly applicable for systems with severe throttling due to missing battery or display"))
# Disable XCPM
self.disable_xcpm_checkbox = wx.CheckBox(self.frame, label="Disable XCPM")
self.disable_xcpm_checkbox.SetValue(self.constants.disable_xcpm)
self.disable_xcpm_checkbox.Bind(wx.EVT_CHECKBOX, self.disable_xcpm_click)
self.disable_xcpm_checkbox.SetPosition(wx.Point(
self.disable_battery_throttling_checkbox.GetPosition().x,
self.disable_battery_throttling_checkbox.GetPosition().y + self.disable_battery_throttling_checkbox.GetSize().height))
self.disable_xcpm_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable XCPM on Ivy Bridge EP and newer Macs\nMainly applicable for systems with severe throttling due to missing battery or display"))
# Software Demux
self.software_demux_checkbox = wx.CheckBox(self.frame, label="Software Demux")
self.software_demux_checkbox.SetValue(self.constants.software_demux)
self.software_demux_checkbox.Bind(wx.EVT_CHECKBOX, self.software_demux_click)
self.software_demux_checkbox.SetPosition(wx.Point(
self.disable_battery_throttling_checkbox.GetPosition().x,
self.disable_battery_throttling_checkbox.GetPosition().y + self.disable_battery_throttling_checkbox.GetSize().height))
self.disable_xcpm_checkbox.GetPosition().x,
self.disable_xcpm_checkbox.GetPosition().y + self.disable_xcpm_checkbox.GetSize().height))
self.software_demux_checkbox.SetToolTip(wx.ToolTip("This will force a software based demux on MacBookPro8,2/3 aiding for better battery life\nThis will require the dGPU to be disabled via NVRAM"))
if not self.constants.custom_model and self.computer.real_model not in ["MacBookPro8,2", "MacBookPro8,3"]:
self.software_demux_checkbox.Disable()
@@ -1943,6 +1951,14 @@ class wx_python_gui:
else:
print("Disable Battery Throttling Disabled")
self.constants.disable_msr_power_ctl = False
def disable_xcpm_click(self, event=None):
if self.disable_xcpm_checkbox.GetValue():
print("Disable XCPM Enabled")
self.constants.disable_xcpm = True
else:
print("Disable XCPM Disabled")
self.constants.disable_xcpm = False
def software_demux_click(self, event=None):
if self.software_demux_checkbox.GetValue():
@@ -2424,6 +2440,9 @@ OpenCore Legacy Patcher by default knows the most ideal
def non_metal_config_menu(self, event=None):
# Configures ASB's Blur settings
# Check Dark Menu Bar:
# defaults read ASB_DarkMenuBar
# defaults write -g ASB_DarkMenuBar -bool true
# Check Beta Blur:
# defaults read ASB_BlurBeta
# defaults write -g ASB_BlurBeta -bool true
@@ -2472,7 +2491,11 @@ OpenCore Legacy Patcher by default knows the most ideal
self.subheader_4.SetPosition(wx.Point(0, self.subheader_3.GetPosition().y + self.subheader_3.GetSize().height+ 5))
self.subheader_4.Centre(wx.HORIZONTAL)
is_dark_menu_bar = subprocess.run(["defaults", "read", "-g", "ASB_DarkMenuBar"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if is_dark_menu_bar in ["1", "true"]:
is_dark_menu_bar = True
else:
is_dark_menu_bar = False
is_blur_enabled = subprocess.run(["defaults", "read", "-g", "ASB_BlurBeta"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if is_blur_enabled in ["1", "true"]:
@@ -2480,12 +2503,18 @@ OpenCore Legacy Patcher by default knows the most ideal
else:
is_blur_enabled = False
# Checkbox: Dark Menu Bar
self.dark_menu_bar_checkbox = wx.CheckBox(self.frame, label="Dark Menu Bar")
self.dark_menu_bar_checkbox.SetValue(is_dark_menu_bar)
self.dark_menu_bar_checkbox.Bind(wx.EVT_CHECKBOX, self.enable_dark_menubar_click)
self.dark_menu_bar_checkbox.SetPosition(wx.Point(0, self.subheader_4.GetPosition().y + self.subheader_4.GetSize().height + 10))
self.dark_menu_bar_checkbox.Centre(wx.HORIZONTAL)
# Checkbox: Enable Beta Blur
self.enable_beta_blur_checkbox = wx.CheckBox(self.frame, label="Enable Beta Blur")
self.enable_beta_blur_checkbox.SetValue(is_blur_enabled)
self.enable_beta_blur_checkbox.Bind(wx.EVT_CHECKBOX, self.enable_beta_blur_click)
self.enable_beta_blur_checkbox.SetPosition(wx.Point(0, self.subheader_4.GetPosition().y + self.subheader_4.GetSize().height + 10))
self.enable_beta_blur_checkbox.Center(wx.HORIZONTAL)
self.enable_beta_blur_checkbox.SetPosition(wx.Point(self.dark_menu_bar_checkbox.GetPosition().x, self.dark_menu_bar_checkbox.GetPosition().y + self.dark_menu_bar_checkbox.GetSize().height + 10))
# Text: Blur Radius
self.blur_radius_text = wx.StaticText(self.frame, label="Current Blur Radius: " + "px")
@@ -2525,6 +2554,13 @@ OpenCore Legacy Patcher by default knows the most ideal
subprocess.run(["defaults", "write", "-g", "ASB_BlurBeta", "-bool", "false"])
print("Beta Blur Enabled:", event.IsChecked())
def enable_dark_menubar_click(self, event=None):
if event.IsChecked():
subprocess.run(["defaults", "write", "-g", "ASB_DarkMenuBar", "-bool", "true"])
else:
subprocess.run(["defaults", "write", "-g", "ASB_DarkMenuBar", "-bool", "false"])
print("Dark Menu Bar Enabled:", event.IsChecked())
def blur_radius_scale_change(self, event=None):
val = event.GetInt()
subprocess.run(["defaults", "write", "-g", "ASB_BlurOverride", "-float", str(val)])

View File

@@ -501,6 +501,42 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>SDXC Patch for Pre-Ivy</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>21.0.0</string>
<key>BundlePath</key>
<string>BigSurSDXC.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/BigSurSDXC</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>I210 Ethernet patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.0.0</string>
<key>BundlePath</key>
<string>CatalinaIntelI210Ethernet.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/CatalinaIntelI210Ethernet</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
payloads/Tools/ocvalidate-0.7.8 Executable file

Binary file not shown.

View File

@@ -126,9 +126,6 @@ class BuildOpenCore:
self.constants.cpufriend_path,
lambda: self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None",
),
# Ethernet patches
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"),
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell"),
# Legacy audio
(
"AppleALC.kext",
@@ -177,25 +174,52 @@ class BuildOpenCore:
print(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
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 or self.constants.disable_xcpm is True:
# With macOS 12.3 Beta 1, Apple dropped the 'plugin-type' check within X86PlatformPlugin
# Because of this, X86PP will match onto the CPU instead of ACPI_SMC_PlatformPlugin
# This causes power management to break on pre-Ivy Bridge CPUs as they don't have correct
# power management tables provided.
# This patch will simply increase ASPP's 'IOProbeScore' to outmatch X86PP
print("- Fixing ACPI SMC Power Management support")
print("- Overriding ACPI SMC matching")
self.enable_kext("ASPP-Override.kext", self.constants.aspp_override_version, self.constants.aspp_override_path)
if self.constants.disable_xcpm is True:
# Only inject on older OSes if user requests
self.get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
if self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1", "MacBookPro10,1"]:
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path)
# Ethernet Patch Sets
if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom":
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-x support
# Applicable for pre-Ivy Bridge models
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
if not self.constants.custom_model and 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 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
# Applicable for pre-Ivy Bridge models
if self.get_kext_by_bundle_path("CatalinaBCM5701Ethernet.kext")["Enabled"] is False:
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
elif isinstance(controller, device_probe.IntelEthernet) and controller.chipset == device_probe.IntelEthernet.Chipsets.AppleIntelI210Ethernet:
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
# Apple's IOSkywalkFamily in DriverKit requires VT-D support
# Applicable for pre-Ivy Bridge models
if self.get_kext_by_bundle_path("CatalinaIntelI210Ethernet.kext")["Enabled"] is False:
self.enable_kext("CatalinaIntelI210Ethernet.kext", self.constants.i210_version, self.constants.i210_path)
elif isinstance(controller, device_probe.NVIDIAEthernet):
if self.get_kext_by_bundle_path("nForceEthernet.kext")["Enabled"] is False:
self.enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
elif isinstance(controller, device_probe.Marvell) or isinstance(controller, device_probe.SysKonnect):
if self.get_kext_by_bundle_path("MarvelYukonEthernet.kext")["Enabled"] is False:
self.enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
else:
if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom":
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
# Applicable for pre-Ivy Bridge models
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia":
self.enable_kext("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path)
elif smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell":
self.enable_kext("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path)
# i3 Ivy Bridge iMacs don't support RDRAND
# However for prebuilt, assume they do
@@ -386,6 +410,12 @@ class BuildOpenCore:
self.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)
# With macOS Monterey, Apple's SDXC driver requires the system to support VT-D
# 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 (self.constants.computer.sdxc_controller and not self.constants.custom_model) or (self.model.startswith("MacBookPro8") or self.model.startswith("Macmini5")):
self.enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path)
# USB Map
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
if (
@@ -899,10 +929,10 @@ class BuildOpenCore:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
# Lets us check in sys_patch.py if config supports FileVault
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
if self.constants.disable_msr_power_ctl is True and self.model.startswith("MacBook"):
print("- Disabling Battery Throttling")
if self.constants.disable_msr_power_ctl is True:
print("- Disabling Firmware Throttling")
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
# Nehalem and newer MacBooks force firmware throttling via MSR_POWER_CTL
# Nehalem and newer systems force firmware throttling via MSR_POWER_CTL
self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
if self.constants.disable_connectdrivers is True:
print("- Disabling ConnectDrivers")

View File

@@ -807,16 +807,16 @@ https://dortania.github.io/OpenCore-Legacy-Patcher/ACCEL.html#unable-to-switch-g
print(
"""
By default on Nehalem and newer Macs, the firmware will throttle if
the battery is either dead or missing. The firmware will set
the battery or Display is either dead or missing. The firmware will set
'BD PROCHOT' to notify the OS the machine needs to run in an extreme
low power mode.
Enabling this option will patch 'MSR_POWER_CTL' to be unset allowing
proper CPU behaviour as if battery is present. Note that this can cause
proper CPU behaviour as if hardware is present. Note that this can cause
instability in situations where the CPU is being taxed and pulls more
power than the PSU can supply.
power than the laptop's PSU can supply.
Note: Only supported on Nehalem and newer MacBooks (2010+)
Note: Only supported on Nehalem and newer Macs (2010+)
"""
)
@@ -830,6 +830,32 @@ Note: Only supported on Nehalem and newer MacBooks (2010+)
else:
self.set_battery_throttle()
def set_xcpm(self):
utilities.cls()
utilities.header(["Disable XCPM"])
print(
"""
By default on Ivy Bridge EP and newer Macs, the system will throttle if
the battery or Display is either dead or missing. Apple's XCPM will set
'BD PROCHOT' to avoid damage to the system.
Enabling this option will disable Apple's XNU CPU Power Management (XCPM)
and fall back onto the older ACPI_SMC_PlatformPlugin.kext.
Note: Only supported on Ivy Bridge EP and newer Macs (2013+)
"""
)
change_menu = input("Disable XCPM?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_xcpm = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_xcpm = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.set_xcpm()
def set_surplus(self):
utilities.cls()
utilities.header(["Override SurPlus MaxKernel"])
@@ -1236,6 +1262,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
],
[f"Set Hibernation Workaround:\tCurrently {self.constants.disable_connectdrivers}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_hibernation_workaround],
[f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle],
[f"Disable XCPM:\t\tCurrently {self.constants.disable_xcpm}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_xcpm],
[f"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
[f"Set 3rd Party SSD Support:\tCurrently {self.constants.allow_3rd_party_drives}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_3rd_party_drices],
[f"Set FeatureUnlock: \tCurrently {self.constants.fu_status}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_fu_settings],

View File

@@ -14,8 +14,8 @@ from data import os_data
class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.4.2" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.3.1" # PatcherSupportPkg
self.patcher_version = "0.4.3" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.3.4" # PatcherSupportPkg
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
self.discord_link = "https://discord.gg/rqdPgH8xSN"
@@ -26,20 +26,20 @@ class Constants:
# OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg
self.opencore_commit = "b530a29 - 01-11-2022"
self.opencore_version = "0.7.7"
self.opencore_commit = "30798fb - 02-07-2022"
self.opencore_version = "0.7.8"
# Kext Versioning
## Acidanthera
## https://github.com/acidanthera
self.lilu_version = "1.5.9" # Lilu
self.whatevergreen_version = "1.5.6" # WhateverGreen
self.lilu_version = "1.6.0" # Lilu
self.whatevergreen_version = "1.5.7" # WhateverGreen
self.airportbcrmfixup_version = "2.1.3" # AirPortBrcmFixup
self.nvmefix_version = "1.0.9" # NVMeFix
self.applealc_version = "1.6.3" # AppleALC
self.restrictevents_version = "1.0.6" # RestrictEvents
self.restrictevents_mbp_version = "1.0.6" # RestrictEvents blocking displaypolicyd (see RestrictEvents-MBP91.patch)
self.featureunlock_version = "1.0.6" # FeatureUnlock
self.featureunlock_version = "1.0.7" # FeatureUnlock
self.debugenhancer_version = "1.0.4" # DebugEnhancer
self.cpufriend_version = "1.2.4" # CPUFriend
self.bluetool_version = "2.6.1" # BlueToolFixup (BrcmPatchRAM)
@@ -57,10 +57,12 @@ class Constants:
## Apple - Dortania Modified
self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet
self.i210_version = "1.0.0" # CatalinaIntelI210Ethernet
self.corecaptureelcap_version = "1.0.1" # corecaptureElCap
self.io80211elcap_version = "2.0.0" # IO80211ElCap
self.io80211high_sierra_version = "1.0.1" # IO80211HighSierra
self.io80211mojave_version = "1.0.1" # IO80211Mojave
self.bigsursdxc_version = "1.0.0" # BigSurSDXC
## Dortania
## https://github.com/dortania
@@ -68,7 +70,7 @@ class Constants:
self.smcspoof_version = "1.0.0" # SMC-Spoof
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
self.btspoof_version = "1.0.0" # Bluetooth-Spoof
self.aspp_override_version = "1.0.0" # ACPI_SMC_PlatformPlugin Override
self.aspp_override_version = "1.0.1" # ACPI_SMC_PlatformPlugin Override
## Syncretic
## https://forums.macrumors.com/members/syncretic.1173816/
@@ -185,6 +187,7 @@ class Constants:
self.allow_3rd_party_drives = True # Allow ThridPartyDrives quirk
self.set_content_caching = False # Set Content Caching
self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches
self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext)
self.legacy_accel_support = [
os_data.os_data.mojave,
@@ -283,6 +286,10 @@ class Constants:
def bcm570_path(self):
return self.payload_kexts_path / Path(f"Ethernet/CatalinaBCM5701Ethernet-v{self.bcm570_version}.zip")
@property
def i210_path(self):
return self.payload_kexts_path / Path(f"Ethernet/CatalinaIntelI210Ethernet-v{self.i210_version}.zip")
@property
def marvel_path(self):
return self.payload_kexts_path / Path(f"Ethernet/MarvelYukonEthernet-v{self.marvel_version}.zip")
@@ -294,6 +301,10 @@ class Constants:
@property
def mce_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleMCEReporterDisabler-v{self.mce_version}.zip")
@property
def bigsursdxc_path(self):
return self.payload_kexts_path / Path(f"Misc/BigSurSDXC-v{self.bigsursdxc_version}.zip")
@property
def mousse_path(self):
@@ -693,10 +704,6 @@ class Constants:
def legacy_wifi_support(self):
return self.payload_apple_application_support / Path("Legacy-Wifi")
@property
def legacy_keyboard_backlight_support(self):
return self.payload_apple_application_support / Path("Keyboard-Backlight")
@property
def legacy_dropbox_support(self):
return self.payload_apple_application_support / Path("Dropbox")

View File

@@ -153,6 +153,14 @@ class NVMeController(PCIDevice):
aspm: Optional[int] = None
# parent_aspm: Optional[int] = None
@dataclass
class EthernetController(PCIDevice):
CLASS_CODE: ClassVar[int] = 0x020000
chipset: enum.Enum = field(init=False)
def __post_init__(self):
self.detect_chipset()
@dataclass
class SATAController(PCIDevice):
@@ -178,6 +186,10 @@ class OHCIController(PCIDevice):
class UHCIController(PCIDevice):
CLASS_CODE: ClassVar[int] = 0x0c0300
@dataclass
class SDXCController(PCIDevice):
CLASS_CODE: ClassVar[int] = 0x080501
@dataclass
class NVIDIA(GPU):
VENDOR_ID: ClassVar[int] = 0x10DE
@@ -205,6 +217,18 @@ class NVIDIA(GPU):
else:
self.arch = NVIDIA.Archs.Unknown
@dataclass
class NVIDIAEthernet(EthernetController):
VENDOR_ID: ClassVar[int] = 0x10DE
class Chipsets(enum.Enum):
nForceEthernet = "nForceEthernet"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
# nForce driver matches against Vendor ID, thus making all nForce chipsets supported
self.chipset = NVIDIAEthernet.Chipsets.nForceEthernet
@dataclass
class AMD(GPU):
@@ -298,6 +322,27 @@ class Intel(GPU):
else:
self.arch = Intel.Archs.Unknown
@dataclass
class IntelEthernet(EthernetController):
VENDOR_ID: ClassVar[int] = 0x8086
class Chipsets(enum.Enum):
AppleIntel8254XEthernet = "AppleIntel8254XEthernet Supported"
AppleIntelI210Ethernet = "AppleIntelI210Ethernet Supported"
Intel82574L = "Intel82574L Supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in pci_data.intel_ids.AppleIntel8254XEthernet:
self.chipset = IntelEthernet.Chipsets.AppleIntel8254XEthernet
elif self.device_id in pci_data.intel_ids.AppleIntelI210Ethernet:
self.chipset = IntelEthernet.Chipsets.AppleIntelI210Ethernet
elif self.device_id in pci_data.intel_ids.Intel82574L:
self.chipset = IntelEthernet.Chipsets.Intel82574L
else:
self.chipset = IntelEthernet.Chipsets.Unknown
@dataclass
class Broadcom(WirelessCard):
@@ -328,6 +373,21 @@ class Broadcom(WirelessCard):
else:
self.chipset = Broadcom.Chipsets.Unknown
@dataclass
class BroadcomEthernet(EthernetController):
VENDOR_ID: ClassVar[int] = 0x14E4
class Chipsets(enum.Enum):
AppleBCM5701Ethernet = "AppleBCM5701Ethernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in pci_data.broadcom_ids.AppleBCM5701Ethernet:
self.chipset = BroadcomEthernet.Chipsets.AppleBCM5701Ethernet
else:
self.chipset = BroadcomEthernet.Chipsets.Unknown
@dataclass
class Atheros(WirelessCard):
@@ -348,6 +408,56 @@ class Atheros(WirelessCard):
self.chipset = Atheros.Chipsets.Unknown
@dataclass
class Aquantia(EthernetController):
VENDOR_ID: ClassVar[int] = 0x1D6A
class Chipsets(enum.Enum):
# pylint: disable=invalid-name
AppleEthernetAquantiaAqtion = "AppleEthernetAquantiaAqtion supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in pci_data.aquantia_ids.AppleEthernetAquantiaAqtion:
self.chipset = Aquantia.Chipsets.AppleEthernetAquantiaAqtion
else:
self.chipset = Aquantia.Chipsets.Unknown
@dataclass
class Marvell(EthernetController):
VENDOR_ID: ClassVar[int] = 0x11AB
class Chipsets(enum.Enum):
MarvelYukonEthernet = "MarvelYukonEthernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in pci_data.marvell_ids.MarvelYukonEthernet:
self.chipset = Marvell.Chipsets.MarvelYukonEthernet
else:
self.chipset = Marvell.Chipsets.Unknown
@dataclass
class SysKonnect(EthernetController):
VENDOR_ID: ClassVar[int] = 0x1148
class Chipsets(enum.Enum):
MarvelYukonEthernet = "MarvelYukonEthernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in pci_data.syskonnect_ids.MarvelYukonEthernet:
self.chipset = SysKonnect.Chipsets.MarvelYukonEthernet
else:
self.chipset = SysKonnect.Chipsets.Unknown
@dataclass
class Computer:
real_model: Optional[str] = None
@@ -359,11 +469,14 @@ class Computer:
dgpu: Optional[GPU] = None # Shortcut for GFX0
storage: list[PCIDevice] = field(default_factory=list)
usb_controllers: list[PCIDevice] = field(default_factory=list)
sdxc_controller: list[PCIDevice] = field(default_factory=list)
ethernet: Optional[EthernetController] = field(default_factory=list)
wifi: Optional[WirelessCard] = None
cpu: Optional[CPU] = None
oclp_version: Optional[str] = None
opencore_version: Optional[str] = None
bluetooth_chipset: Optional[str] = None
ambient_light_sensor: Optional[bool] = False
third_party_sata_ssd: Optional[bool] = False
@staticmethod
@@ -375,9 +488,12 @@ class Computer:
computer.wifi_probe()
computer.storage_probe()
computer.usb_controller_probe()
computer.sdxc_controller_probe()
computer.ethernet_probe()
computer.smbios_probe()
computer.cpu_probe()
computer.bluetooth_probe()
computer.ambient_light_sensor_probe()
computer.sata_disk_probe()
return computer
@@ -434,6 +550,25 @@ class Computer:
break
ioreg.IOObjectRelease(device)
def ambient_light_sensor_probe(self):
device = next(ioreg.ioiterator_to_list(ioreg.IOServiceGetMatchingServices(ioreg.kIOMasterPortDefault, ioreg.IOServiceNameMatching("ALS0".encode()), None)[1]), None)
if device:
self.ambient_light_sensor = True
ioreg.IOObjectRelease(device)
def sdxc_controller_probe(self):
sdxc_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault,
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": [{"class-code": binascii.a2b_hex(utilities.hexswap(hex(SDXCController.CLASS_CODE)[2:].zfill(8)))}]},
None,
)[1]
)
for device in sdxc_controllers:
self.sdxc_controller.append(SDXCController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
def usb_controller_probe(self):
xhci_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
@@ -476,7 +611,24 @@ class Computer:
for device in uhci_controllers:
self.usb_controllers.append(UHCIController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
def ethernet_probe(self):
ethernet_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault,
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": [{"class-code": binascii.a2b_hex(utilities.hexswap(hex(EthernetController.CLASS_CODE)[2:].zfill(8)))}]},
None,
)[1]
)
# for device in ethernet_controllers:
# self.ethernet.append(EthernetController.from_ioregistry(device))
# ioreg.IOObjectRelease(device)
for device in ethernet_controllers:
vendor: Type[EthernetController] = PCIDevice.from_ioregistry(device).vendor_detect(inherits=EthernetController) # type: ignore
if vendor:
self.ethernet.append(vendor.from_ioregistry(device)) # type: ignore
ioreg.IOObjectRelease(device)
def storage_probe(self):
sata_controllers = ioreg.ioiterator_to_list(

View File

@@ -168,9 +168,18 @@ Please build OpenCore first!"""
# cancelled prompt
return
else:
utilities.TUIOnlyPrint(
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + ["", "Please report this to the devs at GitHub."]
).start()
if self.constants.gui_mode is False:
utilities.TUIOnlyPrint(
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + [""]
).start()
else:
print("An error occurred!")
print(result.stderr.decode())
# Check if we're in Safe Mode, and if so, tell user FAT32 is unsupported
if utilities.check_boot_mode() == "safe_boot":
print("\nSafe Mode detected. FAT32 is unsupported by macOS in this mode.")
print("Please disable Safe Mode and try again.")
return
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {full_disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
parent_disk = partition_info["ParentWholeDisk"]
@@ -242,7 +251,10 @@ Please build OpenCore first!"""
print("\nPress [Enter] to continue.\n")
input()
else:
utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!", "Please report this to the devs at GitHub."]).start()
if self.constants.gui_mode is False:
utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!"]).start()
else:
print("EFI failed to mount!")
def rmtree_handler(func, path, exc_info):
if exc_info[0] == FileNotFoundError:

View File

@@ -87,6 +87,7 @@ def download_install_assistant(download_path, ia_link):
return False
def install_macOS_installer(download_path):
print("- Extracting macOS installer from InstallAssistant.pkg\n This may take some time")
args = [
"osascript",
"-e",

View File

@@ -16,6 +16,7 @@ class OpenCoreLegacyPatcher:
self.generate_base_data()
if utilities.check_cli_args() is None:
if launch_gui is True:
utilities.disable_cls()
from gui import gui_main
gui_main.wx_python_gui(self.constants)
else:

View File

@@ -24,11 +24,16 @@ class PatchSysVolume:
self.root_mount_path = None
self.validate = False
self.added_legacy_kexts = False
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
# GUI will detect hardware patches betfore starting PatchSysVolume()
# However the TUI will not, so allow for data to be passed in manually avoiding multiple calls
if hardware_details is None:
hardware_details = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set()
self.init_hardware_patches(hardware_details)
self.init_pathing(custom_root_mount_path=None, custom_data_mount_path=None)
def init_hardware_patches(self, hardware_details):
self.amfi_must_disable = hardware_details["Settings: Requires AMFI exemption"]
self.check_board_id = hardware_details["Settings: Requires Board ID validation"]
@@ -52,7 +57,11 @@ class PatchSysVolume:
self.legacy_gmux = hardware_details["Miscellaneous: Legacy GMUX"]
self.legacy_keyboard_backlight = hardware_details["Miscellaneous: Legacy Keyboard Backlight"]
if self.constants.detected_os > os_data.os_data.catalina:
def init_pathing(self, custom_root_mount_path=None, custom_data_mount_path=None):
if custom_root_mount_path and custom_data_mount_path:
self.mount_location = custom_root_mount_path
self.data_mount_location = custom_data_mount_path
elif self.root_supports_snapshot is True:
# Big Sur and newer use APFS snapshots
self.mount_location = "/System/Volumes/Update/mnt1"
self.mount_location_data = ""
@@ -72,8 +81,11 @@ class PatchSysVolume:
def find_mount_root_vol(self, patch):
self.root_mount_path = utilities.get_disk_path()
if self.root_mount_path.startswith("disk"):
if self.constants.detected_os == os_data.os_data.catalina and self.validate is False:
print("- Mounting Catalina Root Volume as writable")
if (
self.constants.detected_os == os_data.os_data.catalina or
(self.constants.detected_os > os_data.os_data.catalina and self.root_supports_snapshot is False)
):
print("- Mounting Dedicated Root Volume as writable")
utilities.elevated(["mount", "-uw", f"{self.mount_location}/"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print(f"- Found Root Volume at: {self.root_mount_path}")
if Path(self.mount_extensions).exists():
@@ -81,7 +93,7 @@ class PatchSysVolume:
if patch is True:
# Root Volume unpatching is unreliable due to being a live volume
# Only worth while on Big Sur as '--last-sealed-snapshot' is hit or miss
if self.constants.detected_os == os_data.os_data.big_sur and utilities.check_seal() is True:
if self.constants.detected_os == os_data.os_data.big_sur and self.root_supports_snapshot is True and utilities.check_seal() is True:
self.backup_volume()
self.patch_root_vol()
return True
@@ -89,7 +101,7 @@ class PatchSysVolume:
self.unpatch_root_vol()
return True
else:
if self.constants.detected_os > os_data.os_data.catalina:
if self.constants.detected_os > os_data.os_data.catalina and self.root_supports_snapshot is True:
print("- Mounting APFS Snapshot as writable")
result = utilities.elevated(["mount", "-o", "nobrowse", "-t", "apfs", f"/dev/{self.root_mount_path}", self.mount_location], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode == 0:
@@ -99,7 +111,7 @@ class PatchSysVolume:
if patch is True:
# Root Volume unpatching is unreliable due to being a live volume
# Only worth while on Big Sur as '--last-sealed-snapshot' is hit or miss
if self.constants.detected_os == os_data.os_data.big_sur and utilities.check_seal() is True:
if self.constants.detected_os == os_data.os_data.big_sur and self.root_supports_snapshot is True and utilities.check_seal() is True:
self.backup_volume()
self.patch_root_vol()
return True
@@ -207,7 +219,7 @@ class PatchSysVolume:
print("- Could not find Extensions.zip, cannot manually unpatch root volume")
def unpatch_root_vol(self):
if self.constants.detected_os > os_data.os_data.catalina:
if self.constants.detected_os > os_data.os_data.catalina and self.root_supports_snapshot is True:
print("- Reverting to last signed APFS snapshot")
result = utilities.elevated(["bless", "--mount", self.mount_location, "--bootefi", "--last-sealed-snapshot"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
@@ -217,9 +229,7 @@ class PatchSysVolume:
print("- Failed to revert snapshot via bless, falling back on manual restoration")
self.manual_root_patch_revert()
else:
if (Path(self.mount_application_support) / Path("SkyLightPlugins")).exists():
print("- Found SkylightPlugins folder, removing")
utilities.process_status(utilities.elevated(["rm", "-rf", f"{self.mount_application_support}/SkyLightPlugins"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
self.clean_skylight_plugins()
print("- Unpatching complete")
print("\nPlease reboot the machine for patches to take effect")
else:
@@ -247,12 +257,7 @@ class PatchSysVolume:
else:
self.success_status = True
print("- Successfully built new kernel cache")
# if self.constants.gui_mode is False:
# if self.constants.detected_os > os_data.os_data.catalina:
# input("Press [ENTER] to continue with snapshotting")
# else:
# input("Press [ENTER] to continue with kernel and dyld cache merging")
if self.constants.detected_os > os_data.os_data.catalina:
if self.root_supports_snapshot is True:
print("- Creating new APFS snapshot")
bless = utilities.elevated(
["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
@@ -270,8 +275,9 @@ class PatchSysVolume:
if self.constants.detected_os == os_data.os_data.catalina:
print("- Merging kernel cache")
utilities.process_status(utilities.elevated(["kcditto"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print("- Merging dyld cache")
utilities.process_status(utilities.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]))
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina]:
print("- Merging dyld cache")
utilities.process_status(utilities.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]))
print("- Patching complete")
print("\nPlease reboot the machine for patches to take effect")
if self.constants.gui_mode is False:
@@ -301,6 +307,11 @@ class PatchSysVolume:
utilities.process_status(utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def clean_skylight_plugins(self):
if (Path(self.mount_application_support) / Path("SkyLightPlugins/")).exists():
print("- Found SkylightPlugins folder, removing")
utilities.process_status(utilities.elevated(["rm", "-rf", f"{self.mount_application_support}/SkyLightPlugins"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def add_brightness_patch(self):
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
@@ -339,8 +350,10 @@ class PatchSysVolume:
)
def add_legacy_keyboard_backlight_patch(self):
print("- Merging Keyboard Backlight SkyLightPlugins")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_keyboard_backlight_support}/", self.mount_application_support], stdout=subprocess.PIPE)
print("- Enabling Keyboard Backlight delay")
utilities.process_status(
utilities.elevated(["defaults", "write", "/Library/Preferences/.GlobalPreferences.plist", "NonMetal_BacklightHack", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
def add_legacy_dropbox_patch(self):
print("- Merging DropboxHack SkyLightPlugins")
@@ -396,7 +409,6 @@ class PatchSysVolume:
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey] and self.constants.allow_ts2_accel is True:
# TODO: Enable for Monterey when acceleration patches proress
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11TS2)
@@ -506,6 +518,9 @@ class PatchSysVolume:
if self.constants.detected_os == os_data.os_data.monterey:
self.add_legacy_dropbox_patch()
if self.legacy_keyboard_backlight is True:
self.add_legacy_keyboard_backlight_patch()
print("- Merging general legacy Frameworks")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if self.constants.detected_os > os_data.os_data.big_sur:
@@ -543,6 +558,10 @@ class PatchSysVolume:
def patch_root_vol(self):
print(f"- Running patches for {self.model}")
# Before starting, clean out old plugins
self.clean_skylight_plugins()
# Graphics patches
if self.nvidia_legacy is True:
print("- Installing legacy Nvidia Patches")
@@ -630,10 +649,6 @@ class PatchSysVolume:
if self.legacy_gmux is True:
print("- Installing Legacy Mux Brightness support")
self.add_legacy_mux_patch()
if self.legacy_keyboard_backlight is True:
print("- Installing Legacy Keyboard Backlight support")
self.add_legacy_keyboard_backlight_patch()
if self.validate is False:
self.rebuild_snapshot()

View File

@@ -1,5 +1,10 @@
from resources import constants, device_probe, utilities, generate_smbios
from data import model_array, os_data, smbios_data, cpu_data, sip_data
# Hardware Detection Logic for Root Patching
# Returns a dictionary of patches with boolean values
# Used when supplying data to sys_patch.py
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
from resources import constants, device_probe, utilities
from data import model_array, os_data, sip_data
class detect_root_patch:
def __init__(self, model, versions):
@@ -50,7 +55,7 @@ class detect_root_patch:
if self.constants.detected_os > non_metal_os:
self.nvidia_legacy = True
self.amfi_must_disable = True
# self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler:
if self.constants.detected_os > os_data.os_data.big_sur:
# Kepler drivers were dropped with Beta 7
@@ -73,11 +78,13 @@ class detect_root_patch:
if self.constants.detected_os > non_metal_os:
self.iron_gpu = True
self.amfi_must_disable = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
elif gpu.arch == device_probe.Intel.Archs.Sandy_Bridge:
if self.constants.detected_os > non_metal_os:
self.sandy_gpu = True
self.amfi_must_disable = True
self.check_board_id = True
self.legacy_keyboard_backlight = self.check_legacy_keyboard_backlight()
elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
if self.constants.detected_os > os_data.os_data.big_sur:
self.ivy_gpu = True
@@ -90,6 +97,7 @@ class detect_root_patch:
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.legacy_keyboard_backlight = False
def check_dgpu_status(self):
dgpu = self.constants.computer.dgpu
@@ -111,14 +119,10 @@ class detect_root_patch:
return False
def check_legacy_keyboard_backlight(self):
# With Big Sur and newer, Skylight patch set unfortunately breaks native keyboard backlight
# Penryn Macs are able to re-enable the keyboard backlight by simply running '/usr/libexec/TouchBarServer'
# For Arrendale and newer, this has no effect.
if self.model.startswith("MacBookPro") or self.model.startswith("MacBookAir"):
# non-Metal MacBooks never had keyboard backlight
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
if self.constants.detected_os > os_data.os_data.catalina:
return True
# iMac12,x+ have an 'ACPI0008' device, but it's not a keyboard backlight
# Best to assume laptops will have a keyboard backlight
if self.model.startswith("MacBook"):
return self.constants.computer.ambient_light_sensor
return False
def detect_patch_set(self):

View File

@@ -84,6 +84,14 @@ def get_disk_path():
root_mount_path = root_mount_path[:-2] if root_mount_path.count("s") > 1 else root_mount_path
return root_mount_path
def check_if_root_is_apfs_snapshot():
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
try:
is_snapshotted = root_partition_info["APFSSnapshot"]
except KeyError:
is_snapshotted = False
return is_snapshotted
def check_seal():
# 'Snapshot Sealed' property is only listed on booted snapshots
@@ -312,7 +320,7 @@ def verify_network_connection(url):
except (requests.exceptions.Timeout, requests.exceptions.TooManyRedirects, requests.exceptions.ConnectionError, requests.exceptions.HTTPError):
return False
def download_file(link, location, is_gui=None):
def download_file(link, location, is_gui=None, verify_checksum=False):
if verify_network_connection(link):
short_link = os.path.basename(link)
if Path(location).exists():
@@ -361,13 +369,18 @@ def download_file(link, location, is_gui=None):
if total_file_size > 1024:
total_downloaded_string = f" ({round(float(dl / total_file_size * 100), 2)}%)"
print(f"{round(count / 1024 / 1024, 2)}MB Downloaded{file_size_string}{total_downloaded_string}\nAverage Download Speed: {round(dl//(time.perf_counter() - start) / 100000 / 8, 2)} MB/s")
checksum = hashlib.sha256()
with location.open("rb") as file:
chunk = file.read(1024 * 1024 * 16)
while chunk:
checksum.update(chunk)
if verify_checksum is True:
# Verify checksum
# Note that this can be quite taxing on slower Macs
checksum = hashlib.sha256()
with location.open("rb") as file:
chunk = file.read(1024 * 1024 * 16)
return checksum
while chunk:
checksum.update(chunk)
chunk = file.read(1024 * 1024 * 16)
return checksum
return True
else:
cls()
header = "# Could not establish Network Connection with provided link! #"
@@ -393,6 +406,11 @@ def monitor_disk_output(disk):
output = output[-2]
return output
def check_boot_mode():
# Check whether we're in Safe Mode or not
sys_plist = plistlib.loads(subprocess.run(["system_profiler", "SPSoftwareDataType"], stdout=subprocess.PIPE).stdout)
return sys_plist[0]["_items"][0]["boot_mode"]
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
# When runnign through our GUI, we run as root, however we do not get uid 0
# Best to assume CLI is running as root