Compare commits

...

162 Commits
0.3.0 ... 0.3.2

Author SHA1 Message Date
Mykola Grymalyuk
37769e052a Increment Binaries 2021-12-13 11:58:55 -07:00
Mykola Grymalyuk
d94ffc1472 Limit AppleIntelPIIXATA to Big Sur 2021-12-13 11:28:41 -07:00
Mykola Grymalyuk
5c9a0c74d4 Resolve NVMe Patching on 2016-2017 MacBook Pros
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/794
2021-12-13 10:51:10 -07:00
Mykola Grymalyuk
6e20a51d8f utilities.py: Clean up downloader logic 2021-12-12 22:05:00 -07:00
Mykola Grymalyuk
e0284bffe6 Implement SkyLightShims List.txt generation 2021-12-12 20:50:07 -07:00
Mykola Grymalyuk
2b6d318cfd Ensure ACPI path is correctly parsed 2021-12-08 18:04:48 -07:00
Mykola Grymalyuk
faadb3f740 Fix FU versioning 2021-12-08 15:21:26 -07:00
Mykola Grymalyuk
d6a82f08a0 Increment FeatureUnlock 2021-12-08 11:30:20 -07:00
Mykola Grymalyuk
3b22a593dd Sync changelog 2021-12-08 11:18:02 -07:00
Mykola Grymalyuk
56501818a9 Merge pull request #777 from dortania/5k-patch
Add 5k Display Output Support
2021-12-08 11:14:02 -07:00
Mykola Grymalyuk
52225e15b2 Only copy boot.efi if present 2021-12-08 11:12:19 -07:00
Mykola Grymalyuk
f75f1aa87a Ensure boot.efi is copied to root in TUI 2021-12-08 09:16:28 -07:00
Mykola Grymalyuk
e30f8be03d Streamline diags.efi injection, add GUI support 2021-12-08 09:05:13 -07:00
Mykola Grymalyuk
fd2662717c Avoid incorrectly setting Minimal spoof on GCN Macs 2021-12-07 20:35:46 -07:00
Mykola Grymalyuk
83cffeb1e5 Adjust comment 2021-12-07 20:19:14 -07:00
Mykola Grymalyuk
ca734ff055 Add inital 5k Patchset 2021-12-07 20:14:01 -07:00
Mykola Grymalyuk
67ddb619c7 Add 5k Display Data set 2021-12-07 19:14:56 -07:00
Mykola Grymalyuk
36b584dc41 Add Pikera Patch to Legacy GCN 2021-12-07 09:01:37 -07:00
Mykola Grymalyuk
bf86619e82 Add Legacy GCN build support off model 2021-12-05 11:29:16 -07:00
Mykola Grymalyuk
4acf8b1a67 Add Network failure handling 2021-11-28 11:00:32 -07:00
Mykola Grymalyuk
5298c4ecb8 Sync PatcherSupportPkg 2021-11-27 11:31:13 -07:00
Mykola Grymalyuk
be5f9114af Sync PatcherSupportPkg 2021-11-27 10:10:15 -07:00
Mykola Grymalyuk
b1df91cac3 Add Apple RAID Card support 2021-11-25 17:57:31 -07:00
Mykola Grymalyuk
60221edb07 Sync PatcherSupportPkg 2021-11-22 14:04:45 -07:00
Mykola Grymalyuk
779d348853 defaults.py: add break to loops 2021-11-22 13:56:02 -07:00
Mykola Grymalyuk
fcc0516b6a defaults.py: Iterate over computer.gpus
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/753
2021-11-22 13:53:39 -07:00
Mykola Grymalyuk
f840e30f36 Sync PatcherSupportPkg 2021-11-19 20:16:44 -07:00
Mykola Grymalyuk
24e645fb07 Fix typo 2021-11-19 19:59:58 -07:00
Mykola Grymalyuk
a519d66e90 Sync build 2021-11-19 19:41:35 -07:00
Mykola Grymalyuk
5af6c4ac54 Fix Wifi Password prompt in Monterey on legacy wifi 2021-11-19 19:37:17 -07:00
Mykola Grymalyuk
57eb61cb9a Fix USBVideo kext 2021-11-19 19:31:22 -07:00
Mykola Grymalyuk
b2b9cc7686 Fix displaypolicyd blocking 2021-11-19 14:52:36 -07:00
Mykola Grymalyuk
5d07311892 Add return menu to macOS downloader 2021-11-18 17:43:13 -07:00
Mykola Grymalyuk
889b5f3c71 Add legacy iSight patch
Thanks Jazzny for notifying!
2021-11-18 16:46:46 -07:00
Mykola Grymalyuk
eef336ab62 Adjust KeyError level
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/745
2021-11-18 11:33:12 -07:00
Mykola Grymalyuk
c37aa306fd Add 3rd Party SATA SSD detection
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/741
2021-11-17 22:01:26 -07:00
Mykola Grymalyuk
48380afdd5 Avoid enabling AirportBrcmFixup without wifi 2021-11-17 21:41:27 -07:00
Mykola Grymalyuk
1486859d79 Allow disabling of ConnectDrivers
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/742
2021-11-17 12:22:57 -07:00
Mykola Grymalyuk
9a4085ca50 Fix typo 2021-11-15 19:25:18 -07:00
Mykola Grymalyuk
936febe2e4 Move from i++ to enumerate() 2021-11-15 12:30:28 -07:00
Mykola Grymalyuk
3ad2c538be Fix Content Caching with spoofless usage 2021-11-14 21:18:06 -07:00
Mykola Grymalyuk
f705affcae Fix comment 2021-11-14 20:48:00 -07:00
Mykola Grymalyuk
2546e9167f Fix ordering 2021-11-14 20:44:40 -07:00
Mykola Grymalyuk
f84828483b Fix command 2021-11-14 20:43:49 -07:00
Mykola Grymalyuk
4bfe8b1038 Merge pull request #731 from dortania/limit-signing
Limit GUI Signing to Releases
2021-11-14 20:32:01 -07:00
Mykola Grymalyuk
89765a6c5f Fix GUI upload 2021-11-14 20:25:49 -07:00
Mykola Grymalyuk
4c043ab6dc Update build-gui.yml 2021-11-14 20:21:58 -07:00
Mykola Grymalyuk
8efc702077 Limit GUI signing to releases 2021-11-14 20:14:25 -07:00
Mykola Grymalyuk
90cc87702d Add Building from Source documentation 2021-11-14 19:50:45 -07:00
Mykola Grymalyuk
b27007d55c Fix SurPlus entry 2021-11-14 13:27:23 -07:00
Mykola Grymalyuk
0368ab00b7 Remove extra user input prompts during patching 2021-11-14 13:22:26 -07:00
Mykola Grymalyuk
606dc03b2b Remove backups on pre-snapshot based OSes 2021-11-14 12:29:31 -07:00
Mykola Grymalyuk
1799691348 Implement libSystem.dylib based SIP parsing 2021-11-14 12:24:35 -07:00
Mykola Grymalyuk
fda3a1724d Raise SurPlus MaxKernel to 21.99.99 2021-11-14 11:44:12 -07:00
Dhinak G
b320980aef Update issue template 2021-11-13 20:53:32 -05:00
Mykola Grymalyuk
874a0557e3 Increment FeatureUnlock
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/564
2021-11-12 19:07:17 -07:00
Mykola Grymalyuk
8db9cab06c Resolve iMac MXM Nvidia display output 2021-11-12 13:19:52 -07:00
Mykola Grymalyuk
d73f8979eb Increment PatcherSupportPkg 2021-11-11 22:24:01 -07:00
Mykola Grymalyuk
87bdc65e6c Merge pull request #697 from RedBearAK/patch-1
Fix for info about unable to click "Done" button
2021-11-08 16:23:14 -07:00
Mykola Grymalyuk
e325f6a25b Merge pull request #629 from ghost/patch-3
Update TESTED.md
2021-11-08 16:22:38 -07:00
Mykola Grymalyuk
21b2f86654 Clarify FileVault support 2021-11-08 09:06:50 -07:00
Mykola Grymalyuk
afb91b8b4f Add stock drive data set 2021-11-07 12:37:08 -07:00
Mykola Grymalyuk
2ace124880 Sync changelog 2021-11-05 23:30:15 -06:00
Mykola Grymalyuk
6b92640b64 Merge pull request #696 from dortania/walkthrough
Implement macOS InstallAssistant downloader
2021-11-05 23:29:08 -06:00
Mykola Grymalyuk
6689817872 Fix Integrity typo
Thanks to @J-Human
2021-11-05 23:24:13 -06:00
Mykola Grymalyuk
15bcfa7b79 Merge pull request #702 from dortania/airplay-12.1
Fix AirPlay to Mac support for 12.1 Beta 1
2021-11-05 23:19:15 -06:00
Mykola Grymalyuk
a5afbc6420 Fix 12.1 AirPlay to Mac 2021-11-05 23:18:16 -06:00
Mykola Grymalyuk
da32e3bfcf Test AirPlay to Mac fix 2021-11-04 23:40:00 -06:00
RedBearAK
822464a0bf Fix for info about unable to click "Done" button
Found solution for being unable to click the "Done" button when editing Sidebar Widget settings: Shift-Tab instead of Tab.
2021-11-03 18:09:50 -08:00
Mykola Grymalyuk
b42169f980 Strip unused functions 2021-11-03 19:29:24 -06:00
Mykola Grymalyuk
dd17f5da29 Update form 2021-11-03 14:10:38 -06:00
Mykola Grymalyuk
9f3d3453df Avoid Installing OC to ESP if not requested 2021-11-03 11:44:29 -06:00
Mykola Grymalyuk
95521e2225 Update 11.2.3 size 2021-11-03 11:37:05 -06:00
Mykola Grymalyuk
924cac7577 Add 11.2.3 mirror 2021-11-03 11:20:30 -06:00
Mykola Grymalyuk
c83e926e7d Fix exit 2021-11-02 19:18:45 -06:00
Mykola Grymalyuk
4929715830 macOS Installer Creation: initial commit 2021-11-02 18:32:10 -06:00
Mykola Grymalyuk
8fc1bf9572 Clean downloader_file funtion 2021-11-02 15:30:13 -06:00
Mykola Grymalyuk
875e77b0d1 Clean up download_file function 2021-11-02 09:58:09 -06:00
Mykola Grymalyuk
31bfdc755c Fix typo 2021-11-01 10:24:44 -06:00
Mykola Grymalyuk
4424209d3e Increment Binaries 2021-11-01 10:20:12 -06:00
Mykola Grymalyuk
75ca458747 Add Navi 23 IDs 2021-11-01 10:19:54 -06:00
Mykola Grymalyuk
7e08d3afc1 Update Post Install docs 2021-10-31 13:57:00 -06:00
Mykola Grymalyuk
24a0817890 Fix typo 2021-10-31 11:59:48 -06:00
Mykola Grymalyuk
0072cd2988 Update docs 2021-10-31 11:32:24 -06:00
Mykola Grymalyuk
5696dcd934 Fix tabbing 2021-10-31 09:48:06 -06:00
Mykola Grymalyuk
3ac7964fb0 Fix iGPU-only iMac14,x display output
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/661
2021-10-30 10:41:00 -06:00
Mykola Grymalyuk
dc4238fb09 Resolve BCM94331 BT4.0 issue
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/654
2021-10-30 10:36:40 -06:00
Mykola Grymalyuk
d68d04fd8c Update bug_report.yml 2021-10-30 10:21:33 -06:00
Mykola Grymalyuk
08852b8f4c Update issues template 2021-10-30 10:20:17 -06:00
Mykola Grymalyuk
7463d56ffc Adjust SIP naming 2021-10-30 07:51:26 -06:00
Mykola Grymalyuk
377b0dd797 Fix remaining check 2021-10-28 09:25:13 -06:00
Mykola Grymalyuk
ec683f21a4 Fix os_data call
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/647
2021-10-28 09:10:59 -06:00
Mykola Grymalyuk
dabe66e052 Refactor: move to os_data.py usage 2021-10-27 21:16:09 -06:00
Mykola Grymalyuk
91f3b94992 Move ESP disk installation to dedicated file 2021-10-27 20:56:51 -06:00
Mykola Grymalyuk
699ccd50c5 Merge pull request #548 from dortania/vmm
Support Spoofless Approach via VMM
2021-10-27 20:07:58 -06:00
Mykola Grymalyuk
491b5fe078 Sync changelog 2021-10-27 20:07:41 -06:00
Mykola Grymalyuk
5db6be9828 Merge branch 'main' into vmm 2021-10-26 20:01:15 -06:00
lulu-gh
e3871d5c35 Update TESTED.md 2021-10-26 15:58:25 -07:00
Mykola Grymalyuk
11a427ef01 Merge pull request #624 from Ausdauersportler/patch-7
Update MONTEREY-DROP.md
2021-10-26 16:14:14 -06:00
Ausdauersportler
5c54276a85 Update MONTEREY-DROP.md
Added short section about NVIDIA Kepler based systems.
2021-10-26 17:31:32 +02:00
Mykola Grymalyuk
7f9311c175 Merge pull request #619 from educovas/main
Update brightness control models
2021-10-26 08:09:06 -06:00
educovas
e4682f6307 Update brightness control models 2021-10-25 18:37:39 -03:00
Mykola Grymalyuk
bc88ed27d1 Increment version 2021-10-25 15:20:26 -06:00
Mykola Grymalyuk
113156c94c Sync changelog 2021-10-25 15:13:38 -06:00
Mykola Grymalyuk
99879bdcfc Resolve CPUFriend injection 2021-10-24 09:36:03 -06:00
Mykola Grymalyuk
e1cb78fa0b Merge pull request #614 from akidone/patch-1
TESTED.md
2021-10-24 09:23:41 -06:00
akidone
6109d8c92f TESTED.md
Added my good old MacBookPro10,2 to the list, as it works perfectly with patcher 0.3.0.
2021-10-24 11:20:27 +02:00
Mykola Grymalyuk
b473d189dd Sync PatcherSupportPkg 2021-10-23 22:05:31 -06:00
Mykola Grymalyuk
3b89fc2950 Sync PatcherSupportPkg 2021-10-22 16:12:59 -06:00
Mykola Grymalyuk
707cc5c45f Clarify VMM comment 2021-10-21 16:44:15 -06:00
Mykola Grymalyuk
80e5c38ee7 Merge branch 'main' into vmm 2021-10-21 16:42:37 -06:00
Mykola Grymalyuk
1b4fd73673 Add TS2 MacBook Pro troubleshooting 2021-10-21 15:50:16 -06:00
Mykola Grymalyuk
aec3bf4d08 Git's drunk 2021-10-21 12:53:26 -06:00
Mykola Grymalyuk
1b76b68a1b Fix cslv
Weird git bug, for some reason didn't update this correctly
2021-10-21 12:49:40 -06:00
Mykola Grymalyuk
1190e169cb Merge branch 'main' into vmm 2021-10-21 12:42:54 -06:00
Mykola Grymalyuk
ca2fd695b3 Fix crashing on dict append
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/597
2021-10-21 11:34:46 -06:00
Mykola Grymalyuk
9669196a07 Add ADP2,1 data set 2021-10-20 20:44:40 -06:00
Mykola Grymalyuk
88696c7047 Add MacBookPro18,x data set 2021-10-20 14:27:21 -06:00
Mykola Grymalyuk
8706959f65 Sync PatchSupportPkg 2021-10-20 14:25:40 -06:00
Mykola Grymalyuk
a63d1953b4 Fix non-Metal Control Center 2021-10-19 13:18:11 -06:00
Mykola Grymalyuk
6d129505ea Fix non-Metal acceleration crashing on 12.0.1 2021-10-18 21:53:31 -06:00
Mykola Grymalyuk
f12028aa84 Add support for RELEASE kexts 2021-10-18 20:17:45 -06:00
Mykola Grymalyuk
cf2a58e6bf Merge branch 'main' into vmm 2021-10-18 19:41:47 -06:00
Mykola Grymalyuk
6bc36c737c Remove legacy GMUX patch set for MacBookPro5,x
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/584
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/580
2021-10-17 15:53:38 -06:00
Mykola Grymalyuk
5f07e9ffd9 Drop CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE usage 2021-10-17 15:48:08 -06:00
Mykola Grymalyuk
9f4d96d446 Merge branch 'main' into vmm 2021-10-17 11:25:40 -06:00
Mykola Grymalyuk
0ff6a18e83 Avoid erroring on odd length values 2021-10-17 10:10:40 -06:00
Mykola Grymalyuk
a153b500b9 Remove garbage 2021-10-17 00:14:32 -06:00
Mykola Grymalyuk
db617db1fd Allow for setting custom SIP values via TUI
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/516
2021-10-17 00:13:49 -06:00
Mykola Grymalyuk
69e50aeb6d Fix incorrectly parsing SecureBootModel status
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/581
2021-10-16 23:21:29 -06:00
Mykola Grymalyuk
eaa686e045 Add saftey check for Vault configurations 2021-10-16 21:51:55 -06:00
Mykola Grymalyuk
6381910639 Update binaries to release build 2021-10-16 13:57:40 -06:00
Mykola Grymalyuk
68d25d30b4 Merge pull request #579 from educovas/main
Update documentation
2021-10-16 13:55:22 -06:00
educovas
16a666e836 2 2021-10-16 16:48:04 -03:00
educovas
5e91ea181b typo 2021-10-16 16:47:39 -03:00
educovas
f4e487c648 More changes 2021-10-16 16:24:59 -03:00
educovas
d1fbeba50f Add Safari extensions workaround / + 2021-10-16 16:20:32 -03:00
educovas
8c138658e2 Update supported Ones 2021-10-16 16:06:32 -03:00
educovas
729feba2ba Update host and target OS 2021-10-16 16:04:12 -03:00
educovas
978d2fda26 Fix typo 2021-10-16 15:58:51 -03:00
educovas
5e0354531a Monterey legacy WiFi workaround 2021-10-16 15:53:02 -03:00
educovas
19ed65968d Merge pull request #1 from dortania/main
Update
2021-10-16 15:39:55 -03:00
Mykola Grymalyuk
b3ad321922 Merge branch 'main' into vmm 2021-10-16 09:15:54 -06:00
Mykola Grymalyuk
5aee1aa60f Fix GMUX switching
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/574
2021-10-16 08:59:33 -06:00
Mykola Grymalyuk
ab22a225c4 Increment build 2021-10-15 19:54:38 -06:00
Mykola Grymalyuk
ecde9ce077 Fix Nvdiai MXM patch set 2021-10-15 16:08:45 -06:00
Mykola Grymalyuk
c3dfc35692 Adjust defaults for VMM usage 2021-10-15 11:29:56 -06:00
Mykola Grymalyuk
cfa5175c72 Ensure WEG is enabled for iMac MXM patch set 2021-10-15 10:27:07 -06:00
Mykola Grymalyuk
e591f912b9 Strip unneeded agdpmod patches 2021-10-15 10:13:11 -06:00
Mykola Grymalyuk
17c130112e Merge remote-tracking branch 'origin/main' into vmm 2021-10-15 09:40:48 -06:00
Mykola Grymalyuk
1d336f9dcf Merge branch 'main' into vmm 2021-10-11 16:50:35 -06:00
Mykola Grymalyuk
ee15a55876 Merge branch 'main' into vmm 2021-10-10 20:50:25 -06:00
Mykola Grymalyuk
2d9403c524 Fix logic 2021-10-08 08:53:15 -06:00
Mykola Grymalyuk
664b7ddcd4 Merge branch 'main' into vmm 2021-10-08 08:46:31 -06:00
Mykola Grymalyuk
4a8f61a01d Merge branch 'main' into vmm 2021-10-06 10:39:25 -06:00
Mykola Grymalyuk
d62e6fda43 Merge branch 'main' into vmm 2021-10-06 10:29:24 -06:00
Mykola Grymalyuk
3aa6e76c15 Add HW_BID patch 2021-10-05 20:44:29 -06:00
Mykola Grymalyuk
0484e8e18c Fix typo 2021-10-05 17:03:40 -06:00
Mykola Grymalyuk
5a4ee57034 Allow stock Board ID for spoofs 2021-10-05 16:30:02 -06:00
Mykola Grymalyuk
e20bc2aca5 Fix USB map 2021-10-05 15:58:48 -06:00
Mykola Grymalyuk
4d9325b238 Fix typo 2021-10-05 12:07:24 -06:00
Mykola Grymalyuk
84bd66fd92 Implement VMM Patching 2021-10-05 11:51:32 -06:00
70 changed files with 2615 additions and 762 deletions

View File

@@ -1,6 +1,5 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: [bug]
body:
- type: markdown
@@ -101,6 +100,39 @@ body:
- Other/Non-Applicable
validations:
required: true
- type: dropdown
id: verify-previously-reported
attributes:
label: Have you verified whether this issue has been opened before? If no, your issue will be closed
description: If no, your issue will be closed. We'd appreciate it if users check with Github Issue's search before filing (https://github.com/dortania/OpenCore-Legacy-Patcher/issues?q=is%3Aissue)
multiple: true
options:
- 'true'
- 'false'
validations:
required: true
- type: dropdown
id: verify-guide
attributes:
label: Have you verified whether this issue is covered in our guide? ie. Troubleshooting and Legacy Acceleration pages
description: If no, your issue will be closed. We'd appreciate it if users check with Guide before filing (https://dortania.github.io/OpenCore-Legacy-Patcher/)
multiple: true
options:
- 'true'
- 'false'
validations:
required: true
- type: dropdown
id: 3rd-party-application
attributes:
label: Is this issue with a 3rd party application?
description: If yes, please move discussions onto forums. We're unable to dedicate time to working on every single application that may be broken in macOS. Only file issues if you have a fix you'd like to add to our project
multiple: true
options:
- 'true'
- 'false'
validations:
required: true
- type: dropdown
id: os-version
attributes:
@@ -132,7 +164,7 @@ body:
- type: textarea
id: what-happened
attributes:
label: What is the Isssue?
label: What is the Issue?
description: Additionally, explain what you expected to happen?
value: "Please clearly explain the issue"
validations:

View File

@@ -22,11 +22,16 @@ jobs:
- name: Merge new GUI
run: cp OCLP-CLI OpenCore\ Patcher.app/Contents/Resources/
- run: python3 merge_gui.py
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/OCLP-CLI"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app"'
- name: Code Sign Binaries for release
if: github.event_name == 'release'
run: |
'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/OCLP-CLI"'
'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app"'
- run: ditto -c -k --sequesterRsrc --keepParent OpenCore\ Patcher.app OpenCore-Patcher-GUI.app.zip
- run: ./../sign-gui.sh
- name: Notarize Binaries for release
if: github.event_name == 'release'
run: ./../sign-gui.sh
- name: Upload GUI to Artifacts
uses: actions/upload-artifact@v2
with:

6
.gitignore vendored
View File

@@ -2,6 +2,9 @@
OCLP-GUI.command
/payloads/Apple
/payloads/*.zip
/payloads/BuildManifest.plist
/payloads/*.sucatalog
/payloads/*.pkg
/payloads/__MACOSX
/App
/Build-Folder
@@ -16,4 +19,5 @@ __pycache__/
/docs/.vuepress/.config.js.swp
/docs/yarn.lock
/docs/yarn-error.log
/docs/node_modules/
/docs/node_modules/
/payloads/List.txt

View File

@@ -1,5 +1,55 @@
# OpenCore Legacy Patcher changelog
## 0.3.2
- Implement spoofless support (ie. no SMBIOS patching)
- Requires macOS 11.3 or newer, for 11.2.3 and older use Minimal or higher spoofing
- See additional notes before updating: [VMM usage notes](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/543#issuecomment-953441283)
- Adjust SIP setting to better reflect current SIP usage
- Resolve Monterey Bluetooth issues on user-upgraded BCM94331 BT4.0 modules
- Fix iGPU-only iMac14,x display output when using Minimal/Moderate spoof
- Increment Binaries:
- OpenCore 0.7.6 - release
- Lilu 1.5.8 - release
- BrcmPatchRAM 2.6.1 - release
- WhateverGreen 1.5.5 - release
- PatcherSupportPkg 0.2.8 - release
- FeatureUnlock 1.0.5 - rolling (9cf1e81)
- Fix AirPlay to Mac on macOS 12.1
- Add macOS InstallAssistant downloader to TUI
- Resolve rare memory corruption due to FeatureUnlock
- Raise SurPlus MaxKernel to 21.99.99
- Fix Content Caching with spoofless usage
- Allow disabling of ConnectDrivers
- Aid with Hibernation on MacBookPro9,1/MacBookPro10,1
- Add legacy iSight patch
- Applicable for MacBook4,1/5,2
- Affected Device IDs: 0x8300, 0x8501, 0x8503
- Credit to parrotgeek1 for LegacyUSBVideoSupport
- Fix Wifi Password prompt in Monterey on legacy wifi
- Applicable for Atheros, BCM94328, BCM94322
- Fix OpenCL Acceleration on Ivy Bridge and Kepler
- Add Apple RAID Card support
- Add Legacy GCN build support off model for MXM iMacs
- Resolve 5k Display Output support on 5k iMacs and iMac Pro
- Resolve NVMe Patching on 2016-2017 MacBook Pros
- Enable Windows VMX support for Haswell and Broadwell MacBooks
## 0.3.1
- Increment Binaries:
- OpenCorePkg 0.7.4 release
- RestrictEvents 1.0.5 release
- WhateverGreen 1.5.4 release
- Allow for setting custom SIP values via TUI
- Drop `CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE` requirement for root patching
- Lowers default SIP Disabled value to 0xA03
- Update Legacy GMUX patchset to latest Sierra Secuirty Update
- [Source](https://github.com/HackintoshHD/mbp5x-instant-gpu-switching)
- Fix non-Metal acceleration crashing on 12.0.1
- Yes Apple adding a notch broke our accel patches
- Fix non-Metal Control Center crashing on 12.0 Beta 10+
- Increment Binaries:
- PatcherSupportPkg 0.1.12
## 0.3.0
- Fix Nvidia Tesla Acceleration in Monterey Beta 7+
- Add missing NVDAStartup
@@ -84,6 +134,7 @@
- System Preferences will not report settings however
- Allow Root Volume Patched Systems to use FileVault 2
- Requires macOS 11.3 (20E232) or newer
- Unsupported on APFS ROM Patched Macs, revert to stock firmware to resolve
- Add offline TUI build
- Allows for root patching without network connection
- Add Legacy Wireless support for Monterey

View File

@@ -7,7 +7,7 @@ import subprocess
import sys
from pathlib import Path
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments, install
from data import model_array
@@ -72,10 +72,11 @@ class OpenCoreLegacyPatcher:
if ((self.constants.custom_model or self.computer.real_model) in model_array.SupportedSMBIOS) or self.constants.allow_oc_everywhere is True
else []
) + [
["Install OpenCore to USB/internal drive", build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi],
["Install OpenCore to USB/internal drive", install.tui_disk_installation(self.constants).copy_efi],
["Post-Install Volume Patch", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).PatchVolume],
["Change Model", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_model],
["Patcher Settings", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).patcher_settings],
["Installer Creation", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).download_macOS],
["Credits", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).credits],
]
@@ -87,5 +88,5 @@ class OpenCoreLegacyPatcher:
if getattr(sys, "frozen", False) and self.constants.recovery_status is False:
subprocess.run("""osascript -e 'tell application "Terminal" to close first window' & exit""", shell=True)
OpenCoreLegacyPatcher()
if __name__ == '__main__':
OpenCoreLegacyPatcher()

View File

@@ -18,23 +18,19 @@ Note: Only clean-installs and upgrades are supported, macOS Big Sur installs alr
* You can however reinstall macOS with this patcher and retain your original data
Note 2: Currently OpenCore Legacy Patcher officially supports patching to run macOS 11, Big Sur installs. For older OSes, OpenCore may function however support is currently not provided from Dortania.
Note 2: Currently OpenCore Legacy Patcher officially supports patching to run macOS Big Sur and Monterey installs. For older OSes, OpenCore may function however support is currently not provided from Dortania.
* For macOS Mojave and Catalina support, we recommend the use of [dosdude1's patchers](http://dosdude1.com)
* macOS Monterey usage is provided however support is limited, currently recommended for users to run Big Sur for best compatibility
## Running from source
To run the project from source, see here: [Build and run from source](./SOURCE.md)
## Support
To get aid with the patcher, we recommend joining the [OpenCore Patcher Paradise Discord Server](https://discord.gg/rqdPgH8xSN). We're actively there and is the quickest way to receive help. For bigger issues such as patcher crashing on build and such, we recommend opening an issue right here on GitHub(Please review [How to debug with OpenCore](https://dortania.github.io/OpenCore-Legacy-Patcher/DEBUG.html) before opening issues):
* [OpenCore Legacy Patcher's Issue's tab](https://github.com/dortania/OpenCore-Legacy-Patcher/issues)
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)
To get aid with the patcher, we recommend joining the [OpenCore Patcher Paradise Discord Server](https://discord.gg/rqdPgH8xSN). We're actively there and is the quickest way to receive help. For bigger issues such as patcher crashing on build and such, we recommend opening an issue right here on GitHub
* Please review [How to debug with OpenCore](https://dortania.github.io/OpenCore-Legacy-Patcher/DEBUG.html) before opening issues
## Credits

94
SOURCE.md Normal file
View File

@@ -0,0 +1,94 @@
# Build and run from source
OpenCore Legacy Patcher at its core is a python-based TUI/CLI based application. This means that to run the project from source, you simply need to invoke the OpenCore-Patcher.command file via Python.
For developers wishing to validate mainline changes, you may use these nightly links:
* [GUI (Graphical Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OpenCore-Patcher-GUI.app.zip)
* [TUI (Text Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI.app.zip)
* [TUI (Text Based App) - Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI-Offline.app.zip)
**Warning**: These binaries should not be used without first consulting the [CHANGELOG](./CHANGELOG.md). Do not distribute these links in forums, instead direct to this file.
* Users running new builds of the project without understanding what has changed are at higher of bricking their installation as they do not read any warnings provided in the CHANGELOG. We wish to minimize these situations as much as possible.
## 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/).
* Python installations either preinstalled or provided with Xcode/Xcode Tools are unsupported due to reliablility issues
Once Python is installed, open Terminal and run the following:
```sh
# Move into a directory to store the project
cd ~/Developer
# Clone project
git clone https://github.com/dortania/OpenCore-Legacy-Patcher
# Move into Project directory
cd ./OpenCore-Legacy-Patcher
# Install Python dependacies used by the project
pip3 install -r requirements.txt
```
## Running OpenCore Legacy Patcher
To run the project from source, simply invoke via python3:
```sh
python3 OpenCore-Patcher.command
```
Note that the OpenCore-Patcher.command file can be run as both a TUI and a CLI utility for other programs to call. If no core arguments are passed, the TUI is initialized. Otherwise the CLI will start:
```sh
python3 OpenCore-Patcher.command --build --model iMac12,2 --verbose
```
See `-h`/`--help` for more information on supported CLI arguments.
## Generating prebuilt binaries
The main goal of generating prebuilt binaries is to strip the requirement of a local python installation for users. For developers, there's very little benefit besides for usage with the project's GUI ([Generating the GUI](#generating-the-gui)). For development, simply use the OpenCore-Patcher.command file with a python3 installation.
* Note that due to PyInstaller's linking mechanism, binaries generated on Catalina and newer are not compatible with High Sierra and older
* To ensure the largest compatibility, generate binaries on macOS Mojave. These binaries will be compatible with macOS 10.9 to macOS 12.
* Currently our build system is a [Macmini8,1 provided by MacStadium](https://www.macstadium.com/opensource) running macOS Mojave (10.14.6).
```sh
# Install PyInstaller
pip3 install pyinstaller
# Move into project directory
cd ~/Developer/OpenCore-Legacy-Patcher/
# Create the pyinstaller based Application
pyinstaller OpenCore-Patcher.spec
# Post PyInstaller clean up
./after_pyinstaller.sh
# Open build folder
open ./dist/
```
Once done, you'll find the application generated at `./dist/OpenCore-Patcher.app`:
![](./images/build-dist.png)
## Generating the GUI
To generate a GUI, you will have need a core `OpenCore-Patcher` binary generated during the above stage([Generating prebuilt binaries](#generating-prebuilt-binaries)).
Once conditions are met, you'll be able to work with the GUI portion. The source of which is found at [dortania/OCLP-GUI](https://github.com/dortania/OCLP-GUI).
```sh
# Move into a directory to store the project
cd ~/Developer
# Clone project
git clone https://github.com/dortania/OCLP-GUI
# Update the OpenCore-Patcher binary from the core project
cp ./OpenCore-Legacy-Patcher/dist/OpenCore-Patcher ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/
# Rename binary to OCLP-CLI
mv ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/OCLP-GUI/OpenCore-Patcher ./OCLP-GUI/OpenCore\ Patcher/OpenCore\ Patcher/OCLP-GUI/OCLP-CLI
# Build project
cd ./OCLP-GUI/OpenCore\ Patcher; xcodebuild; cd ../../
# Open build folder
open ./OCLP-GUI/OpenCore\ Patcher/build/Release/
```

View File

@@ -19,4 +19,5 @@ class cpu_data(enum.IntEnum):
apple_dtk = 112 # A12
apple_m1 = 114 # A14
apple_m2 = 115 # A15
apple_m1_pro = 115
apple_m1_max = 116

14
data/dylib_data.py Normal file
View File

@@ -0,0 +1,14 @@
# Data for SkyLightShim Plugin systems
class shim_list:
shim_pathing = {
"CoreWLAN.dylib": "/Systen/Library/CoreServices/WiFiAgent.app/Contents/MacOS/WiFiAgent",
"BacklightFixup.dylib": "/System/Library/CoreServices/loginwindow.app/Contents/Mac0S/loginwindow",
}
shim_legacy_accel = [
"CoreWLAN.dylib",
]
shim_legacy_accel_keyboard = [
"BacklightFixup.dylib",
]

11
data/mirror_data.py Normal file
View File

@@ -0,0 +1,11 @@
# Mirrors of Apple's InstallAssistant.ppkg
# Currently only listing important Installers no longer on Apple's servers
Install_macOS_Big_Sur_11_2_3 = {
"Version": "11.2.3",
"Build": "20D91",
"Link": "https://archive.org/download/install-assistant-20D91/InstallAssistant.pkg",
"Size": 12211077798,
"Source": "Archive.org",
"integrity": None,
}

View File

@@ -536,14 +536,6 @@ class amd_ids:
0x6810, # R7 370 / R9 270X/370X
0x6818, # HD 7870
0x6819, # HD 7850 / R7 265 / R9 270 1024SP
# AMDPitcairnGraphicsAccelerator - AMD7000Controller
0x6800, # HD 7970M
0x6801, # HD 8970M
0x6806, # Unknown
0x6808, # W7000
0x6810, # R7 370 / R9 270X/370X
0x6818, # HD 7870
0x6819, # HD 7850 / R7 265 / R9 270 1024SP
# AMDTahitiGraphicsAccelerator - AMD7000Controller
0x6790, # Unknown
0x6798, # HD 7970/8970 OEM / R9 280X / D700
@@ -598,86 +590,89 @@ class amd_ids:
# GCN v4
# AMDRadeonX4000
# AMDBaffinGraphicsAccelerator - AMD9500Controller
0x67E0,
0x67E3,
0x67E8,
0x67EB,
0x67EF,
0x67FF,
0x67E1,
0x67E7,
0x67E9,
0x67E0, # Pro WX 4170
0x67E3, # Pro WX 4100
0x67E8, # Pro WX 4130/4150
0x67EB, # Pro V5300X
0x67EF, # 460/560D / Pro 450/455/460/555/555X/560/560X
0x67FF, # 550 640SP / RX 560/560X
0x67E1, # Unknown
0x67E7, # Unknown
0x67E9, # Unknown
# AMDEllesmereGraphicsAccelerator - AMD9500Controller
0x67C0,
0x67C1,
0x67C2,
0x67C4,
0x67C7,
0x67DF,
0x67D0,
0x67C8,
0x67C9,
0x67CA,
0x67CC,
0x67CF,
0x67C0, # Pro WX 7100 Mobile
0x67C1, # Unknown
0x67C2, # Pro V7300X / V7350x2
0x67C4, # Pro WX 7100
0x67C7, # Pro WX 5100
0x67DF, # 470/480/570/570X/580/580X/590
0x67D0, # Pro V7300X / V7350x2
0x67C8, # Unknown
0x67C9, # Unknown
0x67CA, # Unknown
0x67CC, # Unknown
0x67CF, # Unknown
]
vega_ids = [
# GCN v5
# AMDRadeonX5000
# AMDVega10GraphicsAccelerator - AMD10000Controller
0x6860,
0x6861,
0x6862,
0x6863,
0x6864,
0x6867,
0x6868,
0x6869,
0x686A,
0x686B,
0x686C,
0x686D,
0x686E,
0x686F,
0x687F,
0x6860, # Instinct MI25
0x6861, # Pro WX 9100
0x6862, # Pro SSG
0x6863, # Vega Frontier
0x6864, # Pro V340
0x6867, # Pro Vega 56
0x6868, # Pro WX 8100/8200
0x6869, # Pro Vega 48
0x686A, # Unknown
0x686B, # Pro Vega 64X
0x686C, # Instinct MI25
0x686D, # Unknown
0x686E, # Unknown
0x686F, # Unknown
0x687F, # RX Vega 56/64
# AMDVega12GraphicsAccelerator - AMD10000Controller
0x69A0,
0x69A1,
0x69A2,
0x69A3,
0x69AF,
0x69A0, # Unknown
0x69A1, # Unknown
0x69A2, # Unknown
0x69A3, # Unknown
0x69AF, # Unknown
# AMDVega20GraphicsAccelerator - AMD10000Controller
0x66A0,
0x66A1,
0x66A2,
0x66A3,
0x66A7,
0x66AF,
0x66A0, # Instinct
0x66A1, # Pro VII/Instinct MI50
0x66A2, # Unknown
0x66A3, # Pro Vega II/ Pro Vega II Duo
0x66A7, # Unknown
0x66AF, # VII
]
navi_ids = [
# AMDRadeonX6000
# AMDNavi10GraphicsAccelerator
0x7310,
0x7312,
0x7318,
0x7319,
0x731A,
0x731B,
0x731F,
0x7310, # Pro W5700X
0x7312, # Pro W5700
0x7318, # Unknown
0x7319, # Unknown
0x731A, # Unknown
0x731B, # Unknown
0x731F, # RX 5600/5600 XT / 5700/5700 XT
# AMDNavi12GraphicsAccelerator
0x7360, # 5600M
# AMDNavi14GraphicsAccelerator
0x7340,
0x7341,
0x7343,
0x7347,
0x734F,
0x7340, # 5500/5500M / Pro 5500M
0x7341, # Pro W5500
0x7343, # Unknown
0x7347, # Pro W5500M
0x734F, # Pro W5300M
# AMDNavi21GraphicsAccelerator
0x73A2,
0x73AB,
0x73BF,
0x73A2, # Pro W6900X
0x73AB, # Pro W6800X/Pro W6800X Duo
0x73BF, # 6800/6800 XT / 6900 XT
# AMDNavi23GraphicsAccelerator
0x73E3, # Pro W6600
0x73FF, # 6600/6600 XT/6600M
]
r500_ids = [
@@ -758,65 +753,66 @@ class amd_ids:
class intel_ids:
# https://dgpu-docs.intel.com/devices/hardware-table.html
gma_950_ids = [
0x2582,
0x2592,
0x2772,
0x27A2,
0x2582, # 915G
0x2592, # 915GM
0x2772, # 945G
0x27A2, # 945GM
]
gma_x3100_ids = [
0x2a02,
0x2a02, # 965GM
]
iron_ids = [
# AppleIntelHDGraphics IDs
0x0044,
0x0046,
0x0044, # Unknown
0x0046, # HD Graphics
]
sandy_ids = [
# AppleIntelHD3000Graphics IDs
# AppleIntelSNBGraphicsFB IDs
0x0106,
0x0601,
0x0116,
0x0102,
0x0126,
0x0106, # HD Graphics 2000
0x0601, # Unknown
0x0116, # HD Graphics 3000
0x0102, # HD Graphics 2000
0x0126, # HD Graphics 3000
]
ivy_ids = [
# AppleIntelHD4000Graphics IDs
# AppleIntelFramebufferCapri IDs
0x0152,
0x0156,
0x0162,
0x0166,
0x0152, # HD Graphics 2500
0x0156, # HD Graphics 2500
0x0162, # HD Graphics 4000
0x0166, # HD Graphics 4000
]
haswell_ids = [
# AppleIntelHD5000Graphics IDs
# AppleIntelFramebufferAzul IDs
0x0D26,
0x0A26,
0x0A2E,
0x0D22,
0x0412,
0x0D26, # Iris Pro Graphics P5200
0x0A26, # HD Graphics 5000
0x0A2E, # Iris Graphics 5100
0x0D22, # Iris Pro Graphics 5200
0x0412, # HD Graphics 4600
]
broadwell_ids = [
# AppleIntelBDWGraphicsFramebuffer IDs
0x0BD1,
0x0BD2,
0x0BD3,
0x1606,
0x160E,
0x1616,
0x161E,
0x1626,
0x1622,
0x1612,
0x162B,
0x0BD1, # Unknown
0x0BD2, # Unknown
0x0BD3, # Unknown
0x1606, # HD Graphics
0x160E, # HD Graphics
0x1616, # HD Graphics 5500
0x161E, # HD Graphics 5300
0x1626, # HD Graphics 6000
0x1622, # Iris Pro Graphics 6200
0x1612, # HD Graphics 5600
0x162B, # Iris Graphics 6100
]
skylake_ids = [
@@ -856,9 +852,9 @@ class intel_ids:
]
comet_lake_ids = [
0x9BC8,
0x9BC5,
0x9BC4,
0x9BC8, # UHD Graphics 630
0x9BC5, # UHD Graphics 630
0x9BC4, # UHD Graphics
]
ice_lake_ids = [
@@ -877,9 +873,9 @@ class intel_ids:
AppleIntel8254XEthernet = [
# AppleIntel8254XEthernet IDs
0x1096,
0x100F,
0x105E,
0x1096, # 80003ES2LAN
0x100F, # 82545EM
0x105E, # 82571EB/82571GB
]
AppleIntelI210Ethernet = [
@@ -898,8 +894,8 @@ class intel_ids:
Intel82574L = [
# Intel82574L IDs
0x104B,
0x10F6,
0x104B, # 82566DC
0x10F6, # 82574L
]
@@ -947,11 +943,11 @@ class broadcom_ids:
AppleBCM5701Ethernet = [
# AppleBCM5701Ethernet IDs
0x1684,
0x16B0,
0x16B4,
0x1682,
0x1686,
0x1684, # BCM5764M
0x16B0, # BCM57761
0x16B4, # BCM57765
0x1682, # BCM57762
0x1686, # BCM57766
]

View File

@@ -22,14 +22,17 @@ class system_integrity_protection:
"CSR_ALLOW_UNTRUSTED_KEXTS", # 0x1
"CSR_ALLOW_UNRESTRICTED_FS", # 0x2
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE", # 0x400
]
root_patch_sip_big_sur = [
# Variables required to root patch in Big Sur and Monterey
"CSR_ALLOW_UNTRUSTED_KEXTS", # 0x1
"CSR_ALLOW_UNRESTRICTED_FS", # 0x2
"CSR_ALLOW_UNRESTRICTED_FS", # 0x2 - Required to mount and edit root volume, as well as load modded platform binaries
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE", # 0x400
"CSR_ALLOW_UNAUTHENTICATED_ROOT", # 0x800
"CSR_ALLOW_UNAUTHENTICATED_ROOT", # 0x800 - Required to avoid KC mismatch kernel panic
]
# CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE (introduced with Mojave):
# This bit is quite strange and was originally assumed to be required for modded platform binaries
# However after extensive testing, this doesn't seem true. In addition, this bit is never flipped via
# 'csrutil disable'. Usage within the kernel is not present.

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,10 @@
* [Wake from sleep heavily distorted on AMD/ATI in macOS 11.3 and newer](#wake-from-sleep-heavily-distorted-on-amd-ati-in-macos-11-3-and-newer)
* [Unable to switch GPUs on 2011 15" and 17" MacBook Pros](#unable-to-switch-gpus-on-2011-15-and-17-macbook-pros)
* [Erratic Colours on ATI TeraScale 2 GPUs (HD5000/HD6000)](#erratic-colours-on-ati-terascale-2-gpus-hd5000-hd6000)
* [Unable to allow Safari Extensions](#unable-to-allow-Safari-Extensions)
* [Cannot Login on 2011 15" and 17" MacBook Pros](#cannot-login-on-2011-15-and-17-macbook-pros)
The below page is for users experiencing issues with their overall usage of macOS Big Sur and the Legacy Graphics Acceleration patches. Note that the following GPUs currently do not have acceleration support in Big Sur:
The below page is for users experiencing issues with their overall usage of macOS Big Sur / macOS Monterey and the Legacy Graphics Acceleration patches. Note that the following GPUs currently do not have acceleration support in Big Sur / Monterey:
* Intel 3rd and 4th Gen - GMA series
@@ -33,22 +35,6 @@ For those unfamiliar with what is considered a non-Metal GPU, see below chart:
:::
Additionally we currently do not have macOS Monterey acceleration patches for non-Metal Macs. We recommend users either upgrade their Macs with a Metal GPU or remain on Big Sur until further development
::: details Why there's no non-Metal patches for Monterey
With macOS Monterey, please understand our current legacy acceleration patch sets are no longer functional. As of right now, only basic framebuffer and brightness control may be achieved, however proper animations and hardware acceleration is not available.
This is due to numerous changes with Skylight and other macOS frameworks relying more and more on Metal functions and thus making it even more difficult to re-add legacy OpenGL support.
> When can we expect acceleration support
For the time being, please understand we cannot predict when there will be patch sets ready. Note that it took over 300 days from Big Sur's unveiling to achieve public acceleration for non-Metal GPUs. And with TeraScale 2 acceleration, this took almost 3 years to achieve public acceleration.
So please be patient as developers are hard at work, however please expect no acceleration support in Monterey until next year at the minimum if not even later.
:::
## Downloading older non-Metal Apps
Many Apple apps now have direct reliance on Metal for proper functioning, however legacy builds of these apps still do work in Big Sur. See below for archive of many apps such as Pages, iMovie, GarageBand.
@@ -104,7 +90,7 @@ Due to the Metal Backend, the enhanced color output of these apps seems to heavi
## Cannot press "Done" when editing a Sidebar Widget
To work around this, simply press Tab to hover over and press spacebar to simulate a click.
Workaround: Press some combination of Tab, or Tab and then Shift-Tab, or just Shift-Tab until the "Done" button is highlighted. Then press spacebar to activate the button, the same as in any other dialog with a highlighted button halo.
## Wake from sleep heavily distorted on AMD/ATI in macOS 11.3 and newer
@@ -135,4 +121,33 @@ Due to an odd bug with ATI's TeraScale 2 GPUs, many users will experience errati
Applications that can set color depth are:
* [SwitchResX](https://www.madrau.com)
* [ResXtreme](https://macdownload.informer.com/resxtreme/)
* [ResXtreme](https://macdownload.informer.com/resxtreme/)
## Unable to allow Safari Extensions
Due to an bug on the legacy acceleration patches, users won't be able to enable Safari Extensions
This tool can be used to work-around this issue:
* [Non-Metal Safari Extensions](https://github.com/moosethegoose2213/Non-Metal-Safari-Extensions/)
## Cannot Login on 2011 15" and 17" MacBook Pros
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:
1. Boot macOS in Single User Mode
* Press Cmd+S in OpenCore's menu when you turn the Mac on
2. When command line prompt appears, enter the dGPU disabler argument (at the bottom)
3. Reboot and patched macOS should work normally
4. If you still want to use the dGPU, run OCLP's TUI app and enable TS2 Acceleration. Then root patch your Mac again
* `Patcher Settings -> Misc Settings -> TeraScale 2 Accel`
5. Either Reset NVRAM or set `gpu-power-prefs` to zeros to re-enable the dGPU
```sh
# Forces GMUX to use iGPU only (ie. disable dGPU)
nvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%01%00%00%00
# To reset, simply write zeros or NVRAM Reset your Mac
nvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%00%00%00%00
```

View File

@@ -7,11 +7,11 @@ With OpenCore Legacy Patcher we recommend users go through the below table to un
| Features | [OpenCore Legacy Patcher](https://github.com/dortania/OpenCore-Legacy-Patcher/) | [Patched Sur](https://github.com/BenSova/Patched-Sur) |
| :--- | :--- | :--- |
| Over The Air Updates | <span style="color:#30BCD5">Native System Preferences, additionally supports Deltas (~2GB) for Metal GPUs</span> | <span style="color:red">Inside Patcher Sur app (~12GB), only available when InstallAssistants release.</span> InstallAssistants generally available same day as System Preference updates, however developer betas will lag behind by 1 day compared to OTAs |
| FileVault | <span style="color:#30BCD5">Fully supported on all machines</span> | <span style="color:red">Not supported</span> |
| FileVault | <span style="color:#30BCD5">Fully supported on all machines</span>. Note unsupported on APFS ROM Patched Macs, revert to stock firmware to resolve | <span style="color:red">Not supported</span> |
| System Integrity Protection | <span style="color:#30BCD5">Fully enabled on Metal GPUs</span> | <span style="color:red">Disabled for early 2013 and older during the patching process and first boot afterwards, otherwise enabled</span> |
| APFS Snapshots | <span style="color:#30BCD5">Fully enabled</span> | <span style="color:red">Disabled</span> |
| User facing | <span style="color:red">TUI interface</span> | <span style="color:#30BCD5">SwiftUI interface, more user friendly</span> |
| Supported OSes | <span style="color:#30BCD5">10.7-11</span> | <span style="color:red">10.15-11</span> |
| Supported OSes | <span style="color:#30BCD5">10.7-12</span> | <span style="color:red">10.15-11</span> |
| Firmware Patching | <span style="color:#30BCD5">None required</span> | <span style="color:red">Required for models without native APFS support</span> |
| BootCamp Switching | <span style="color:red">Requires EFI Conversion for Start Disk support, otherwise still supported</span> | <span style="color:#30BCD5">Native</span> |
| Non-Metal GPU Acceleration | <span style="color:#30BCD5">In active development</span>, see Acceleration Progress Tracker: [Link](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108) | <span style="color:red">Currently not researching</span> |

View File

@@ -20,10 +20,10 @@ Regarding OS support, see below:
| Support Entry | Supported OSes | Description | Comment |
| :--- | :--- | :--- | :--- |
| HostOS | macOS 10.9 - macOS 11 | Refers to OSes where running OpenCore-Patcher.app are supported | Supports 10.7+ if [Python 3.9 or higher](https://www.python.org/downloads/) is manually installed, simply run the `OpenCore-Patcher.command` located in the repo |
| TargetOS | macOS 11 | Refers to OSes that can be patched to run with OpenCore | May support 10.4 and newer (in a potentially broken state). No support provided. |
| HostOS | macOS 10.9 - macOS 12 | Refers to OSes where running OpenCore-Patcher.app are supported | Supports 10.7+ if [Python 3.9 or higher](https://www.python.org/downloads/) is manually installed, simply run the `OpenCore-Patcher.command` located in the repo |
| TargetOS | macOS 11 - macOS 12 | Refers to OSes that can be patched to run with OpenCore | May support 10.4 and newer (in a potentially broken state). No support provided. |
* macOS Monterey support is currently in beta and is not recommended for everyday users. The below page is meant to represent macOS Big Sur support and may not correctly reflect Monterey's support on each model
* macOS Monterey support is currently in beta and is not recommended for everyday users.
* Recommend looking at the [macOS Monterey Support page](./MONTEREY-DROP.md) for a better idea of Monterey's current status
### MacBook
@@ -35,7 +35,7 @@ Regarding OS support, see below:
| MacBook3,1 | Late 2007 | ^^ | ^^ |
| MacBook4,1 | Early 2008 | <span style="color:#30BCD5"> YES </span> | - No GPU Acceleration in Mavericks and newer<br/>- No Keyboard and Trackpad<br/>- No USB |
| MacBook5,1 | Late 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> |
| MacBook5,2 | Early 2009 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Trackpad is recognized as mouse<br/>- Brightness control partially supported |
| MacBook5,2 | Early 2009 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Trackpad is recognized as mouse |
| MacBook6,1 | Late 2009 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> |
| MacBook7,1 | Mid-2010 | ^^ | ^^ |
| MacBook8,1 | Mid-2015 | ^^ | <span style="color:green"> Everything is supported</span> |
@@ -107,8 +107,8 @@ Regarding OS support, see below:
| iMac5,1 | Late 2006 | ^^ | 32-Bit Firmware limitation |
| iMac5,2 | ^^ | ^^ | ^^ |
| iMac6,1 | ^^ | ^^ | ^^ |
| iMac7,1 | Mid-2007 | <span style="color:#30BCD5"> YES </span> | - Requires an [SSE4.1 CPU Upgrade](https://lowendmac.com/2018/penryn-t9300-9500-cpu-upgrades-for-the-2007-imac/)<br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Brightness control partially supported on Nvidia GPUs, AMD unsupported<br/>- Stock Bluetooth 2.0 card non-functional |
| iMac8,1 | Early 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)))<br/>- Brightness control partially supported on Nvidia GPUs, AMD unsupported |
| iMac7,1 | Mid-2007 | <span style="color:#30BCD5"> YES </span> | - Requires an [SSE4.1 CPU Upgrade](https://lowendmac.com/2018/penryn-t9300-9500-cpu-upgrades-for-the-2007-imac/)<br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Stock Bluetooth 2.0 card non-functional |
| iMac8,1 | Early 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))) |
| iMac9,1 | Early 2009 | ^^ | ^^ |
| iMac10,1 | Late 2009 | ^^ | - GPU is socketed, [recommend upgrading to Metal GPU](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/?post=17425857#post-17425857) <br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)) |
| iMac11,1 | ^^ | ^^ | ^^ |

View File

@@ -102,6 +102,19 @@ By default these machines require root volume patches to gain graphics accelerat
:::
::: details NVIDIA Kepler dGPU Acceleration (Resolved in 0.2.5 and newer)
* NVIDIA Kepler dGPUs lost support
By default these machines require root volume patches to gain graphics acceleration in Monterey. OpenCore Legacy Patcher supports readding support however SIP can no longer be enabled due to root patching:
* MacBookPro9,1
* MacBookPro10,1
* iMac13,x
* iMac14,x
:::
::: details Non-Metal Acceleration (Resolved in 0.2.5 and newer)
* Non-Metal GPUs no longer have working acceleration patches:

View File

@@ -38,14 +38,46 @@ Note 2: NVRAM may need to be reset to ensure SIP is correctly re-enabled
## Applying Post Install Volume Patches
**Note**: For users who need Post-Install Volume patches for legacy video acceleration support, you **must** disable the following settings in "Patcher Settings" when building and installing your new OpenCore:
For users with unsupported GPUs/wifi cards, you'll need to run the Post Install Root Volume patches to regain functionality. See below on whether your hardware needs root volume patching.
* SIP: Disabled
* SecureBootModel: Disabled
* Hint: Try running the root volume patch option, the Patcher will determine and install patches only when required. So there is no harm in applying them
Once set, rebuild OpenCore, install to drive and reboot. Then, Post-Install Volume patches will run just fine
::: details Unsupported GPUs in macOS Big Sur
To apply the Post-Install Volume patches [to test out the Beta Graphics Acceleration Patches system](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108), select option #3 as shown below:
* Nvidia:
* Tesla (8000 - 300 series)
* AMD:
* TeraScale (2000 - 6000 series)
* Intel:
* Iron Lake
* Sandy Bridge (2000 - 3000 series)
:::
::: details Unsupported GPUs in macOS Monterey
* Nvidia:
* Tesla (8000 - 300 series)
* Kepler (600 - 800 series)
* AMD:
* TeraScale (2000 - 6000 series)
* Intel:
* Iron Lake
* Sandy Bridge (2000 - 3000 series)
* Ivy Bridge (4000 series)
:::
::: details Unsupported Wireless Cards in macOS Monterey
* Broadcom:
* BCM94328
* BCM94322
* Atheros
:::
To apply the Post-Install Volume patches, select option #3 as shown below:
![](../images/root-patch.png)

View File

@@ -58,7 +58,7 @@ To aid users in troubleshooting, we've compiled a list of users who've reported
| ^^ | ^^ | vinaypundith | - Patcher version 0.0.7 |
| MacBookPro10,1 | ^^ | traviswparker | - Stock model <br/>- Patcher version 0.0.14 |
| ^^ | ^^ | il-rollino | - Upgraded BCM94360CSAX <br/>- Patcher version 0.0.21 |
| MacBookPro10,2 | No reports | N/A | N/A |
| MacBookPro10,2 | ^^ | akidone | - Upgraded BCM94360CSAX <br/>- Patcher version 0.3.0 |
### Mac mini
@@ -78,8 +78,8 @@ To aid users in troubleshooting, we've compiled a list of users who've reported
| SMBIOS | Tested | Tester | Comment |
| :--- | :--- | :--- | :--- |
| iMac7,1 | No reports | N/A | N/A |
| iMac8,1 | <span style="color:#30BCD5"> YES </span> | EduCovas | - Stock Model<br/>- Patcher version 0.0.21 |
| iMac7,1 | <span style="color:#30BCD5"> YES </span> | lulujyc | iMac 20-inch 2007. Patcher version 0.3.1. The USB 1.1 controller is rather unstable on Big Sur+, using USB hubs (forcing USB 2.0) can fix unrecognized keyboard/ mouse. Otherwise runs great, including brightness control. Upgraded BCM94352HMB, manually added 3rd-party drivers. Tested: Big Sur, Monterey. |
| iMac8,1 | ^^ | EduCovas | - Stock Model<br/>- Patcher version 0.0.21 |
| iMac9,1 | ^^ | Allanrfox | ^^ |
| ^^ | ^^ | Jakeluke | ^^ |
| iMac10,1 | ^^ | Ausdauersportler | - Upgraded with WX4150 |

View File

@@ -10,6 +10,8 @@ Here are some common errors users may experience while using this patcher:
* [How to Boot Big Sur Recovery](#how-to-boot-big-sur-recovery)
* [Stuck on "Your Mac needs a firmware update"](#stuck-on-your-mac-needs-a-firmware-update)
* [No Brightness Control](#no-brightness-control)
* [Cannot connect Wi-Fi on Monterey with legacy cards](#cannot-connect-Wi-Fi-on-Monterey-with-legacy-cards)
* [No Graphics Acceleration on Intel Ivy Bridge and Nvidia Kepler GPUs](#no-graphics-acceleration-on-intel-ivy-bridge-and-nvidia-kepler-gpus)
## Stuck on `This version of Mac OS X is not supported on this platform`
@@ -68,3 +70,15 @@ With OCLP v0.0.22, we've added support for brightness control on many models. Ho
To work-around, we recommend user try out the below app:
* [Brightness Slider](https://actproductions.net/free-apps/brightness-slider/)
## Cannot connect Wi-Fi on Monterey with legacy cards
With OCLP v0.2.5, we've added support for legacy Wi-Fi on Monterey. However some users may have noticed that they can't connect to wireless networks.
To work-around, we recommend users to manually connect using the "other" option on the Wi-Fi menu bar or manually adding the network on the "Network" preference pane.
## No Graphics Acceleration on Intel Ivy Bridge and Nvidia Kepler GPUs
With macOS Monterey, Apple removed Graphics Drivers for both Intel Ivy Bride and Nvidia Kepler. To re-enable acceleration, simply run the Post Install Root Volume patches.
Once rebooted, acceleration will be re-enabled as well as brightness control for laptops.

BIN
images/build-dist.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

View File

@@ -216,7 +216,56 @@
<key>MmioWhitelist</key>
<array/>
<key>Patch</key>
<array/>
<array>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Skip Board ID check</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AFAAbABhAHQAZgBvAHIAbQBTAHUAcABwAG8AcgB0AC4AcABsAGkAcwB0</data>
<key>Identifier</key>
<string>Apple</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>Replace</key>
<data>AC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAu</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Reroute HW_BID to OC_BID</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>SABXAF8AQgBJAEQA</data>
<key>Identifier</key>
<string>Apple</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>Replace</key>
<data>TwBDAF8AQgBJAEQA</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
<key>Quirks</key>
<dict>
<key>AllowRelocationBlock</key>
@@ -251,6 +300,8 @@
<integer>0</integer>
<key>RebuildAppleMemoryMap</key>
<false/>
<key>ResizeAppleGpuBars</key>
<integer>-1</integer>
<key>SetupVirtualMap</key>
<false/>
<key>SignalAppleOS</key>
@@ -584,7 +635,7 @@
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<string>20.99.99</string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>BundlePath</key>
@@ -1062,6 +1113,42 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>LegacyUSBVideoSupport.kext</string>
<key>Comment</key>
<string>Legacy iSight support</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/LegacyUSBVideoSupport</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>18.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>AppleRAIDCard.kext</string>
<key>Comment</key>
<string>RAID Card Support</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/AppleRAIDCard</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array>
<key>Block</key>
<array/>
@@ -1222,7 +1309,7 @@
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>21.1.0</string>
<string>21.99.99</string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
@@ -1252,7 +1339,7 @@
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>21.1.0</string>
<string>21.99.99</string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
@@ -1262,6 +1349,96 @@
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>Reroute kern.hv_vmm_present patch (1)</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AGRpcmVjdF9oYW5kb2ZmAEVuYWJsZSBkaXJlY3QgaGFuZG9mZiBmb3IgcmVhbHRpbWUgdGhyZWFkcwA=</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>AGh2X3ZtbV9wcmVzZW50AEVuYWJsZSBkaXJlY3QgaGFuZG9mZiBmb3IgcmVhbHRpbWUgdGhyZWFkcwA=</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>Reroute kern.hv_vmm_present patch (2)</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AGh2X2Rpc2FibGUAaHZfdm1tX3ByZXNlbnQA</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>AGh2X2Rpc2FibGUAZGlyZWN0X2hhbmRvZmYA</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string>_IOGetVMMPresent</string>
<key>Comment</key>
<string>Force IOGetVMMPresent</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data></data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>uAEAAADD</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
<key>Quirks</key>
<dict>
@@ -1278,7 +1455,7 @@
<key>DisableIoMapper</key>
<false/>
<key>DisableLinkeditJettison</key>
<true/>
<false/>
<key>DisableRtcChecksum</key>
<false/>
<key>ExtendBTFeatureFlags</key>
@@ -1401,7 +1578,7 @@
<key>ScanPolicy</key>
<integer>0</integer>
<key>SecureBootModel</key>
<string>j137</string>
<string>Default</string>
<key>Vault</key>
<string>Optional</string>
</dict>
@@ -1710,6 +1887,8 @@
<key>Drivers</key>
<array>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>OpenRuntime.efi</string>
<key>Enabled</key>
@@ -1718,6 +1897,8 @@
<string></string>
</dict>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>OpenCanopy.efi</string>
<key>Enabled</key>
@@ -1726,6 +1907,8 @@
<string></string>
</dict>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>NvmExpressDxe.efi</string>
<key>Enabled</key>
@@ -1734,6 +1917,8 @@
<string></string>
</dict>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>ExFatDxeLegacy.efi</string>
<key>Enabled</key>
@@ -1742,6 +1927,8 @@
<string></string>
</dict>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>XhciDxe.efi</string>
<key>Enabled</key>
@@ -1750,6 +1937,8 @@
<string></string>
</dict>
<dict>
<key>Comment</key>
<string></string>
<key>Path</key>
<string>OpenLinuxBoot.efi</string>
<key>Enabled</key>
@@ -1793,6 +1982,8 @@
<false/>
<key>ProvideConsoleGop</key>
<true/>
<key>ReconnectGraphicsOnConnect</key>
<false/>
<key>ReconnectOnResChange</key>
<false/>
<key>ReplaceTabWithSpace</key>
@@ -1801,6 +1992,8 @@
<string>Max</string>
<key>SanitiseClearScreen</key>
<false/>
<key>UIScale</key>
<integer>-1</integer>
<key>TextRenderer</key>
<string>BuiltinGraphics</string>
<key>UgaPassThrough</key>
@@ -1851,6 +2044,8 @@
<false/>
<key>EnableVectorAcceleration</key>
<true/>
<key>EnableVmx</key>
<false/>
<key>DisableSecurityPolicy</key>
<false/>
<key>ExitBootServicesDelay</key>
@@ -1867,6 +2062,8 @@
<false/>
<key>RequestBootVarRouting</key>
<true/>
<key>ResizeGpuBars</key>
<integer>-1</integer>
<key>TscSyncTimeout</key>
<integer>0</integer>
<key>UnblockFsConnect</key>

BIN
payloads/Drivers/diags.efi Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1,56 +0,0 @@
diff --git a/BrcmPatchRAM/BlueToolFixup.cpp b/BrcmPatchRAM/BlueToolFixup.cpp
index 0fa891a..18e4b74 100644
--- a/BrcmPatchRAM/BlueToolFixup.cpp
+++ b/BrcmPatchRAM/BlueToolFixup.cpp
@@ -37,8 +37,10 @@ bool BlueToolFixup::start(IOService *provider) {
}
setProperty("VersionInfo", kextVersion);
setName("bluetooth");
+ /*
uint8_t bytes[] {0x00, 0x00, 0x00, 0x00};
setProperty("transport-encoding", bytes, sizeof(bytes));
+ */
registerService();
return true;
@@ -50,7 +52,22 @@ bool BlueToolFixup::start(IOService *provider) {
static const uint8_t kSkipUpdateFilePathOriginal[] = "/etc/bluetool/SkipBluetoothAutomaticFirmwareUpdate";
static const uint8_t kSkipUpdateFilePathPatched[] = "/System/Library/CoreServices/boot.efi";
+static const uint8_t kVendorCheckOriginal[] =
+ {
+ 0x74, 0x08, // jz short 08
+ 0x81, 0xFA, // cmp edx
+ 0x12, 0x0A, 0x00, 0x00 // Vendor CSR
+ };
+
+ static const uint8_t kVendorCheckPatched[] =
+ {
+ 0xEB, 0x08, // jmp short 08
+ 0x81, 0xFA, // cmp edx
+ 0x12, 0x0A, 0x00, 0x00 // Vendor CSR
+ };
+
static const char *blueToolPath = "/usr/sbin/BlueTool";
+static const char *bluetoothdPath = "/usr/sbin/bluetoothd";
static mach_vm_address_t orig_cs_validate {};
@@ -71,9 +88,14 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
char path[PATH_MAX];
int pathlen = PATH_MAX;
FunctionCast(patched_cs_validate_page, orig_cs_validate)(vp, pager, page_offset, data, validated_p, tainted_p, nx_p);
- if (vn_getpath(vp, path, &pathlen) == 0 && UNLIKELY(strcmp(path, blueToolPath) == 0)) {
- searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
- }
+ if (vn_getpath(vp, path, &pathlen) == 0) {
+ if (UNLIKELY(strcmp(path, blueToolPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kSkipUpdateFilePathOriginal, kSkipUpdateFilePathPatched);
+ }
+ if (UNLIKELY(strcmp(path, bluetoothdPath) == 0)) {
+ searchAndPatch(data, PAGE_SIZE, path, kVendorCheckOriginal, kVendorCheckPatched);
+ }
+ }
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -21,6 +21,7 @@ build_types = [
bad_drivers = [
"AudioDxe.efi",
"BiosVideo.efi",
"CrScreenshotDxe.efi",
"HiiDatabase.efi",
"NvmExpressDxe.efi",

Binary file not shown.

BIN
payloads/Tools/ocvalidate-0.7.6 Executable file

Binary file not shown.

View File

@@ -53,6 +53,16 @@ class BuildOpenCore:
else:
print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder)
def chainload_diags(self):
Path(self.constants.opencore_release_folder / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers")).mkdir(parents=True, exist_ok=True)
if self.constants.boot_efi is True:
path_oc_loader = self.constants.opencore_release_folder / Path("EFI/BOOT/BOOTx64.efi")
else:
path_oc_loader = self.constants.opencore_release_folder / Path("System/Library/CoreServices/boot.efi")
shutil.move(path_oc_loader, self.constants.opencore_release_folder / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi"))
shutil.copy(self.constants.diags_launcher_path, self.constants.opencore_release_folder)
shutil.move(self.constants.opencore_release_folder / Path("diags.efi"), self.constants.opencore_release_folder / Path("boot.efi"))
def build_efi(self):
utilities.cls()
@@ -98,13 +108,11 @@ class BuildOpenCore:
for name, version, path, check in [
# Essential kexts
("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path, lambda: True),
("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False),
("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro),
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path, lambda: self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1"]),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
# CPU patches
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: self.model.startswith("MacPro") or self.model.startswith("Xserve")),
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: (self.model.startswith("MacPro") or self.model.startswith("Xserve")) and self.constants.serial_settings != "None"),
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
(
"telemetrap.kext",
@@ -116,7 +124,7 @@ class BuildOpenCore:
"CPUFriend.kext",
self.constants.cpufriend_version,
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,
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"),
@@ -129,7 +137,7 @@ class BuildOpenCore:
lambda: (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True,
),
# IDE patch
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in model_array.IDEPatch),
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: "PATA" in smbios_data.smbios_dictionary[self.model]["Stock Storage"]),
# Misc
(
"FeatureUnlock.kext",
@@ -143,7 +151,33 @@ class BuildOpenCore:
self.enable_kext(name, version, path, check)
if self.constants.allow_oc_everywhere is False:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
if self.constants.serial_settings == "None":
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
# print("- Enabling Board ID exemption patch")
# self.get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
print("- Enabling VMM exemption patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2)")["Enabled"] = True
# Patch HW_BID to OC_BID
# Set OC_BID to MacPro6,1 Board ID (Mac-F60DEB81FF30ACF6)
# Goal is to only allow OS booting through OCLP, otherwise failing
print("- Enabling HW_BID reroute")
self.get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Reroute HW_BID to OC_BID")["Enabled"] = True
self.config["NVRAM"]["Add"]["4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"]["OC_BID"] = "Mac-F60DEB81FF30ACF6"
self.config["NVRAM"]["Delete"]["4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"] += ["OC_BID"]
else:
print("- Enabling SMC exemption patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
if self.get_kext_by_bundle_path("Lilu.kext")["Enabled"] is True:
# Required for Lilu in 11.0+
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
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":
@@ -152,14 +186,10 @@ class BuildOpenCore:
# Applicable for pre-Ivy Bridge models
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
if self.constants.allow_oc_everywhere is False:
if (smbios_data.smbios_dictionary[generate_smbios.set_smbios_model_spoof(self.model) or self.constants.override_smbios]["SecureBootModel"]) != None:
# Monterey T2 SMBIOS don't get OS updates without a T2 SBM
# Forces VMM patch instead
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:
# i3 Ivy Bridge iMacs don't support RDRAND
# However for prebuilt, assume they do
if (not self.constants.custom_model and "RDRAND" not in self.computer.cpu.flags) or \
(smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value):
# Ref: https://github.com/reenigneorcim/SurPlus
# Enable for all systems missing RDRAND support
print("- Adding SurPlus Patch for Race Condition")
@@ -243,43 +273,43 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
# WiFi patches
# TODO: -a is not supported in Lion and older, need to add proper fix
if self.constants.detected_os > self.constants.lion and not self.constants.custom_model:
if not self.constants.custom_model:
if self.computer.wifi:
print(f"- Found Wireless Device {utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}")
self.config["#Revision"]["Hardware-Wifi"] = f"{utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}"
else:
print("- Unable to run Wireless hardware detection")
if not self.constants.custom_model and self.computer.wifi:
if isinstance(self.computer.wifi, device_probe.Broadcom):
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
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}")
if self.computer.wifi.pci_path:
arpt_path = self.computer.wifi.pci_path
print(f"- Found ARPT device at {arpt_path}")
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.country_code}
else:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
if self.constants.enable_wake_on_wlan is True:
print("- Enabling Wake on WLAN support")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
wifi_fake_id(self)
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
if not self.constants.custom_model:
if self.computer.wifi:
if isinstance(self.computer.wifi, device_probe.Broadcom):
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
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}")
if self.computer.wifi.pci_path:
arpt_path = self.computer.wifi.pci_path
print(f"- Found ARPT device at {arpt_path}")
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.country_code}
else:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
if self.constants.enable_wake_on_wlan is True:
print("- Enabling Wake on WLAN support")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
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("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("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("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
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
else:
if smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
print("- Enabling BCM943224 and BCM94331 Networking Support")
@@ -308,8 +338,8 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
# CPUFriend
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False:
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
Path(self.constants.pp_kext_folder).mkdir()
Path(self.constants.pp_contents_folder).mkdir()
shutil.copy(pp_map_path, self.constants.pp_contents_folder)
@@ -319,6 +349,13 @@ class BuildOpenCore:
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
print("- Adding IOHIDFamily patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
# Legacy iSight patches
try:
if smbios_data.smbios_dictionary[self.model]["Legacy iSight"] is True:
self.enable_kext("LegacyUSBVideoSupport.kext", self.constants.apple_isight_version, self.constants.apple_isight_path)
except KeyError:
pass
# SSDT patches
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem.value and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
@@ -337,7 +374,6 @@ class BuildOpenCore:
# USB Map
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
# iMac7,1 kernel panics with USB map installed, remove for time being until properly debugged
if (
usb_map_path.exists()
and self.constants.allow_oc_everywhere is False
@@ -351,54 +387,58 @@ class BuildOpenCore:
self.get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
if self.constants.allow_oc_everywhere is False:
if self.model == "MacBookPro9,1":
print("- Adding AppleMuxControl Override")
amc_map_path = Path(self.constants.plist_folder_path) / Path("AppleMuxControl/Info.plist")
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
Path(self.constants.amc_kext_folder).mkdir()
Path(self.constants.amc_contents_folder).mkdir()
shutil.copy(amc_map_path, self.constants.amc_contents_folder)
self.get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
elif self.model == "MacBookPro10,1":
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
if self.constants.serial_settings != "None":
if self.model == "MacBookPro9,1":
print("- Adding AppleMuxControl Override")
amc_map_path = Path(self.constants.plist_folder_path) / Path("AppleMuxControl/Info.plist")
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
Path(self.constants.amc_kext_folder).mkdir()
Path(self.constants.amc_contents_folder).mkdir()
shutil.copy(amc_map_path, self.constants.amc_contents_folder)
self.get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
if self.model not in model_array.NoAGPMSupport:
print("- Adding AppleGraphicsPowerManagement Override")
agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist")
Path(self.constants.agpm_kext_folder).mkdir()
Path(self.constants.agpm_contents_folder).mkdir()
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
self.get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
if self.model not in model_array.NoAGPMSupport:
print("- Adding AppleGraphicsPowerManagement Override")
agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist")
Path(self.constants.agpm_kext_folder).mkdir()
Path(self.constants.agpm_contents_folder).mkdir()
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
self.get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
if self.model in model_array.AGDPSupport:
print("- Adding AppleGraphicsDevicePolicy Override")
agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist")
Path(self.constants.agdp_kext_folder).mkdir()
Path(self.constants.agdp_contents_folder).mkdir()
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
if self.model in model_array.AGDPSupport:
print("- Adding AppleGraphicsDevicePolicy Override")
agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist")
Path(self.constants.agdp_kext_folder).mkdir()
Path(self.constants.agdp_contents_folder).mkdir()
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
if self.constants.serial_settings != "None":
# AGPM Patch
if self.model in model_array.DualGPUPatch:
print("- Adding dual GPU patch")
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
self.gfx0_path = self.computer.dgpu.pci_path
print(f"- Found GFX0 Device Path: {self.gfx0_path}")
else:
if not self.constants.custom_model:
print("- Failed to find GFX0 Device path, falling back on known logic")
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
# AGPM Patch
if self.model in model_array.DualGPUPatch:
print("- Adding dual GPU patch")
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
self.gfx0_path = self.computer.dgpu.pci_path
print(f"- Found GFX0 Device Path: {self.gfx0_path}")
else:
if not self.constants.custom_model:
print("- Failed to find GFX0 Device path, falling back on known logic")
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True:
print("- Prioritizing DRM support over Intel QuickSync")
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256}
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
"name": binascii.unhexlify("23646973706C6179"),
"IOName": "#display",
"class-code": binascii.unhexlify("FFFFFFFF"),
}
else:
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True:
print("- Prioritizing DRM support over Intel QuickSync")
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256}
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
"name": binascii.unhexlify("23646973706C6179"),
"IOName": "#display",
"class-code": binascii.unhexlify("FFFFFFFF"),
}
elif self.constants.serial_settings != "None":
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
if self.model.startswith("iMac14,"):
if self.computer.igpu and not self.computer.dgpu:
# Ensure that agdpmod is applied to iMac14,x with iGPU only
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"agdpmod": "vit9696"}
# Audio Patch
if self.constants.set_alc_usage is True:
@@ -449,6 +489,7 @@ class BuildOpenCore:
self.enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
self.enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
self.get_kext_by_bundle_path("IOFireWireFamily.kext/Contents/PlugIns/AppleFWOHCI.kext")["Enabled"] = True
def backlight_path_detection(self):
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
@@ -465,6 +506,9 @@ class BuildOpenCore:
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
def nvidia_patch(self, backlight_path):
if not self.get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
# Ensure WEG is enabled as we need if for Backlight patching
self.enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3", "iMac10,1"]:
print("- Adding Nvidia Brightness Control and DRM patches")
self.config["DeviceProperties"]["Add"][backlight_path] = {
@@ -506,11 +550,14 @@ class BuildOpenCore:
def amd_patch(self, backlight_path):
print("- Adding AMD DRM patches")
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 80, "unfairgva": 1}
if not self.get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
# Ensure WEG is enabled as we need if for Backlight patching
self.enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1}
if self.constants.custom_model and self.model == "iMac11,2":
# iMac11,2 can have either PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0) or PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)
# Set both properties when we cannot run hardware detection
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"] = {"shikigva": 80, "unfairgva": 1}
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"] = {"shikigva": 128, "unfairgva": 1}
if self.model in ["iMac12,1", "iMac12,2"]:
print("- Disabling unsupported iGPU")
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
@@ -523,14 +570,34 @@ class BuildOpenCore:
self.enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
if self.computer and self.computer.dgpu:
if self.computer.dgpu.arch == device_probe.AMD.Archs.Legacy_GCN_7000:
# Add Power Gate Patches
self.config["DeviceProperties"]["Add"][backlight_path] += {
print("- Adding Legacy GCN Power Gate Patches")
self.config["DeviceProperties"]["Add"][backlight_path].update({
"rebuild-device-tree": 1,
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
"CAIL,CAIL_DisableUVDPowerGating": 1,
"CAIL,CAIL_DisableVCEPowerGating": 1,
}
"agdpmod": "pikera",
})
elif self.constants.imac_model == "Legacy GCN":
print("- Adding Legacy GCN Power Gate Patches")
self.config["DeviceProperties"]["Add"][backlight_path].update({
"rebuild-device-tree": 1,
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
"CAIL,CAIL_DisableUVDPowerGating": 1,
"CAIL,CAIL_DisableVCEPowerGating": 1,
"agdpmod": "pikera",
})
if self.model == "iMac11,2":
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"].update({
"rebuild-device-tree": 1,
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
"CAIL,CAIL_DisableUVDPowerGating": 1,
"CAIL,CAIL_DisableVCEPowerGating": 1,
"agdpmod": "pikera",
})
# Check GPU Vendor
if self.constants.metal_build is True:
@@ -628,10 +695,14 @@ class BuildOpenCore:
print("- Fixing Legacy Bluetooth for macOS Monterey")
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
elif self.computer.bluetooth_chipset == "BRCM20702 Hub" and smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] == bluetooth_data.bluetooth_data.BRCM20702_v1.value:
print("- Fixing Legacy Bluetooth for macOS Monterey")
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
# smbios_data.smbios_dictionary[self.model]["Bluetooth Model"]
elif self.computer.bluetooth_chipset == "BRCM20702 Hub":
# BCM94331 can include either BCM2070 or BRCM20702 v1 Bluetooth chipsets
# Note Monterey only natively supports BRCM20702 v2 (found with BCM94360)
# Due to this, BlueToolFixup is required to resolve Firmware Uploading on legacy chipsets
if self.computer.wifi:
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
print("- Fixing Legacy Bluetooth for macOS Monterey")
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
elif smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
print("- Fixing Legacy Bluetooth for macOS Monterey")
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
@@ -665,10 +736,55 @@ class BuildOpenCore:
except KeyError:
pass
# Check if model has 5K display
# Apple has 2 modes for display handling on 5K iMacs and iMac Pro
# If at any point in the boot chain an "unsupported" entry is loaded, the firmware will tell the
# Display Controller to enter a 4K compatible mode that only uses a single DisplayPort 1.2 stream internally.
# This is to prevent situations where the system would boot into an enviroment that cannot handle the custom
# dual DisplayPort 1.2 streams the 5k Display uses
# To work around this issue, we trick the firmware into loading OpenCore through Apple's Hardware Diagnostic Tests
# Specifically hiding as Product.efi under '/System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi'
# The reason chainloading via ./Drivers/HardwareDrivers is possible is thanks to it being loaded via an encrypted file buffer
# whereas other drivers like ./qa_logger.efi is invoked via Device Path.
try:
smbios_data.smbios_dictionary[self.model]["5K Display"]
print("- Adding 5K Display Patch")
# Set LauncherPath to '/boot.efi'
# This is to ensure that only the Mac's firmware presents the boot option, but not OpenCore
# https://github.com/acidanthera/OpenCorePkg/blob/0.7.6/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c#L50-L73
self.config["Misc"]["Boot"]["LauncherPath"] = "\\boot.efi"
# Setup diags.efi chainloading
self.chainload_diags()
except KeyError:
pass
# ThirdPartDrives Check
if self.model in model_array.SATAPatch and self.constants.allow_oc_everywhere is False:
print("- Adding SATA Hibernation Patch")
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
for drive in ["SATA 2.5", "SATA 3.5", "mSATA"]:
if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
if not self.constants.custom_model:
if self.computer.third_party_sata_ssd is True:
print("- Adding SATA Hibernation Patch")
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
break
else:
print("- Adding SATA Hibernation Patch")
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
break
# Apple RAID Card check
if not self.constants.custom_model:
if self.computer.storage:
for storage_controller in self.computer.storage:
if storage_controller.vendor_id == 0x106b and storage_controller.device_id == 0x008A:
# AppleRAIDCard.kext only supports pci106b,8a
self.enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
break
elif self.model.startswith("XServe"):
# For XServes, assume RAID is present
# Namely due to Xserve2,1 being limited to 10.7, thus no hardware detection
self.enable_kext("AppleRAIDCard.kext", self.constants.apple_raid_version, self.constants.apple_raid_path)
# DEBUG Settings
if self.constants.verbose_debug is True:
@@ -694,9 +810,12 @@ class BuildOpenCore:
print("- Setting Vault configuration")
self.config["Misc"]["Security"]["Vault"] = "Secure"
self.get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
if self.constants.sip_status is False:
print("- Disabling SIP")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = binascii.unhexlify("030E0000")
if self.constants.custom_sip_value:
print(f"- Setting SIP value to: {self.constants.custom_sip_value}")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = utilities.string_to_hex(self.constants.custom_sip_value.lstrip("0x"))
elif self.constants.sip_status is False:
print("- Set SIP to allow Root Volume patching")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = binascii.unhexlify("030A0000")
# if self.constants.amfi_status is False:
# print("- Disabling AMFI")
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi_get_out_of_my_way=1"
@@ -710,6 +829,10 @@ class BuildOpenCore:
if self.constants.secure_status is False:
print("- Disabling SecureBootModel")
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
if self.constants.force_vmm is True:
print("- Forcing VMM patchset to support OTA updates")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2)")["Enabled"] = True
if self.constants.serial_settings in ["Moderate", "Advanced"]:
print("- Enabling USB Rename Patches")
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "XHC1 to SHC1")["Enabled"] = True
@@ -736,9 +859,20 @@ class BuildOpenCore:
if self.constants.dGPU_switch is True:
smbios_data.smbios_dictionary[self.model]["Switchable GPUs"]
print("- Allowing GMUX switching in Windows")
self.config["Booter"]["Quirks"]["SignalAppleOS"] = True
self.config["Booter"]["Quirks"]["SignalAppleOS"] = True
except KeyError:
pass
if (
self.model.startswith("MacBook")
and (
smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.haswell.value or
smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.broadwell.value
)
):
# Fix Virtual Machine support for non-macOS OSes
# Haswell and Broadwell MacBooks lock out the VMX bit if booting UEFI Windows
print("- Enabling VMX Bit for non-macOS OSes")
self.config["UEFI"]["Quirks"]["EnableVmx"] = True
if self.constants.allow_fv_root is True:
# apfs.kext has an undocumented boot-arg that allows FileVault usage on broken APFS seals (-arv_allow_fv)
# This is however hidden behind kern.development, thus we patch _apfs_filevault_allowed to always return true
@@ -752,6 +886,13 @@ class BuildOpenCore:
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
self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
if self.constants.disable_connectdrivers is True:
print("- Disabling ConnectDrivers")
self.config["UEFI"]["ConnectDrivers"] = False
if self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True:
# Add Content Caching patch
print("- Fixing Content Caching support")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -allow_assetcache"
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
# Ensure this is done at the end so all previous RestrictEvents patches are applied
# RestrictEvents and EFICheckDisabler will confilict if both are injected
@@ -760,8 +901,9 @@ class BuildOpenCore:
def set_smbios(self):
spoofed_model = self.model
if self.constants.override_smbios == "Default":
print("- Setting macOS Monterey Supported SMBIOS")
spoofed_model = generate_smbios.set_smbios_model_spoof(self.model)
if self.constants.serial_settings != "None":
print("- Setting macOS Monterey Supported SMBIOS")
spoofed_model = generate_smbios.set_smbios_model_spoof(self.model)
else:
spoofed_model = self.constants.override_smbios
print(f"- Using Model ID: {spoofed_model}")
@@ -843,6 +985,7 @@ class BuildOpenCore:
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0]
self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1]
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
if self.constants.serial_settings == "Moderate":
print("- Using Moderate SMBIOS patching")
@@ -870,7 +1013,7 @@ class BuildOpenCore:
else:
try:
map_config["IOKitPersonalities_x86_64"][entry]["model"] = self.spoofed_model
if self.constants.serial_settings == "Minimal":
if self.constants.serial_settings in ["Minimal", "None"]:
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH01":
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC1"
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH02":
@@ -880,7 +1023,7 @@ class BuildOpenCore:
except KeyError:
continue
plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True)
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False:
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
# Adjust CPU Friend Data to correct SMBIOS
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")
cpu_config = plistlib.load(Path(new_cpu_ls).open("rb"))
@@ -890,7 +1033,7 @@ class BuildOpenCore:
cpu_config["IOKitPersonalities"]["CPUFriendDataProvider"]["cf-frequency-data"] = string_stuff
plistlib.dump(cpu_config, Path(new_cpu_ls).open("wb"), sort_keys=True)
if self.constants.allow_oc_everywhere is False:
if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
if self.model == "MacBookPro9,1":
new_amc_ls = Path(self.constants.amc_contents_folder) / Path("Info.plist")
amc_config = plistlib.load(Path(new_amc_ls).open("rb"))
@@ -971,6 +1114,9 @@ class BuildOpenCore:
for entry in list(self.config["ACPI"]["Patch"]):
if not entry["Enabled"]:
self.config["ACPI"]["Patch"].remove(entry)
for entry in list(self.config["Booter"]["Patch"]):
if not entry["Enabled"]:
self.config["Booter"]["Patch"].remove(entry)
for entry in list(self.config["Kernel"]["Add"]):
if not entry["Enabled"]:
self.config["Kernel"]["Add"].remove(entry)
@@ -1004,8 +1150,15 @@ class BuildOpenCore:
def sign_files(self):
if self.constants.vault is True:
print("- Vaulting EFI")
subprocess.run([str(self.constants.vault_path), f"{self.constants.oc_folder}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if utilities.check_command_line_tools() is True:
# sign.command checks for the existance of '/usr/bin/strings' however does not verify whether it's executable
# sign.command will continue to run and create an unbootable OpenCore.efi due to the missing strings binary
# macOS has dummy binaries that just reroute to the actual binaries after you install Xcode's Command Line Tools
print("- Vaulting EFI")
subprocess.run([str(self.constants.vault_path), f"{self.constants.oc_folder}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
print("- Missing Command Line tools, skipping Vault for saftey reasons")
print("- Install via 'xcode-select --install' and rerun OCLP if you wish to vault this config")
def build_opencore(self):
self.build_efi()
@@ -1018,182 +1171,4 @@ class BuildOpenCore:
print(f" {self.constants.opencore_release_folder}")
print("")
if self.constants.gui_mode is False:
input("Press [Enter] to go back.\n")
def copy_efi(self):
utilities.cls()
utilities.header(["Installing OpenCore to Drive"])
if not self.constants.opencore_release_folder.exists():
utilities.TUIOnlyPrint(
["Installing OpenCore to Drive"],
"Press [Enter] to go back.\n",
[
"""OpenCore folder missing!
Please build OpenCore first!"""
],
).start()
return
print("\nDisk picker is loading...")
all_disks = {}
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
try:
# High Sierra and newer
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
except ValueError:
# Sierra and older
disks = plistlib.loads(subprocess.run("diskutil list -plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
for disk in disks["AllDisksAndPartitions"]:
disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
try:
all_disks[disk["DeviceIdentifier"]] = {"identifier": disk_info["DeviceNode"], "name": disk_info["MediaName"], "size": disk_info["TotalSize"], "partitions": {}}
for partition in disk["Partitions"]:
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {partition['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
all_disks[disk["DeviceIdentifier"]]["partitions"][partition["DeviceIdentifier"]] = {
"fs": partition_info.get("FilesystemType", partition_info["Content"]),
"type": partition_info["Content"],
"name": partition_info.get("VolumeName", ""),
"size": partition_info["TotalSize"],
}
except KeyError:
# Avoid crashing with CDs installed
continue
# TODO: Advanced mode
menu = utilities.TUIMenu(
["Select Disk"],
"Please select the disk you would like to install OpenCore to: ",
in_between=["Missing disks? Ensure they have an EFI or FAT32 partition."],
return_number_instead_of_direct_call=True,
loop=True,
)
for disk in all_disks:
if not any(all_disks[disk]["partitions"][partition]["fs"] in ("msdos", "EFI") for partition in all_disks[disk]["partitions"]):
continue
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})", key=disk[4:])
response = menu.start()
if response == -1:
return
disk_identifier = "disk" + response
selected_disk = all_disks[disk_identifier]
menu = utilities.TUIMenu(
["Select Partition"],
"Please select the partition you would like to install OpenCore to: ",
return_number_instead_of_direct_call=True,
loop=True,
in_between=["Missing partitions? Ensure they are formatted as an EFI or FAT32.", "", "* denotes likely candidate."],
)
for partition in selected_disk["partitions"]:
if selected_disk["partitions"][partition]["fs"] not in ("msdos", "EFI"):
continue
text = f"{partition}: {selected_disk['partitions'][partition]['name']} ({utilities.human_fmt(selected_disk['partitions'][partition]['size'])})"
if selected_disk["partitions"][partition]["type"] == "EFI" or (
selected_disk["partitions"][partition]["type"] == "Microsoft Basic Data" and selected_disk["partitions"][partition]["size"] < 1024 * 1024 * 512
): # 512 megabytes:
text += " *"
menu.add_menu_option(text, key=partition[len(disk_identifier) + 1 :])
response = menu.start()
if response == -1:
return
# TODO: Apple Script fails in Yosemite(?) and older
args = [
"osascript",
"-e",
f'''do shell script "diskutil mount {disk_identifier}s{response}"'''
' with prompt "OpenCore Legacy Patcher needs administrator privileges to mount your EFI."'
" with administrator privileges"
" without altering line endings",
]
if self.constants.detected_os >= self.constants.el_capitan and not self.constants.recovery_status:
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
result = subprocess.run(f"diskutil mount {disk_identifier}s{response}".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode != 0:
if "execution error" in result.stderr.decode() and result.stderr.decode().strip()[-5:-1] == "-128":
# 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()
return
# TODO: Remount if readonly
drive_host_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk_identifier}s{response}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
sd_type = drive_host_info["MediaName"]
try:
ssd_type = drive_host_info["SolidState"]
except KeyError:
ssd_type = False
mount_path = Path(partition_info["MountPoint"])
disk_type = partition_info["BusProtocol"]
utilities.cls()
utilities.header(["Copying OpenCore"])
if mount_path.exists():
if (mount_path / Path("EFI/Microsoft")).exists():
print("- Found Windows Boot Loader")
print("\nWould you like to continue installing OpenCore?")
print("Installing OpenCore onto this drive may make Windows unbootable until OpenCore")
print("is removed from the partition")
print("We highly recommend users partition 200MB off their drive with Disk Utility")
print(" Name:\t\t OPENCORE")
print(" Format:\t\t FAT32")
print(" Size:\t\t 200MB")
choice = input("\nWould you like to still install OpenCore to this drive?(y/n): ")
if not choice in ["y", "Y", "Yes", "yes"]:
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
return
if (mount_path / Path("EFI/OC")).exists():
print("- Removing preexisting EFI/OC folder")
shutil.rmtree(mount_path / Path("EFI/OC"), onerror=rmtree_handler)
if (mount_path / Path("System")).exists():
print("- Removing preexisting System folder")
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
print("- Copying OpenCore onto EFI partition")
shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC"))
shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System"))
if self.constants.boot_efi is True:
print("- Converting Bootstrap to BOOTx64.efi")
if (mount_path / Path("EFI/BOOT")).exists():
shutil.rmtree(mount_path / Path("EFI/BOOT"), onerror=rmtree_handler)
Path(mount_path / Path("EFI/BOOT")).mkdir()
shutil.move(mount_path / Path("System/Library/CoreServices/boot.efi"), mount_path / Path("EFI/BOOT/BOOTx64.efi"))
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
# Array filled with common SD Card names
# Note most USB-based SD Card readers generally report as "Storage Device", and no reliable way to detect further
if sd_type in ["SD Card Reader", "SD/MMC"]:
print("- Adding SD Card icon")
shutil.copy(self.constants.icon_path_sd, mount_path)
elif ssd_type is True:
print("- Adding SSD icon")
shutil.copy(self.constants.icon_path_ssd, mount_path)
elif disk_type == "USB":
print("- Adding External USB Drive icon")
shutil.copy(self.constants.icon_path_external, mount_path)
else:
print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, mount_path)
print("- Cleaning install location")
if not self.constants.recovery_status:
# RecoveryOS doesn't support dot_clean
# Remove dot_clean, requires full disk access
# subprocess.run(["dot_clean", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- Unmounting EFI partition")
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- OpenCore transfer complete")
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()
input("Press [Enter] to continue\n")

View File

@@ -1,10 +1,10 @@
# Handle misc CLI menu options
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
from __future__ import print_function
import subprocess
import sys
from resources import constants, utilities, defaults, sys_patch
from data import cpu_data, smbios_data, model_array
from resources import constants, install, utilities, defaults, sys_patch, installer
from data import cpu_data, smbios_data, model_array, os_data, mirror_data
class MenuOptions:
@@ -46,8 +46,10 @@ class MenuOptions:
change_menu = input("Enable Kext DEBUG mode(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.kext_debug = True
self.constants.kext_variant = "DEBUG"
elif change_menu in {"n", "N", "no", "No"}:
self.constants.kext_debug = False
self.constants.kext_variant = "RELEASE"
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
@@ -62,9 +64,10 @@ Patcher assumes based on stock configuration (ie. iMac10,x-12,x)
Valid Options:
1. None(stock GPU)
2. Nvidia GPU
3. AMD GPU
1. None (stock GPU)
2. Nvidia Kepler
3. AMD Polaris
4. AMD Legacy GCN
Q. Return to previous menu
Note: Patcher will detect whether hardware has been upgraded regardless, this
@@ -75,12 +78,19 @@ option is for those patching on a different machine or OCLP cannot detect.
if change_menu == "1":
self.constants.metal_build = False
self.constants.imac_vendor = "None"
self.constants.imac_model = ""
elif change_menu == "2":
self.constants.metal_build = True
self.constants.imac_vendor = "Nvidia"
self.constants.imac_model = "Kepler"
elif change_menu == "3":
self.constants.metal_build = True
self.constants.imac_vendor = "AMD"
self.constants.imac_model = "Polaris"
elif change_menu == "4":
self.constants.metal_build = True
self.constants.imac_vendor = "AMD"
self.constants.imac_model = "Legacy GCN"
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
@@ -95,6 +105,7 @@ Recommended for adanced users who want control how serials are handled
Valid options:
0. None:\tOnly update FirmwareFeatures
1. Minimal:\tUse original serials and minimally update SMBIOS
2. Moderate:\tReplace entire SMBIOS but keep original serials
3. Advanced:\tReplace entire SMBIOS and generate new serials
@@ -104,7 +115,9 @@ Note: For new users we recommend leaving as default(1. Minimal)
"""
)
change_menu = input("Set SMBIOS Spoof Level(ie. 1): ")
if change_menu == "1":
if change_menu == "0":
self.constants.serial_settings = "None"
elif change_menu == "1":
self.constants.serial_settings = "Minimal"
elif change_menu == "2":
self.constants.serial_settings = "Moderate"
@@ -160,14 +173,15 @@ Note: For security reasons, OpenShell will be disabled when Vault is set.
utilities.cls()
utilities.header(["Set System Integrity protection"])
print(
"""SIP is used to ensure proper secuirty measures are set,
however to patch the root volume this must be disabled.
Only disable is absolutely necessary. SIP value = 0xE03
f"""SIP is used to ensure proper secuirty measures are set,
however to patch the root volume this must be lowered partially.
Only disable is absolutely necessary. SIP value = 0xA03
Valid options:
1. Enable SIP
2. Disable SIP
2. Lower SIP partially (allow root volume patching)
3. Set Custom SIP value {self.constants.custom_sip_value}
Q. Return to previous menu
"""
@@ -177,6 +191,8 @@ Q. Return to previous menu
self.constants.sip_status = True
elif change_menu == "2":
self.constants.sip_status = False
elif change_menu == "3":
self.set_custom_sip_value()
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
@@ -188,7 +204,7 @@ Q. Return to previous menu
print(
"""SecureBootModel is used to ensure best firmware security,
however to patch the root volume this must be disabled.
Only disable is absolutely necessary. SIP value = 0xFEF
Only recommended to enable for users with T2 SMBIOS spoofs.
Valid options:
@@ -665,7 +681,7 @@ If AppleALC is detected, the Patcher will not install AppleHDA.
utilities.header(["Set Windows GMUX support"])
print(
"""
With OCLP, we're able to restore iGPU funbctionality on iGPU+dGPU
With OCLP, we're able to restore iGPU functionality on iGPU+dGPU
MacBook Pros. However for some this may not be desires, ie. eGPUs
for Windows may prefer to only work with the dGPU and eGPU active.
"""
@@ -743,9 +759,9 @@ Note: Only supported on Nehalem and newer MacBooks (2010+)
utilities.header(["Override SurPlus MaxKernel"])
print(
"""
By default OCLP will only allow SurPlus to be used on kernels 21.1.0
and older (ie. Monterey beta 7 and older). This is for saftey reasons
in the event newer OSes may break compatibility and result in boot loops.
By default OCLP will only allow SurPlus to be used on Big Sur and Monterey.
This is for safety reasons in the event newer OSes may break compatibility
and result in boot loops.
Enabling this option will allow SurPlus to have no MaxKernel set, and
therefore allow it to run on anything newer than 11.2.3. However if you
@@ -763,6 +779,60 @@ the event there's issues.
print("Returning to previous menu")
else:
self.set_surplus()
def set_hibernation_workaround(self):
utilities.cls()
utilities.header(["Set Hibernation Workaround"])
print(
"""
For users with Hibernation issues, you can flip this option to disable certain
OpenCore settings that may affect the stability of Hibernation. Namely
OpenCore's ConnectDrivers option.
Flipping this setting will disable automatic loading of additional drives in
OpenCore's boot menu other than what was booted.
Note: This option should only be flipped under the following circumstances:
- You are experincing wake failures from hibernation
- You are only using 1 disk in your system for booting (ie. no RAID)
- OpenCore is installed on the same disk as the OS
- Your system has an Intel iGPU and Nvidia dGPU
- You have no need to boot external media through OpenCore
"""
)
change_menu = input("Disable ConnectDrivers?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_connectdrivers = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_connectdrivers = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.set_hibernation_workaround()
def set_custom_sip_value(self):
utilities.cls()
utilities.header(["Set Custom SIP Value"])
print(
"""
By default OCLP will use the SIP value of 0x00 as the enabled and
0xA03 for machines that require root patching. For users who wish
to flip additional bits in SIP may use this option.
To disable SIP outright, set it to 0xFEF
"""
)
change_menu = input("Set Custom SIP Value (0xFEF): ")
try:
# Verify whether input is a valid hex value
int(change_menu, 16)
# Convert to binary hex
self.constants.custom_sip_value = change_menu
except ValueError:
print("Invalid input, returning to previous menu")
self.set_custom_sip_value()
def credits(self):
utilities.TUIOnlyPrint(
@@ -815,19 +885,22 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
utilities.header(["Patching System Volume"])
no_patch = False
if self.constants.detected_os == self.constants.monterey:
no_unpatch = False
if self.constants.detected_os == os_data.os_data.monterey:
print(MenuOptions.monterey)
elif self.constants.detected_os == self.constants.big_sur:
elif self.constants.detected_os == os_data.os_data.big_sur:
print(MenuOptions.big_sur)
elif self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.moj_cat_accel == True:
elif self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina] and self.constants.moj_cat_accel == True:
print(MenuOptions.mojave_catalina)
no_unpatch = True
else:
print(MenuOptions.default)
no_patch = True
no_unpatch = True
change_menu = input("Patch System Volume?: ")
if no_patch is not True and change_menu == "1":
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
elif no_patch is not True and change_menu == "2":
elif no_unpatch is not True and change_menu == "2":
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
else:
print("Returning to main menu")
@@ -911,7 +984,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
# MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_amfi,
# ],
[
f"Set System Integrity Protection (SIP):\tCurrently {self.constants.sip_status}",
f"Set System Integrity Protection (SIP):\tCurrently {self.constants.custom_sip_value or self.constants.sip_status}",
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_sip,
],
[
@@ -979,8 +1052,10 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}",
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support,
],
[f"Set Software Demux:\t\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
[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"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
]
for option in options:
@@ -1007,6 +1082,103 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def download_macOS(self):
utilities.cls()
utilities.header(["Create macOS installer"])
print(
"""
This option allows you to download and flash a macOS installer
to your USB drive.
1. Download macOS Installer
2. Use Existing Installer
B. Exit
"""
)
change_menu = input("Select an option: ")
if change_menu == "1":
self.download_macOS_installer()
elif change_menu == "2":
self.find_local_installer()
elif change_menu in ["B", "b"]:
return
else:
self.download_macOS()
def download_install_assistant(self, link):
installer.download_install_assistant(self.constants.payload_path, link)
# To avoid selecting the wrong installer by mistake, let user select the correct one
self.find_local_installer()
def download_macOS_installer(self):
response = None
while not (response and response == -1):
options = []
title = ["Select the macOS Installer you wish to download"]
menu = utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
avalible_installers = installer.list_downloadable_macOS_installers(self.constants.payload_path, "DeveloperSeed")
if avalible_installers:
# Add mirror of 11.2.3 for users who want it
options.append([f"macOS {mirror_data.Install_macOS_Big_Sur_11_2_3['Version']} ({mirror_data.Install_macOS_Big_Sur_11_2_3['Build']} - {utilities.human_fmt(mirror_data.Install_macOS_Big_Sur_11_2_3['Size'])} - {mirror_data.Install_macOS_Big_Sur_11_2_3['Source']})", lambda: self.download_install_assistant(mirror_data.Install_macOS_Big_Sur_11_2_3['Link'])])
for app in avalible_installers:
options.append([f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']})", lambda x=app: self.download_install_assistant(avalible_installers[x]['Link'])])
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def find_local_installer(self):
response = None
while not (response and response == -1):
options = []
title = ["Select the macOS Installer you wish to use"]
menu = utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
avalible_installers = installer.list_local_macOS_installers()
if avalible_installers:
for app in avalible_installers:
options.append([f"{avalible_installers[app]['Short Name']}: {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']})", lambda: self.list_disks(avalible_installers[app]['Path'])])
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def list_disks(self, installer_path):
disk = installer.select_disk_to_format()
if disk != None:
if installer.format_drive(disk) is True:
# Only install if OC is found
# Allows a user to create a macOS Installer without OCLP if desired
if self.constants.opencore_release_folder.exists() and self.constants.walkthrough is True:
# ESP will always be the first partition when formatted by disk utility
install.tui_disk_installation.install_opencore(self, f"disk{disk}", "1")
if installer.create_installer(installer_path, "OCLP-Installer") is True:
utilities.cls()
utilities.header(["Create macOS installer"])
print("Installer created successfully.")
input("Press enter to exit.")
if self.constants.walkthrough is True:
self.closing_message()
else:
utilities.cls()
utilities.header(["Create macOS installer"])
print("Installer creation failed.")
input("Press enter to return to the previous.")
return
else:
if self.constants.walkthrough is True:
sys.exit()
def closing_message(self):
utilities.cls()
utilities.header(["Create macOS installer"])
print("Thank you for using OpenCore Legacy Patcher!")
print("Reboot your machine and select EFI Boot to load OpenCore")
print("")
print("If you have any issues, remember to check the guide as well as\nour Discord server:")
print("\n\tGuide: https://dortania.github.io/OpenCore-Legacy-Patcher/")
print("\tDiscord: https://discord.gg/rqdPgH8xSN")
input("\nPress enter to exit: ")
sys.exit()
big_sur = """Patches Root volume to fix misc issues such as:
@@ -1045,7 +1217,7 @@ is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
2. Unpatch System Volume
B. Exit
"""
mojave_catalina = """Patches Root volume to fix misc issues such as:
@@ -1063,7 +1235,6 @@ is patched, you can no longer have Delta updates.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""

View File

@@ -8,44 +8,47 @@ from pathlib import Path
from typing import Optional
from resources import device_probe
from data import os_data
class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.3.0" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.7" # PatcherSupportPkg
self.patcher_version = "0.3.2" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.2.8" # 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/"
# OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg
self.opencore_commit = "ff4b099 - 09-06-2021"
self.opencore_version = "0.7.3"
self.opencore_commit = "7266ec9 - 12-06-2021"
self.opencore_version = "0.7.6"
# Kext Versioning
## Acidanthera
## https://github.com/acidanthera
self.lilu_version = "1.5.6" # Lilu
self.whatevergreen_version = "1.5.3" # WhateverGreen
self.lilu_version = "1.5.8" # Lilu
self.whatevergreen_version = "1.5.5" # 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.5" # RestrictEvents
self.restrictevents_mbp_version = "1.0.5" # RestrictEvents blocking displaypolicyd (see RestrictEvents-MBP91.patch)
self.featureunlock_version = "1.0.3" # FeatureUnlock
self.featureunlock_version = "1.0.5" # FeatureUnlock
self.debugenhancer_version = "1.0.4" # DebugEnhancer
self.cpufriend_version = "1.2.4" # CPUFriend
self.bluetool_version = "2.6.1" # BlueToolFixup
self.bluetool_version = "2.6.1" # BlueToolFixup (BrcmPatchRAM)
self.cslvfixup_version = "2.6.1" # CSLVFixup
## Apple
## https://www.apple.com
self.marvel_version = "1.0.1" # MarvelYukonEthernet
self.nforce_version = "1.0.1" # nForceEthernet
self.piixata_version = "1.0.1" # AppleIntelPIIXATA
self.fw_kext = "1.0.1" # IOFireWireFamily
self.apple_trackpad = "1.0.1" # AppleUSBTrackpad
self.marvel_version = "1.0.1" # MarvelYukonEthernet
self.nforce_version = "1.0.1" # nForceEthernet
self.piixata_version = "1.0.1" # AppleIntelPIIXATA
self.fw_kext = "1.0.1" # IOFireWireFamily
self.apple_trackpad = "1.0.1" # AppleUSBTrackpad
self.apple_isight_version = "1.0.0" # AppleiSight
self.apple_raid_version = "1.0.0" # AppleRAIDCard
## Apple - Dortania Modified
self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet
@@ -104,6 +107,7 @@ class Constants:
## Kext Settings
self.kext_debug = False # Enables Lilu debug and DebugEnhancer
self.kext_variant = "RELEASE"
## NVRAM Settings
self.verbose_debug = False # -v
@@ -111,7 +115,7 @@ class Constants:
## SMBIOS Settings
self.custom_cpu_model = 2 # Patch type value
self.custom_cpu_model_value = "" # New CPU name within About This Mac
self.serial_settings = "Minimal" # Set SMBIOS level used
self.serial_settings = "None" # Set SMBIOS level used
self.override_smbios = "Default" # Set SMBIOS model used
## Latebloom Settings
@@ -121,12 +125,12 @@ class Constants:
self.latebloom_debug = 0 # Debug Setting
## Security Settings
self.apecid_support = False # ApECID
self.amfi_status = True # Apple Mobile File Integrity
self.sip_status = True # System Integrity Protection
self.secure_status = False # Secure Boot Model
self.vault = False # EFI Vault
self.disable_cs_lv = False # Disable Library validation
self.apecid_support = False # ApECID
self.amfi_status = True # Apple Mobile File Integrity
self.sip_status = True # System Integrity Protection
self.secure_status = False # Secure Boot Model
self.vault = False # EFI Vault
self.disable_cs_lv = False # Disable Library validation
## OS Settings
self.os_support = 12.0
@@ -142,44 +146,32 @@ class Constants:
## Graphics Settings
self.metal_build = False # Set MXM Build support
self.imac_vendor = "None" # Set MXM GPU vendor
self.imac_model = "" # Set MXM GPU model
self.drm_support = False # Set iMac14,x DRM support
self.allow_ivy_igpu = False # Set iMac13,x iGPU support
self.moj_cat_accel = False # Set Mojave/Catalina Acceleration support
self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support
## Miscellaneous
self.disallow_cpufriend = False # Disable CPUFriend
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
self.disable_tb = False # Disable Thunderbolt Controller
self.set_alc_usage = True # Set AppleALC usage
self.dGPU_switch = True # Set Display GPU Switching for Windows
self.force_surplus = False # Force SurPlus patch in newer OSes
self.force_latest_psp = False # Force latest PatcherSupportPkg
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
self.software_demux = False # Enable Software Demux patch set
# OS Versions
## Based off Major Kernel Version
self.tiger = 8
self.leopard = 9
self.snow_leopard = 10
self.lion = 11
self.mountain_lion = 12
self.mavericks = 13
self.yosemite = 14
self.el_capitan = 15
self.sierra = 16
self.high_sierra = 17
self.mojave = 18
self.catalina = 19
self.big_sur = 20
self.monterey = 21
self.disallow_cpufriend = False # Disable CPUFriend
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
self.disable_tb = False # Disable Thunderbolt Controller
self.set_alc_usage = True # Set AppleALC usage
self.dGPU_switch = True # Set Display GPU Switching for Windows
self.force_surplus = False # Force SurPlus patch in newer OSes
self.force_latest_psp = False # Force latest PatcherSupportPkg
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
self.software_demux = False # Enable Software Demux patch set
self.force_vmm = False # Force VMM patch
self.custom_sip_value = None # Set custom SIP value
self.walkthrough = False # Enable Walkthrough
self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation)
self.legacy_accel_support = [
self.mojave,
self.catalina,
self.big_sur,
self.monterey,
os_data.os_data.mojave,
os_data.os_data.catalina,
os_data.os_data.big_sur,
os_data.os_data.monterey,
]
# Payload Location
@@ -223,6 +215,14 @@ class Constants:
def xhci_driver_path(self):
return self.payload_path / Path("Drivers/XhciDxe.efi")
@property
def diags_launcher_path(self):
return self.payload_path / Path("Drivers/diags.efi")
@property
def list_txt_path(self):
return self.payload_path / Path("List.txt")
# Kexts
@property
def payload_kexts_path(self):
@@ -230,19 +230,19 @@ class Constants:
@property
def lilu_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/Lilu-v{self.lilu_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/Lilu-v{self.lilu_version}-{self.kext_variant}.zip")
@property
def whatevergreen_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/WhateverGreen-v{self.whatevergreen_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/WhateverGreen-v{self.whatevergreen_version}-{self.kext_variant}.zip")
@property
def airportbcrmfixup_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/AirportBrcmFixup-v{self.airportbcrmfixup_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/AirportBrcmFixup-v{self.airportbcrmfixup_version}-{self.kext_variant}.zip")
@property
def restrictevents_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-v{self.restrictevents_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-v{self.restrictevents_version}-{self.kext_variant}.zip")
@property
def efi_disabler_path(self):
@@ -250,7 +250,7 @@ class Constants:
@property
def restrictevents_mbp_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-MBP91-v{self.restrictevents_mbp_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-MBP91-v{self.restrictevents_mbp_version}-{self.kext_variant}.zip")
@property
def bcm570_path(self):
@@ -294,7 +294,7 @@ class Constants:
@property
def applealc_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/AppleALC-v{self.applealc_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/AppleALC-v{self.applealc_version}-{self.kext_variant}.zip")
@property
def piixata_path(self):
@@ -306,7 +306,7 @@ class Constants:
@property
def cpufriend_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/CPUFriend-v{self.cpufriend_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/CPUFriend-v{self.cpufriend_version}-{self.kext_variant}.zip")
@property
def smcspoof_path(self):
@@ -318,19 +318,19 @@ class Constants:
@property
def nvmefix_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/NVMeFix-v{self.nvmefix_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/NVMeFix-v{self.nvmefix_version}-{self.kext_variant}.zip")
@property
def featureunlock_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/FeatureUnlock-v{self.featureunlock_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/FeatureUnlock-v{self.featureunlock_version}-{self.kext_variant}.zip")
@property
def debugenhancer_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/DebugEnhancer-v{self.debugenhancer_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/DebugEnhancer-v{self.debugenhancer_version}-{self.kext_variant}.zip")
@property
def bluetool_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/BlueToolFixup-v{self.bluetool_version}.zip")
return self.payload_kexts_path / Path(f"Acidanthera/BlueToolFixup-v{self.bluetool_version}-{self.kext_variant}.zip")
@property
def cslvfixup_path(self):
@@ -355,6 +355,14 @@ class Constants:
@property
def apple_trackpad_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleUSBTrackpad-v{self.apple_trackpad}.zip")
@property
def apple_isight_path(self):
return self.payload_kexts_path / Path(f"Misc/LegacyUSBVideoSupport-v{self.apple_isight_version}.zip")
@property
def apple_raid_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleRAIDCard-v{self.apple_raid_version}.zip")
@property
def plist_folder_path(self):
@@ -468,7 +476,7 @@ class Constants:
@property
def ocvalidate_path(self):
return self.payload_path / Path("Tools/ocvalidate")
return self.payload_path / Path(f"Tools/ocvalidate-{self.opencore_version}")
# Icons
@property
@@ -520,6 +528,14 @@ class Constants:
@property
def payload_apple_libexec_path(self):
return self.payload_apple_usr_path / Path("libexec")
@property
def payload_apple_private_path(self):
return self.payload_apple_root_path / Path("private")
@property
def payload_apple_etc_path(self):
return self.payload_apple_private_path / Path("etc")
@property
def payload_apple_frameworks_path(self):
@@ -527,7 +543,7 @@ class Constants:
@property
def payload_apple_frameworks_path_accel(self):
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration")
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration-Non-Metal")
@property
def payload_apple_frameworks_path_accel_ts2(self):
@@ -536,22 +552,22 @@ class Constants:
@property
def payload_apple_frameworks_path_accel_ivy(self):
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration-Ivy-Bridge")
@property
def payload_apple_frameworks_path_accel_kepler(self):
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration-Kepler")
@property
def payload_apple_lauchd_path(self):
return self.payload_apple_root_path / Path("LaunchDaemons")
@property
def payload_apple_lauchd_path_accel(self):
return self.payload_apple_lauchd_path / Path("Graphics-Acceleration")
@property
def payload_apple_private_frameworks_path(self):
return self.payload_apple_root_path / Path("PrivateFrameworks")
@property
def payload_apple_private_frameworks_path_accel(self):
return self.payload_apple_private_frameworks_path / Path("Graphics-Acceleration")
return self.payload_apple_private_frameworks_path / Path("Graphics-Acceleration-Non-Metal")
@property
def payload_apple_private_frameworks_path_accel_ts2(self):
@@ -633,6 +649,14 @@ class Constants:
@property
def legacy_wifi_libexec(self):
return self.payload_apple_libexec_path / Path("Legacy-Wifi")
@property
def legacy_wifi_etc(self):
return self.payload_apple_etc_path / Path("Legacy-Wifi")
@property
def legacy_keyboard_backlight_etc(self):
return self.payload_apple_etc_path / Path("Keyboard-Backlight")
sbm_values = [
"j137ap", # iMacPro1,1

View File

@@ -1,6 +1,6 @@
# Generate Default Data
from resources import utilities, device_probe
from data import model_array
from resources import utilities, device_probe, generate_smbios
from data import model_array, smbios_data
class generate_defaults:
@@ -14,16 +14,44 @@ class generate_defaults:
if host_is_target:
if utilities.check_metal_support(device_probe, settings.computer) is False:
settings.disable_cs_lv = True
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
settings.sip_status = False
settings.amfi_status = True
settings.allow_fv_root = True # Allow FileVault on broken seal
if settings.computer.gpus:
for gpu in settings.computer.gpus:
if gpu.arch == device_probe.NVIDIA.Archs.Kepler:
# 12.0 (B7+): Kepler are now unsupported
settings.sip_status = False
settings.amfi_status = True
settings.allow_fv_root = True # Allow FileVault on broken seal
break
if (
isinstance(settings.computer.wifi, device_probe.Broadcom)
and settings.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(settings.computer.wifi, device_probe.Atheros) and settings.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
# 12.0: Legacy Wireless chipsets require root patching
settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal
if settings.computer.gpus:
for gpu in settings.computer.gpus:
if gpu.arch in [
device_probe.AMD.Archs.Legacy_GCN_7000,
device_probe.AMD.Archs.Legacy_GCN_8000,
device_probe.AMD.Archs.Legacy_GCN_9000,
device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega,
device_probe.AMD.Archs.Navi,
]:
# Allow H.265 on AMD
try:
smbios_data.smbios_dictionary[model]["Socketed GPUs"]
settings.serial_settings = "Minimal"
except KeyError:
pass
break
elif model in ["MacPro4,1", "MacPro5,1"]:
# Allow H.265 on AMD
# Assume 2009+ machines have Polaris on pre-builts (internal testing)
# Hardware Detection will never hit this
settings.serial_settings = "Minimal"
elif model in model_array.LegacyGPU:
settings.disable_cs_lv = True
@@ -34,10 +62,6 @@ class generate_defaults:
settings.sip_status = False
# settings.secure_status = True # Monterey
settings.allow_fv_root = True # Allow FileVault on broken seal
else:
settings.sip_status = True
# settings.secure_status = True # Monterey
settings.amfi_status = True
else:
settings.sip_status = False # Unsigned kexts
settings.secure_status = False # Root volume modified
@@ -50,10 +74,6 @@ class generate_defaults:
settings.allow_fv_root = True # Allow FileVault on broken seal
# settings.amfi_status = True # Signed bundles, Don't need to explicitly set currently
if model == "MacBook8,1":
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
settings.serial_settings = "Moderate"
custom_cpu_model_value = utilities.get_nvram("revcpuname", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
if custom_cpu_model_value is not None:
# TODO: Fix to not use two separate variables
@@ -73,3 +93,22 @@ class generate_defaults:
# Check if running in RecoveryOS
settings.recovery_status = utilities.check_recovery()
# Check if model uses T2 SMBIOS, if so see if it needs root patching (determined earlier on via SIP variable)
# If not, allow SecureBootModel usage, otherwise force VMM patching
# Needed for macOS Monterey to allow OTA updates
try:
spoof_model = generate_smbios.set_smbios_model_spoof(model)
except:
# Native Macs (mainly M1s) will error out as they don't know what SMBIOS to spoof to
# As we don't spoof on native models, we can safely ignore this
spoof_model = model
if smbios_data.smbios_dictionary[spoof_model]["SecureBootModel"] is not None:
if settings.sip_status is False:
# Force VMM as root patching breaks .im4m signature
settings.secure_status = False
settings.force_vmm = True
else:
# Allow SecureBootModel
settings.secure_status = True
settings.force_vmm = False

View File

@@ -7,6 +7,7 @@ import binascii
import enum
import itertools
import subprocess
import plistlib
from dataclasses import dataclass, field
from typing import Any, ClassVar, Optional, Type, Union
@@ -50,8 +51,8 @@ class PCIDevice:
device = cls(vendor_id, device_id, int.from_bytes(properties["class-code"][:6], byteorder="little"), name=ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetName(entry, None)[1]))
if "model" in properties:
device.model = properties["model"].strip(b"\0").decode()
if "acpi_path" in properties:
device.acpi_path = properties["acpi-path"].strip(b"\0").decode()
if "acpi-path" in properties:
device.acpi_path = properties["acpi-path"]
device.populate_pci_path(entry)
return device
@@ -153,6 +154,10 @@ class NVMeController(PCIDevice):
class SATAController(PCIDevice):
CLASS_CODE: ClassVar[int] = 0x010601
@dataclass
class SASController(PCIDevice):
CLASS_CODE: ClassVar[int] = 0x010400
@dataclass
class NVIDIA(GPU):
@@ -339,6 +344,7 @@ class Computer:
oclp_version: Optional[str] = None
opencore_version: Optional[str] = None
bluetooth_chipset: Optional[str] = None
third_party_sata_ssd: Optional[bool] = False
@staticmethod
def probe():
@@ -351,6 +357,7 @@ class Computer:
computer.smbios_probe()
computer.cpu_probe()
computer.bluetooth_probe()
computer.sata_disk_probe()
return computer
def gpu_probe(self):
@@ -414,6 +421,14 @@ class Computer:
None,
)[1]
)
sas_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault,
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": [{"class-code": binascii.a2b_hex(utilities.hexswap(hex(SASController.CLASS_CODE)[2:].zfill(8)))}]},
None,
)[1]
)
nvme_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault, {"IOProviderClass": "IONVMeController", "IOParentMatch": {"IOProviderClass": "IOPCIDevice"}, "IOPropertyMatch": {"IOClass": "IONVMeController"}}, None
@@ -422,6 +437,11 @@ class Computer:
for device in sata_controllers:
self.storage.append(SATAController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
for device in sas_controllers:
self.storage.append(SASController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
for device in nvme_controllers:
parent = ioreg.IORegistryEntryGetParentEntry(device, "IOService".encode(), None)[1]
ioreg.IOObjectRelease(device)
@@ -433,7 +453,19 @@ class Computer:
controller = NVMeController.from_ioregistry(parent)
controller.aspm = aspm
if controller.vendor_id != 0x106B:
if (
# Handle Apple Vendor ID
controller.vendor_id != 0x106B
and (
# Handle soldered Samsung SSDs
controller.vendor_id != 0x144D and controller.device_id != 0xA804
)
):
# Avoid patching when a native Apple NVMe drive is present
# Note on 2016-2017 MacBook Pros, 15" devices used a stock Samsung SSD with IONVMeController
# Technically this should be patched based on NVMeFix.kext logic,
# however Apple deemed the SSD unsupported for usage with AppleNVMeController class
# https://github.com/acidanthera/NVMeFix/blob/1.0.9/NVMeFix/NVMeFix.cpp#L220-L225
self.storage.append(controller)
ioreg.IOObjectRelease(parent)
@@ -475,3 +507,26 @@ class Computer:
self.bluetooth_chipset = "BRCM20702 Hub"
elif "Bluetooth":
self.bluetooth_chipset = "Generic"
def sata_disk_probe(self):
# Get all SATA Controllers/Disks from 'system_profiler SPSerialATADataType'
# Determine whether SATA SSD is present and Apple-made
sp_sata_data = plistlib.loads(subprocess.run(f"system_profiler SPSerialATADataType -xml".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
for root in sp_sata_data:
for ahci_controller in root["_items"]:
# Each AHCI controller will have its own entry
# Skip entries that are AHCI PCIe controllers
# Apple's AHCI PCIe controller will report 'PCI' interconnect
try:
if ahci_controller["spsata_physical_interconnect"] == "SATA":
for port in ahci_controller["_items"]:
if port["spsata_medium_type"] == "Solid State" and "apple" not in port["device_model"].lower():
self.third_party_sata_ssd = True
# Bail out of loop as we only need to know if there are any third-party SSDs present
break
except KeyError:
# Notes:
# - SATA Optical Disk Drives don't report 'spsata_medium_type'
# - 'spsata_physical_interconnect' was not introduced till 10.9
continue

213
resources/install.py Normal file
View File

@@ -0,0 +1,213 @@
# Installation of OpenCore files to ESP
# Usage soley for TUI
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
import plistlib
import subprocess
import shutil
import os
from pathlib import Path
from resources import utilities, constants
from data import os_data
class tui_disk_installation:
def __init__(self, versions):
self.constants: constants.Constants = versions
def copy_efi(self):
utilities.cls()
utilities.header(["Installing OpenCore to Drive"])
if not self.constants.opencore_release_folder.exists():
utilities.TUIOnlyPrint(
["Installing OpenCore to Drive"],
"Press [Enter] to go back.\n",
[
"""OpenCore folder missing!
Please build OpenCore first!"""
],
).start()
return
print("\nDisk picker is loading...")
all_disks = {}
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
try:
# High Sierra and newer
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
except ValueError:
# Sierra and older
disks = plistlib.loads(subprocess.run("diskutil list -plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
for disk in disks["AllDisksAndPartitions"]:
disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
try:
all_disks[disk["DeviceIdentifier"]] = {"identifier": disk_info["DeviceNode"], "name": disk_info["MediaName"], "size": disk_info["TotalSize"], "partitions": {}}
for partition in disk["Partitions"]:
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {partition['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
all_disks[disk["DeviceIdentifier"]]["partitions"][partition["DeviceIdentifier"]] = {
"fs": partition_info.get("FilesystemType", partition_info["Content"]),
"type": partition_info["Content"],
"name": partition_info.get("VolumeName", ""),
"size": partition_info["TotalSize"],
}
except KeyError:
# Avoid crashing with CDs installed
continue
# TODO: Advanced mode
menu = utilities.TUIMenu(
["Select Disk"],
"Please select the disk you would like to install OpenCore to: ",
in_between=["Missing disks? Ensure they have an EFI or FAT32 partition."],
return_number_instead_of_direct_call=True,
loop=True,
)
for disk in all_disks:
if not any(all_disks[disk]["partitions"][partition]["fs"] in ("msdos", "EFI") for partition in all_disks[disk]["partitions"]):
continue
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})", key=disk[4:])
response = menu.start()
if response == -1:
return
disk_identifier = "disk" + response
selected_disk = all_disks[disk_identifier]
menu = utilities.TUIMenu(
["Select Partition"],
"Please select the partition you would like to install OpenCore to: ",
return_number_instead_of_direct_call=True,
loop=True,
in_between=["Missing partitions? Ensure they are formatted as an EFI or FAT32.", "", "* denotes likely candidate."],
)
for partition in selected_disk["partitions"]:
if selected_disk["partitions"][partition]["fs"] not in ("msdos", "EFI"):
continue
text = f"{partition}: {selected_disk['partitions'][partition]['name']} ({utilities.human_fmt(selected_disk['partitions'][partition]['size'])})"
if selected_disk["partitions"][partition]["type"] == "EFI" or (
selected_disk["partitions"][partition]["type"] == "Microsoft Basic Data" and selected_disk["partitions"][partition]["size"] < 1024 * 1024 * 512
): # 512 megabytes:
text += " *"
menu.add_menu_option(text, key=partition[len(disk_identifier) + 1 :])
response = menu.start()
if response == -1:
return
self.install_opencore(disk_identifier, response)
def install_opencore(self, disk_identifier, response):
def determine_sd_card(media_name):
# Array filled with common SD Card names
# Note most USB-based SD Card readers generally report as "Storage Device"
# Thus no reliable way to detect further without parsing IOService output (kUSBProductString)
if (
"SD Card" in media_name or \
"SD/MMC" in media_name or \
"SDXC Reader" in media_name or \
"SD Reader" in media_name or \
"Card Reader" in media_name
):
return True
return False
# TODO: Apple Script fails in Yosemite(?) and older
args = [
"osascript",
"-e",
f'''do shell script "diskutil mount {disk_identifier}s{response}"'''
' with prompt "OpenCore Legacy Patcher needs administrator privileges to mount your EFI."'
" with administrator privileges"
" without altering line endings",
]
if self.constants.detected_os >= os_data.os_data.el_capitan and not self.constants.recovery_status:
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
result = subprocess.run(f"diskutil mount {disk_identifier}s{response}".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode != 0:
if "execution error" in result.stderr.decode() and result.stderr.decode().strip()[-5:-1] == "-128":
# 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()
return
drive_host_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk_identifier}s{response}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
sd_type = drive_host_info["MediaName"]
try:
ssd_type = drive_host_info["SolidState"]
except KeyError:
ssd_type = False
mount_path = Path(partition_info["MountPoint"])
disk_type = partition_info["BusProtocol"]
utilities.cls()
utilities.header(["Copying OpenCore"])
if mount_path.exists():
if (mount_path / Path("EFI/Microsoft")).exists():
print("- Found Windows Boot Loader")
print("\nWould you like to continue installing OpenCore?")
print("Installing OpenCore onto this drive may make Windows unbootable until OpenCore")
print("is removed from the partition")
print("We highly recommend users partition 200MB off their drive with Disk Utility")
print(" Name:\t\t OPENCORE")
print(" Format:\t\t FAT32")
print(" Size:\t\t 200MB")
choice = input("\nWould you like to still install OpenCore to this drive?(y/n): ")
if not choice in ["y", "Y", "Yes", "yes"]:
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
return
if (mount_path / Path("EFI/OC")).exists():
print("- Removing preexisting EFI/OC folder")
shutil.rmtree(mount_path / Path("EFI/OC"), onerror=rmtree_handler)
if (mount_path / Path("System")).exists():
print("- Removing preexisting System folder")
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
if (mount_path / Path("boot.efi")).exists():
print("- Removing preexisting boot.efi")
os.remove(mount_path / Path("boot.efi"))
print("- Copying OpenCore onto EFI partition")
shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC"))
shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System"))
if Path(self.constants.opencore_release_folder / Path("boot.efi")).exists():
shutil.copy(self.constants.opencore_release_folder / Path("boot.efi"), mount_path / Path("boot.efi"))
if self.constants.boot_efi is True:
print("- Converting Bootstrap to BOOTx64.efi")
if (mount_path / Path("EFI/BOOT")).exists():
shutil.rmtree(mount_path / Path("EFI/BOOT"), onerror=rmtree_handler)
Path(mount_path / Path("EFI/BOOT")).mkdir()
shutil.move(mount_path / Path("System/Library/CoreServices/boot.efi"), mount_path / Path("EFI/BOOT/BOOTx64.efi"))
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
if determine_sd_card(sd_type) is True:
print("- Adding SD Card icon")
shutil.copy(self.constants.icon_path_sd, mount_path)
elif ssd_type is True:
print("- Adding SSD icon")
shutil.copy(self.constants.icon_path_ssd, mount_path)
elif disk_type == "USB":
print("- Adding External USB Drive icon")
shutil.copy(self.constants.icon_path_external, mount_path)
else:
print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, mount_path)
print("- Cleaning install location")
if not self.constants.recovery_status:
print("- Unmounting EFI partition")
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
print("- OpenCore transfer complete")
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()
def rmtree_handler(func, path, exc_info):
if exc_info[0] == FileNotFoundError:
return
raise # pylint: disable=misplaced-bare-raise

175
resources/installer.py Normal file
View File

@@ -0,0 +1,175 @@
# Creates a macOS Installer
from pathlib import Path
import plistlib
import subprocess
from resources import utilities
def list_local_macOS_installers():
# Finds all applicable macOS installers
# within a user's /Applications folder
# Returns a list of installers
application_list = {}
for application in Path("/Applications").iterdir():
# Verify whether application has createinstallmedia
if (Path("/Applications") / Path(application) / Path("Contents/Resources/createinstallmedia")).exists():
plist = plistlib.load((Path("/Applications") / Path(application) / Path("Contents/Info.plist")).open("rb"))
try:
# Doesn't reflect true OS build, but best to report SDK in the event multiple installers are found with same version
app_version = plist["DTPlatformVersion"]
clean_name = plist["CFBundleDisplayName"]
try:
app_sdk = plist["DTSDKBuild"]
except KeyError:
app_sdk = "Unknown"
application_list.update({
application: {
"Short Name": clean_name,
"Version": app_version,
"Build": app_sdk,
"Path": application,
}
})
except KeyError:
pass
return application_list
def create_installer(installer_path, volume_name):
# Creates a macOS installer
# Takes a path to the installer and the Volume
# Returns boolean on success status
createinstallmedia_path = Path("/Applications") / Path(installer_path) / Path("Contents/Resources/createinstallmedia")
# Sanity check in the event the user somehow deleted it between the time we found it and now
if (createinstallmedia_path).exists():
utilities.cls()
utilities.header(["Starting createinstallmedia"])
print("This will take some time, recommend making some coffee while you wait\n")
utilities.elevated([createinstallmedia_path, "--volume", f"/Volumes/{volume_name}", "--nointeraction"])
return True
else:
print("- Failed to find createinstallmedia")
return False
def download_install_assistant(download_path, ia_link):
# Downloads and unpackages InstallAssistant.pkg into /Applications
utilities.download_file(ia_link, (Path(download_path) / Path("InstallAssistant.pkg")))
print("- Installing InstallAssistant.pkg to /Applications/")
utilities.elevated(["installer", "-pkg", (Path(download_path) / Path("InstallAssistant.pkg")), "-target", "/Applications"])
input("- Press ENTER to continue: ")
def list_downloadable_macOS_installers(download_path, catalog):
avalible_apps = {}
if catalog == "DeveloperSeed":
link = "https://swscan.apple.com/content/catalogs/others/index-12seed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"
elif catalog == "PublicSeed":
link = "https://swscan.apple.com/content/catalogs/others/index-12beta-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"
else:
link = "https://swscan.apple.com/content/catalogs/others/index-12customerseed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz"
# Download and unzip the catalog
utilities.download_file(link, (Path(download_path) / Path("seed.sucatalog.gz")))
subprocess.run(["gunzip", "-d", "-f", Path(download_path) / Path("seed.sucatalog.gz")])
catalog_plist = plistlib.load((Path(download_path) / Path("seed.sucatalog")).open("rb"))
for item in catalog_plist["Products"]:
try:
# Check if entry has SharedSupport and BuildManifest
# Ensures only Big Sur and newer Installers are listed
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["SharedSupport"]
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["BuildManifest"]
for bm_package in catalog_plist["Products"][item]["Packages"]:
if "BuildManifest.plist" in bm_package["URL"]:
utilities.download_file(bm_package["URL"], (Path(download_path) / Path("BuildManifest.plist")))
build_plist = plistlib.load((Path(download_path) / Path("BuildManifest.plist")).open("rb"))
version = build_plist["ProductVersion"]
build = build_plist["ProductBuildVersion"]
for ia_package in catalog_plist["Products"][item]["Packages"]:
if "InstallAssistant.pkg" in ia_package["URL"]:
download_link = ia_package["URL"]
size = ia_package["Size"]
integrity = ia_package["IntegrityDataURL"]
avalible_apps.update({
item: {
"Version": version,
"Build": build,
"Link": download_link,
"Size": size,
"integrity": integrity,
"Source": "Apple Inc.",
}
})
except KeyError:
pass
return avalible_apps
def format_drive(disk_id):
# Formats a disk for macOS install
# Takes a disk ID
# Returns boolean on success status
header = f"# Formatting disk{disk_id} for macOS installer #"
box_length = len(header)
utilities.cls()
print("#" * box_length)
print(header)
print("#" * box_length)
print("")
#print(f"- Formatting disk{disk_id} for macOS installer")
format_process = utilities.elevated(["diskutil", "eraseDisk", "HFS+", "OCLP-Installer", f"disk{disk_id}"])
if format_process.returncode == 0:
print("- Disk formatted")
return True
else:
print("- Failed to format disk")
print(f" Error Code: {format_process.returncode}")
input("\nPress Enter to exit")
return False
def select_disk_to_format():
utilities.cls()
utilities.header(["Installing OpenCore to Drive"])
print("\nDisk picker is loading...")
all_disks = {}
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
try:
# High Sierra and newer
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
except ValueError:
# Sierra and older
disks = plistlib.loads(subprocess.run("diskutil list -plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
for disk in disks["AllDisksAndPartitions"]:
disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
try:
all_disks[disk["DeviceIdentifier"]] = {"identifier": disk_info["DeviceNode"], "name": disk_info["MediaName"], "size": disk_info["TotalSize"], "removable": disk_info["Internal"], "partitions": {}}
except KeyError:
# Avoid crashing with CDs installed
continue
menu = utilities.TUIMenu(
["Select Disk to write the macOS Installer onto"],
"Please select the disk you would like to install OpenCore to: ",
in_between=["Missing drives? Verify they are 14GB+ and external (ie. USB)", "", "Ensure all data is backed up on selected drive, entire drive will be erased!"],
return_number_instead_of_direct_call=True,
loop=True,
)
for disk in all_disks:
# Strip disks that are under 14GB (15,032,385,536 bytes)
# createinstallmedia isn't great at detecting if a disk has enough space
if not any(all_disks[disk]['size'] > 15032385536 for partition in all_disks[disk]):
continue
# Strip internal disks as well (avoid user formatting their SSD/HDD)
# Ensure user doesn't format their boot drive
if not any(all_disks[disk]['removable'] is False for partition in all_disks[disk]):
continue
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})", key=disk[4:])
response = menu.start()
if response == -1:
return None
return response

View File

@@ -13,7 +13,7 @@ from pathlib import Path
import sys
from resources import constants, device_probe, utilities, generate_smbios
from data import sip_data, sys_patch_data, model_array
from data import sip_data, sys_patch_data, model_array, os_data, smbios_data, cpu_data, dylib_data
class PatchSysVolume:
@@ -38,6 +38,7 @@ class PatchSysVolume:
self.legacy_audio = False
self.legacy_wifi = False
self.legacy_gmux = False
self.legacy_keyboard_backlight = False
self.added_legacy_kexts = False
self.amfi_must_disable = False
self.check_board_id = False
@@ -46,11 +47,13 @@ class PatchSysVolume:
self.validate = False
self.supports_metal = False
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
# Big Sur and newer use APFS snapshots
self.mount_location = "/System/Volumes/Update/mnt1"
self.mount_location_data = ""
else:
self.mount_location = ""
self.mount_location_data = ""
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"
@@ -58,18 +61,21 @@ class PatchSysVolume:
self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks"
self.mount_libexec = f"{self.mount_location}/usr/libexec"
self.mount_extensions_mux = f"{self.mount_location}/System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns/"
self.mount_private_etc = f"{self.mount_location_data}/private/etc"
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 == self.constants.catalina and self.validate is False:
if self.constants.detected_os == os_data.os_data.catalina and self.validate is False:
print("- Mounting Catalina 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():
print("- Root Volume is already mounted")
if patch is True:
if self.constants.detected_os < self.constants.big_sur or (self.constants.detected_os == self.constants.big_sur and utilities.check_seal() 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:
self.backup_volume()
self.patch_root_vol()
return True
@@ -77,13 +83,15 @@ class PatchSysVolume:
self.unpatch_root_vol()
return True
else:
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
print("- Mounting APFS Snapshot as writable")
utilities.elevated(["mount", "-o", "nobrowse", "-t", "apfs", f"/dev/{self.root_mount_path}", self.mount_location], stdout=subprocess.PIPE).stdout.decode().strip().encode()
if Path(self.mount_extensions).exists():
print("- Successfully mounted the Root Volume")
if patch is True:
if self.constants.detected_os < self.constants.big_sur or (self.constants.detected_os == self.constants.big_sur and utilities.check_seal() 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:
self.backup_volume()
self.patch_root_vol()
return True
@@ -191,7 +199,7 @@ class PatchSysVolume:
print("- Could not find Extensions.zip, cannot manually unpatch root volume")
def unpatch_root_vol(self):
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
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:
@@ -207,17 +215,35 @@ class PatchSysVolume:
self.manual_root_patch_revert()
def rebuild_snapshot(self):
if self.constants.gui_mode is False:
input("Press [ENTER] to continue with cache rebuild: ")
# Grab List.txt if appropriate
dylib_list = self.build_skylight_plugin_list()
if dylib_list is not None:
print("- Updating SkyLightPlugins List.txt")
if (Path(self.mount_private_etc) / Path("SkyLightPlugins/List.txt")).exists():
print("- Removing existing List.txt")
utilities.process_status(
utilities.elevated(
["rm", "-f", f"{self.mount_private_etc}/SkyLightPlugins/List.txt"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
utilities.process_status(
utilities.elevated(
["cp", dylib_list, f"{self.mount_private_etc}/SkyLightPlugins/"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
print("- Rebuilding Kernel Cache (This may take some time)")
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
result = utilities.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
result = utilities.elevated(["kextcache", "-i", f"{self.mount_location}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# kextcache always returns 0, even if it fails
# Check the output for 'KernelCache ID' to see if the cache was successfully rebuilt
if result.returncode != 0 or (self.constants.detected_os < self.constants.catalina and "KernelCache ID" not in result.stdout.decode()):
if result.returncode != 0 or (self.constants.detected_os < os_data.os_data.catalina and "KernelCache ID" not in result.stdout.decode()):
self.success_status = False
print("- Unable to build new kernel cache")
print("\nPlease report this to Github")
@@ -230,12 +256,12 @@ 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 > self.constants.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 > self.constants.catalina:
# 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:
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
@@ -250,7 +276,7 @@ class PatchSysVolume:
else:
self.unmount_drive()
else:
if self.constants.detected_os == self.constants.catalina:
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")
@@ -291,6 +317,34 @@ set million colour before rebooting"""
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 build_skylight_plugin_list(self):
# ASentientBot's Skylight system support injecting additional dylibs into macOS
# To do so, it parses the List.txt file in '/private/etc/SkyLightPlugins/'
# The format of this file is:
# <plugin path> : <plugin name>
# Parse all dylibs in /private/etc/SkyLightPlugins/, generate an appropriate List.txt
skylight_plugins = []
if self.constants.list_txt_path.exists():
self.constants.list_txt_path.unlink()
if (Path(self.mount_private_etc) / Path("SkyLightPlugins")).exists():
for file in (Path(self.mount_private_etc) / Path("SkyLightPlugins")).glob("*.dylib"):
skylight_plugins.append(file.name)
if len(skylight_plugins) > 0:
with open(self.constants.list_txt_path, "w") as f:
for plugin in skylight_plugins:
try:
path = dylib_data.shim_list.shim_pathing[plugin]
print(f"- Adding {plugin} to list.txt")
f.write(f"{path} : {plugin}\n")
except KeyError:
print(f"- Skipping {plugin}, unknown pathing")
continue
return self.constants.list_txt_path
return None
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)
@@ -315,36 +369,46 @@ set million colour before rebooting"""
utilities.process_status(utilities.elevated(["chmod", "755", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["chown", "root:wheel", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
# dylib patch to resolve password crash prompt
# Note requires ASentientBot's SkyLight to function
# Thus Metal machines do not benefit from this patch, however install anyways as harmless
print("- Merging Wireless private/etc")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_wifi_etc}/", self.mount_private_etc], stdout=subprocess.PIPE)
def add_legacy_mux_patch(self):
self.delete_old_binaries(sys_patch_data.DeleteDemux)
print("- Merging Legacy Mux Kext patches")
utilities.process_status(
utilities.elevated(["cp", "-R", f"{self.constants.legacy_mux_path}/AppleMuxControl.kext", self.mount_extensions_mux], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
def add_legacy_keyboard_backlight_patch(self):
print("- Merging Backlight private/etc")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_keyboard_backlight_etc}/", self.mount_private_etc], stdout=subprocess.PIPE)
def gpu_accel_legacy(self):
if self.constants.detected_os == self.constants.mojave:
if self.constants.detected_os == os_data.os_data.mojave:
print("- Installing General Acceleration Kext patches for Mojave")
self.add_new_binaries(sys_patch_data.AddGeneralAccelMojave, self.constants.legacy_general_path)
elif self.constants.detected_os == self.constants.catalina:
elif self.constants.detected_os == os_data.os_data.catalina:
print("- Installing General Acceleration Kext patches for Catalina")
self.add_new_binaries(sys_patch_data.AddGeneralAccelCatalina, self.constants.legacy_general_path)
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey]:
print("- Installing General Acceleration Kext patches for Big Sur/Monterey")
self.add_new_binaries(sys_patch_data.AddGeneralAccel, self.constants.legacy_general_path)
# Nvidia
def gpu_accel_legacy_nvidia_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina]:
print("- Installing Nvidia Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey]:
print("- Installing Nvidia Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
if self.constants.detected_os == self.constants.monterey and self.constants.detected_os_minor > 0:
if self.constants.detected_os == os_data.os_data.monterey and self.constants.detected_os_minor > 0:
# Beta 7+ removes NVDAStartup
self.add_new_binaries(sys_patch_data.AddNvidiaTeslaAccel12, self.constants.legacy_nvidia_kepler_path)
else:
@@ -353,11 +417,11 @@ set million colour before rebooting"""
# AMD/ATI
def gpu_accel_legacy_ts1_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina]:
print("- Installing TeraScale 1 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey]:
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
self.gpu_accel_legacy()
@@ -367,11 +431,11 @@ set million colour before rebooting"""
self.add_new_binaries(sys_patch_data.AddAMDBrightness, self.constants.legacy_amd_path)
def gpu_accel_legacy_ts2_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.allow_ts2_accel is True:
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina] and self.constants.allow_ts2_accel is True:
print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey] and self.constants.allow_ts2_accel is True:
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)
@@ -384,11 +448,11 @@ set million colour before rebooting"""
# Intel
def gpu_accel_legacy_ironlake_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina]:
print("- Installing Ironlake Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey]:
print("- Installing Ironlake Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
@@ -398,12 +462,12 @@ set million colour before rebooting"""
self.add_new_binaries(sys_patch_data.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
def gpu_accel_legacy_sandybridge_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
if self.constants.detected_os in [os_data.os_data.mojave, os_data.os_data.catalina]:
print("- Installing Sandy Bridge Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(sys_patch_data.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
self.gpu_accel_legacy_sandybridge_board_id()
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
elif self.constants.detected_os in [os_data.os_data.big_sur, os_data.os_data.monterey]:
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur/Monterey")
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
@@ -450,7 +514,7 @@ set million colour before rebooting"""
utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/AppleIntelSNBGraphicsFB.kext"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def gpu_framebuffer_ivybridge_master(self):
if self.constants.detected_os == self.constants.monterey:
if self.constants.detected_os == os_data.os_data.monterey:
print("- Installing IvyBridge Acceleration Kext patches for Monterey")
self.add_new_binaries(sys_patch_data.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
if self.validate is False:
@@ -465,9 +529,11 @@ set million colour before rebooting"""
self.add_new_binaries(sys_patch_data.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
def gpu_framebuffer_kepler_master(self):
if self.constants.detected_os == self.constants.monterey:
if self.constants.detected_os == os_data.os_data.monterey:
print("- Installing Kepler Acceleration Kext patches for Monterey")
self.add_new_binaries(sys_patch_data.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
print("- Merging Kepler Frameworks")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_kepler}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
print("- Installing Kepler Kext patches for generic OS")
self.add_new_binaries(sys_patch_data.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
@@ -479,19 +545,19 @@ set million colour before rebooting"""
def gpu_accel_legacy_extended(self):
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 > self.constants.big_sur:
if self.constants.detected_os > os_data.os_data.big_sur:
print("- Merging Monterey WebKit patch")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ivy}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print("- Merging general legacy PrivateFrameworks")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
if self.constants.detected_os > self.constants.catalina:
print("- Adding IOHID-Fixup.plist")
utilities.process_status(
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_lauchd_path_accel}/", self.mount_lauchd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
utilities.process_status(utilities.elevated(["chmod", "755", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["chown", "root:wheel", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
if self.constants.detected_os > os_data.os_data.catalina:
# With PatcherSupportPkg v0.2.0, IOHID-Fixup.plist is deprecated and integrated into SkyLight patch set
if (Path(self.mount_lauchd) / Path("IOHID-Fixup.plist")).exists():
print("- Stripping legacy IOHID-Fixup.plist")
utilities.process_status(
utilities.elevated(["rm", "-f", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
else:
print("- Disabling Library Validation")
utilities.process_status(
@@ -526,7 +592,7 @@ set million colour before rebooting"""
elif self.kepler_gpu is True:
print("- Installing Kepler Patches")
if self.constants.detected_os == self.constants.monterey:
if self.constants.detected_os == os_data.os_data.monterey:
print("- Detected supported OS, installing Acceleration Patches")
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
@@ -570,7 +636,7 @@ set million colour before rebooting"""
elif self.ivy_gpu is True:
print("- Installing Ivy Bridge Patches")
if self.constants.detected_os == self.constants.monterey:
if self.constants.detected_os == os_data.os_data.monterey:
print("- Detected supported OS, installing Acceleration Patches")
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
@@ -601,6 +667,10 @@ set million colour before rebooting"""
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()
@@ -620,13 +690,13 @@ set million colour before rebooting"""
self.download_files()
def download_files(self):
if self.constants.detected_os == self.constants.monterey:
if self.constants.detected_os == os_data.os_data.monterey:
os_ver = "12-Monterey"
elif self.constants.detected_os == self.constants.big_sur:
elif self.constants.detected_os == os_data.os_data.big_sur:
os_ver = "11-Big-Sur"
elif self.constants.detected_os == self.constants.catalina:
elif self.constants.detected_os == os_data.os_data.catalina:
os_ver = "10.15-Catalina"
elif self.constants.detected_os == self.constants.mojave:
elif self.constants.detected_os == os_data.os_data.mojave:
os_ver = "10.14-Mojave"
else:
raise Exception(f"Unsupported OS: {self.constants.detected_os}")
@@ -657,8 +727,8 @@ set million colour before rebooting"""
Path(self.constants.payload_apple_root_path_zip).unlink()
print("- Binaries downloaded to:")
print(self.constants.payload_path)
if self.constants.gui_mode is False:
input("Press [ENTER] to continue")
# if self.constants.gui_mode is False:
# input("Press [ENTER] to continue")
except zipfile.BadZipFile:
print("- Couldn't unzip")
return
@@ -670,24 +740,24 @@ set million colour before rebooting"""
def detect_gpus(self):
gpus = self.constants.computer.gpus
if self.constants.moj_cat_accel is True:
non_metal_os = self.constants.high_sierra
non_metal_os = os_data.os_data.high_sierra
else:
non_metal_os = self.constants.catalina
i = 0
for gpu in gpus:
non_metal_os = os_data.os_data.catalina
for i, gpu in enumerate(gpus):
if gpu.class_code and gpu.class_code != 0xFFFFFFFF:
print(f"- Found GPU ({i}): {utilities.friendly_hex(gpu.vendor_id)}:{utilities.friendly_hex(gpu.device_id)}")
if gpu.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Fermi]:
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()
elif gpu.arch == device_probe.NVIDIA.Archs.Kepler:
if self.constants.detected_os > self.constants.big_sur:
if self.constants.detected_os > os_data.os_data.big_sur:
# Kepler drivers were dropped with Beta 7
# 12.0 Beta 5: 21.0.0 - 21A5304g
# 12.0 Beta 6: 21.1.0 - 21A5506j
# 12.0 Beta 7: 21.1.0 - 21A5522h
if self.constants.detected_os == self.constants.monterey and self.constants.detected_os_minor > 0:
if self.constants.detected_os == os_data.os_data.monterey and self.constants.detected_os_minor > 0:
if "21A5506j" not in self.constants.detected_os_build:
self.kepler_gpu = True
self.supports_metal = True
@@ -709,10 +779,9 @@ set million colour before rebooting"""
self.amfi_must_disable = True
self.check_board_id = True
elif gpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
if self.constants.detected_os > self.constants.big_sur:
if self.constants.detected_os > os_data.os_data.big_sur:
self.ivy_gpu = True
self.supports_metal = True
i += 1
if self.supports_metal is True:
# Avoid patching Metal and non-Metal GPUs if both present, prioritize Metal GPU
# Main concerns are for iMac12,x with Sandy iGPU and Kepler dGPU
@@ -740,30 +809,44 @@ set million colour before rebooting"""
if igpu and not dgpu:
return True
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
return False
def detect_patch_set(self):
self.detect_gpus()
if self.model in model_array.LegacyBrightness:
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
self.brightness_legacy = True
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
# Special hack for systems with botched GOPs
# TL;DR: No Boot Screen breaks Lilu, therefore breaking audio
if self.constants.detected_os > self.constants.catalina:
if self.constants.detected_os > os_data.os_data.catalina:
self.legacy_audio = True
if (
isinstance(self.constants.computer.wifi, device_probe.Broadcom)
and self.constants.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(self.constants.computer.wifi, device_probe.Atheros) and self.constants.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
if self.constants.detected_os > self.constants.big_sur:
if self.constants.detected_os > os_data.os_data.big_sur:
self.legacy_wifi = True
if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
# if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Sierra uses a legacy GMUX control method needed for dGPU switching on MacBookPro5,x
# Same method is also used for demuxed machines
if self.constants.detected_os > self.constants.high_sierra:
# Note that MacBookPro5,x machines are extremely unstable with this patch set, so disabled until investigated further
# Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/files/7360909/KP-b10-030.txt
if self.constants.detected_os > os_data.os_data.high_sierra:
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Ref: https://doslabelectronics.com/Demux.html
if self.detect_demux() is True:
@@ -795,6 +878,8 @@ set million colour before rebooting"""
print("- Add legacy WiFi Control")
if self.legacy_gmux is True:
print("- Add Legacy Mux Brightness Control")
if self.legacy_keyboard_backlight is True:
print("- Add Legacy Keyboard Backlight Control")
self.no_patch = not any(
[
@@ -813,12 +898,12 @@ set million colour before rebooting"""
)
def verify_patch_allowed(self):
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur if self.constants.detected_os > self.constants.catalina else sip_data.system_integrity_protection.root_patch_sip_mojave
sip = sip_data.system_integrity_protection.root_patch_sip_big_sur if self.constants.detected_os > os_data.os_data.catalina else sip_data.system_integrity_protection.root_patch_sip_mojave
if sip == sip_data.system_integrity_protection.root_patch_sip_mojave:
sip_value = "For Hackintoshes, please set csr-active-config to '03060000' (0x603)\nFor non-OpenCore Macs, please run 'csrutil disable' in RecoveryOS"
else:
sip_value = (
"For Hackintoshes, please set csr-active-config to '030E0000' (0xE03)\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
"For Hackintoshes, please set csr-active-config to '030A0000' (0xA03)\nFor non-OpenCore Macs, please run 'csrutil disable' and \n'csrutil authenticated-root disable' in RecoveryOS"
)
self.sip_enabled, self.sbm_enabled, self.amfi_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os)
if self.sip_enabled is True:

View File

@@ -10,6 +10,8 @@ from pathlib import Path
import os
import binascii
import argparse
from ctypes import CDLL, c_uint, byref
import sys, time
try:
import requests
@@ -21,7 +23,7 @@ except ImportError:
raise Exception("Missing requests library!\nPlease run the following before starting OCLP:\npip3 install requests")
from resources import constants, ioreg
from data import sip_data
from data import sip_data, os_data
def hexswap(input_hex: str):
@@ -92,15 +94,21 @@ def check_seal():
return False
def csr_decode(csr_active_config, os_sip):
if csr_active_config is None:
csr_active_config = b"\x00\x00\x00\x00"
sip_int = int.from_bytes(csr_active_config, byteorder="little")
i = 0
for current_sip_bit in sip_data.system_integrity_protection.csr_values:
def csr_decode(os_sip):
# Based off sip_config.py
# https://gist.github.com/pudquick/8b320be960e1654b908b10346272326b
# https://opensource.apple.com/source/xnu/xnu-7195.141.2/libsyscall/wrappers/csr.c.auto.html
# Far more reliable than parsing csr-active-config
# Note that 'csr_get_active_config' was not introduced until 10.11
# However this function should never be called on 10.10 or earlier
libsys = CDLL('/usr/lib/libSystem.dylib')
raw = c_uint(0)
errmsg = libsys.csr_get_active_config(byref(raw))
sip_int = raw.value
for i, current_sip_bit in enumerate(sip_data.system_integrity_protection.csr_values):
if sip_int & (1 << i):
sip_data.system_integrity_protection.csr_values[current_sip_bit] = True
i = i + 1
# Can be adjusted to whatever OS needs patching
sip_needs_change = all(sip_data.system_integrity_protection.csr_values[i] for i in os_sip)
@@ -131,7 +139,7 @@ def amfi_status():
def check_kext_loaded(kext_name, os_version):
if os_version > constants.Constants().catalina:
if os_version > os_data.os_data.catalina:
kext_loaded = subprocess.run(["kmutil", "showloaded", "--list-only", "--variant-suffix", "release"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
kext_loaded = subprocess.run(["kextstat", "-l"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -159,16 +167,21 @@ def check_monterey_wifi():
def check_metal_support(device_probe, computer):
dgpu = computer.dgpu
igpu = computer.igpu
if (
(dgpu and dgpu.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Fermi, device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_2])
or (igpu and igpu.arch in [device_probe.Intel.Archs.Iron_Lake, device_probe.Intel.Archs.Sandy_Bridge])
or isinstance(igpu, device_probe.NVIDIA)
):
return False
else:
return True
if computer.gpus:
for gpu in computer.gpus:
if (
(gpu.arch in [
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2,
device_probe.Intel.Archs.Iron_Lake,
device_probe.Intel.Archs.Sandy_Bridge
]
)
):
return False
return True
def check_filevault_skip():
@@ -190,22 +203,24 @@ def patching_status(os_sip, os):
gen6_kext = "/System/Library/Extension/AppleIntelHDGraphics.kext"
gen7_kext = "/System/Library/Extension/AppleIntelHD3000Graphics.kext"
if os > constants.Constants().catalina:
if os > os_data.os_data.catalina:
amfi_enabled = amfi_status()
else:
# Catalina and older supports individually disabling Library Validation
amfi_enabled = False
if (
get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False)
and get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in constants.Constants().sbm_values
):
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False):
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in constants.Constants().sbm_values:
sbm_enabled = False
else:
sbm_enabled = False
if get_nvram("csr-active-config", decode=False) and csr_decode(get_nvram("csr-active-config", decode=False), os_sip) is False:
if os > os_data.os_data.yosemite:
sip_enabled = csr_decode(os_sip)
else:
sip_enabled = False
if os > constants.Constants().catalina and not check_filevault_skip():
if os > os_data.os_data.catalina and not check_filevault_skip():
# Assume non-OCLP Macs do not have our APFS seal patch
fv_status: str = subprocess.run("fdesetup status".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if "FileVault is Off" in fv_status:
@@ -238,6 +253,14 @@ def cls():
else:
print("\u001Bc")
def check_command_line_tools():
# Determine whether Command Line Tools exist
# xcode-select -p
xcode_select = subprocess.run("xcode-select -p".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if xcode_select.returncode == 0:
return True
else:
return False
def get_nvram(variable: str, uuid: str = None, *, decode: bool = False):
# TODO: Properly fix for El Capitan, which does not print the XML representation even though we say to
@@ -282,29 +305,75 @@ def get_rom(variable: str, *, decode: bool = False):
return value
def download_file(link, location):
print("- Attempting download from following link:")
print(link)
if Path(location).exists():
print("- Removing old file")
Path(location).unlink()
response = requests.get(link, stream=True)
with location.open("wb") as file:
count = 0
for chunk in response.iter_content(1024 * 1024 * 4):
file.write(chunk)
count += len(chunk)
cls()
print("- Downloading package")
print(f"- {count / 1024 / 1024}MB Downloaded")
checksum = hashlib.sha256()
with location.open("rb") as file:
chunk = file.read(1024 * 1024 * 16)
while chunk:
checksum.update(chunk)
chunk = file.read(1024 * 1024 * 16)
return checksum
def verify_network_connection(url):
try:
response = requests.head(url, timeout=5)
return True
except (requests.exceptions.Timeout, requests.exceptions.TooManyRedirects, requests.exceptions.ConnectionError, requests.exceptions.HTTPError):
return False
def download_file(link, location):
if verify_network_connection(link):
if Path(location).exists():
Path(location).unlink()
try:
# Handle cases where Content-Length has garbage or is missing
total_file_size = int(requests.head(link).headers['Content-Length'])
except KeyError:
total_file_size = 0
if total_file_size != 0:
file_size_rounded = round(total_file_size / 1024 / 1024, 2)
file_size_string = f" of {file_size_rounded}MB"
else:
file_size_string = ""
response = requests.get(link, stream=True)
short_link = os.path.basename(link)
# SU Catalog's link is quite long, strip to make it bearable
if "sucatalog.gz" in short_link:
short_link = "sucatalog.gz"
header = f"# Downloading: {short_link} #"
box_length = len(header)
box_string = "#" * box_length
dl = 0
total_downloaded_string = ""
with location.open("wb") as file:
count = 0
start = time.perf_counter()
for chunk in response.iter_content(1024 * 1024 * 4):
dl += len(chunk)
file.write(chunk)
count += len(chunk)
cls()
print(box_string)
print(header)
print(box_string)
print("")
if total_file_size != 0:
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}")
print(f"Average 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)
chunk = file.read(1024 * 1024 * 16)
return checksum
else:
cls()
header = "# Could not establish Network Connection with provided link! #"
box_length = len(header)
box_string = "#" * box_length
print(box_string)
print(header)
print(box_string)
if constants.Constants().url_patcher_support_pkg in link:
# If we're downloading PatcherSupportPkg, present offline build
print("\nPlease grab the offline variant of OpenCore Legacy Patcher from Github:")
print(f"https://github.com/dortania/OpenCore-Legacy-Patcher/releases/download/{constants.Constants().patcher_version}/OpenCore-Patcher-TUI-Offline.app.zip")
else:
print(link)
sys.exit()
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
# When runnign through our GUI, we run as root, however we do not get uid 0

View File

@@ -59,6 +59,8 @@ def validate(settings):
settings.opencore_debug = True
settings.opencore_build = "DEBUG"
settings.kext_debug = True
settings.kext_variant = "DEBUG"
settings.kext_debug = True
settings.showpicker = False
settings.sip_status = False
settings.secure_status = True
@@ -68,5 +70,6 @@ def validate(settings):
settings.disable_tb = True
settings.force_surplus = True
settings.software_demux = True
settings.serial_settings = "Minimal"
build_prebuilt()
build_dumps()