Compare commits

..

219 Commits
0.2.4 ... 0.3.1

Author SHA1 Message Date
Mykola Grymalyuk
113156c94c Sync changelog 2021-10-25 15:13:38 -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
1b4fd73673 Add TS2 MacBook Pro troubleshooting 2021-10-21 15:50:16 -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
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
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
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
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
a97a32730a Fix function cast 2021-10-15 16:09:47 -06:00
Mykola Grymalyuk
0b3e45f7ba Fix board ID call
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/571
2021-10-15 09:33:34 -06:00
Mykola Grymalyuk
fa89865552 Fix Beta 10 Bluetooth 2021-10-15 09:23:05 -06:00
Mykola Grymalyuk
f58de2e000 Sync PatcherSupportPkg
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/569
2021-10-14 19:05:34 -06:00
Mykola Grymalyuk
f9c1d96aea Fix ADP3,2 ID 2021-10-13 15:06:43 -06:00
Mykola Grymalyuk
30121d869f Add basic GPU data sets 2021-10-12 21:44:32 -06:00
Mykola Grymalyuk
bb62eded77 Add Curie and Comet Lake IDs 2021-10-12 21:42:33 -06:00
Mykola Grymalyuk
dd43a0f243 Add ATI R500 IDs 2021-10-12 21:03:23 -06:00
Mykola Grymalyuk
ce6195529b Add GMA data set 2021-10-12 20:48:52 -06:00
Mykola Grymalyuk
f26e494450 Add Legacy GCN iMac patches
Co-authored-by @Ausdauersportler
2021-10-12 13:20:02 -06:00
Mykola Grymalyuk
82fe98a93c Add Software Based deMUX
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/559
2021-10-11 15:50:07 -06:00
Mykola Grymalyuk
47a2f71612 Add firmware throttle patch
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/555
2021-10-10 20:42:05 -06:00
Mykola Grymalyuk
12e0ffff71 Fix offline releases 2021-10-10 16:46:30 -06:00
Mykola Grymalyuk
d7f3bb7d53 Add missing Macmini5,2 patch 2021-10-09 11:38:53 -06:00
Mykola Grymalyuk
06e0e9a2c0 Fix formatting 2021-10-09 11:19:39 -06:00
Mykola Grymalyuk
12998bc7e1 Fix return code error 2021-10-08 15:02:25 -06:00
Mykola Grymalyuk
68d13775d9 Work around erroring when single element in array 2021-10-08 15:00:58 -06:00
Mykola Grymalyuk
86694de7df Add error handling for bless failure 2021-10-08 12:53:06 -06:00
Mykola Grymalyuk
96fd706ead Implement EFICheckDisabler
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/552
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/551
2021-10-08 08:42:29 -06:00
Mykola Grymalyuk
a0fa3a8808 Fix desync off vmm branch
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/549
2021-10-06 19:23:52 -06:00
Mykola Grymalyuk
27383b5bc7 Update docs 2021-10-06 18:08:11 -06:00
Mykola Grymalyuk
75c6d10089 Fix accidental deletion 2021-10-06 10:37:11 -06:00
Mykola Grymalyuk
ee77f76c3a Add AppleGVA patch set 2021-10-06 09:44:00 -06:00
Mykola Grymalyuk
ae2a015c67 Fix references
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/545
2021-10-05 22:16:50 -06:00
Mykola Grymalyuk
9cbfe5be6a Add TS2 comments 2021-10-05 21:19:13 -06:00
Mykola Grymalyuk
b6297d6b63 Add Panel ID 9cd6 for iMac11,3
Co-authored-by @Ausdauersportler

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/538
2021-10-05 11:49:02 -06:00
Mykola Grymalyuk
f6ef7583ee Merge pull request #528 from dortania/refactor
Refactor Constants
2021-10-04 13:02:24 -06:00
Mykola Grymalyuk
e8d2b4f63e Fix on-model building with CLI 2021-10-04 12:47:27 -06:00
Mykola Grymalyuk
e210c0cbe6 I need sleep 2021-10-04 12:21:32 -06:00
Mykola Grymalyuk
9184302c18 Fix logic 2021-10-04 12:11:54 -06:00
Mykola Grymalyuk
fdfbbf6ae1 Fix clear screen usage in GUI 2021-10-04 11:52:42 -06:00
Mykola Grymalyuk
4f9abbaa49 Fix root patching from CLI 2021-10-04 11:21:59 -06:00
Mykola Grymalyuk
f524c4441b Update pci comment 2021-10-04 11:18:01 -06:00
Mykola Grymalyuk
5ca30e8ffe Fix spec 2021-10-04 11:13:24 -06:00
Mykola Grymalyuk
5742f745b1 Merge branch 'refactor' of https://github.com/dortania/OpenCore-Legacy-Patcher into refactor 2021-10-04 10:52:33 -06:00
Mykola Grymalyuk
91d20b2ad0 Rework args check 2021-10-04 10:52:11 -06:00
Mykola Grymalyuk
8272c092ad Fix init 2021-10-03 18:15:14 -06:00
Mykola Grymalyuk
3790555dec Fix init 2021-10-03 18:01:34 -06:00
Mykola Grymalyuk
3537725a13 Adjust build to py scheme 2021-10-03 14:14:55 -06:00
Mykola Grymalyuk
991a089c45 Tmp 2021-10-03 14:14:39 -06:00
Mykola Grymalyuk
8a6faa0836 Adjust utilities to py scheme 2021-10-03 14:12:11 -06:00
Mykola Grymalyuk
8e1923ee21 Tmp 2021-10-03 14:11:20 -06:00
Mykola Grymalyuk
a2f73a7bdc Adjust Constants to python scheme 2021-10-03 14:10:56 -06:00
Mykola Grymalyuk
2164463e3b Tmp 2021-10-03 14:09:40 -06:00
Mykola Grymalyuk
a980ba95f9 Fix typo 2021-10-03 13:57:17 -06:00
Mykola Grymalyuk
a70b18dd50 Convert additional files to snake naming scheme 2021-10-03 13:54:12 -06:00
Mykola Grymalyuk
e33997320b Use snake nameing scheme 2021-10-03 13:35:01 -06:00
Mykola Grymalyuk
b9a5ba7897 Rename to tmp folders
Work around git not checking case
2021-10-03 13:31:19 -06:00
Mykola Grymalyuk
c0350e036e Enforce Snake Style naming scheme for files 2021-10-03 13:24:51 -06:00
Mykola Grymalyuk
a5f489d48b Depreciate dedicated OCLP-CLI binary
OpenCore-Patcher now supports both CLI and TUI mode
2021-10-03 10:44:13 -06:00
Mykola Grymalyuk
426c572ce2 Fix AppleALC building 2021-10-01 18:00:53 -06:00
Mykola Grymalyuk
9f4ac80083 Update SMBIOS data
Include Ethernet and Chipset information
2021-10-01 12:28:28 -06:00
Mykola Grymalyuk
2e613600de Sync changelog 2021-10-01 10:22:12 -06:00
Mykola Grymalyuk
3a28ba699f Allow iGPU always on iMac13,x 2021-10-01 10:16:30 -06:00
Mykola Grymalyuk
fe359f7ea6 Move FirmwareFeature generation 2021-10-01 09:58:31 -06:00
Mykola Grymalyuk
0e07273c8e Move SMBIOS generation to dedicated file 2021-10-01 09:45:34 -06:00
Mykola Grymalyuk
8b41cc6ff5 Update .spec to include Data folder 2021-10-01 00:17:47 -06:00
Mykola Grymalyuk
d563011c72 Refactor SMBIOS table 2021-10-01 00:04:55 -06:00
Mykola Grymalyuk
06824e6757 Update MONTEREY-DROP.md 2021-09-30 12:09:15 -06:00
Mykola Grymalyuk
cc8bff1e1f Avoid Updating DataHub
Works around hibernation issue
2021-09-29 13:11:06 -06:00
Mykola Grymalyuk
6102bba478 Ensure overrides get RestrictEvents 2021-09-29 12:39:24 -06:00
Mykola Grymalyuk
dd40ddc452 Fix OTA updates on T2 SMBIOS
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/471
2021-09-29 11:49:30 -06:00
Mykola Grymalyuk
8d02a7984d Limit MacBookPro6,2 G State
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/520
2021-09-29 11:31:41 -06:00
Mykola Grymalyuk
61281f597a Add Legacy GMUX patch sets 2021-09-29 11:29:05 -06:00
Mykola Grymalyuk
11e795026b Ensure SMBIOS data is correctly updated 2021-09-27 12:34:58 -06:00
Mykola Grymalyuk
d58e0e3972 Avoid erroring 2021-09-27 09:25:21 -06:00
Mykola Grymalyuk
453703d402 Add SurPlus patch 2021-09-27 09:22:55 -06:00
Mykola Grymalyuk
dfb84ec72b Fix Kepler DisplayPort output 2021-09-27 08:35:30 -06:00
Mykola Grymalyuk
8f98cac918 Misc fixes
- Adjust MacPro/Xserve SMBIOS spoof
- Lower SIP bits flipped
- Force delete SIP on each boot (avoids user error)

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/510
2021-09-25 11:49:05 -06:00
Mykola Grymalyuk
c053fb7244 Fix formatting 2021-09-24 10:31:14 -06:00
Mykola Grymalyuk
0ccb2c74d2 Allow configuring GMUX usage for Windows
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/502
2021-09-24 10:29:43 -06:00
Mykola Grymalyuk
2683b7a7f0 Add forgotten commit 2021-09-24 09:16:04 -06:00
Mykola Grymalyuk
86dcf9fb5b Fix Beta 7 Acceleration on Nvidia Tesla 2021-09-24 07:47:31 -06:00
Mykola Grymalyuk
e31519ac96 Avoid patching Metal and non-metal together 2021-09-23 11:58:48 -06:00
Mykola Grymalyuk
49fa20ecc3 Disable SIP on legacy Wifi Macs 2021-09-23 11:48:10 -06:00
Mykola Grymalyuk
3364ed702a Probe per GPU detected
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/501
2021-09-22 20:57:10 -06:00
Mykola Grymalyuk
32a0289af3 Fix Music.app support
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/497
2021-09-22 19:25:29 -06:00
Mykola Grymalyuk
a3208acbfe Add iMac7,1 USB map 2021-09-22 19:04:01 -06:00
Mykola Grymalyuk
983a7bf8d3 Merge pull request #499 from dortania/2012-bt
Add Transport Exemption to BlueToolFixup
2021-09-22 13:31:17 -06:00
Mykola Grymalyuk
5d85a98637 Adjust logic 2021-09-22 13:30:20 -06:00
Mykola Grymalyuk
ba2149407d Update comments 2021-09-22 13:28:29 -06:00
Mykola Grymalyuk
458a2a406a Add FirmwareFeature upgrading to all Models 2021-09-22 12:46:23 -06:00
Mykola Grymalyuk
374263f926 Fix AMFI check 2021-09-22 12:35:53 -06:00
Mykola Grymalyuk
1b5fb1cef6 Add additional bluetooth checks 2021-09-21 21:41:29 -06:00
Mykola Grymalyuk
e7897ae857 Fix defaults 2021-09-21 21:29:10 -06:00
Mykola Grymalyuk
b34239fb8e Add Kepler Acceleration for Monterey Beta 7 2021-09-21 21:25:49 -06:00
Mykola Grymalyuk
53ea72ed93 Fix another typo 2021-09-21 20:34:15 -06:00
Mykola Grymalyuk
462e268d0d Fix typo 2021-09-21 20:20:38 -06:00
Mykola Grymalyuk
df709afa8d Add AMFI check 2021-09-21 20:08:54 -06:00
Mykola Grymalyuk
7b332e87c4 Fix crash 2021-09-21 19:26:23 -06:00
Mykola Grymalyuk
1b2eea6b50 Add better FV patch detection 2021-09-21 18:59:50 -06:00
Mykola Grymalyuk
0077d6267c Test transport omission 2021-09-19 23:36:22 -06:00
Mykola Grymalyuk
b18236b237 Test BT patch for 2012 Macs 2021-09-19 21:00:07 -06:00
Mykola Grymalyuk
c748b03544 Merge pull request #496 from dortania/Disable-LV
Disable Library Validation Enforcement
2021-09-19 16:18:55 -06:00
Mykola Grymalyuk
81369d1bab Update docs 2021-09-19 16:17:31 -06:00
Mykola Grymalyuk
bf3cc2c9d1 Adjust LV check 2021-09-19 15:29:48 -06:00
Mykola Grymalyuk
159f624060 Sync changelog 2021-09-19 14:38:07 -06:00
Mykola Grymalyuk
8234738403 Remove AMFI requirement for root patching 2021-09-19 14:22:16 -06:00
Mykola Grymalyuk
bf19adef35 Cleanup unneeded variables 2021-09-19 13:16:20 -06:00
Mykola Grymalyuk
6c2ed9ad5a Update SysPatch.py 2021-09-18 22:39:52 -06:00
Mykola Grymalyuk
ac4b796c95 Fix typo 2021-09-18 21:10:37 -06:00
Mykola Grymalyuk
afdf49a074 Add TeraScale 2 Acceleration for Monterey 2021-09-18 16:33:02 -06:00
Mykola Grymalyuk
48c838d92b Use stock BlueToolFixup 2021-09-18 15:41:00 -06:00
Mykola Grymalyuk
3e453f4789 Fix CoreCapture max kernel 2021-09-18 15:28:11 -06:00
Mykola Grymalyuk
c7b282b53c Update documentation 2021-09-18 11:32:43 -06:00
Mykola Grymalyuk
8c6c723e13 Increment Latebloom to 0.22 2021-09-18 10:54:04 -06:00
Mykola Grymalyuk
9dfe616af8 Clean Apple Kexts
Remove unused files including codesignature, Version.plist, Resources, etc as these are not needed for injection via OpenCore
2021-09-18 10:49:00 -06:00
Mykola Grymalyuk
fb9634d29b Add permission fixes for Wifi patches 2021-09-18 10:08:57 -06:00
Mykola Grymalyuk
4edbf9df60 Update Root Patch comment 2021-09-17 23:53:41 -06:00
Mykola Grymalyuk
cd45f7b04c Fix typo 2021-09-17 23:42:55 -06:00
Mykola Grymalyuk
6a5ac03c72 Merge pull request #492 from dortania/Bluetooth-patch
Fix Monterey Bluetooth Support
2021-09-17 22:44:18 -06:00
Mykola Grymalyuk
81ecf14bab Merge branch 'main' into Bluetooth-patch 2021-09-17 22:44:12 -06:00
Mykola Grymalyuk
d84990e91d Add IO80211ElCap verification 2021-09-17 22:41:33 -06:00
Mykola Grymalyuk
d1726f95fc Add Legacy Wireless support for Monterey
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/365
2021-09-17 22:17:41 -06:00
Mykola Grymalyuk
45332d2cf9 Add offline TUI 2021-09-17 13:42:27 -06:00
Mykola Grymalyuk
9e7ad38020 Merge branch 'Bluetooth-patch' of https://github.com/dortania/Opencore-Legacy-Patcher into Bluetooth-patch 2021-09-16 19:26:13 -06:00
Mykola Grymalyuk
18805c8e78 Fix typo 2021-09-16 19:25:42 -06:00
Mykola Grymalyuk
98b7824619 Fix typo 2021-09-16 19:14:06 -06:00
Mykola Grymalyuk
438ae23ee7 Rework BlueToolFixup patch 2021-09-16 15:43:04 -06:00
Mykola Grymalyuk
0e22a9fb00 Fix ModelArray 2021-09-16 14:33:55 -06:00
Mykola Grymalyuk
f78e8edf4e Fix typo 2021-09-16 12:21:52 -06:00
Mykola Grymalyuk
986878055f Add basic hardware detection 2021-09-16 12:21:14 -06:00
Mykola Grymalyuk
1da93b1ca0 Fix Monterey Bluetooth 2021-09-16 10:06:59 -06:00
Mykola Grymalyuk
950f645f02 Merge pull request #488 from mikebeaton/main
Update Big Sur+ Hackintosh SIP instructions
2021-09-13 10:05:44 -06:00
Mykola Grymalyuk
f0c73164d9 Ensure correct accel patches apply in Monterey
Thanks Larsvonhier for pointing this out!
2021-09-13 10:01:37 -06:00
MikeBeaton
5b3425d0c4 Update Big Sur+ Hackintosh SIP instructions to 0xE03 (include required CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE) 2021-09-13 15:12:48 +01:00
Mykola Grymalyuk
0e1aaf0bbd Lax AMFI requirements for Mojave/Catalina 2021-09-12 22:44:29 -06:00
Mykola Grymalyuk
ff685e3504 Merge pull request #485 from dortania/filevault-test
Allow FileVault on Root Patched Macs
2021-09-12 22:37:18 -06:00
Mykola Grymalyuk
bae1a19cfe Lax FileVault requirement for root patching 2021-09-12 22:36:25 -06:00
Mykola Grymalyuk
76aa3bb80f Clean up code 2021-09-12 11:31:31 -06:00
Mykola Grymalyuk
ab4089c37b Allow FileVault on Root Patched systems 2021-09-12 10:34:28 -06:00
Mykola Grymalyuk
a907e05bca Add latebloom repository 2021-09-12 10:32:17 -06:00
Mykola Grymalyuk
8944c789b0 Update PatcherSupportPkg 2021-09-09 09:05:59 -06:00
Mykola Grymalyuk
600e71581c Allow Trackpad gestures on MacBook4,1 and MacBook5,2 2021-09-08 22:17:05 -06:00
Mykola Grymalyuk
15e4650785 Organize Constants.py 2021-09-08 22:09:58 -06:00
Mykola Grymalyuk
201bc141bb Increment PatcherSupportPkg 2021-09-07 16:13:18 -06:00
Mykola Grymalyuk
3c69cb6c65 Increment PatcherSupportPkg 2021-09-06 22:52:29 -06:00
Mykola Grymalyuk
9955b76c1e Add Monterey WebKit patch to legacy GPUs 2021-09-06 22:40:54 -06:00
Mykola Grymalyuk
d77680f25c Increment binaries 2021-09-06 16:54:08 -06:00
Mykola Grymalyuk
10354d717e Add non-Metal Monterey accel 2021-09-05 13:17:39 -06:00
Mykola Grymalyuk
0b51a7e9c8 Fix path error 2021-09-05 11:45:35 -06:00
Mykola Grymalyuk
372ad31d83 Adjust patcher settings 2021-09-05 10:48:46 -06:00
Mykola Grymalyuk
d4836514fd Add import error handling and clean CLI menu 2021-09-04 22:31:20 -06:00
Mykola Grymalyuk
077af5afb3 Add ACPI path verification for DeviceProperty injection
Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/451
2021-08-30 17:36:06 -06:00
Mykola Grymalyuk
6ca3e3524e Update PatcherSupportPkg 2021-08-28 13:14:40 -06:00
Mykola Grymalyuk
8c646b7897 Fix scope typo 2021-08-28 12:55:34 -06:00
Mykola Grymalyuk
90a9ff8bb2 Allow FileVault on Catalina and older 2021-08-28 11:37:16 -06:00
Mykola Grymalyuk
1198a37969 Update MONTEREY-DROP.md
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/455
2021-08-26 09:04:57 -06:00
Mykola Grymalyuk
296978676a Add pikera patch for iMacPro1,1 2021-08-18 18:18:48 -06:00
Mykola Grymalyuk
29fa274096 Add 5700XT/Westmere test data 2021-08-18 11:26:38 -06:00
Mykola Grymalyuk
dfdf4529d2 Add Windows GPU switching 2021-08-15 13:48:58 -06:00
Mykola Grymalyuk
28746bbe2b Fix country code device ID injection
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/435
2021-08-12 09:04:49 -06:00
Mykola Grymalyuk
60c8cd12cd Merge pull request #425 from samplenull/patch-1
Update INSTALLER.md
2021-08-11 23:19:59 -06:00
Mykola Grymalyuk
71a045fb13 Fix typo in previous commit 2021-08-11 22:32:41 -06:00
Mykola Grymalyuk
10d11c3b1b Add validation check to CI 2021-08-11 22:30:46 -06:00
Mykola Grymalyuk
f0c282cbbc Increment Binaries 2021-08-11 22:24:33 -06:00
Mykola Grymalyuk
7b0b9ea18b Merge pull request #432 from dortania/wifi-test
Allow plist override for BCM943224 and BCM94331 Wireless cards
2021-08-11 20:14:30 -06:00
Mykola Grymalyuk
3f6d8c2283 Fix country code support 2021-08-11 20:13:43 -06:00
Mykola Grymalyuk
ff5a7f3a35 Adjust AirportBrcmFixup injection 2021-08-11 20:09:20 -06:00
Mykola Grymalyuk
515bd5950f Fix thing 2021-08-11 13:48:17 -06:00
Mykola Grymalyuk
b1d5851131 Inject device ID via Info.plist 2021-08-10 20:20:49 -06:00
Mykola Grymalyuk
3298625351 Set iMacPro1,1 SMBIOS for Mac Pro and Xserve 2021-08-10 16:02:45 -06:00
Mykola Grymalyuk
ff4a19b268 Sync changelog 2021-08-10 10:51:09 -06:00
Mykola Grymalyuk
9b4a1e992b Merge pull request #430 from dortania/thunderbolt
Allow disabling of Thunderbolt on 2013-2014 MacBook Pros
2021-08-10 09:47:31 -07:00
Mykola Grymalyuk
fc59cfffa1 Add configuration option for users 2021-08-10 10:06:45 -06:00
Mykola Grymalyuk
cf884532d7 Disable TB2 in 2013-2014 Pros 2021-08-09 10:43:14 -06:00
Mykola Grymalyuk
0b1092d4b9 Merge pull request #428 from satmandu/patch-1
Add current release to Issue Template
2021-08-09 09:21:39 -07:00
satmandu
cddd7af701 Make suggested changes 2021-08-09 12:19:51 -04:00
satmandu
6cb2141654 Add current release to Issue Template 2021-08-09 11:47:57 -04:00
Mykola Grymalyuk
a5fcc35d3c Add MacPro4,1 data set 2021-08-09 09:19:48 -06:00
Denis Kazimirov
8cc22fd88a Update INSTALLER.md
Add space to fix 404 error when download installinstallmacos.py
2021-08-07 16:11:54 +03:00
Mykola Grymalyuk
66435c7c08 Add Ethernet data sets 2021-08-06 10:27:06 -06:00
Mykola Grymalyuk
3569a265e6 Force pyinstaller path 2021-08-05 17:57:55 -06:00
Mykola Grymalyuk
3515d81c26 Avoid upgrading dependancies 2021-08-05 17:45:23 -06:00
Mykola Grymalyuk
3416a4bbdd Transfer runner 2021-08-05 17:27:10 -06:00
Dhinak G
6a5787abae Return checksum in download_file 2021-08-04 14:08:07 -04:00
Mykola Grymalyuk
a104316037 Add missing x86legacy entry 2021-08-04 11:37:24 -06:00
Mykola Grymalyuk
cabdfe9a27 Lax rsync verification
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/418
2021-08-04 08:36:40 -06:00
Mykola Grymalyuk
c535609a32 Fix latebloom typo in arguments 2021-08-03 10:07:25 -06:00
Mykola Grymalyuk
a095edc380 Allow Root Patching on Mojave and Catalina 2021-08-02 21:06:33 -06:00
Mykola Grymalyuk
f1ac88d23b Fix iMac17,1 TB2 typo 2021-08-02 20:47:33 -06:00
Mykola Grymalyuk
4a1918238e Fix formatting 2021-08-02 16:46:15 -06:00
Mykola Grymalyuk
33653a7108 Implement Root Volume backups
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/378
2021-08-02 16:34:19 -06:00
Mykola Grymalyuk
03f65d1766 Implement Latebloom configuration via cli 2021-07-31 22:57:33 -06:00
Mykola Grymalyuk
cb7d62f2ee Update docs to better reflect current state 2021-07-31 22:27:40 -06:00
Mykola Grymalyuk
4139e555cc Add remaining iGPU archs to device_probe 2021-07-31 21:20:17 -06:00
Mykola Grymalyuk
244d7cfbf9 Increment build 2021-07-31 10:39:08 -06:00
Mykola Grymalyuk
d9dcfc6125 Fix iMac13,x crash on prebuilt models 2021-07-31 10:35:01 -06:00
104 changed files with 7688 additions and 4309 deletions

View File

@@ -1,4 +1,4 @@
[flake8]
extend-ignore = E501, E203
per-file-ignores =
Resources/Constants.py:E704
Resources/constants.py:E704

View File

@@ -85,8 +85,8 @@ body:
label: Application Version
description: What build version of our software are you running?
options:
- 0.2.3 (Latest Build)
- 0.2.2 (Latest Release)
- Latest Build (nightly)
- Latest Release
validations:
required: true
- type: dropdown

33
.github/workflows/build-app-offline.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: CI - Build Offline TUI
on:
push:
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: Build Offline TUI
runs-on: x86_64_mojave
steps:
- uses: actions/checkout@v2
- run: python3 create_offline_build.py
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI-Offline.app.zip OpenCore-Patcher.app
- name: Upload App to Artifacts
uses: actions/upload-artifact@v2
with:
name: OpenCore-Patcher-TUI-Offline.app
path: OpenCore-Patcher-TUI-Offline.app.zip
- name: Upload to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: OpenCore-Patcher-TUI-Offline.app.zip
tag: ${{ github.ref }}
file_glob: true

View File

@@ -9,16 +9,12 @@ on:
jobs:
build:
name: Build TUI
runs-on: x86_64
runs-on: x86_64_mojave
steps:
- uses: actions/checkout@v2
- name: Install Python Dependencies
run: pip3 install --upgrade pyinstaller requests pyobjc
- run: pyinstaller OpenCore-Patcher.spec
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
- run: ./../sign-tui.sh
- name: Upload App to Artifacts

View File

@@ -9,25 +9,22 @@ on:
jobs:
build:
name: Build GUI
runs-on: x86_64
runs-on: x86_64_mojave
steps:
- uses: actions/checkout@v2
- name: Install Python Dependencies
run: pip3 install --upgrade pyinstaller requests pyobjc
- run: pyinstaller OCLP-CLI.spec
- run: cd dist; cp OCLP-CLI ../; cd ..
- run: zip OCLP-CLI.zip OCLP-CLI
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: cd dist; cp OpenCore-Patcher ../; cd ..; mv OpenCore-Patcher OCLP-CLI
- name: Download latest nightly OCLP-GUI
run: curl -S -L https://nightly.link/dortania/OCLP-GUI/workflows/build-app/master/OpenCore-Patcher-GUI.app.zip --output ./OpenCore-Patcher-GUI.app.zip
run: curl -S -L https://nightly.link/dortania/OCLP-GUI/workflows/build-app/master/OpenCore-Patcher-GUI.app.zip --output ./OpenCore-Patcher-GUI.app.zip --insecure
- run: unzip -o OpenCore-Patcher-GUI.app.zip
- run: unzip OpenCore-Patcher-GUI.app.zip; rm OpenCore-Patcher-GUI.app.zip
- 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 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 entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "OpenCore Patcher.app"'
- 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"'
- run: ditto -c -k --sequesterRsrc --keepParent OpenCore\ Patcher.app OpenCore-Patcher-GUI.app.zip
- run: ./../sign-gui.sh
- name: Upload GUI to Artifacts
@@ -39,7 +36,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: OCLP-CLI
path: OCLP-CLI.zip
path: OCLP-CLI
- name: Upload to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
@@ -48,3 +45,5 @@ jobs:
file: OpenCore-Patcher-GUI.app.zip
tag: ${{ github.ref }}
file_glob: true
- name: Validate OpenCore
run: ./OCLP-CLI --validate

2
.gitignore vendored
View File

@@ -1,7 +1,7 @@
.DS_Store
OCLP-GUI.command
/payloads/Apple
/payloads/Apple.zip
/payloads/*.zip
/payloads/__MACOSX
/App
/Build-Folder

View File

@@ -1,5 +1,114 @@
# OpenCore Legacy Patcher changelog
## 0.3.1
- 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
- Allow configuring GMUX usage for Windows
- Applicable for iGPU+dGPU MacBook Pros
- Allow usage of legacy AppleHDA
- Only use for machines that cannot achieve audio support normally
- Main usage for Macs without boot screen output
- Revert iMacPro1,1 SMBIOS usage on Mac Pros and Xserves
- Resolves display output issues on Legacy GCN
- Limit SIP bits flipped when disabled
- 0xFEF -> 0xE03
- `CSR_ALLOW_UNTRUSTED_KEXTS`
- `CSR_ALLOW_UNRESTRICTED_FS`
- `CSR_ALLOW_UNAPPROVED_KEXTS`
- `CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE`
- `CSR_ALLOW_UNAUTHENTICATED_ROOT`
- Fix Kepler DisplayPort output
- Apply `agdpmod=vit9696` patch
- Add Syncretic's SurPlus 11.3+ Race Condition Patch
- [Source](https://github.com/reenigneorcim/SurPlus)
- Downgrade Nvidia Kepler Bundles to 11.0 Beta 3
- Resolves crashing at high loads, credit to [Jackluke](https://github.com/jacklukem) for discovery
- Add Legacy GMUX patchsets
- Applicable for dual GPU MacBookPro5,x and demuxed MacBookPro8,x
- Increment Binaries:
- PatcherSupportPkg 0.1.7 release
- RestrictEvents 1.0.5 rolling (2430ed0)
- Limit MacBookPro6,2 G State
- Works around crashing when switching GPUs
- Fix OTA updates on T2 SMBIOS
- Allow iMac13,x iGPU usage always
- Due to both Kepler and Ivy needing root patching, no benefit to disable the iGPU
- Refactor Hardware Model building
- Resolve dGPU output on MacBookPro10,1
- Add Panel ID `9cd6` for iMac11,3
- Resolves Brightness control
- Add AppleGVA patch set for HD3000 machines
- Mainly applicable for iMac12,x and iGPU-only MacBooks
- Add EFICheckDisabler
- Based off stripped RestrictEvents.kext
- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks
- Implement software demux patch set for 2011 15/17" MacBook Pros
- Alternative to hardware demux
- Adds [AMDGPUWakeHandler](https://github.com/blackgate/AMDGPUWakeHandler)
- Add Legacy GCN support for iMac11,x and iMac12,x with upgraded GPUs
- Note: iMac12,x with legacy GCN will fail to wake
- Fix Beta 10 Bluetooth
- Works around new Broadcom/CSR vendor checks in `bluetoothd`
## 0.2.5
- Implement Latebloom configuration via command line tool
- Implement Root Volume backups in addition to APFS snapshot reversions
- Backups applicable to machines with sealed APFS snapshots
- Allow Root Patching on Mojave and Catalina
- Currently experimental
- Allow disabling of faulty Thunderbolt controllers on 2013-2014 MacBook Pros
- Currently limited to MacBookPro11,x
- Set iMacPro1,1 SMBIOS for Mac Pro and Xserve models
- Allows for wider array of OS support (High Sierra+)
- Use plist override for BCM943224 and BCM94331 support in Big Sur+
- Allows for older OS support through OpenCore
- Increment Binaries:
- OpenCore 0.7.2 release
- Lilu 1.5.5 release
- AppleALC 1.6.3 release
- WhateverGreen 1.5.2 release
- FeatureUnlock 1.0.3 release
- PatcherSupportPkg 0.1.2 release
- Allow iGPU/dGPU switching in Windows
- Applicable to MacBook Pros with Intel iGPU and Nvidia/AMD dGPU
- Clean up Patcher Settings
- Allow disabling of TeraScale 2 Acceleration during root volume patch
- Use for MacBookPro8,x with heavily degraded dGPUs
- Add non-Metal Monterey Acceleration
- Currently supports:
- Intel Ironlake and Sandy Bridge
- Nvidia Tesla
- AMD TeraScale 1 and 2
- Allow Trackpad gestures on MacBook4,1 and MacBook5,2
- System Preferences will not report settings however
- Allow Root Volume Patched Systems to use FileVault 2
- Requires macOS 11.3 (20E232) or newer
- Add offline TUI build
- Allows for root patching without network connection
- Add Legacy Wireless support for Monterey
- Applicable for BCM94328, BCM94322 and Atheros chipsets
- Add Legacy Bluetooth support for Monterey
- Applicable for BRCM2046 and BRCM2070 chipsets
- Disable Library Validation allowing for AMFI usage
- Remove reliance on amfi_get_out_of_my_way=1
- Add Kepler Accleration Patches for Monterey Beta 7 and newer
- Add FirmwareFeature upgrading to all Models
- Fixes Monterey Beta 7 installation issues
- Add iMac7,1 USB map
## 0.2.4
- Fix BlessOverride typo
@@ -58,6 +167,7 @@
- Lilu 1.5.4 rolling (f69a972 - 06-20-2021)
- RestrictEvents 1.0.3 rolling (3773ce2 - 06-20-2021)
- SidecarFixup 1.0.2 rolling (2c29166 - 06-21-2021)
- PatcherSupportPkg 0.0.18
- Allow AirPlay to Mac support on Skylake - Coffeelake Macs
## 0.1.9

View File

@@ -1,262 +0,0 @@
#!/usr/bin/env python3
# Copyright (C) 2020-2021 Mykola Grymalyuk
from __future__ import print_function
import subprocess
import sys
import platform
import argparse
from pathlib import Path
from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities, ModelExample
class OpenCoreLegacyPatcher:
def __init__(self):
print("Loading...")
Utilities.disable_cls()
self.constants = Constants.Constants()
self.constants.computer = device_probe.Computer.probe()
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
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
self.constants.custom_cpu_model = 1
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
if "-v" in (Utilities.get_nvram("boot-args") or ""):
self.constants.verbose_debug = True
# Check if running in RecoveryOS
self.constants.recovery_status = Utilities.check_recovery()
parser = argparse.ArgumentParser()
# Generic building args
parser.add_argument("--build", help="Build OpenCore", action="store_true", required=False)
parser.add_argument("--verbose", help="Enable verbose boot", action="store_true", required=False)
parser.add_argument("--debug_oc", help="Enable OpenCore DEBUG", action="store_true", required=False)
parser.add_argument("--debug_kext", help="Enable kext DEBUG", action="store_true", required=False)
parser.add_argument("--hide_picker", help="Hide OpenCore picker", action="store_true", required=False)
parser.add_argument("--disable_sip", help="Disable SIP", action="store_true", required=False)
parser.add_argument("--disable_smb", help="Disable SecureBootModel", action="store_true", required=False)
parser.add_argument("--vault", help="Enable OpenCore Vaulting", action="store_true", required=False)
parser.add_argument("--support_all", help="Allow OpenCore on natively supported Models", action="store_true", required=False)
parser.add_argument("--firewire", help="Enable FireWire Booting", action="store_true", required=False)
parser.add_argument("--nvme", help="Enable NVMe Booting", action="store_true", required=False)
parser.add_argument("--wlan", help="Enable Wake on WLAN support", action="store_true", required=False)
parser.add_argument("--disable_amfi", help="Disable AMFI", action="store_true", required=False)
parser.add_argument("--moderate_smbios", help="Moderate SMBIOS Patching", action="store_true", required=False)
# Building args requiring value values
parser.add_argument("--model", action="store", help="Set custom model", required=False)
parser.add_argument("--disk", action="store", help="Specifies disk to install to", required=False)
parser.add_argument("--smbios_spoof", action="store", help="Set SMBIOS patching mode", required=False)
# SysPatch args
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
parser.add_argument("--terascale_2", help="Enable TeraScale 2 Acceleration", action="store_true", required=False)
#parser.add_argument("--patch_disk", action="store", help="Specifies disk to root patch", required=False)
parser.add_argument("--validate", help="Validate", action="store_true", required=False)
args = parser.parse_args()
self.constants.gui_mode = True
self.constants.current_path = Path.cwd()
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
print("- Rerouting payloads location")
self.constants.payload_path = sys._MEIPASS / Path("payloads")
else:
print("- Using default payloads location")
if args.disk:
print(f"- Install Disk set: {args.disk}")
self.constants.disk = args.disk
if args.validate:
self.validate()
#if args.patch_disk:
# print(f"- Patch Disk set: {args.patch_disk}")
# self.constants.patch_disk = args.patch_disk
if args.verbose:
print("- Set verbose configuration")
self.constants.verbose_debug = True
if args.debug_oc:
print("- Set OpenCore DEBUG configuration")
self.constants.opencore_debug = True
self.constants.opencore_build = "DEBUG"
if args.debug_kext:
print("- Set kext DEBUG configuration")
self.constants.kext_debug = True
if args.hide_picker:
print("- Set HidePicker configuration")
self.constants.showpicker = False
if args.disable_sip:
print("- Set Disable SIP configuration")
self.constants.sip_status = False
if args.disable_smb:
print("- Set Disable SecureBootModel configuration")
self.constants.secure_status = False
if args.vault:
print("- Set Vault configuration")
self.constants.vault = True
if args.firewire:
print("- Set FireWire Boot configuration")
self.constants.firewire_boot = True
if args.nvme:
print("- Set NVMe Boot configuration")
self.constants.nvme_boot = True
if args.disable_amfi:
print("- Set Disable AMFI configuration")
self.constants.disable_amfi = True
if args.wlan:
print("- Set Wake on WLAN configuration")
self.constants.enable_wake_on_wlan = True
if args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
self.constants.serial_settings = "Moderate"
if args.smbios_spoof:
if args.smbios_spoof == "Minimal":
self.constants.serial_settings = "Minimal"
elif args.smbios_spoof == "Moderate":
self.constants.serial_settings = "Moderate"
elif args.smbios_spoof == "Advanced":
self.constants.serial_settings = "Advanced"
else:
print(f"- Unknown SMBIOS arg passed: {args.smbios_spoof}")
if args.support_all:
print("- Building for natively supported model")
self.constants.allow_oc_everywhere = True
self.constants.serial_settings = "None"
if args.build:
if args.model:
print(f"- Using custom model: {args.model}")
self.constants.custom_model = args.model
self.set_defaults(self.constants.custom_model, False)
self.build_opencore()
elif self.computer.real_model not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
)
sys.exit(1)
else:
print(f"- Using detected model: {self.constants.computer.real_model}")
self.set_defaults(self.constants.custom_model, True)
self.build_opencore()
if args.patch_sys_vol:
if args.terascale_2:
print("- Set TeraScale 2 Accel configuration")
self.constants.terascale_2_patch = True
print("- Set System Volume patching")
self.patch_vol()
elif args.unpatch_sys_vol:
print("- Set System Volume unpatching")
self.unpatch_vol()
def set_defaults(self, model, host_is_target):
if model in ModelArray.LegacyGPU:
if (
host_is_target
and self.computer.dgpu
and self.computer.dgpu.arch
in [
device_probe.AMD.Archs.Legacy_GCN,
device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega,
device_probe.AMD.Archs.Navi,
device_probe.NVIDIA.Archs.Kepler,
]
):
print("- Detected Metal GPU, overriding default configuration")
# Building on device and we have a native, supported GPU
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.disable_amfi = False
elif host_is_target:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Root volume modified
self.constants.disable_amfi = True # Unsigned binaries
if model in ModelArray.ModernGPU:
if host_is_target and model in ["iMac13,1", "iMac13,3"] and self.computer.dgpu:
# Some models have a supported dGPU, others don't
print("- Detected Metal dGPU, overriding default configuration")
self.constants.sip_status = True
elif host_is_target:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
# self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
if model == "MacBook8,1" and host_is_target:
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
self.constants.serial_settings == "Moderate"
self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
def patch_vol(self):
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
def unpatch_vol(self):
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def validate(self):
# Runs through ocvalidate to check for errors
valid_dumps = [
ModelExample.MacBookPro.MacBookPro92_Stock,
#ModelExample.MacBookPro.MacBookPro171_Stock,
#ModelExample.Macmini.Macmini91_Stock,
ModelExample.iMac.iMac81_Stock,
ModelExample.iMac.iMac112_Stock,
ModelExample.iMac.iMac122_Upgraded,
ModelExample.MacPro.MacPro31_Stock,
ModelExample.MacPro.MacPro31_Upgrade,
ModelExample.MacPro.MacPro31_Modern_AMD,
ModelExample.MacPro.MacPro31_Modern_Kepler,
]
self.constants.validate = True
for model in ModelArray.SupportedSMBIOS:
print(f"Validating predefined model: {model}")
self.constants.custom_model = model
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {model}")
else:
print(f"Validation succeeded for predefined model: {model}")
for model in valid_dumps:
self.constants.computer = model
self.computer = self.constants.computer
self.constants.custom_model = ""
print(f"Validating dumped model: {self.computer.real_model}")
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {self.computer.real_model}")
else:
print(f"Validation succeeded for predefined model: {self.computer.real_model}")
OpenCoreLegacyPatcher()
# Example arg for OCLP command line
# ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2

View File

@@ -1,35 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os
sys.path.append(os.path.abspath(os.getcwd()))
from Resources import Constants
block_cipher = None
a = Analysis(['OCLP-CLI.command'],
pathex=['Resources'],
binaries=[],
datas=[('payloads', 'payloads')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[('u', None, 'OPTION')],
name='OCLP-CLI',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )

View File

@@ -3,271 +3,40 @@
from __future__ import print_function
import platform
import subprocess
import sys
from pathlib import Path
from Resources import Build, CliMenu, Constants, ModelArray, SysPatch, Utilities, device_probe
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments
from data import model_array
class OpenCoreLegacyPatcher:
def __init__(self):
print("Loading...")
self.constants = Constants.Constants()
print("- Loading...")
self.constants = constants.Constants()
self.generate_base_data()
if utilities.check_cli_args() is None:
self.main_menu()
def generate_base_data(self):
self.constants.detected_os = os_probe.detect_kernel_major()
self.constants.detected_os_minor = os_probe.detect_kernel_minor()
self.constants.detected_os_build = os_probe.detect_kernel_build()
self.constants.computer = device_probe.Computer.probe()
self.constants.recovery_status = utilities.check_recovery()
self.computer = self.constants.computer
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
self.constants.detected_os_minor = int(platform.uname().release.partition(".")[2].partition(".")[0])
self.set_defaults(self.computer.real_model, True)
def set_defaults(self, model, host_is_target):
# Defaults
self.constants.sip_status = True
self.constants.secure_status = False # Default false for Monterey
self.constants.disable_amfi = False
if model in ModelArray.LegacyGPU:
if (
host_is_target
and self.computer.dgpu
and self.computer.dgpu.arch
in [
device_probe.AMD.Archs.Legacy_GCN,
device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega,
device_probe.AMD.Archs.Navi,
device_probe.NVIDIA.Archs.Kepler,
]
):
# Building on device and we have a native, supported GPU
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
self.constants.disable_amfi = False
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Root volume modified
self.constants.disable_amfi = True # Unsigned binaries
if model in ModelArray.ModernGPU:
if host_is_target and model in ["iMac13,1", "iMac13,3"] and self.computer.dgpu:
# Some models have a supported dGPU, others don't
self.constants.sip_status = True
# self.constants.secure_status = True # Monterey
# self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
else:
self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume
# self.constants.disable_amfi = False # 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
self.constants.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
self.constants.custom_cpu_model = 1
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
if "-v" in (Utilities.get_nvram("boot-args") or ""):
self.constants.verbose_debug = True
if Utilities.amfi_status() is False:
self.constants.disable_amfi = True
self.constants.latebloom_delay, self.constants.latebloom_range, self.constants.latebloom_debug = Utilities.latebloom_detection(model)
# Check if running in RecoveryOS
self.constants.recovery_status = Utilities.check_recovery()
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def change_model(self):
Utilities.cls()
Utilities.header(["Select Different Model"])
print(
"""
Tip: Run the following command on the target machine to find the model identifier:
system_profiler SPHardwareDataType | grep 'Model Identifier'
"""
)
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
if self.constants.custom_model not in ModelArray.SupportedSMBIOS:
print(
f"""
{self.constants.custom_model} is not a valid SMBIOS Identifier for macOS {self.constants.os_support}!
"""
)
print_models = input(f"Print list of valid options for macOS {self.constants.os_support}? (y/n)")
if print_models.lower() in {"y", "yes"}:
print("\n".join(ModelArray.SupportedSMBIOS))
input("\nPress [ENTER] to continue")
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
if utilities.check_cli_args() is not None:
print("- Detected arguments, switching to CLI mode")
self.constants.gui_mode = True # Assumes no user interaction is required
self.constants.current_path = Path.cwd()
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
print("- Rerouting payloads location")
self.constants.payload_path = sys._MEIPASS / Path("payloads")
arguments.arguments().parse_arguments(self.constants)
else:
self.set_defaults(self.constants.custom_model, False)
def patcher_settings(self):
response = None
while not (response and response == -1):
title = ["Adjust Patcher Settings"]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [
[f"Enable Verbose Mode:\t\tCurrently {self.constants.verbose_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_verbose],
[f"Enable OpenCore DEBUG:\t\tCurrently {self.constants.opencore_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_oc],
[f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_kext],
[f"Set ShowPicker Mode:\t\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_showpicker],
[f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_vault],
[f"Allow FireWire Boot:\t\tCurrently {self.constants.firewire_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_firewire],
[f"Allow NVMe Boot:\t\t\tCurrently {self.constants.nvme_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_nvme],
[f"Allow Wake on WLAN:\t\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl],
[f"Allow Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy],
[f"Disable AMFI:\t\t\tCurrently {self.constants.disable_amfi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_amfi],
[
f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_sip,
],
[
f"Allow OpenCore on native Models:\tCurrently {self.constants.allow_oc_everywhere}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_native_models,
],
[
f"Latebloom settings:\t\tDelay {self.constants.latebloom_delay}, Range {self.constants.latebloom_range}, Debug {self.constants.latebloom_debug}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).latebloom_settings,
],
["Advanced Patch Settings, for developers only", self.advanced_patcher_settings],
]
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def advanced_patcher_settings(self):
response = None
while not (response and response == -1):
title = ["Adjust Advanced Patcher Settings, for developers ONLY"]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_metal],
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_serial],
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).bootstrap_setting],
[
f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}",
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_cpufriend,
],
[f"Override SMBIOS Spoof:\t\tCurrently {self.constants.override_smbios}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_smbios],
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).custom_cpu],
["Set SeedUtil Status", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_seedutil],
]
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def credits(self):
Utilities.TUIOnlyPrint(
["Credits"],
"Press [Enter] to go back.\n",
[
"""Many thanks to the following:
- Acidanthera:\tOpenCore, kexts and other tools
- Khronokernel:\tWriting and maintaining this patcher
- DhinakG:\t\tWriting and maintaining this patcher
- ASentientBot:\tLegacy Acceleration Patches
- Ausdauersportler:\tLinking fixes for SNBGraphicsFB and AMDX3000
- Syncretic:\t\tAAAMouSSE and telemetrap
- cdf:\t\tNightShiftEnabler and Innie"""
],
).start()
def PatchVolume(self):
Utilities.cls()
Utilities.header(["Patching System Volume"])
big_sur = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration for non-Metal GPUs
- Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates or have FileVault
enabled.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
monterey = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration
- Intel: Ivy Bridge (4000 series iGPUs)
- Basic Framebuffer and brightness Control (No acceleration)
- Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates or have FileVault
enabled.
Supported Options:
1. Patch System Volume
2. Unpatch System Volume (Experimental)
B. Exit
"""
mojave_catalina = """Patches Root volume to fix misc issues such as:
- Graphics Acceleration
- Nvidia: Tesla - Fermi (8000-500 series)
- Intel: Ironlake - Sandy Bridge
- AMD: TeraScale 1 and 2 (2000-6000 series)
- Audio support for iMac7,1 and iMac8,1
WARNING: Root Volume Patching is still in active development, please
have all important user data backed up. Note when the system volume
is patched, you can no longer have Delta updates or have FileVault
enabled.
Supported Options:
1. Patch System Volume
B. Exit
"""
default = """
This OS has no root patches available to apply, please ensure you're patching a booted
install that requires root patches such as macOS Big Sur or Monterey
Supported Options:
B. Exit
"""
no_patch = False
if self.constants.detected_os == self.constants.monterey:
print(monterey)
elif self.constants.detected_os == self.constants.big_sur:
print(big_sur)
elif self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.moj_cat_accel == True:
print(mojave_catalina)
else:
print(default)
no_patch = True
change_menu = input("Patch System Volume?: ")
if no_patch is not True and change_menu == "1":
SysPatch.PatchSysVolume(self.constants.custom_model or self.computer.real_model, self.constants).start_patch()
elif no_patch is not True and change_menu == "2" and self.constants.detected_os > self.constants.catalina:
SysPatch.PatchSysVolume(self.constants.custom_model or self.computer.real_model, self.constants).start_unpatch()
else:
print("Returning to main menu")
print("- No arguments present, loading TUI")
def main_menu(self):
response = None
@@ -277,11 +46,13 @@ B. Exit
f"Selected Model: {self.constants.custom_model or self.computer.real_model}",
]
if (self.constants.custom_model or self.computer.real_model) not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
if (self.constants.custom_model or self.computer.real_model) not in model_array.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
in_between = [
"Your model is not supported by this patcher for running unsupported OSes!",
"",
'If you plan to create the USB for another machine, please select the "Change Model" option in the menu.',
'If you plan to create the USB for another machine, please select the \n"Change Model" option in the menu.',
"",
'If you want to run OCLP on a native Mac, please toggle \n"Allow OpenCore on native Models" in settings',
]
elif not self.constants.custom_model and self.computer.real_model == "iMac7,1" and "SSE4.1" not in self.computer.cpu.flags:
in_between = [
@@ -294,18 +65,18 @@ B. Exit
else:
in_between = ["This model is supported"]
menu = Utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
menu = utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
options = (
[["Build OpenCore", self.build_opencore]]
if ((self.constants.custom_model or self.computer.real_model) in ModelArray.SupportedSMBIOS) or self.constants.allow_oc_everywhere is True
[["Build OpenCore", build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore]]
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", self.install_opencore],
["Post-Install Volume Patch", self.PatchVolume],
["Change Model", self.change_model],
["Patcher Settings", self.patcher_settings],
["Credits", self.credits],
["Install OpenCore to USB/internal drive", build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, 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],
["Credits", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).credits],
]
for option in options:
@@ -317,4 +88,4 @@ B. Exit
subprocess.run("""osascript -e 'tell application "Terminal" to close first window' & exit""", shell=True)
OpenCoreLegacyPatcher().main_menu()
OpenCoreLegacyPatcher()

View File

@@ -1,12 +1,12 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os
sys.path.append(os.path.abspath(os.getcwd()))
from Resources import Constants
from resources import constants
block_cipher = None
a = Analysis(['OpenCore-Patcher.command'],
pathex=['Resources'],
pathex=['resources', 'data'],
binaries=[],
datas=[('payloads', 'payloads')],
hiddenimports=[],
@@ -35,10 +35,10 @@ exe = EXE(pyz,
console=True )
app = BUNDLE(exe,
name='OpenCore-Patcher.app',
icon="OC-Patcher.icns",
icon="payloads/OC-Patcher.icns",
bundle_identifier=None,
info_plist={
"CFBundleShortVersionString": Constants.Constants().patcher_version,
"CFBundleShortVersionString": constants.Constants().patcher_version,
"CFBundleExecutable": "MacOS/Launcher",
"NSHumanReadableCopyright": "Copyright 2020-2021 Dortania"
})

View File

@@ -33,6 +33,7 @@ Nightly builds can be found here courteous of nightly.link:
* [Nightly OpenCore Patcher (GUI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OpenCore-Patcher-GUI.app.zip)
* [Nightly OpenCore Patcher (TUI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI.app.zip)
* [Offline Variant](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-offline/main/OpenCore-Patcher-TUI-Offline.app.zip) (No network connection needed on target Mac for Root Patching)
* [Nightly OpenCore Patcher (CLI)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-gui/main/OCLP-CLI.zip)
## Credits
@@ -54,14 +55,18 @@ Nightly builds can be found here courteous of nightly.link:
* Mac Pro on OpenCore Patch set and documentation
* [Innie](https://github.com/cdf/Innie) and [NightShiftEnabler](https://github.com/cdf/NightShiftEnabler)
* [Syncretic](https://forums.macrumors.com/members/syncretic.1173816/)
* [AAAMouSSE](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/) and [telemetrap](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/post-28447707)
* [AAAMouSSE](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/), [telemetrap](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/post-28447707) and [SurPlus](https://github.com/reenigneorcim/SurPlus)
* [dosdude1](https://github.com/dosdude1)
* Main author of GUI
* Development of previous patchers, laying out much of what needs to be patched
* [parrotgeek1](https://github.com/parrotgeek1)
* [VMM Patch Set](https://github.com/dortania/OpenCore-Legacy-Patcher/blob/4a8f61a01da72b38a4b2250386cc4b497a31a839/payloads/Config/config.plist#L1222-L1281)
* [BarryKN](https://github.com/BarryKN)
* Development of previous patchers, laying out much of what needs to be patched
* [mario_bros_tech](https://github.com/mariobrostech) and the rest of the Unsupported Mac Discord
* Catalyst that started OpenCore Legacy Patcher
* [arter97](https://github.com/arter97/)
* [SimpleMSR](https://github.com/arter97/SimpleMSR/) to disable firmware throttling in Nehalem+ MacBooks without batteries
* MacRumors and Unsupported Mac Communities
* Endless testing, reporting issues
* Apple

View File

@@ -1,567 +0,0 @@
# Handle misc CLI menu options
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
from __future__ import print_function
import subprocess
from Resources import Constants, Utilities
class MenuOptions:
def __init__(self, model, versions):
self.model = model
self.constants: Constants.Constants = versions
def change_verbose(self):
Utilities.cls()
Utilities.header(["Set Verbose mode"])
change_menu = input("Enable Verbose mode(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.verbose_debug = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.verbose_debug = False
else:
print("Invalid option")
def change_oc(self):
Utilities.cls()
Utilities.header(["Set OpenCore DEBUG mode"])
change_menu = input("Enable OpenCore DEBUG mode(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.opencore_debug = True
self.constants.opencore_build = "DEBUG"
elif change_menu in {"n", "N", "no", "No"}:
self.constants.opencore_debug = False
self.constants.opencore_build = "RELEASE"
else:
print("Invalid option")
def change_kext(self):
Utilities.cls()
Utilities.header(["Set Kext DEBUG mode"])
change_menu = input("Enable Kext DEBUG mode(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.kext_debug = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.kext_debug = False
else:
print("Invalid option")
def change_metal(self):
Utilities.cls()
Utilities.header(["Assume Metal GPU Always in iMac"])
print(
"""This is for iMacs that have upgraded Metal GPUs, otherwise
Patcher assumes based on stock configuration (ie. iMac10,x-12,x)
Valid Options:
1. None(stock GPU)
2. Nvidia GPU
3. AMD GPU
Note: Patcher will detect whether hardware has been upgraded regardless, this
option is for those patching on a different machine or OCLP cannot detect.
"""
)
change_menu = input("Set GPU Patch type(ie. 1): ")
if change_menu == "1":
self.constants.metal_build = False
self.constants.imac_vendor = "None"
elif change_menu == "2":
self.constants.metal_build = True
self.constants.imac_vendor = "Nvidia"
elif change_menu == "3":
self.constants.metal_build = True
self.constants.imac_vendor = "AMD"
else:
print("Invalid option")
def change_serial(self):
Utilities.cls()
Utilities.header(["Set SMBIOS Mode"])
print(
"""This section is for setting how OpenCore generates the SMBIOS
Recommended for adanced users who want control how serials are handled
Valid options:
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
Note: For new users we recommend leaving as default(1. Minimal)
"""
)
change_menu = input("Set SMBIOS Mode(ie. 1): ")
if change_menu == "1":
self.constants.serial_settings = "Minimal"
elif change_menu == "2":
self.constants.serial_settings = "Moderate"
elif change_menu == "3":
self.constants.serial_settings = "Advanced"
else:
print("Invalid option")
def change_showpicker(self):
Utilities.cls()
Utilities.header(["Set OpenCore Picker mode"])
print(
"""By default, OpenCore will show its boot picker each time on boot up,
however this can be disabled by default and be shown on command by repeatedly
pressing the "Esc" key
"""
)
change_menu = input("Show OpenCore Picker by default(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.showpicker = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.showpicker = False
else:
print("Invalid option")
def change_vault(self):
Utilities.cls()
Utilities.header(["Set OpenCore Vaulting"])
print(
"""By default, this patcher will sign all your files and ensure none of the
contents can be tampered with. However for more advanced users, you may
want to be able to freely edit the config.plist and files.
Note: For security reasons, OpenShell will be disabled when Vault is set.
"""
)
change_menu = input("Enable Vault(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.vault = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.vault = False
else:
print("Invalid option")
def change_sip(self):
Utilities.cls()
Utilities.header(["Set SIP and SecureBootModel"])
print(
"""SIP and SecureBootModel are used to ensure proper OTA functionality,
however to patch the root volume both of these must be disabled.
Only disable is absolutely necessary. SIP value = 0xFEF
Valid options:
1. Enable Both
2. Disable SIP only
3. Disable SecureBootModel Only
4. Disable Both
"""
)
change_menu = input("Set SIP and SecureBootModel(ie. 1): ")
if change_menu == "1":
self.constants.sip_status = True
self.constants.secure_status = True
elif change_menu == "2":
self.constants.sip_status = False
self.constants.secure_status = True
elif change_menu == "3":
self.constants.sip_status = True
self.constants.secure_status = False
elif change_menu == "4":
self.constants.sip_status = False
self.constants.secure_status = False
else:
print("Invalid option")
def set_amfi(self):
Utilities.cls()
Utilities.header(["Disable AMFI"])
print(
"""Required for Root Patching non-Metal GPUs
in macOS Big Sur. Without this, will receive kernel panic once
Patcher finishes installing legacy acceleration patches.
"""
)
change_menu = input("Disable AMFI(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_amfi = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_amfi = False
else:
print("Invalid option")
def bootstrap_setting(self):
Utilities.cls()
Utilities.header(["Set Bootstrap method"])
print(
"""Sets OpenCore's bootstrap method, currently the patcher supports the
following options.
Valid options:
1. System/Library/CoreServices/boot.efi (default)
2. EFI/BOOT/BOOTx64.efi
3. Exit
Note: S*/L*/C*/boot.efi method is only installed to the EFI partition only
and not to macOS itself.
Recommended to set to BOOTx64.efi in situations where your Mac cannot
see the EFI Boot entry in the boot picker.
"""
)
change_menu = input("Set Bootstrap method: ")
if change_menu == "1":
self.constants.boot_efi = False
elif change_menu == "2":
self.constants.boot_efi = True
else:
print("Invalid option")
def drm_setting(self):
Utilities.cls()
Utilities.header(["Set DRM preferences"])
print(
"""Sets OpenCore's DRM preferences for iMac13,x and iMac14,x.
In Big Sur, some DRM based content may be broken by
default in AppleTV, Photobooth, etc.
To resolve, you can opt to disable Intel QuickSync support in
favor of Nvidia's Software rendering. This can aid in DRM however
greatly hampers Video rendering performance in Final Cut Pro and
other programs relying on such features.
Recommend only disabling if absolutely required.
"""
)
change_menu = input("Enable Nvidia's Software DRM rendering(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.drm_support = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.drm_support = False
else:
print("Invalid option")
def allow_native_models(self):
Utilities.cls()
Utilities.header(["Allow OpenCore on native Models"])
print(
"""Allows natively supported Macs to use OpenCore. Recommended
for users with 3rd Party NVMe SSDs to achieve improved overall
power usage.
"""
)
change_menu = input("Allow OpenCore on all Models(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.allow_oc_everywhere = True
self.constants.serial_settings = "None"
elif change_menu in {"n", "N", "no", "No"}:
self.constants.allow_oc_everywhere = False
self.constants.serial_settings = "Minimal"
else:
print("Invalid option")
def custom_cpu(self):
Utilities.cls()
Utilities.header(["Set custom CPU Model Name"])
print(
"""Change reported CPU Model name in About This Mac
Custom names will report as follows:
1: Original Name: 2.5 Ghz Dual-Core Intel Core i5
2. CPU name: Intel(R) Core(TM) i5-3210M CPU @ 2.50Ghz
3. Custom Name: 2.5Ghz Cotton Candy (example)
"""
)
if self.constants.custom_cpu_model_value == "":
if self.constants.custom_cpu_model == 0:
print("Currently using original name")
else:
print("Currently using CPU name")
else:
print(f"Custom CPU name currently: {self.constants.custom_cpu_model_value}")
change_menu = input("Set custom CPU Name(1,2,3): ")
if change_menu == "1":
self.constants.custom_cpu_model = 2
self.constants.custom_cpu_model_value = ""
elif change_menu == "2":
self.constants.custom_cpu_model = 0
self.constants.custom_cpu_model_value = ""
elif change_menu == "3":
self.constants.custom_cpu_model = 1
self.constants.custom_cpu_model_value = input("Enter new CPU Name: ")
else:
print("Invalid option")
def custom_color_thing(self):
Utilities.cls()
Utilities.header(["Set custom CPU Model Name"])
print(
"""Change reported CPU Model name in About This Mac
Custom names will report as follows:
1: Custom Color
2. Reset
"""
)
change_menu = input("Set custom CPU Name(1,2,3): ")
if change_menu == "1":
print("")
# temp_tk_root = tk.Tk()
# temp_tk_root.wm_withdraw()
# self.constants.custom_color = colorchooser.askcolor(title="Choose color")
# temp_tk_root.destroy()
elif change_menu == "2":
self.constants.custom_color = ""
else:
print("Invalid option")
def disable_cpufriend(self):
Utilities.cls()
Utilities.header(["Disable CPU Friend?"])
print(
"""Only recommended for advanced users
Disabling CPUFriend forces macOS into using a different
Mac's power profile for CPUs and GPUs, which can harm the
hardware
"""
)
change_menu = input("Disable CPU Friend?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disallow_cpufriend = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disallow_cpufriend = False
else:
print("Invalid option")
def set_seedutil(self):
Utilities.cls()
Utilities.header(["Set SeedUtil Status"])
print(
"""Used for setting OS Update Preferences
Valid options:
1. Public Release Seed (Default)
2. Public Beta Seed
3. Developer Beta Seed
4. Check SeedUtil's current status
"""
)
change_menu = input("Set update status(Press [ENTER] to exit): ")
if change_menu == "1":
subprocess.run(["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "unenroll"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
elif change_menu == "2":
subprocess.run(["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "unenroll"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(
["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "enroll", "PublicSeed"], stdout=subprocess.PIPE
).stdout.decode().strip().encode()
elif change_menu == "3":
subprocess.run(["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "unenroll"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(
["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "enroll", "DeveloperSeed"], stdout=subprocess.PIPE
).stdout.decode().strip().encode()
elif change_menu == "4":
result = subprocess.run(["sudo", "/System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil", "current"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = [i.partition(":")[2] for i in result.stdout.decode().split("\n") if "Currently enrolled in" in i][0]
print(f"SeedUtil Current Status: {result}")
input("\nPress [ENTER] to continue")
self.set_seedutil()
else:
print("Returning to main menu")
def set_smbios(self):
Utilities.cls()
Utilities.header(["Override SMBIOS Spoof"])
print(
"""Change model OpenCore spoofs Mac too
Valid options:
1. Default set by OpenCore (Default)
2. User Override
3. Disable all spoofing (unsupported configuration)
"""
)
change_menu = input("Set SMBIOS status: ")
if change_menu == "1":
print("Setting SMBIOS spoof to default mode")
self.constants.override_smbios = "Default"
elif change_menu == "2":
custom_smbios = input("Set new SMBIOS mode: ")
try:
test = self.constants.board_id[custom_smbios]
self.constants.override_smbios = custom_smbios
except KeyError:
print("Unsupported SMBIOS, defaulting to Default setting")
self.constants.override_smbios = "Default"
elif change_menu == "3":
print("Disabling SMBIOS spoof")
self.constants.override_smbios = self.model
else:
print("Returning to main menu")
def allow_firewire(self):
Utilities.cls()
Utilities.header(["Allow FireWire Boot Support"])
print(
"""
In macOS Catalina and newer, Apple restricted
usage of FireWire devices to boot macOS for
security concerns relating to DMA access.
If you are comfortable lowering the security,
you can re-enable FireWire support for Catalina
and newer.
Note: MacBook5,x-7,1 don't support FireWire boot
"""
)
change_menu = input("Enable FireWire Boot support?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.firewire_boot = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.firewire_boot = False
else:
print("Invalid option")
def allow_nvme(self):
Utilities.cls()
Utilities.header(["Allow NVMe UEFI Support"])
print(
"""
For machines not natively supporting NVMe,
this option allows you to see and boot NVMe
drive in OpenCore's picker
Not required if your machine natively supports NVMe
Note: You must have OpenCore on a bootable volume
first, ie. USB or SATA drive. Once loaded,
OpenCore will enable NVMe support in it's picker
"""
)
change_menu = input("Enable NVMe Boot support?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.nvme_boot = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.nvme_boot = False
else:
print("Invalid option")
def enable_terascale(self):
Utilities.cls()
Utilities.header(["Enable TeraScale 2 Acceleration"])
print(
"""
Currently TeraScale 2 graphics acceleration is in beta with
some unfortunate bugs on login including strobing colours
until the user forces Million Colours on the Display with
SwitchResX or resXtreme
Users sensitive to seizures should avoid using TeraScale 2
patches or ask someone to handle inital setup to ensure
no issues
Note: Acceleration only applies to macOS Big Sur
"""
)
change_menu = input("Enable TS2 Acceleration?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.terascale_2_patch = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.terascale_2_patch = False
else:
print("Invalid option")
def allow_wowl(self):
Utilities.cls()
Utilities.header(["Allow Wake on WLAN"])
print(
"""
Due to an unfortunate bug in macOS Big Sur+, Wake on WLAN is
disabled by default for BCM943224, BCM94331 and BCM94360/2 chipsets.
This is due to Wake on WLAN creating network instability and in other cases
halving network speeds. This issue is not replicable across machines however
be prepared if enabling.
"""
)
change_menu = input("Allow Wake on WLAN?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.enable_wake_on_wlan = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.enable_wake_on_wlan = False
else:
print("Invalid option")
def allow_ivy(self):
Utilities.cls()
Utilities.header(["Allow Ivy iMac iGPU"])
print(
"""
For iMac13,x systems with a Nvidia dGPU, the iGPU is disabled by default to
allow Delta Updates, FileVault, SIP and such on macOS Monterey. However due to
this, DRM and QuickSync support may be broken.
Users can choose to override this option but be aware SIP and FileVault must be
disabled to run root patches to fix DRM and QuickSync.
Note: This does not apply for Big Sur, the iGPU can be renabled without
consequence
Note 2: This setting only affects iMac13,x with dGPUs
"""
)
change_menu = input("Allow Ivy iMac iGPU?(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.allow_ivy_igpu = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.allow_ivy_igpu = False
else:
print("Invalid option")
def latebloom_settings(self):
Utilities.cls()
Utilities.header(["Set latebloom properties"])
print(
f"""
Set latebloom properties, useful for debugging boot stalls on
pre-Sandy Bridge Macs.
Valid options:
1. Set delay (currently: {self.constants.latebloom_delay}ms)
2. Set range (currently: {self.constants.latebloom_range}ms)
3. Set debug (currently: {bool(self.constants.latebloom_debug)})
"""
)
change_menu = input("Select latebloom property(1/2/3): ")
if change_menu == "1":
try:
self.constants.latebloom_delay = int(input("Set delay: "))
except ValueError:
input("Invalid value, press [ENTER] to continue")
elif change_menu == "2":
try:
self.constants.latebloom_range = int(input("Set range: "))
except ValueError:
input("Invalid value, press [ENTER] to continue")
elif change_menu == "3":
try:
print("Currently supports either 0(False) or 1(True)")
latebloom_debug = int(input("Set debug(0/1): "))
if latebloom_debug not in [0, 1]:
input("Invalid value, press [ENTER] to continue")
else:
self.constants.latebloom_debug = latebloom_debug
except ValueError:
input("Invalid value, press [ENTER] to continue")
else:
print("Invalid option")

File diff suppressed because it is too large Load Diff

View File

@@ -1,622 +0,0 @@
# Framework for mounting and patching macOS root volume
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
# Missing Features:
# - Full System/Library Snapshotting (need to research how Apple achieves this)
# - Temporary Work-around: sudo bless --mount /System/Volumes/Update/mnt1 --bootefi --last-sealed-snapshot
# - Work-around battery throttling on laptops with no battery (IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/)
import os
import shutil
import subprocess
import zipfile
from pathlib import Path
from Resources import Constants, device_probe, ModelArray, SysPatchArray, Utilities
class PatchSysVolume:
def __init__(self, model, versions):
self.model = model
self.constants: Constants.Constants = versions
self.computer = self.constants.computer
self.root_mount_path = None
self.sip_enabled = True
self.sbm_enabled = True
self.amfi_enabled = True
self.fv_enabled = True
self.nvidia_legacy = False
self.amd_ts1 = False
self.amd_ts2 = False
self.iron_gpu = False
self.sandy_gpu = False
self.ivy_gpu = False
self.brightness_legacy = False
self.legacy_audio = False
self.added_legacy_kexts = False
self.amfi_must_disable = False
self.check_board_id = False
self.bad_board_id = False
self.no_patch = True
if self.constants.detected_os > self.constants.catalina:
# Big Sur and newer use APFS snapshots
self.mount_location = "/System/Volumes/Update/mnt1"
else:
self.mount_location = ""
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_frameworks = f"{self.mount_location}/System/Library/Frameworks"
self.mount_lauchd = f"{self.mount_location}/System/Library/LaunchDaemons"
self.mount_private_frameworks = f"{self.mount_location}/System/Library/PrivateFrameworks"
def elevated(self, *args, **kwargs) -> subprocess.CompletedProcess:
if os.getuid() == 0 or self.constants.gui_mode is True:
return subprocess.run(*args, **kwargs)
else:
return subprocess.run(["sudo"] + [args[0][0]] + args[0][1:], **kwargs)
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:
print("- Mounting Catalina Root Volume as writable")
self.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:
self.patch_root_vol()
return True
else:
self.unpatch_root_vol()
return True
else:
if self.constants.detected_os > self.constants.catalina:
print("- Mounting APFS Snapshot as writable")
self.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:
self.patch_root_vol()
return True
else:
self.unpatch_root_vol()
return True
else:
print("- Failed to mount the Root Volume")
print("- Recommend rebooting the machine and trying to patch again")
if self.constants.gui_mode is False:
input("- Press [ENTER] to exit: ")
else:
print("- Could not find root volume")
if self.constants.gui_mode is False:
input("- Press [ENTER] to exit: ")
def unpatch_root_vol(self):
if self.constants.detected_os > self.constants.catalina:
print("- Reverting to last signed APFS snapshot")
result = self.elevated(["bless", "--mount", self.mount_location, "--bootefi", "--last-sealed-snapshot"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("- Unable to revert root volume patches")
print("Reason for unpatch Failure:")
print(result.stdout.decode())
# print("- Failed to revert snapshot via bless, falling back on manual restoration")
# self.undo_root_patch()
else:
print("- Unpatching complete")
print("\nPlease reboot the machine for patches to take effect")
# else:
# self.undo_root_patch()
def rebuild_snapshot(self):
if self.constants.gui_mode is False:
input("Press [ENTER] to continue with cache rebuild: ")
print("- Rebuilding Kernel Cache (This may take some time)")
if self.constants.detected_os > self.constants.catalina:
result = self.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
result = self.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()):
self.success_status = False
print("- Unable to build new kernel cache")
print("\nPlease report this to Github")
print("Reason for Patch Failure:")
print(result.stdout.decode())
print("")
print("\nPlease reboot the machine to avoid potential issues rerunning the patcher")
if self.constants.gui_mode is False:
input("Press [ENTER] to continue")
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:
print("- Creating new APFS snapshot")
self.elevated(["bless", "--folder", f"{self.mount_location}/System/Library/CoreServices", "--bootefi", "--create-snapshot"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
self.unmount_drive()
else:
if self.constants.detected_os == self.constants.catalina:
print("- Merging kernel cache")
Utilities.process_status(self.elevated(["kcditto"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print("- Merging dyld cache")
Utilities.process_status(self.elevated(["update_dyld_shared_cache", "-root", f"{self.mount_location}/"]))
print("- Patching complete")
print("\nPlease reboot the machine for patches to take effect")
if self.amd_ts2 is True:
print(
"""\nPlease note that with ATI TeraScale 2 GPUs, you may experience colour strobing
on reboot. Please use SwitchResX or ResXtreme to force 1 million colours on your
monitor to fix this. If you are epileptic, please ask for someone to aid you or
set million colour before rebooting"""
)
if self.constants.gui_mode is False:
input("\nPress [ENTER] to continue")
def unmount_drive(self):
print("- Unmounting Root Volume (Don't worry if this fails)")
self.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def delete_old_binaries(self, vendor_patch):
for delete_current_kext in vendor_patch:
delete_path = Path(self.mount_extensions) / Path(delete_current_kext)
if Path(delete_path).exists():
print(f"- Deleting {delete_current_kext}")
Utilities.process_status(self.elevated(["rm", "-R", delete_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
else:
print(f"- Couldn't find {delete_current_kext}, skipping")
def add_new_binaries(self, vendor_patch, vendor_location):
for add_current_kext in vendor_patch:
existing_path = Path(self.mount_extensions) / Path(add_current_kext)
if Path(existing_path).exists():
print(f"- Found conflicting kext, Deleting Root Volume's {add_current_kext}")
Utilities.process_status(self.elevated(["rm", "-R", existing_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print(f"- Adding {add_current_kext}")
Utilities.process_status(self.elevated(["cp", "-R", f"{vendor_location}/{add_current_kext}", self.mount_extensions], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
Utilities.process_status(self.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
Utilities.process_status(self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def add_brightness_patch(self):
self.delete_old_binaries(SysPatchArray.DeleteBrightness)
self.add_new_binaries(SysPatchArray.AddBrightness, self.constants.legacy_brightness)
Utilities.process_status(
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_brightness}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
)
Utilities.process_status(self.elevated(["chmod", "-Rf", "755", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
Utilities.process_status(self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def add_audio_patch(self):
self.delete_old_binaries(SysPatchArray.DeleteVolumeControl)
self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path)
def gpu_accel_legacy(self):
if self.constants.detected_os == self.constants.mojave:
print("- Installing General Acceleration Kext patches for Mojave")
self.add_new_binaries(SysPatchArray.AddGeneralAccelMojave, self.constants.legacy_general_path)
elif self.constants.detected_os == self.constants.catalina:
print("- Installing General Acceleration Kext patches for Catalina")
self.add_new_binaries(SysPatchArray.AddGeneralAccelCatalina, self.constants.legacy_general_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing General Acceleration Kext patches for Big Sur")
self.add_new_binaries(SysPatchArray.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]:
print("- Installing Nvidia Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Nvidia Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
else:
print("- Installing basic Nvidia Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddNvidiaBrightness, self.constants.legacy_nvidia_path)
# AMD/ATI
def gpu_accel_legacy_ts1_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
print("- Installing TeraScale 1 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
else:
print("- Installing basic TeraScale 1 Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.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]:
print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
else:
print("- Installing basic TeraScale 2 Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
# Intel
def gpu_accel_legacy_ironlake_master(self):
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
print("- Installing Ironlake Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Ironlake Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
else:
print("- Installing basic Ironlake Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.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]:
print("- Installing Sandy Bridge Acceleration Kext patches for Mojave/Catalina")
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
elif self.constants.detected_os == self.constants.big_sur:
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur")
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
self.gpu_accel_legacy()
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
else:
print("- Installing basic Sandy Bridge Framebuffer Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
def gpu_framebuffer_ivybridge_master(self):
if self.constants.detected_os == self.constants.monterey:
print("- Installing IvyBridge Acceleration Kext patches for Monterey")
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
print("- Fixing Acceleration in CoreMedia")
Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print("- Merging Ivy Bridge Frameworks")
Utilities.process_status(
self.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 Ivy Bridge PrivateFrameworks")
Utilities.process_status(
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ivy}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
)
else:
print("- Installing basic Ivy Bridge Kext patches for generic OS")
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
def gpu_accel_legacy_extended(self):
print("- Merging general legacy Frameworks")
Utilities.process_status(
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
print("- Merging general legacy PrivateFrameworks")
Utilities.process_status(self.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(
self.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(self.elevated(["chmod", "755", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
Utilities.process_status(self.elevated(["chown", "root:wheel", f"{self.mount_lauchd}/IOHID-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def gpu_accel_legacy_extended_ts2(self):
print("- Merging TeraScale 2 legacy Frameworks")
Utilities.process_status(
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_frameworks_path_accel_ts2}/", self.mount_frameworks], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
print("- Merging TeraScale 2 PrivateFrameworks")
Utilities.process_status(
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ts2}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
)
print("- Fixing Acceleration in CMIO")
Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.cmio", "CMIO_Unit_Input_ASC.DoNotUseOpenCL", "-bool", "true"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def patch_root_vol(self):
print(f"- Running patches for {self.model}")
# Graphics patches
if self.nvidia_legacy is True:
print("- Installing legacy Nvidia Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected supported OS, installing Acceleration Patches")
self.added_legacy_kexts = True
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_nvidia_master()
elif self.amd_ts1 is True:
print("- Installing legacy TeraScale 1 Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected supported OS, installing Acceleration Patches")
self.added_legacy_kexts = True
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_ts1_master()
elif self.amd_ts2 is True:
print("- Installing legacy TeraScale 2 Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected supported OS, installing Acceleration Patches")
self.added_legacy_kexts = True
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_ts2_master()
if self.iron_gpu is True:
print("- Installing legacy Ironlake Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected supported OS, installing Acceleration Patches")
self.added_legacy_kexts = True
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_ironlake_master()
elif self.sandy_gpu is True:
print("- Installing legacy Sandy Bridge Patches")
if self.constants.detected_os in self.constants.legacy_accel_support:
print("- Detected supported OS, installing Acceleration Patches")
self.added_legacy_kexts = True
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_accel_legacy_sandybridge_master()
elif self.ivy_gpu is True:
print("- Installing Ivy Bridge Patches")
if self.constants.detected_os == self.constants.monterey:
print("- Detected supported OS, installing Acceleration Patches")
else:
print("- Detected unsupported OS, installing Basic Framebuffer")
self.gpu_framebuffer_ivybridge_master()
if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support:
# TeraScale 2 patches must be installed after Intel HD3000
self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
if self.added_legacy_kexts is True and self.constants.detected_os in self.constants.legacy_accel_support:
self.gpu_accel_legacy_extended()
if self.amd_ts2 is True:
self.gpu_accel_legacy_extended_ts2()
# Misc patches
if self.brightness_legacy is True:
print("- Installing legacy Brightness Control")
self.add_brightness_patch()
if self.legacy_audio is True:
print("- Fixing Volume Control Support")
self.add_audio_patch()
self.rebuild_snapshot()
def check_files(self):
if Path(self.constants.payload_apple_root_path).exists():
print("- Found Apple Binaries")
if self.constants.gui_mode is False:
patch_input = input("Would you like to redownload?(y/n): ")
if patch_input in {"y", "Y", "yes", "Yes"}:
shutil.rmtree(Path(self.constants.payload_apple_root_path))
self.download_files()
else:
self.download_files()
else:
print("- Apple binaries missing")
self.download_files()
def download_files(self):
if self.constants.detected_os == self.constants.monterey:
os_ver = "12-Monterey"
elif self.constants.detected_os == self.constants.big_sur:
os_ver = "11-Big-Sur"
elif self.constants.detected_os == self.constants.catalina:
os_ver = "10.15-Catalina"
elif self.constants.detected_os == self.constants.mojave:
os_ver = "10.14-Mojave"
else:
raise Exception(f"Unsupported OS: {self.constants.detected_os}")
link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/{os_ver}.zip"
if Path(self.constants.payload_apple_root_path).exists():
print("- Removing old Apple Binaries folder")
Path(self.constants.payload_apple_root_path).unlink()
if Path(self.constants.payload_apple_root_path_zip).exists():
print("- Removing old Apple Binaries zip")
Path(self.constants.payload_apple_root_path_zip).unlink()
Utilities.download_file(link, self.constants.payload_apple_root_path_zip)
if self.constants.payload_apple_root_path_zip.exists():
print("- Download completed")
print("- Unzipping download...")
try:
Utilities.process_status(subprocess.run(["unzip", self.constants.payload_apple_root_path_zip], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.constants.payload_path))
print("- Renaming folder")
os.rename(self.constants.payload_path / Path(os_ver), self.constants.payload_apple_root_path)
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")
except zipfile.BadZipFile:
print("- Couldn't unzip")
return
else:
print("- Download failed, please verify the below link works:")
print(link)
input("Press [ENTER] to continue")
def detect_gpus(self):
dgpu = self.constants.computer.dgpu
igpu = self.constants.computer.igpu
if self.constants.moj_cat_accel is True:
non_metal_os = self.constants.high_sierra
else:
non_metal_os = self.constants.catalina
if dgpu:
print(f"- Found GFX0: {Utilities.friendly_hex(dgpu.vendor_id)}:{Utilities.friendly_hex(dgpu.device_id)}")
if dgpu.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
elif dgpu.arch == device_probe.AMD.Archs.TeraScale_1:
if self.constants.detected_os > non_metal_os:
self.amd_ts1 = True
self.amfi_must_disable = True
elif dgpu.arch == device_probe.AMD.Archs.TeraScale_2:
if self.constants.detected_os > non_metal_os:
self.amd_ts2 = True
self.amfi_must_disable = True
if igpu and igpu.class_code != 0xFFFFFF:
print(f"- Found IGPU: {Utilities.friendly_hex(igpu.vendor_id)}:{Utilities.friendly_hex(igpu.device_id)}")
if igpu.arch == device_probe.Intel.Archs.Iron_Lake:
if self.constants.detected_os > non_metal_os:
self.iron_gpu = True
self.amfi_must_disable = True
elif igpu.arch == device_probe.Intel.Archs.Sandy_Bridge:
if self.constants.detected_os > non_metal_os:
self.sandy_gpu = True
self.amfi_must_disable = True
self.check_board_id = True
elif igpu.arch == device_probe.Intel.Archs.Ivy_Bridge:
if self.constants.detected_os > self.constants.big_sur:
self.ivy_gpu = True
elif isinstance(igpu, device_probe.NVIDIA):
if self.constants.detected_os > non_metal_os:
self.nvidia_legacy = True
self.amfi_must_disable = True
def detect_patch_set(self):
self.detect_gpus()
if self.model in ModelArray.LegacyBrightness:
if self.constants.detected_os > self.constants.catalina:
self.brightness_legacy = True
if self.model in ["iMac7,1", "iMac8,1"]:
if self.constants.detected_os > self.constants.catalina:
self.legacy_audio = True
Utilities.cls()
print("The following patches will be applied:")
if self.nvidia_legacy is True:
print("- Add Legacy Nvidia Tesla Graphics Patch")
elif self.amd_ts1 is True:
print("- Add Legacy ATI TeraScale 1 Graphics Patch")
elif self.amd_ts2 is True:
print("- Add Legacy ATI TeraScale 2 Graphics Patch")
if self.iron_gpu is True:
print("- Add Legacy Intel IronLake Graphics Patch")
elif self.sandy_gpu is True:
print("- Add Legacy Intel Sandy Bridge Graphics Patch")
elif self.ivy_gpu is True:
print("- Add Legacy Intel Ivy Bridge Graphics Patch")
if self.brightness_legacy is True:
print("- Add Legacy Brightness Control")
if self.legacy_audio is True:
print("- Add legacy Audio Control")
self.no_patch = not any(
[
self.nvidia_legacy,
self.amd_ts1,
self.amd_ts2,
self.iron_gpu,
self.sandy_gpu,
self.ivy_gpu,
self.brightness_legacy,
self.legacy_audio,
]
)
def verify_patch_allowed(self):
sip = self.constants.root_patch_sip_big_sur if self.constants.detected_os > self.constants.catalina else self.constants.root_patch_sip_mojave
if sip == self.constants.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 '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)
if self.sip_enabled is True:
print("\nCannot patch! Please disable System Integrity Protection (SIP).")
print("Disable SIP in Patcher Settings and Rebuild OpenCore\n")
print("Ensure the following bits are set for csr-active-config:")
print("\n".join(sip))
print(sip_value)
if self.sbm_enabled is True:
print("\nCannot patch! Please disable Apple Secure Boot.")
print("Disable SecureBootModel in Patcher Settings and Rebuild OpenCore")
print("For Hackintoshes, set SecureBootModel to Disabled")
if self.fv_enabled is True:
print("\nCannot patch! Please disable FileVault.")
print("Go to System Preferences -> Security and disable FileVault")
if self.amfi_enabled is True and self.amfi_must_disable is True:
print("\nCannot patch! Please disable AMFI.")
print("For Hackintoshes, please add amfi_get_out_of_my_way=1 to boot-args")
if self.check_board_id is True and self.computer.reported_board_id not in self.constants.sandy_board_id:
print("\nCannot patch! Board ID not supported by AppleIntelSNBGraphicsFB")
print(f"Detected Board ID: {self.computer.reported_board_id}")
print("Please ensure your Board ID is listed below:")
print("\n".join(self.constants.sandy_board_id))
self.bad_board_id = True
if self.dosdude_patched is True:
print("\nCannot patch! Detected machine has already been patched by another patcher")
print("Please ensure your install is either clean or patched with OpenCore Legacy Patcher")
if any(
[self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched, self.amfi_enabled if self.amfi_must_disable else False, self.bad_board_id if self.check_board_id else False]
):
return False
else:
return True
# Entry Function
def start_patch(self):
print("- Starting Patch Process")
print(f"- Determinging Required Patch set for Darwin {self.constants.detected_os}")
self.detect_patch_set()
if self.no_patch is True:
change_menu = None
print("- No Root Patches required for your machine!")
if self.constants.gui_mode is False:
input("\nPress [ENTER] to return to the main menu: ")
elif self.constants.gui_mode is False:
change_menu = input("Would you like to continue with Root Volume Patching?(y/n): ")
else:
change_menu = "y"
print("Continuing root patching")
if change_menu in ["y", "Y"]:
print("- Continuing with Patching")
print("- Verifying whether Root Patching possible")
if self.verify_patch_allowed() is True:
print("- Patcher is capable of patching")
self.check_files()
self.find_mount_root_vol(True)
elif self.constants.gui_mode is False:
input("\nPress [ENTER] to return to the main menu: ")
else:
print("- Returning to main menu")
def start_unpatch(self):
print("- Starting Unpatch Process")
if self.verify_patch_allowed() is True:
self.find_mount_root_vol(False)
if self.constants.gui_mode is False:
input("\nPress [ENTER] to return to the main menu")

View File

@@ -1,316 +0,0 @@
# Copyright (C) 2020-2021, Dhinak G
from __future__ import print_function
import hashlib
import math
import os
import plistlib
import subprocess
from pathlib import Path
import re
import os
import requests
from Resources import Constants, ioreg
def hexswap(input_hex: str):
hex_pairs = [input_hex[i : i + 2] for i in range(0, len(input_hex), 2)]
hex_rev = hex_pairs[::-1]
hex_str = "".join(["".join(x) for x in hex_rev])
return hex_str.upper()
def process_status(process_result):
if process_result.returncode != 0:
print(f"Process failed with exit code {process_result.returncode}")
print(f"Please file an issue on our Github")
raise Exception(f"Process result: \n{process_result.stdout.decode()}")
def human_fmt(num):
for unit in ["B", "KB", "MB", "GB", "TB", "PB"]:
if abs(num) < 1000.0:
return "%3.1f %s" % (num, unit)
num /= 1000.0
return "%.1f %s" % (num, "EB")
def header(lines):
lines = [i for i in lines if i is not None]
total_length = len(max(lines, key=len)) + 4
print("#" * (total_length))
for line in lines:
left_side = math.floor(((total_length - 2 - len(line.strip())) / 2))
print("#" + " " * left_side + line.strip() + " " * (total_length - len("#" + " " * left_side + line.strip()) - 1) + "#")
print("#" * total_length)
RECOVERY_STATUS = None
def check_recovery():
global RECOVERY_STATUS # pylint: disable=global-statement # We need to cache the result
if RECOVERY_STATUS is None:
RECOVERY_STATUS = Path("/System/Library/BaseSystem").exists()
return RECOVERY_STATUS
def get_disk_path():
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
root_mount_path = root_partition_info["DeviceIdentifier"]
root_mount_path = root_mount_path[:-2] if root_mount_path.count("s") > 1 else root_mount_path
return root_mount_path
def latebloom_detection(model):
if model in ["MacPro4,1", "MacPro5,1", "iMac7,1", "iMac8,1"]:
# These machines are more likely to experience boot hangs, increase delays to accomodate
lb_delay = "250"
else:
lb_delay = "100"
lb_range = "1"
lb_debug = "1"
if get_nvram("boot-args", decode=False):
if "latebloom=" in get_nvram("boot-args", decode=False):
lb_delay = re.search(r"(?:[, ])latebloom=(\d+)", get_nvram("boot-args", decode=False))
lb_delay = lb_delay[1]
if "lb_range=" in get_nvram("boot-args", decode=False):
lb_range = re.search(r"(?:[, ])lb_range=(\d+)", get_nvram("boot-args", decode=False))
lb_range = lb_range[1]
if "lb_debug=" in get_nvram("boot-args", decode=False):
lb_debug = re.search(r"(?:[, ])lb_debug=(\d+)", get_nvram("boot-args", decode=False))
lb_debug = lb_debug[1]
return int(lb_delay), int(lb_range), int(lb_debug)
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 Constants.Constants.csr_values:
if sip_int & (1 << i):
Constants.Constants.csr_values[current_sip_bit] = True
i = i + 1
# Can be adjusted to whatever OS needs patching
sip_needs_change = all(Constants.Constants.csr_values[i] for i in os_sip)
if sip_needs_change is True:
return False
else:
return True
def friendly_hex(integer: int):
return "{:02X}".format(integer)
def amfi_status():
amfi_1 = "amfi_get_out_of_my_way=0x1"
amfi_2 = "amfi_get_out_of_my_way=1"
if get_nvram("boot-args", decode=False) and (amfi_1 in get_nvram("boot-args", decode=False) or amfi_2 in get_nvram("boot-args", decode=False)):
return False
return True
def patching_status(os_sip):
# Detection for Root Patching
sip_enabled = True # System Integrity Protection
sbm_enabled = True # Secure Boot Status (SecureBootModel)
amfi_enabled = True # Apple Mobile File Integrity
fv_enabled = True # FileVault
dosdude_patched = True
gen6_kext = "/System/Library/Extension/AppleIntelHDGraphics.kext"
gen7_kext = "/System/Library/Extension/AppleIntelHD3000Graphics.kext"
amfi_enabled = amfi_status()
if get_nvram("HardwareModel", "94B73556-2197-4702-82A8-3E1337DAFBFB", decode=False) not in Constants.Constants.sbm_values:
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:
sip_enabled = False
fv_status: str = subprocess.run("fdesetup status".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if fv_status.startswith("FileVault is Off"):
fv_enabled = False
if not (Path(gen6_kext).exists() and Path(gen7_kext).exists()):
dosdude_patched = False
return sip_enabled, sbm_enabled, amfi_enabled, fv_enabled, dosdude_patched
clear = True
def disable_cls():
global clear
clear = False
def cls():
global clear
if not clear:
return
if not check_recovery():
os.system("cls" if os.name == "nt" else "clear")
else:
print("\u001Bc")
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
if uuid is not None:
uuid += ":"
else:
uuid = ""
nvram = ioreg.IORegistryEntryFromPath(ioreg.kIOMasterPortDefault, "IODeviceTree:/options".encode())
value = ioreg.IORegistryEntryCreateCFProperty(nvram, f"{uuid}{variable}", ioreg.kCFAllocatorDefault, ioreg.kNilOptions)
ioreg.IOObjectRelease(nvram)
if not value:
return None
value = ioreg.corefoundation_to_native(value)
if decode and isinstance(value, bytes):
value = value.strip(b"\0").decode()
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(f"- 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)
print(f"- Checksum: {checksum.hexdigest()}")
# def menu(title, prompt, menu_options, add_quit=True, auto_number=False, in_between=[], top_level=False):
# return_option = ["Q", "Quit", None] if top_level else ["B", "Back", None]
# if add_quit: menu_options.append(return_option)
# cls()
# header(title)
# print()
# for i in in_between: print(i)
# if in_between: print()
# for index, option in enumerate(menu_options):
# if auto_number and not (index == (len(menu_options) - 1) and add_quit):
# option[0] = str((index + 1))
# print(option[0] + ". " + option[1])
# print()
# selected = input(prompt)
# keys = [option[0].upper() for option in menu_options]
# if not selected or selected.upper() not in keys:
# return
# if selected.upper() == return_option[0]:
# return -1
# else:
# menu_options[keys.index(selected.upper())][2]() if menu_options[keys.index(selected.upper())][2] else None
class TUIMenu:
def __init__(self, title, prompt, options=None, return_number_instead_of_direct_call=False, add_quit=True, auto_number=False, in_between=None, top_level=False, loop=False):
self.title = title
self.prompt = prompt
self.in_between = in_between or []
self.options = options or []
self.return_number_instead_of_direct_call = return_number_instead_of_direct_call
self.auto_number = auto_number
self.add_quit = add_quit
self.top_level = top_level
self.loop = loop
self.added_quit = False
def add_menu_option(self, name, description="", function=None, key=""):
self.options.append([key, name, description, function])
def start(self):
return_option = ["Q", "Quit"] if self.top_level else ["B", "Back"]
if self.add_quit and not self.added_quit:
self.add_menu_option(return_option[1], function=None, key=return_option[0])
self.added_quit = True
while True:
cls()
header(self.title)
print()
for i in self.in_between:
print(i)
if self.in_between:
print()
for index, option in enumerate(self.options):
if self.auto_number and not (index == (len(self.options) - 1) and self.add_quit):
option[0] = str((index + 1))
print(option[0] + ". " + option[1])
for i in option[2]:
print("\t" + i)
print()
selected = input(self.prompt)
keys = [option[0].upper() for option in self.options]
if not selected or selected.upper() not in keys:
if self.loop:
continue
else:
return
if self.add_quit and selected.upper() == return_option[0]:
return -1
elif self.return_number_instead_of_direct_call:
return self.options[keys.index(selected.upper())][0]
else:
self.options[keys.index(selected.upper())][3]() if self.options[keys.index(selected.upper())][3] else None
if not self.loop:
return
class TUIOnlyPrint:
def __init__(self, title, prompt, in_between=None):
self.title = title
self.prompt = prompt
self.in_between = in_between or []
def start(self):
cls()
header(self.title)
print()
for i in self.in_between:
print(i)
if self.in_between:
print()
return input(self.prompt)

View File

@@ -1,2 +1,2 @@
#!/bin/sh
cp launcher.sh dist/OpenCore-Patcher.app/Contents/MacOS/Launcher
cp payloads/launcher.sh dist/OpenCore-Patcher.app/Contents/MacOS/Launcher

14
create_offline_build.py Normal file
View File

@@ -0,0 +1,14 @@
import subprocess
from resources import constants
patcher_support_pkg_version = constants.Constants().patcher_support_pkg_version
binary_packages = ["10.14-Mojave", "10.15-Catalina", "11-Big-Sur", "12-Monterey"]
for binary_package in binary_packages:
print(f"- Downloading {binary_package}...")
download_cmd = f"curl -LO https://github.com/dortania/PatcherSupportPkg/releases/download/{patcher_support_pkg_version}/{binary_package}.zip"
subprocess.run(download_cmd, shell=True)
print("- Moving into payloads")
move_cmd = f"mv {binary_package}.zip ./payloads/"
subprocess.run(move_cmd, shell=True)
print("- Download complete")

15
data/bluetooth_data.py Normal file
View File

@@ -0,0 +1,15 @@
import enum
class bluetooth_data(enum.IntEnum):
# Bluetooth Chipsets
NonApplicable = 0
BRCM2045 = 1 # TODO: Rename chipset, currently guessing MacPro1,1-3,1 name
BRCM2046 = 2 # BT 2.1
BRCM2070 = 3 # BT 2.1
BRCM20702_v1 = 4 # BT 4.0 - 2012
BRCM20702_v2 = 5 # BT 4.0 - 2013+
BRCM20703 = 6 # BT 4.2
BRCM20703_UART = 9 # BRCM20703 over UART, BT 4.2
UART = 10 # T2
PCIe = 20 # Apple Silicon

23
data/cpu_data.py Normal file
View File

@@ -0,0 +1,23 @@
import enum
class cpu_data(enum.IntEnum):
pentium_4 = 0
yonah = 1
conroe = 2
penryn = 3
nehalem = 4 # (Westmere included)
sandy_bridge = 5 # 2000
ivy_bridge = 6 # 3000
haswell = 7 # 4000
broadwell = 8 # 5000
skylake = 9 # 6000
kaby_lake = 10 # 7000
coffee_lake = 11 # 8000
comet_lake = 12 # 9000
ice_lake = 13 # 10000
apple_dtk = 112 # A12
apple_m1 = 114 # A14
apple_m1_pro = 115
apple_m1_max = 116

View File

@@ -1,6 +1,6 @@
# Example Hardware probe of multiple models
# To be used when running validation tests
from Resources import device_probe
from resources import device_probe
class MacBook:
@@ -69,6 +69,24 @@ class MacBookPro:
class Macmini:
Macmini81_Stock = device_probe.Computer(
real_model="Macmini8,1",
real_board_id="Mac-7BA5B2DFE22DDD8C",
reported_model="Macmini8,1",
reported_board_id="Mac-7BA5B2DFE22DDD8C",
gpus=[device_probe.Intel(vendor_id=32902, device_id=16027, class_code=196608, name="IGPU", model="Intel UHD Graphics 630", pci_path="PciRoot(0x0)/Pci(0x2,0x0)")],
igpu=device_probe.Intel(vendor_id=32902, device_id=16027, class_code=196608, name="IGPU", model="Intel UHD Graphics 630", pci_path="PciRoot(0x0)/Pci(0x2,0x0)"),
dgpu=None,
storage=[],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17508, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x0)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "PCLMULQDQ", "DTES64", "MON", "DSCPL", "VMX", "SMX", "EST", "TM2", "SSSE3", "FMA", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "x2APIC", "MOVBE", "POPCNT", "AES", "PCID", "XSAVE", "OSXSAVE", "SEGLIM64", "TSCTMR", "AVX1.0", "RDRAND", "F16C"]
),
oclp_version=None,
opencore_version=None
)
Macmini91_Stock = device_probe.Computer(
# Run under Rosetta
real_model="Macmini9,1",
@@ -258,3 +276,68 @@ class MacPro:
oclp_version=None,
opencore_version=None,
)
MacPro41_Upgrade = device_probe.Computer(
# Upgraded model with AMD HD7950, Atheros PCIe card
real_model="MacPro4,1",
real_board_id="Mac-F221BEC8",
reported_model="MacPro4,1",
reported_board_id="Mac-F221BEC8",
gpus=[device_probe.AMD(vendor_id=4098, device_id=26522, class_code=196608, name="PXS1", model="AMD Radeon HD 7950", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)")],
igpu=None,
dgpu=None,
storage=[device_probe.SATAController(vendor_id=32902, device_id=14882, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")],
wifi=device_probe.Atheros(vendor_id=5772, device_id=48, class_code=163840, name="PXS4", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x4,0x0)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU W3520 @ 2.67GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "POPCNT"]
),
oclp_version=None,
opencore_version=None
)
MacPro41_Modern_AMD = device_probe.Computer(
# Upgraded model with AMD RX470, BCM94360CD, Intel 660p
# Booted through OpenCore
real_model="MacPro4,1",
real_board_id="Mac-F221BEC8",
reported_model="MacPro4,1",
reported_board_id="Mac-27AD2F918AE68F61",
gpus=[device_probe.AMD(vendor_id=4098, device_id=26591, class_code=196608, name="GFX0", model="Radeon RX 470/570", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)")],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=26591, class_code=196608, name="GFX0", model="Radeon RX 470/570", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=14882, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)"),
device_probe.NVMeController(vendor_id=32902, device_id=61864, class_code=67586, name="PXS3", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)", aspm=2)
],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17312, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x4,0x0)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU W3520 @ 2.67GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "POPCNT"]
),
oclp_version="0.2.5",
opencore_version="REL-071-2021-07-02"
)
MacPro41_51__Flashed_Modern_AMD = device_probe.Computer(
# 4,1 flashed to 5,1, RX5700XT, BCM94360CD, WD SN750 NVMe
real_model="MacPro5,1",
real_board_id="Mac-F221BEC8",
reported_model="MacPro5,1",
reported_board_id="Mac-F221BEC8",
gpus=[device_probe.AMD(vendor_id=4098, device_id=29471, class_code=196608, name="GFX0", model="AMD Radeon RX 5700 XT", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)")],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=29471, class_code=196608, name="GFX0", model="AMD Radeon RX 5700 XT", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=14882, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)"),
device_probe.NVMeController(vendor_id=5559, device_id=20482, class_code=67586, name="PXS3", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)", aspm=2)
],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17312, class_code=163840, name="PXS4", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x4,0x0)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU X5670 @ 2.93GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "PCLMULQDQ", "DTES64", "MON", "DSCPL", "VMX", "SMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "POPCNT", "AES", "PCID"]
),
oclp_version="0.2.5",
opencore_version="REL-071-2021-07-02"
)

395
data/model_array.py Normal file
View File

@@ -0,0 +1,395 @@
# Lists all models and required patches
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
SupportedSMBIOS = [
# MacBook
"MacBook4,1",
"MacBook5,1",
"MacBook5,2",
"MacBook6,1",
"MacBook7,1",
"MacBook8,1",
# MacBook Air
"MacBookAir2,1",
"MacBookAir3,1",
"MacBookAir3,2",
"MacBookAir4,1",
"MacBookAir4,2",
"MacBookAir5,1",
"MacBookAir5,2",
"MacBookAir6,1",
"MacBookAir6,2",
# MacBook Pro
"MacBookPro4,1",
"MacBookPro5,1",
"MacBookPro5,2",
"MacBookPro5,3",
"MacBookPro5,4",
"MacBookPro5,5",
"MacBookPro6,1",
"MacBookPro6,2",
"MacBookPro7,1",
"MacBookPro8,1",
"MacBookPro8,2",
"MacBookPro8,3",
"MacBookPro9,1",
"MacBookPro9,2",
"MacBookPro10,1",
"MacBookPro10,2",
"MacBookPro11,1",
"MacBookPro11,2",
"MacBookPro11,3",
# Mac Mini
"Macmini3,1",
"Macmini4,1",
"Macmini5,1",
"Macmini5,2",
"Macmini5,3",
"Macmini6,1",
"Macmini6,2",
# iMac
"iMac7,1",
"iMac8,1",
"iMac9,1",
"iMac10,1",
"iMac11,1",
"iMac11,2",
"iMac11,3",
"iMac12,1",
"iMac12,2",
"iMac13,1",
"iMac13,2",
"iMac13,3",
"iMac14,1",
"iMac14,2",
"iMac14,3",
"iMac14,4",
"iMac15,1",
# Mac Pro
"MacPro3,1",
"MacPro4,1",
"MacPro5,1",
# Xserve
"Xserve2,1",
"Xserve3,1",
]
# Audio
LegacyAudio = [
"MacBook4,1",
"MacBook5,1",
"MacBook5,2",
"MacBook6,1",
"MacBook7,1",
"MacBookAir2,1",
"MacBookAir3,1",
"MacBookAir3,2",
"MacBookAir4,1",
"MacBookAir4,2",
"MacBookPro4,1",
"MacBookPro5,1",
"MacBookPro5,2",
"MacBookPro5,3",
"MacBookPro5,4",
"MacBookPro5,5",
"MacBookPro6,1",
"MacBookPro6,2",
"MacBookPro7,1",
"MacBookPro8,1",
"MacBookPro8,2",
"MacBookPro8,3",
"Macmini3,1",
"Macmini4,1",
"Macmini5,1",
"Macmini5,2",
"Macmini5,3",
# "iMac7,1",
# "iMac8,1",
"iMac9,1",
"iMac10,1",
"iMac11,1",
"iMac11,2",
"iMac11,3",
"iMac12,1",
"iMac12,2",
"MacPro3,1",
"Dortania1,1",
]
# GPU
ModernGPU = [
"MacBookAir5,1", # Intel 4000
"MacBookAir5,2", # Intel 4000
"MacBookPro9,1", # Intel 4000 + Nvidia 650M
"MacBookPro9,2", # Intel 4000
"MacBookPro10,1", # Intel 4000 + Nvidia 650M
"MacBookPro10,2", # Intel 4000
"MacBookPro11,3", # Intel 5000 + Nvidia Kepler
"Macmini6,1", # Intel 4000
"Macmini6,2", # Intel 4000
"iMac13,1", # Intel 4000
"iMac13,2", # Intel 4000 + Nvidia Kepler
"iMac13,3", # Intel 4000
"iMac14,1", # Intel 5000 + Nvidia Kepler
"iMac14,2", # Intel 5000 + Nvidia Kepler
"iMac14,3", # Intel 5000 + Nvidia Kepler
]
LegacyGPU = [
"MacBook4,1", # GMA X3100
"MacBook5,1", # Nvidia 9000
"MacBook5,2", # Nvidia 9000
"MacBook6,1", # Nvidia 9000
"MacBook7,1", # Nvidia 300
"MacBookAir2,1", # Nvidia 9000
"MacBookAir3,1", # Nvidia 300
"MacBookAir3,2", # Nvidia 300
"MacBookAir4,1", # Intel 3000
"MacBookAir4,2", # Intel 3000
"MacBookPro4,1", # Nvidia 8000
"MacBookPro5,1", # Nvidia 9000
"MacBookPro5,2", # Nvidia 9000
"MacBookPro5,3", # Nvidia 9000
"MacBookPro5,4", # Nvidia 9000
"MacBookPro5,5", # Nvidia 9000
"MacBookPro6,1", # Intel 100 + Nvidia 300
"MacBookPro6,2", # Intel 100 + Nvidia 300
"MacBookPro7,1", # Nvidia 300
"MacBookPro8,1", # Intel 3000
"MacBookPro8,2", # Intel 3000 + AMD 6000
"MacBookPro8,3", # Intel 3000 + AMD 6000
"Macmini3,1", # Nvidia 9000
"Macmini4,1", # Nvidia 300
"Macmini5,1", # Intel 3000
"Macmini5,2", # AMD 6000
"Macmini5,3", # Intel 3000
"iMac7,1", # AMD 2000
"iMac8,1", # Nvidia and AMD 2400
"iMac9,1", # Nvidia 9000
"iMac10,1", # Nvidia 9000 and AMD 4000
"iMac11,1", # AMD 4000
"iMac11,2", # AMD 4000 and 5000
"iMac11,3", # AMD 5000
"iMac12,1", # AMD 6000
"iMac12,2", # AMD 6000
"Dortania1,1", # RTX 3080
]
LegacyGPUNvidia = [
"MacBook5,1", # Nvidia 9000
"MacBook5,2", # Nvidia 9000
"MacBook6,1", # Nvidia 9000
"MacBook7,1", # Nvidia 300
"MacBookAir2,1", # Nvidia 9000
"MacBookAir3,1", # Nvidia 300
"MacBookAir3,2", # Nvidia 300
"MacBookPro4,1", # Nvidia 8000
"MacBookPro5,1", # Nvidia 9000
"MacBookPro5,2", # Nvidia 9000
"MacBookPro5,3", # Nvidia 9000
"MacBookPro5,4", # Nvidia 9000
"MacBookPro5,5", # Nvidia 9000
"MacBookPro6,1", # Intel 100 + Nvidia 300
"MacBookPro6,2", # Intel 100 + Nvidia 300
"MacBookPro7,1", # Nvidia 300
"Macmini3,1", # Nvidia 9000
"Macmini4,1", # Nvidia 300
"iMac9,1", # Nvidia 9000
# "iMac10,1", # Nvidia 9000 and AMD 4000
]
LegacyGPUAMD = [
"MacBookPro8,2", # Intel 3000 + AMD 6000
"MacBookPro8,3", # Intel 3000 + AMD 6000
"Macmini5,2", # AMD 6000
"iMac7,1", # AMD 2000
# "iMac8,1", # Nvidia and AMD 2000
# "iMac10,1", # Nvidia 9000 and AMD 4000
"iMac11,1", # AMD 4000
"iMac11,2", # AMD 4000 and 5000
"iMac11,3", # AMD 5000
"iMac12,1", # AMD 6000
"iMac12,2", # AMD 6000
]
LegacyGPUAMDIntelGen2 = [
"MacBookPro8,2", # Intel 3000 + AMD 6000
"MacBookPro8,3", # Intel 3000 + AMD 6000
"Macmini5,2", # AMD 6000
"iMac12,1", # AMD 6000
"iMac12,2", # AMD 6000
]
LegacyGPUIntelGen1 = [
"MacBookPro6,1", # Intel 100 + Nvidia 300
"MacBookPro6,2", # Intel 100 + Nvidia 300
]
LegacyGPUIntelGen2 = [
"MacBookAir4,1", # Intel 3000
"MacBookAir4,2", # Intel 3000
"MacBookPro8,1", # Intel 3000
"MacBookPro8,2", # Intel 3000 + AMD 6000
"MacBookPro8,3", # Intel 3000 + AMD 6000
"Macmini5,1", # Intel 3000
"Macmini5,3", # Intel 3000
]
LegacyBrightness = [
"MacBook5,2",
"iMac7,1",
"iMac8,1",
"iMac9,1",
]
NVMePatch = ["MacPro3,1", "MacPro4,1", "Xserve3,1", "Dortania1,1"]
DualGPUPatch = [
"MacBookPro5,1",
"MacBookPro5,2",
"MacBookPro5,3",
"MacBookPro6,1",
"MacBookPro6,2",
"MacBookPro8,2",
"MacBookPro8,3",
"Macmini5,2",
"iMac12,1",
"iMac12,2",
"iMac13,1",
"iMac13,2",
"iMac14,2",
"iMac14,3",
"Dortania1,1",
]
DualGPUPatchRetina = [
"MacBookPro10,1",
"MacBookPro11,3",
]
IntelNvidiaDRM = [
"iMac13,1",
"iMac13,2",
"iMac14,2",
"iMac14,3",
]
IDEPatch = ["MacBook4,1", "MacBookPro4,1", "iMac7,1", "iMac8,1", "MacPro3,1", "Xserve2,1", "Dortania1,1"]
# Mac Pro and Xserve
MacPro = ["MacPro3,1", "MacPro4,1", "MacPro5,1", "Xserve2,1", "Xserve3,1", "Dortania1,1"]
SATAPatch = [
"MacBook4,1",
"MacBook5,1",
"MacBook5,2",
"MacBook6,1",
"MacBook7,1",
"MacBookAir2,1",
"MacBookAir3,1",
"MacBookAir3,2",
"MacBookAir4,1",
"MacBookAir4,2",
"MacBookPro4,1",
"MacBookPro5,1",
"MacBookPro5,2",
"MacBookPro5,3",
"MacBookPro5,4",
"MacBookPro5,5",
"MacBookPro6,1",
"MacBookPro6,2",
"MacBookPro7,1",
"MacBookPro8,1",
"MacBookPro8,2",
"MacBookPro8,3",
"MacBookPro9,1",
"MacBookPro9,2",
"Macmini3,1",
"Macmini4,1",
"Macmini5,1",
"Macmini5,2",
"Macmini5,3",
"iMac7,1",
"iMac8,1",
"iMac9,1",
"iMac10,1",
"iMac11,1",
"iMac11,2",
"iMac11,3",
"iMac12,1",
"iMac12,2",
"MacPro3,1",
"MacPro4,1",
"MacPro5,1",
"Xserve2,1",
"Xserve3,1",
"Dortania1,1",
]
NoAGPMSupport = ["MacBook4,1", "MacBookPro4,1", "iMac7,1", "iMac8,1", "MacPro3,1", "Xserve2,1", "Dortania1,1"]
AGDPSupport = [
"MacBookPro9,1",
"MacBookPro10,1",
"iMac13,1",
"iMac13,2",
"iMac14,1",
"iMac14,2",
"iMac14,3",
"iMac14,4",
"iMac15,1",
# TODO: Uncomment when dropped from macOS
# "iMac17,1",
# "iMac18,2",
# "iMac18,3",
# "iMac19,1",
# "iMac19,2",
# "iMac20,1",
# "iMac20,2",
# "iMacPro1,1",
# "MacPro6,1",
]
Missing_USB_Map = [
"MacBook4,1",
"MacBook5,1",
"MacBook5,2",
"MacBook6,1",
"MacBook7,1",
"MacBookAir2,1",
"MacBookAir3,1",
"MacBookAir3,2",
"MacBookAir4,1",
"MacBookAir4,2",
"MacBookPro4,1",
"MacBookPro5,1",
"MacBookPro5,2",
"MacBookPro5,3",
"MacBookPro5,4",
"MacBookPro5,5",
"MacBookPro6,1",
"MacBookPro6,2",
"MacBookPro7,1",
"MacBookPro8,1",
"MacBookPro8,2",
"MacBookPro8,3",
"Macmini3,1",
"Macmini4,1",
"Macmini5,1",
"Macmini5,2",
"Macmini5,3",
"iMac7,1",
"iMac8,1",
"iMac9,1",
"iMac10,1",
"iMac11,1",
"iMac11,2",
"iMac11,3",
"iMac12,1",
"iMac12,2",
"MacPro3,1",
"MacPro4,1",
"Xserve2,1",
"Xserve3,1",
]

20
data/os_data.py Normal file
View File

@@ -0,0 +1,20 @@
import enum
class os_data(enum.IntEnum):
# OS Versions, Based off Major Kernel Version
tiger = 8
leopard = 9
snow_leopard = 10
lion = 11
mountain_lion = 12
mavericks = 13
yosemite = 14
el_capitan = 15
sierra = 16
high_sierra = 17
mojave = 18
catalina = 19
big_sur = 20
monterey = 21
max_os = 99

View File

@@ -1,10 +1,20 @@
# Array of Device IDs for different devices
class nvidia_ids:
# Courteous of envytools as well as Macrumors:
# https://envytools.readthedocs.io/en/latest/hw/pciid.html
# https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
curie_ids = [
0x0040,
0x00f0,
0x0220,
0x0140,
0x0160,
0x0090,
0x01d0,
0x0390,
0x0290,
]
tesla_ids = [
# G80
0x0190, # G80 [GeForce 8800 GTS / 8800 GTX]
@@ -515,61 +525,79 @@ class nvidia_ids:
class amd_ids:
legacy_gcn_ids = [
# AMDRadeonX4000
# AMDBonaireGraphicsAccelerator
0x6640,
0x6641,
0x6646,
0x6647,
0x6650,
0x6651,
0x665C,
0x665D,
# AMDFijiGraphicsAccelerator
0x7300,
0x730F,
# AMDHawaiiGraphicsAccelerator
0x67B0,
# AMDPitcairnGraphicsAccelerator
0x6800,
0x6801,
0x6806,
0x6808,
0x6810,
0x6818,
0x6819,
# AMDTahitiGraphicsAccelerator
0x6790,
0x6798,
0x679A,
0x679E,
0x6780,
# AMDTongaGraphicsAccelerator
0x6920,
0x6921,
0x6930,
0x6938,
0x6939,
# AMDVerdeGraphicsAccelerator
0x6820,
0x6821,
0x6823,
0x6825,
0x6827,
0x682B,
0x682D,
0x682F,
0x6835,
0x6839,
0x683B,
0x683D,
0x683F,
gcn_7000_ids = [
# GCN v1
# 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
# 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
0x679A, # HD 7950/8950 OEM / R9 280
0x679E, # HD 7870 XT
0x6780, # W9000
# AMDVerdeGraphicsAccelerator - AMD7000Controller
0x6820, # HD 8890M / R9 M275X/M375X / M5100
0x6821, # HD 8870M / R9 M270X/M370X
0x6823, # HD 8850M / R9 M265X
0x6825, # HD 7870M
0x6827, # HD 7850M/8850M
0x682B, # HD 8830M / R7 250 / R7 M465X
0x682D, # M4000
0x682F, # HD 7730M
0x6835, # R9 255
0x6839, # Unknown
0x683B, # Unknown
0x683D, # HD 7770/8760 / R7 250X
0x683F, # HD 7750/8740 / R7 250E
]
gcn_8000_ids = [
# GCN v2
# AMDBonaireGraphicsAccelerator - AMD8000Controller
0x6640, # M6100
0x6641, # HD 8930M
0x6646, # R9 M280X / W6170M
0x6647, # R9 M270X/M280X
0x6650, # Unknown
0x6651, # Unknown
0x665C, # HD 7790/8770 / R7 360 / R9 260/360
0x665D, # R7 200
# AMDHawaiiGraphicsAccelerator - AMD8000Controller
0x67B0, # R9 290X/390X
]
gcn_9000_ids = [
# GCN v3
# AMDFijiGraphicsAccelerator - AMD9000Controller
0x7300, # R9 FURY / NANO
0x730F, # Unknown
# AMDTongaGraphicsAccelerator - AMD9000Controller
0x6920, # R9 M395/ M395X
0x6921, # R9 M295X / M390X
0x6930, # Unknown
0x6938, # R9 380X / R9 M295X
0x6939, # R9 285/380
]
polaris_ids = [
# GCN v4
# AMDRadeonX4000
# AMDBaffinGraphicsAccelerator
# AMDBaffinGraphicsAccelerator - AMD9500Controller
0x67E0,
0x67E3,
0x67E8,
@@ -579,7 +607,7 @@ class amd_ids:
0x67E1,
0x67E7,
0x67E9,
# AMDEllesmereGraphicsAccelerator
# AMDEllesmereGraphicsAccelerator - AMD9500Controller
0x67C0,
0x67C1,
0x67C2,
@@ -595,8 +623,9 @@ class amd_ids:
]
vega_ids = [
# GCN v5
# AMDRadeonX5000
# AMDVega10GraphicsAccelerator
# AMDVega10GraphicsAccelerator - AMD10000Controller
0x6860,
0x6861,
0x6862,
@@ -612,13 +641,13 @@ class amd_ids:
0x686E,
0x686F,
0x687F,
# AMDVega12GraphicsAccelerator
# AMDVega12GraphicsAccelerator - AMD10000Controller
0x69A0,
0x69A1,
0x69A2,
0x69A3,
0x69AF,
# AMDVega20GraphicsAccelerator
# AMDVega20GraphicsAccelerator - AMD10000Controller
0x66A0,
0x66A1,
0x66A2,
@@ -638,7 +667,7 @@ class amd_ids:
0x731B,
0x731F,
# AMDNavi12GraphicsAccelerator
0x7360,
0x7360, # 5600M
# AMDNavi14GraphicsAccelerator
0x7340,
0x7341,
@@ -650,6 +679,14 @@ class amd_ids:
0x73AB,
0x73BF,
]
r500_ids = [
0x7187, # X1300/X1550
0x7146, # X1300/X1550
0x71c5, # Mobile X1600
0x7249, # X1900 XT
]
terascale_1_ids = [
0x9400,
0x9401,
@@ -688,39 +725,50 @@ class amd_ids:
]
terascale_2_ids = [
0x6738,
0x6739,
0x6720,
0x6722,
0x6768,
0x6770,
0x6779,
0x6760,
0x6761,
0x68E0,
0x6898,
0x6899,
0x68B8,
0x68B0,
0x68B1,
0x68A0,
0x68A1,
0x6840,
0x6841,
0x68D8,
0x68C0,
0x68C1,
0x68D9,
0x6750,
0x6758,
0x6759,
0x6740,
0x6741,
0x6745,
0x6738, # HD 6870
0x6739, # HD 6850
0x6720, # HD 6970M/6990M
0x6722, # Unknown
0x6768, # Unknown
0x6770, # HD 6450A/7450A
0x6779, # HD 6450/7450/8450 / R5 230 OEM
0x6760, # HD 6400M/7400M
0x6761, # HD 6430M
0x68E0, # HD 5430/5450/547
0x6898, # HD 5870
0x6899, # HD 5850
0x68B8, # HD 5770
0x68B0, # Unknown
0x68B1, # Unknown
0x68A0, # HD 5870 (mobile)
0x68A1, # HD 5850 (mobile)
0x6840, # HD 7500M/7600M
0x6841, # HD 7550M/7570M/7650M
0x68D8, # HD 5670/5690/5730
0x68C0, # HD 5730 / 6570M
0x68C1, # HD 5650/5750 / 6530M/6550M
0x68D9, # HD 5550/5570/5630/6510/6610/7570
0x6750, # HD 6650A/7650A
0x6758, # HD 6670/7670
0x6759, # HD 6570/7570/8550
0x6740, # HD 6730M/6770M/7690M XT
0x6741, # HD 6630M/6650M/6750M/7670M/7690M
0x6745, # Unknown
]
class intel_ids:
gma_950_ids = [
0x2582,
0x2592,
0x2772,
0x27A2,
]
gma_x3100_ids = [
0x2a02,
]
iron_ids = [
# AppleIntelHDGraphics IDs
0x0044,
@@ -746,8 +794,123 @@ class intel_ids:
0x0166,
]
haswell_ids = [
# AppleIntelHD5000Graphics IDs
# AppleIntelFramebufferAzul IDs
0x0D26,
0x0A26,
0x0A2E,
0x0D22,
0x0412,
]
broadwell_ids = [
# AppleIntelBDWGraphicsFramebuffer IDs
0x0BD1,
0x0BD2,
0x0BD3,
0x1606,
0x160E,
0x1616,
0x161E,
0x1626,
0x1622,
0x1612,
0x162B,
]
skylake_ids = [
# AppleIntelSKLGraphicsFramebuffer IDs
0x1916,
0x191E,
0x1926,
0x1927,
0x1912,
0x1932,
0x1902,
0x1917,
0x193B,
0x191B,
]
kaby_lake_ids = [
# AppleIntelKBLGraphicsFramebuffer IDs
0x5912,
0x5916,
0x591B,
0x591C,
0x591E,
0x5926,
0x5927,
0x5923,
]
coffee_lake_ids = [
# AppleIntelCFLGraphicsFramebuffer IDs
0x3E9B,
0x3EA5,
0x3EA6,
0x3E92,
0x3E91,
0x3E98,
]
comet_lake_ids = [
0x9BC8,
0x9BC5,
0x9BC4,
]
ice_lake_ids = [
# AppleIntelICLLPGraphicsFramebuffer IDs
0xFF05,
0x8A70,
0x8A71,
0x8A51,
0x8A5C,
0x8A5D,
0x8A52,
0x8A53,
0x8A5A,
0x8A5B,
]
AppleIntel8254XEthernet = [
# AppleIntel8254XEthernet IDs
0x1096,
0x100F,
0x105E,
]
AppleIntelI210Ethernet = [
# AppleIntelI210Ethernet IDs
0x1533, # I210
0x15F2, # I225
0x15F3, # I225
0x3100, # I225
0x3101, # I225
0x5502, # I225
0x0D9F, # I225
0x15F8, # I225
0x15F7, # I225
0x15FD, # I225
]
Intel82574L = [
# Intel82574L IDs
0x104B,
0x10F6,
]
class broadcom_ids:
AppleBCMWLANBusInterfacePCIe = [
0x43DC, # BCM4355
0x4464, # BCM4364
0x4488, # BCM4377b
0x4425, # Unknown
]
AirPortBrcmNIC = [
# AirPortBrcmNIC IDs
0x43BA, # BCM43602
@@ -782,6 +945,82 @@ class broadcom_ids:
0x432D, # BCM4322 - never used by Apple
]
AppleBCM5701Ethernet = [
# AppleBCM5701Ethernet IDs
0x1684,
0x16B0,
0x16B4,
0x1682,
0x1686,
]
class aquantia_ids:
AppleEthernetAquantiaAqtion = [
# AppleEthernetAquantiaAqtion IDs
0x0001, # AQC107
0xD107, # AQC107
0x07B1, # AQC107
0x80B1, # AQC107
0x87B1, # AQC107
0x88B1, # AQC107
0x89B1, # AQC107
0x91B1, # AQC107
0x92B1, # AQC107
0x00C0, # AQC113
0x04C0, # AQC113
]
class marvell_ids:
MarvelYukonEthernet = [
# AppleYukon2.kext IDs
# AppleYukon2 supports 2 vendors (Marvell and SysKonnect)
0x9E00,
0x2100,
0x9E00,
0x2200,
0x9E00,
0x8100,
0x9E00,
0x8200,
0x9E00,
0x9100,
0x9E00,
0x9200,
0x9000,
0x2100,
0x9000,
0x2200,
0x9000,
0x8100,
0x9000,
0x8200,
0x9000,
0x9100,
0x9000,
0x9200,
0x9E00,
0x2200,
0x9E00,
0x2200,
]
class syskonnect_ids:
MarvelYukonEthernet = [
# AppleYukon2.kext IDs
# AppleYukon2 supports 2 vendors (Marvell and SysKonnect)
0x4365,
0x4360,
0x435A,
0x4354,
0x4362,
0x4363,
0x00BA,
0x436A,
]
class atheros_ids:
AtherosWifi = [

38
data/sip_data.py Normal file
View File

@@ -0,0 +1,38 @@
class system_integrity_protection:
csr_values = {
# Source: macOS 11.4 (XNU's csr.h)
# https://opensource.apple.com/source/xnu/xnu-7195.121.3/bsd/sys/csr.h.auto.html
"CSR_ALLOW_UNTRUSTED_KEXTS": False, # 0x1 - Allows Unsigned Kexts - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_UNRESTRICTED_FS": False, # 0x2 - File System Access - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_TASK_FOR_PID": False, # 0x4 - Unrestricted task_for_pid() - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_KERNEL_DEBUGGER": False, # 0x8 - Allow Kernel Debugger - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_APPLE_INTERNAL": False, # 0x10 - Set AppleInternal Features - Introduced in El Capitan # noqa: E241
# "CSR_ALLOW_DESTRUCTIVE_DTRACE": False, # 0x20 - Allow destructive DTrace - Deprecated # noqa: E241
"CSR_ALLOW_UNRESTRICTED_DTRACE": False, # 0x20 - Unrestricted DTrace usage - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_UNRESTRICTED_NVRAM": False, # 0x40 - Unrestricted NVRAM write - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_DEVICE_CONFIGURATION": False, # 0x80 - Allow custom DeviceTree (iOS) - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_ANY_RECOVERY_OS": False, # 0x100 - Skip BaseSystem Verification - Introduced in Sierra # noqa: E241
"CSR_ALLOW_UNAPPROVED_KEXTS": False, # 0x200 - Allow Unnotarized Kexts - Introduced in High Sierra # noqa: E241
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE": False, # 0x400 - Override Executable Policy - Introduced in Mojave # noqa: E241
"CSR_ALLOW_UNAUTHENTICATED_ROOT": False, # 0x800 - Allow Root Volume Mounting - Introduced in Big Sur # noqa: E241
}
root_patch_sip_mojave = [
# Variables required to root patch in Mojave and Catalina
"CSR_ALLOW_UNTRUSTED_KEXTS", # 0x1
"CSR_ALLOW_UNRESTRICTED_FS", # 0x2
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200
]
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 - Required to mount and edit root volume, as well as load modded platform binaries
"CSR_ALLOW_UNAPPROVED_KEXTS", # 0x200
"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.

2271
data/smbios_data.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
# Lists Root patches used by SysPatch.py
# Lists Root patches used by sys_patch.py
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
DeleteNvidiaAccel11 = [
"AMDRadeonX4000.kext",
@@ -91,7 +91,10 @@ AddNvidiaKeplerAccel11 = [
"NVDAGK100Hal.kext",
"NVDAResman.kext",
"NVDAStartup.kext",
"NVSMU.kext",
]
AddNvidiaTeslaAccel12 = [
"NVDAStartup.kext",
]
AddAMDAccel11 = [
@@ -156,10 +159,18 @@ AddIntelGen2Accel = [
"AppleIntelHD3000GraphicsGA.plugin",
"AppleIntelHD3000GraphicsGLDriver.bundle",
"AppleIntelHD3000GraphicsVADriver.bundle",
"AppleIntelSNBGraphicsFB.kext",
# "AppleIntelSNBGraphicsFB.kext",
"AppleIntelSNBVA.bundle",
]
AddIntelGen2AccelStock = [
"AppleIntelSNBGraphicsFB-Clean.kext",
]
AddIntelGen2AccelPatched = [
"AppleIntelSNBGraphicsFB.kext",
]
AddIntelGen3Accel = [
"AppleIntelFramebufferCapri.kext",
"AppleIntelHD4000Graphics.kext",
@@ -174,6 +185,16 @@ AddGeneralAccel = ["IOAcceleratorFamily2.kext", "IOSurface.kext"]
DeleteBrightness = ["AppleGraphicsControl.kext/Contents/PlugIns/AGDCBacklightControl.kext"]
DeleteDemux = [
"AppleGraphicsControl.kext/Contents/PlugIns/AGDCBacklightControl.kext",
"AppleGraphicsControl.kext/Contents/PlugIns/AppleMuxControl.kext",
"AppleBacklight.kext",
]
AddDemux = [
"AppleMuxControl.kext",
]
AddBrightness = [
"AppleBacklight.kext",
"AppleBacklightExpert.kext",
@@ -184,6 +205,10 @@ AddVolumeControl = [
"IOAudioFamily.kext",
]
AddVolumeControlv2 = [
"AppleHDA.kext",
]
DeleteVolumeControl = [
"AppleVirtIO.kext",
"AppleVirtualGraphics.kext",
@@ -193,7 +218,7 @@ DeleteVolumeControl = [
]
AddNvidiaAccelLegacy = [
"GeForceGA.bundle",
# "GeForceGA.bundle",
"GeForceTesla.kext",
"GeForceTeslaGLDriver.bundle",
"GeForceTeslaVADriver.bundle",
@@ -245,3 +270,18 @@ AddGeneralAccelMojave = [
"IOAcceleratorFamily2.kext",
"IOGraphicsFamily.kext",
]
BackupLocations = [
"System/Library/Extensions",
"System/Library/Frameworks/CoreDisplay.framework",
"System/Library/Frameworks/IOSurface.framework",
"System/Library/Frameworks/OpenGL.framework",
"System/Library/Frameworks/WebKit.framework",
"System/Library/LaunchDaemons",
"System/Library/PrivateFrameworks/DisplayServices.framework",
"System/Library/PrivateFrameworks/GPUSupport.framework",
"System/Library/PrivateFrameworks/SkyLight.framework",
"System/Library/PrivateFrameworks/IOAccelerator.framework",
"System/Library/PrivateFrameworks/AppleGVA.framework",
"System/Library/PrivateFrameworks/AppleGVACore.framework",
]

View File

@@ -134,7 +134,6 @@ module.exports = {
'TERMS',
'HOW',
'PATCHEXPLAIN',
'CLI',
]
},

View File

@@ -7,13 +7,34 @@
* [Photos and Maps Apps Heavily Distorted](#photos-and-maps-apps-heavily-distorted)
* [Cannot press "Done" when editing a Sidebar Widget](#cannot-press-done-when-editing-a-sidebar-widget)
* [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 achieve GPU Acceleration on 2011 15" and 17" MacBook Pros](#unable-to-achieve-gpu-acceleration-on-2011-15-and-17-macbook-pros)
* [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:
* AMD/ATI TeraScale 2 - HD5/6000 series
* Intel 3rd and 4th Gen - GMA series
For those unfamiliar with what is considered a non-Metal GPU, see below chart:
::: details macOS GPU Chart
| Graphics Vendor | Architecture | Series | Supports Metal |
| :--- | :--- | :--- | :--- |
| ATI | TeraScale 1 | HD2000 - HD4000 | <span style="color:red">No</span> |
| ^^ | TeraScale 2 | HD5000 - HD6000 | ^^ |
| AMD | GCN (and newer) | HD7000+ | <span style="color:green">Yes</span> |
| Nvidia | Tesla | 8000GT - GT300 | <span style="color:red">No</span> |
| ^^ | Fermi | GT400 - GT500 | ^^ |
| ^^ | Kepler | GT600 - GT700 | <span style="color:green">Yes</span> |
| Intel | GMA | GMA900 - GMA3000 | <span style="color:red">No</span> |
| ^^ | Iron Lake | HD series | ^^ |
| ^^ | Sandy Bridge | HD3000 | ^^ |
| ^^ | Ivy Bridge (and newer) | HD4000 | <span style="color:green">Yes</span> |
:::
## 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.
@@ -30,6 +51,10 @@ Currently Zoom relies partially on Metal and so needs a small binary patch. Dosd
## Unable to grant special permissions to apps (ie. Camera Access to Zoom)
With version 0.2.5, this issue should be full resolved
::: details 0.2.4 and older Work-Around
Due to the usage of `amfi_get_out_of_my_way=1`, macOS will fail to prompt users for special permissions upon application start as well as omit the entires in System Preferences. To work around this, we recommend users install [tccplus](https://github.com/jslegendre/tccplus) to manage permissions.
Example usage with Discord and microphone permissions:
@@ -53,6 +78,8 @@ $ sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or RE
$ sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access VALUES('kTCCServiceCamera','us.zoom.xos',0,2,0,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);"
```
:::
## Keyboard Backlight broken
Due to forcing `hidd` into spinning up with the fallback mode enabled, this can break the OS's recognition of backlight keyboards. Thankfully the drivers themselves still do operate so applications such as [LabTick](https://www.macupdate.com/app/mac/22151/lab-tick) are able to set the brightness manually.
@@ -65,17 +92,21 @@ Due to the Metal Backend, the enhanced color output of these apps seems to heavi
To work around this, simply press Tab to hover over and press spacebar to simulate a click.
Note: This work-around doesn't seem to work in macOS 11.3 and newer
## Wake from sleep heavily distorted on AMD/ATI in macOS 11.3 and newer
Unfortunately a very well known issue the community is investigating, current known solution is to simply downgrade to 11.2.3 or older until a proper fix can be found.
Unfortunately a very well known issue the community is investigating, current known solution is to simply downgrade to 11.2.3 or older until a proper fix can be found. Additionally logging out and logging in can resolve the issue without requiring a reboot
* Note, this issue should be exclusive to TeraScale 1 GPUs (ie. HD2000-4000). TeraScale 2 GPUs should not exhibit this issue
In the event Apple removes 11.2.3 from their catalogue, we've provided a mirror below:
* [Install macOS 11.2.3 20D91](https://archive.org/details/install-mac-os-11.2.3-20-d-91)
## Unable to achieve GPU Acceleration on 2011 15" and 17" MacBook Pros
## Unable to switch GPUs on 2011 15" and 17" MacBook Pros
Currently OpenCore Legacy Patcher doesn't have support for the TeraScale 2 series dGPUs found in the 15" and 17" models. Currently the best way to achieve graphics acceleration is to simply disable the dGPU and force the iGPU always.
Currently OpenCore Legacy Patcher, GPU switching between the iGPU and dGPU is broken. The simplest way to set a specific GPU is to disable the dGPU when you wish to remain on the more power efficient iGPU.
The best way to achieve this is to boot Recovery (or Single User Mode if the dGPU refuses to function at all) and run the following command:
@@ -83,4 +114,42 @@ The best way to achieve this is to boot Recovery (or Single User Mode if the dGP
nvram FA4CE28D-B62F-4C99-9CC3-6815686E30F9:gpu-power-prefs=%01%00%00%00
```
This will disable the dGPU and allow graphics acceleration in Big Sur. Note that external display outputs are directly routed to the dGPU and therefore can no longer be used. Solutions such as a [DisplayLink Adapters](https://www.displaylink.com/products/usb-adapters) can work around this limitation in theory. However, currently the proprietary DisplayLink driver refuses to function on legacy-patched systems, either resulting in a windowserver crash loop or no output at all.
This will disable the dGPU and allow the iGPU to function in Big Sur. Note that external display outputs are directly routed to the dGPU and therefore can no longer be used. Solutions such as a [DisplayLink Adapters](https://www.displaylink.com/products/usb-adapters) can work around this limitation in theory. However, currently the proprietary DisplayLink driver refuses to function on legacy-patched systems, either resulting in a windowserver crash loop or no output at all.
## Erratic Colours on ATI TeraScale 2 GPUs (HD5000/HD6000)
Due to an odd bug with ATI's TeraScale 2 GPUs, many users will experience erratic/strobing colours once finished installing and rebooting into the accelerated patches. The issue stems from an incorrect assumption in the GPU drivers where it will enforce the Billion Colour space on your display. To fix, simply force your Display into a lower color depth such as a Million Colours.
Applications that can set color depth are:
* [SwitchResX](https://www.madrau.com)
* [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">Supported on Metal GPUs</span> | <span style="color:red">Not supported</span> |
| FileVault | <span style="color:#30BCD5">Fully supported on all machines</span> | <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

@@ -1,41 +0,0 @@
# Command Line Args
With OpenCore Legacy Patcher, we include an extra binary called [OCLP-CLI](https://github.com/dortania/OpenCore-Legacy-Patcher/releases/). The purpose of this binary is to easily run our OpenCore build process for other programs to hook onto. Below is documentation on currently supported arguments.
### Build Arguments
* **--build**: Build OpenCore
* **--model xxxx**: override default model detection
* ex. **--model iMac11,2**
* **--metal_gpu xxxx**: override default GPU detection (ie. Nvidia, AMD)
* **--metal_gpu Nvidia**
* **--smbios_spoof xxxx**: set spoofing mode, defaults to Minimal if no arg provided (ie. Minimal, Moderate, Advanced)
* ex. **--smbios_spoof Moderate**
* **--verbose**: enable verbose booting
* **--debug_oc**: enable debug OpenCore
* **--debug_kext**: enable debug kexts
* **--skip_wifi**: skip wifi patch
* **--hide_picker**: hide OpenCore's picker
* **--disable_sip**: disables SIP
* **--disable_smb**: disables SecureBootModel
* **--vault**: enable OpenCore vaulting
Example usage:
```bash
./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2
```
Note, when building OpenCore the output folder will be next to the OCLP binary as OpenCore-RELEASE or OpenCore-DEBUG folder.
### Patch System Arguments
* **--patch_sys_vol**: patches root volume with detected hardware
Example usage:
```bash
sudo ./OCLP-CLI --patch_sys_vol
```
Note, root volume patching needs to be run as sudo

View File

@@ -12,7 +12,7 @@ This doc is centered around downloading and writing the macOS installer to a USB
The simplest way to download macOS installs would be to use installinstallmacos:
```sh
[ ! -d ~/macOS-installer/ ] && mkdir ~/macOS-installer; cd ~/macOS-installer; [ ! -f ~/macOS-installer/installinstallmacos.py ] && curl -O https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py; sudo python installinstallmacos.py
[ ! -d ~/macOS-installer/ ] && mkdir ~/macOS-installer; cd ~/macOS-installer; [ ! -f ~/macOS-installer/installinstallmacos.py ] && curl -O https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py ; sudo python installinstallmacos.py
```
* Note: On El Capitan (10.11) and older, you'll need to specify a catalog at the end of the command:

View File

@@ -16,6 +16,8 @@ This patcher is made of multiple external applications from different people and
* All rights reserved to respective authors
* [AAAMouSSE](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/) - Syncretic
* [telemetrap](https://forums.macrumors.com/threads/mp3-1-others-sse-4-2-emulation-to-enable-amd-metal-driver.2206682/post-28447707) - Syncretic
* [SurPlus](https://github.com/reenigneorcim/SurPlus) - Syncretic
* [VMM Patch Set](https://github.com/dortania/OpenCore-Legacy-Patcher/blob/4a8f61a01da72b38a4b2250386cc4b497a31a839/payloads/Config/config.plist#L1222-L1281) - parrotgeek1
* Apple Binaries - Apple Inc.
Remaining files within OpenCore Legacy Patcher are copyrighted 2020-2021 Mykola Grymalyuk & Dhinak G. For integration into other projects, please request written permission.

View File

@@ -20,8 +20,11 @@ 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.
* Recommend looking at the [macOS Monterey Support page](./MONTEREY-DROP.md) for a better idea of Monterey's current status
### MacBook
@@ -35,6 +38,7 @@ Regarding OS support, see below:
| 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 |
| 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> |
### MacBook Air
@@ -48,6 +52,8 @@ Regarding OS support, see below:
| MacBookAir4,2 | ^^ | ^^ | ^^ |
| MacBookAir5,1 | Mid-2012 |^^ | <span style="color:green"> Everything is supported</span> |
| MacBookAir5,2 | ^^ | ^^ | ^^ |
| MacBookAir6,1 | Mid-2013, Early 2014 | ^^ | ^^ |
| MacBookAir6,2 | ^^ | ^^ | ^^ |
### MacBook Pro
@@ -74,6 +80,9 @@ Regarding OS support, see below:
| MacBookPro9,2 | ^^ | ^^ | ^^ |
| MacBookPro10,1 | Mid-2012, Early 2013 | ^^ | ^^ |
| MacBookPro10,2 | Late 2012, Early 2013 | ^^ | ^^ |
| MacBookPro11,1 | Late 2013, Mid-2014 | ^^ | ^^ |
| MacBookPro11,2 | ^^ | ^^ | ^^ |
| MacBookPro11,3 | ^^ | ^^ | ^^ |
### Mac mini
@@ -113,6 +122,8 @@ Regarding OS support, see below:
| iMac14,1 | Late 2013 | ^^ | ^^ |
| iMac14,2 | ^^ | ^^ | ^^ |
| iMac14,3 | ^^ | ^^ | ^^ |
| iMac14,4 | Mid-2014 | ^^ | ^^ |
| iMac15,1 | Late 2014, Mid-2015 | ^^ | [Display will output to 4k instead of 5k](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/359) |
* For iMac10,1 through iMac12,x, we highly recommend users upgrade the GPU to a Metal supported model. See here for more information: [iMac late 2009 to mid-2011 Graphics Card Upgrade Guide](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/?post=17425857#post-17425857)

View File

@@ -1,60 +1,57 @@
# macOS Monterey Support
With OpenCore Legacy Patcher v0.1.7 and newer, we've implemented beta macOS Monterey support for users. Please note that Apple has dropped a lot of hardware with this release as well as broken many of our previous patch sets. This page will be used to inform users regarding current issues and will be updated as new patch sets are developed and added to our patcher.
## Newly dropped hardware
Current models with full, unhindered support in OpenCore Legacy Patcher are the following:
With Monterey, Apple continues their their somewhat ruthless march of dropping Intel hardware. This release saw the removal, and thus addition into OpenCore Legacy Patcher, of the following models:
* iMac13,x and newer
* iMac10,1-12,x included if Wireless Card and Bluetooth upgraded as well as Metal GPU
* Macmini7,1 and newer
* MacBook8,1 and newer
* MacBookAir6,x and newer
* MacBookPro11,x and newer
* MacPro3,1 and newer
* Requires Wireless Card and Bluetooth upgrade for 3,1-5,1 as well as Metal GPU
* iMac14,4
* iMac15,1
* MacBook8,1
* MacBookAir6,1
* MacBookAir6,2
* MacBookPro11,1
* MacBookPro11,2
* MacBookPro11,3
## Current Hardware Drawbacks:
All of these models now have support in OpenCore Legacy Patcher. Note iMac15,1 does have [an unfortunate firmware bug preventing resolutions above 4k](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/359) with OpenCore Legacy Patcher
Below is a list of hardware that currently has issues with Monterey:
## Previously Broken Hardware
* [Acceleration Support Dropped](#acceleration-support-dropped)
* [Metal GPUs](#metal-gpus)
* [Non-Metal GPUs](#non-metal-gpus)
* [Bluetooth Support Dropped](#bluetooth-support-dropped)
* [Wireless Support Dropped](#wireless-support-dropped)
::: details macOS 12.0 Beta 4 issue on 2012 to early 2013 machines (Resolved in 0.2.5 and newer)
## Acceleration Support Dropped
Currently in macOS 12.0 Beta 4, many Ivy Bridge Macs have experienced Bluetooth issues relating to their BCM20702 chipset. Currently the exact issue is unknown however is assumed to be a bug on Apple's end. Recommend downgrading to macOS 12.0 Beta 3 till resolved:
### Metal GPUs
* [12.0 Beta 3 (21A5284e) InstallAssistant (Direct)](http://swcdn.apple.com/content/downloads/02/08/071-63739-A_G5RYVW5JHT/dfz5gp3s0jm9vl7m30oewq141zkpv8edr8/InstallAssistant.pkg)
* [12.0 Beta 3 (21A5284e) InstallAssistant (archive.org)](https://archive.org/details/12.0-21a5284e-beta-3)
* Intel HD4000 iGPUs lost support
* Re-introduced with OpenCore Legacy Patcher v0.1.7
A temporary fix is to restart the BlueTool and bluetoothd process with each boot, note it may not work for all users:
By default these machines require root volume patches to gain graphics acceleration in Monterey. OpenCore Legacy Patcher supports readding support however SIP and FileVault can no longer be enabled due to root patching:
```sh
sudo killall -9 BlueTool bluetoothd
```
* Macmini6,x
* MacBookAir5,x
* MacBookPro9,x
* MacBookPro10,x
:::
### Non-Metal GPUs
::: details Wireless Support Dropped (Resolved in 0.2.5 and newer)
* Non-Metal GPUs no longer have working acceleration patches:
* Intel Ironlake and Sandy Bridge iGPUs
* Nvidia Tesla and Fermi GPUs
* AMD TeraScale 1 and 2 GPUs
* Broadcom BCM94328, BCM94322 and Atheros Wireless Chipsets lost support
The following machines cannot gain graphics acceleration at all in Monterey, only basic framebuffer and brightness control (iMac8,1/9,1 and MacBook5,2 excluded):
The following models lost Bluetooth support in macOS Monterey due to their legacy Wireless chipset:
* iMac12,x and older
* Macmini5,x and older
* MacBook7,1 and older
* MacBookAir4,x and older
* MacBookPro8,x and older
* Macmini3,1 and older
* MacBook5,x and older
* MacBookAir2,1 and older
* MacBookPro7,1 and older
* MacPro5,1 and older
Note: iMac10,1 through iMac12,x can be upgraded with Metal GPUs, [see here for more info](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/)
Note: BCM943224, BCM94331, BCM94360 and BCM943602 are still fully support by OpenCore Legacy Patcher
## Bluetooth Support Dropped
:::
::: details Bluetooth Support Dropped (Resolved in 0.2.5 and newer)
* BRCM2046 and BRCM2070 Bluetooth Chipsets lost support
@@ -67,6 +64,8 @@ The following models lost Bluetooth support in macOS Monterey due to their legac
* MacBookPro8,1 and older
* MacPro5,1 and older
Note: Native BRCM20702 and BRCM20703 are still fully support by OpenCore Legacy Patcher
::: details Dropped Firmwares
Here are the firmwares macOS Monterey Dropped (previously located within IOBluetoothUSBDFU.kext):
@@ -90,19 +89,34 @@ Here are the firmwares macOS Monterey Dropped (previously located within IOBluet
:::
Note: Native BRCM20702 and BRCM20703 are still fully support by OpenCore Legacy Patcher
::: details Ivy Bridge iGPU Acceleration (Resolved in 0.1.7 and newer)
## Wireless Support Dropped
* Intel HD4000 iGPUs lost support
* Broadcom BCM94328, BCM94322 and Atheros Wireless Chipsets 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:
The following models lost Bluetooth support in macOS Monterey due to their legacy Wireless chipset:
* Macmini6,x
* MacBookAir5,x
* MacBookPro9,x
* MacBookPro10,x
:::
::: details Non-Metal Acceleration (Resolved in 0.2.5 and newer)
* Non-Metal GPUs no longer have working acceleration patches:
* Intel Ironlake and Sandy Bridge iGPUs
* Nvidia Tesla and Fermi GPUs
* AMD TeraScale 1 and 2 GPUs
The following machines cannot gain graphics acceleration at all in Monterey, only basic framebuffer and brightness control (iMac8,1/9,1 and MacBook5,2 excluded):
* iMac12,x and older
* Macmini3,1 and older
* MacBook5,x and older
* MacBookAir2,1 and older
* MacBookPro7,1 and older
* MacPro5,1 and older
* Macmini5,x and older
* MacBook7,1 and older
* MacBookAir4,x and older
* MacBookPro8,x and older
Note: BCM943224, BCM94331, BCM94360 and BCM943602 are still fully support by OpenCore Legacy Patcher
Note: iMac10,1 through iMac12,x can be upgraded with Metal GPUs, [see here for more info](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/)
:::

View File

@@ -19,7 +19,7 @@ Below is a run down of the main logic OpenCore Legacy Patcher uses to gain nativ
* EHCx and XHC1 Patches
* Reason: Required for proper USB operation
* Logic: Avoids USB maps of newer models attaching and breaking USB port functionality
* Models: All models require
* Models: All models require when spoofing with Moderate or Advanced SMBIOS
### Booter -> Quirks
@@ -53,11 +53,11 @@ Below is a run down of the main logic OpenCore Legacy Patcher uses to gain nativ
* SMC Patch
* Reason: Required to avoid SMC Firmware updates
* Logic: Patches out `smc-version` in AppleSMC.kext, requires SMC-Spoof.kext for full functionality
* Models: All models require
* Models: All models require when spoofing SMBIOS
* IOHIDFamily Patch
* Reason: Required for HID peripheral support in macOS on older hardware
* Logic: Tricks IOHIDFamily into thinking it's always booting recovery
* Models: [2010 and older](https://github.com/dortania/OpenCore-Legacy-Patcher/blob/79ab028b0a039e97a528e0b99c876d95d9c2d41d/Resources/ModelArray.py#L310-L332)
* Models: Penryn CPUs (Core2 series)
### Kernel -> Quirks
@@ -196,15 +196,13 @@ Below is an explanation of what Kexts OpenCore Legacy Patcher will inject into m
Unfortunately certain on-disk patches are required to achieve full functionality. Below is a breakdown of patches supported
Note, GPU Acceleration Patches are not public yet, the below section is simply documentation for easier research with new aids.
::: details Audio Patches
### Extensions
* AppleHDA
* Reason: Re-add High Sierra's AppleHDA to achieve audio support
* Models: 2011 and older Macs (excluding MacPro4,1+)
* Reason: Re-add El Capitan's AppleHDA to achieve audio support
* Models: iMac7,1 and iMac8,1
:::

BIN
docs/ResXtreme.zip Normal file

Binary file not shown.

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

View File

@@ -10,6 +10,7 @@ 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)
## Stuck on `This version of Mac OS X is not supported on this platform`
@@ -68,3 +69,9 @@ 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.

View File

@@ -2,9 +2,9 @@
# Copyright (C) 2021 Mykola Grymalyuk
import plistlib
from pathlib import Path
from Resources import Constants
from resources import constants
app_path = Path.cwd() / Path ("OpenCore Patcher.app/Contents/Info.plist")
info = plistlib.load(Path(app_path).open("rb"))
info["CFBundleShortVersionString"] = Constants.Constants().patcher_version
info["CFBundleShortVersionString"] = constants.Constants().patcher_version
plistlib.dump(info, Path(app_path).open("wb"), sort_keys=True)

BIN
payloads/ACPI/SSDT-DGPU.aml Normal file

Binary file not shown.

View File

@@ -0,0 +1,103 @@
/* Requests power off of dGPU in MacBookPro8,2/3 (TS2 hardware failure)
* Main goal is to ensure power draw from the dGPU is reduced as
* much as possible to simulate a hardware demux without actual
* hardware modifications.
*
* Notes:
* - SSDT must be used in conjuction with '_INI' to 'XINI' patch
* to reroute PCI0 initialization.
*
* - AMD drivers in macOS may still attempt to attach and kernel
* panic. Disable the dGPU with class-code/device-id spoof or
* with '-wegnoegpu'.
*
* - dGPU will reactivate with sleep-wake, additional process
* is needed to disable the dGPU.
* - ie. AMDGPUWakeHandler.kext for macOS
*
* Ref:
* - https://www.tonymacx86.com/threads/help-macbook-pro-disable-radeon-gpu-via-dsdt.164458/
* - https://github.com/blackgate/AMDGPUWakeHandler
* - https://help.ubuntu.com/community/MacBookPro8-2/Raring
*/
DefinitionBlock ("", "SSDT", 2, "DRTNIA", "dGPU_OFF", 0x00001000)
{
External (_SB_.PCI0, DeviceObj)
External (OSYS)
Scope (_SB.PCI0)
{
OperationRegion (IOGP, SystemIO, 0x0700, 0x51)
Field (IOGP, ByteAcc, NoLock, Preserve)
{
Offset (0x10),
P710, 8,
Offset (0x28),
P728, 8,
Offset (0x40),
P740, 8,
Offset (0x50),
P750, 8
}
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
Store (0x07D0, OSYS)
If (CondRefOf (\_OSI, Local0))
{
If (_OSI ("Darwin"))
{
Store (0x2710, OSYS)
}
If (\_OSI ("Linux"))
{
Store (0x03E8, OSYS)
}
If (\_OSI ("Windows 2001"))
{
Store (0x07D1, OSYS)
}
If (\_OSI ("Windows 2001 SP1"))
{
Store (0x07D1, OSYS)
}
If (\_OSI ("Windows 2001 SP2"))
{
Store (0x07D2, OSYS)
}
If (\_OSI ("Windows 2006"))
{
Store (0x07D6, OSYS)
}
If (\_OSI ("Windows 2007"))
{
Store (0x07D7, OSYS)
}
If (\_OSI ("Windows 2008"))
{
Store (0x07D8, OSYS)
}
If (\_OSI ("Windows 2009"))
{
Store (0x07D9, OSYS)
}
}
// Disables dGPU
Store ("Requesting dGPU power off", Debug)
P728 = One // Switch select
P710 = 0x02 // Switch display
P740 = 0x02 // Switch DDC
P750 = Zero // Power down discrete graphics
}
}
}

View File

@@ -31,6 +31,14 @@
<key>Path</key>
<string>SSDT-PCI.aml</string>
</dict>
<dict>
<key>Enabled</key>
<false/>
<key>Comment</key>
<string>Requests power off of dGPU for Sandy Bridge MacBook Pros</string>
<key>Path</key>
<string>SSDT-DGPU.aml</string>
</dict>
</array>
<key>Delete</key>
<array/>
@@ -156,6 +164,36 @@
<key>TableSignature</key>
<data>RFNEVA==</data>
</dict>
<dict>
<key>Base</key>
<string>\_SB.PCI0</string>
<key>BaseSkip</key>
<integer>0</integer>
<key>Comment</key>
<string>_INI to XINI</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>X0lOSQ==</data>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>OemTableId</key>
<data></data>
<key>Replace</key>
<data>WElOSQ==</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
<key>TableLength</key>
<integer>0</integer>
<key>TableSignature</key>
<data>RFNEVA==</data>
</dict>
</array>
<key>Quirks</key>
<dict>
@@ -234,7 +272,7 @@
<array>
<dict>
<key>Arch</key>
<string>x86_64</string>
<string>Any</string>
<key>Comment</key>
<string>Patching Engine</string>
<key>Enabled</key>
@@ -242,7 +280,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>10.0.0</string>
<string>8.0.0</string>
<key>BundlePath</key>
<string>Lilu.kext</string>
<key>ExecutablePath</key>
@@ -350,7 +388,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.0.0</string>
<string>12.0.0</string>
<key>BundlePath</key>
<string>AirportBrcmFixup.kext</string>
<key>ExecutablePath</key>
@@ -420,7 +458,7 @@
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>16.0.0</string>
<key>BundlePath</key>
@@ -438,7 +476,7 @@
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>16.0.0</string>
<key>BundlePath</key>
@@ -456,7 +494,7 @@
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>16.0.0</string>
<key>BundlePath</key>
@@ -470,33 +508,15 @@
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Atheros Wifi Patch</string>
<string>Monterey Atheros Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>18.0.0</string>
<key>BundlePath</key>
<string>IO80211HighSierra.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/IO80211HighSierra</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Atheros Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<key>MinKernel</key>
<string>18.0.0</string>
<key>BundlePath</key>
<string>IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext</string>
<string>IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/AirPortAtheros40</string>
<key>PlistPath</key>
@@ -506,33 +526,15 @@
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Broadcom Wifi Patch</string>
<string>Monterey BCM94322 Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<string></string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>BundlePath</key>
<string>IO80211Mojave.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/IO80211Mojave</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Broadcom Wifi Patch</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string>20.99.99</string>
<key>MinKernel</key>
<string>19.0.0</string>
<key>BundlePath</key>
<string>IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext</string>
<string>IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/AirPortBrcm4331</string>
<key>PlistPath</key>
@@ -646,6 +648,42 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Disable EFI Checks</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>BundlePath</key>
<string>EFICheckDisabler.kext</string>
<key>ExecutablePath</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Bluetooth Patch for BRCM2046 and BRCM2070</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>21.0.0</string>
<key>BundlePath</key>
<string>Bluetooth-Spoof.kext</string>
<key>ExecutablePath</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
@@ -934,6 +972,96 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>AppleUSBTrackpad.kext</string>
<key>Comment</key>
<string>Fix legacy MacBook Trackpad</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/AppleUSBTrackpad</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>16.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>BlueToolFixup.kext</string>
<key>Comment</key>
<string>Fix Monterey Bluetooth</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/BlueToolFixup</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>21.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>CSLVFixup.kext</string>
<key>Comment</key>
<string>Fix Music</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/CSLVFixup</string>
<key>MaxKernel</key>
<string>20.99.99</string>
<key>MinKernel</key>
<string>20.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>SimpleMSR.kext</string>
<key>Comment</key>
<string>Disable firmware based battery throttling</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/SimpleMSR</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>AMDGPUWakeHandler.kext</string>
<key>Comment</key>
<string>Force disable dGPU on wake</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/AMDGPUWakeHandler</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array>
<key>Block</key>
<array/>
@@ -1014,6 +1142,126 @@
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string>_apfs_filevault_allowed</string>
<key>Comment</key>
<string>Force FileVault on Broken Seal</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data></data>
<key>Identifier</key>
<string>com.apple.filesystems.apfs</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>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string>_cs_require_lv</string>
<key>Comment</key>
<string>Disable Library Validation Enforcement</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.0.0</string>
<key>Replace</key>
<data>uAAAAADD</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>_early_random</string>
<key>Comment</key>
<string>SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AHQjSIs=</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>800</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>21.1.0</string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>AOsjSIs=</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>_register_and_init_prng</string>
<key>Comment</key>
<string>SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>ukgBAAAx9g==</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>256</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string>21.1.0</string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>ukgBAADrBQ==</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
<key>Quirks</key>
<dict>
@@ -1065,7 +1313,7 @@
<key>FuzzyMatch</key>
<true/>
<key>KernelArch</key>
<string>x86_64</string>
<string>Auto</string>
<key>KernelCache</key>
<string>Auto</string>
</dict>
@@ -1073,8 +1321,7 @@
<key>Misc</key>
<dict>
<key>BlessOverride</key>
<array>
</array>
<array/>
<key>Boot</key>
<dict>
<key>ConsoleAttributes</key>
@@ -1215,11 +1462,13 @@
<dict>
<key>OCLP-Version</key>
<string></string>
<key>OCLP-Settings</key>
<string></string>
</dict>
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
<dict>
<key>boot-args</key>
<string>keepsyms=1 debug=0x100 -lilubetaall</string>
<string>keepsyms=1 debug=0x100</string>
<key>csr-active-config</key>
<data>AAAAAA==</data>
</dict>
@@ -1235,12 +1484,14 @@
<key>4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102</key>
<array>
<string>OCLP-Version</string>
<string>OCLP-Settings</string>
<string>revcpu</string>
<string>revcpuname</string>
</array>
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
<array>
<string>boot-args</string>
<string>csr-active-config</string>
</array>
<key>FA4CE28D-B62F-4C99-9CC3-6815686E30F9</key>
<array/>
@@ -1294,7 +1545,7 @@
<key>Generic</key>
<dict>
<key>AdviseFeatures</key>
<false/>
<true/>
<key>SystemMemoryStatus</key>
<string>Auto</string>
<key>MaxBIOSVersion</key>
@@ -1314,242 +1565,6 @@
<key>SystemUUID</key>
<string></string>
</dict>
<key>Memory</key>
<dict>
<key>DataWidth</key>
<integer>64</integer>
<key>ErrorCorrection</key>
<integer>3</integer>
<key>FormFactor</key>
<integer>9</integer>
<key>MaxCapacity</key>
<integer>137438953472</integer>
<key>TotalWidth</key>
<integer>64</integer>
<key>Type</key>
<integer>26</integer>
<key>TypeDetail</key>
<integer>128</integer>
<key>Devices</key>
<array>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 1</string>
<key>Manufacturer</key>
<string>Acidanthera\GoldenGate</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA000000001</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 2</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 3</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA000000002</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 4</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 5</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA000000002</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 6</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 7</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA000000001</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 8</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 9</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 10</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 11</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
<dict>
<key>AssetTag</key>
<string></string>
<key>BankLocator</key>
<string></string>
<key>DeviceLocator</key>
<string>Slot 12</string>
<key>Manufacturer</key>
<string>Acidanthera</string>
<key>PartNumber</key>
<string>M00001-4GB</string>
<key>SerialNumber</key>
<string>AAA00000000X</string>
<key>Size</key>
<integer>131072</integer>
<key>Speed</key>
<integer>5733</integer>
</dict>
</array>
</dict>
<key>PlatformNVRAM</key>
<dict>
<key>BID</key>
@@ -1648,9 +1663,9 @@
<key>JumpstartHotPlug</key>
<false/>
<key>MinDate</key>
<integer>0</integer>
<integer>20180621</integer>
<key>MinVersion</key>
<integer>0</integer>
<integer>748077008000000</integer>
</dict>
<key>AppleInput</key>
<dict>
@@ -1662,6 +1677,8 @@
<integer>0</integer>
<key>KeySubsequentDelay</key>
<integer>5</integer>
<key>GraphicsInputMirroring</key>
<false/>
<key>PointerSpeedDiv</key>
<integer>1</integer>
<key>PointerSpeedMul</key>
@@ -1691,7 +1708,56 @@
<key>ConnectDrivers</key>
<true/>
<key>Drivers</key>
<array/>
<array>
<dict>
<key>Path</key>
<string>OpenRuntime.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
<dict>
<key>Path</key>
<string>OpenCanopy.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
<dict>
<key>Path</key>
<string>NvmExpressDxe.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
<dict>
<key>Path</key>
<string>ExFatDxeLegacy.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
<dict>
<key>Path</key>
<string>XhciDxe.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
<dict>
<key>Path</key>
<string>OpenLinuxBoot.efi</string>
<key>Enabled</key>
<false/>
<key>Arguments</key>
<string></string>
</dict>
</array>
<key>Input</key>
<dict>
<key>KeyFiltering</key>
@@ -1789,6 +1855,8 @@
<false/>
<key>ExitBootServicesDelay</key>
<integer>0</integer>
<key>ForceOcWriteFlash</key>
<false/>
<key>ForgeUefiSupport</key>
<false/>
<key>IgnoreInvalidFlexRatio</key>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,56 @@
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.

View File

@@ -0,0 +1 @@
Based off RestrictEvents.kext, stripped binary to block Apple's EFICheck driver

Binary file not shown.

View File

@@ -1,21 +1,12 @@
From 772e02b375b5b2186342965f3089d9d1bca053bf Mon Sep 17 00:00:00 2001
From: Dhinak G <17605561+dhinakg@users.noreply.github.com>
Date: Tue, 23 Mar 2021 17:21:48 -0400
Subject: [PATCH] Disable displaypolicyd
---
RestrictEvents/RestrictEvents.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/RestrictEvents/RestrictEvents.cpp b/RestrictEvents/RestrictEvents.cpp
index 69b6af8..029417c 100644
index 27562f0..66365a3 100644
--- a/RestrictEvents/RestrictEvents.cpp
+++ b/RestrictEvents/RestrictEvents.cpp
@@ -35,6 +35,7 @@ struct RestrictEventsPolicy {
@@ -61,6 +61,7 @@ struct RestrictEventsPolicy {
static const char *procBlacklist[] {
"/System/Library/CoreServices/ExpansionSlotNotification",
"/System/Library/CoreServices/MemorySlotNotification",
"/usr/libexec/firmwarecheckers/eficheck/eficheck",
+ "/usr/libexec/displaypolicyd"
+ "/usr/libexec/displaypolicyd",
};
char pathbuf[MAXPATHLEN];
char pathbuf[MAXPATHLEN];

Binary file not shown.

Binary file not shown.

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

@@ -764,7 +764,7 @@
<key>model</key>
<string>XXerve3,1</string>
</dict>
<key>#iMac7,1</key>
<key>iMac7,1</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
@@ -3527,14 +3527,14 @@
<key>Tunnel Endpoint Device Vendor ID</key>
<data>AQAAAA==</data>
</dict>
<key>#iMac7,1-EHC1</key>
<key>iMac7,1-EHC1</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
<key>IOClass</key>
<string>AppleUSBHostMergeProperties</string>
<key>IONameMatch</key>
<string>EH01</string>
<string>EHC1</string>
<key>IOProviderClass</key>
<string>AppleUSBEHCIPCI</string>
<key>IOProviderMergeProperties</key>
@@ -3590,14 +3590,14 @@
<key>model</key>
<string>iXac7,1</string>
</dict>
<key>#iMac7,1-EHC2</key>
<key>iMac7,1-EHC2</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
<key>IOClass</key>
<string>AppleUSBHostMergeProperties</string>
<key>IONameMatch</key>
<string>EH02</string>
<string>EHC2</string>
<key>IOProviderClass</key>
<string>AppleUSBEHCIPCI</string>
<key>IOProviderMergeProperties</key>
@@ -5461,7 +5461,7 @@
<key>model</key>
<string>Xacmini4,1</string>
</dict>
<key>#iMac7,1-OHC1</key>
<key>iMac7,1-OHC1</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
@@ -5501,9 +5501,9 @@
</dict>
</dict>
<key>model</key>
<string>iXac9,1</string>
<string>iXac7,1</string>
</dict>
<key>#iMac7,1-OHC2</key>
<key>iMac7,1-OHC2</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleUSBHostMergeProperties</string>
@@ -5543,7 +5543,7 @@
</dict>
</dict>
<key>model</key>
<string>iXac9,1</string>
<string>iXac7,1</string>
</dict>
<key>iMac8,1-OHC1</key>
<dict>

Binary file not shown.

Binary file not shown.

View File

@@ -5,12 +5,10 @@
# - Place the X64 folder in the /payloads/OpenCore folder
# - Rename to OpenCore-VERSION (ie. DEBUG or RELEASE)
# - Run script
# - Rename folders to appropriate versions (ie. OpenCore-v0.6.8)
# - Rename folders to appropriate versions (ie. OpenCore-Build)
# - Zip folders
# TODO:
# - Import OC version from Constants.py
# - Download latest builds from dortania.github.io
# - Automatically rename and zip folders
from __future__ import print_function
import subprocess
@@ -69,7 +67,7 @@ for version in build_types:
else:
print(f"- Unable to find {delete_tools}, skipping")
print("Renaming folder to OpenCore-Build and zipping")
print("- Renaming folder to OpenCore-Build and zipping")
subprocess.run(f"mv ./OpenCore-{version} ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"zip -r ./OpenCore-{version}.zip ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"rm -rf ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"rm -rf ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()

Binary file not shown.

107
resources/arguments.py Normal file
View File

@@ -0,0 +1,107 @@
import sys
from resources import defaults, build, utilities, validation, sys_patch
from data import model_array
# Generic building args
class arguments:
def __init__(self):
self.args = utilities.check_cli_args()
def parse_arguments(self, settings):
if self.args.model:
if self.args.model:
print(f"- Using custom model: {self.args.model}")
settings.custom_model = self.args.model
defaults.generate_defaults.probe(settings.custom_model, False, settings)
elif settings.computer.real_model not in model_array.SupportedSMBIOS and settings.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
)
sys.exit(1)
else:
print(f"- Using detected model: {settings.computer.real_model}")
defaults.generate_defaults.probe(settings.custom_model, True, settings)
if self.args.disk:
print(f"- Install Disk set: {self.args.disk}")
settings.disk = self.args.disk
if self.args.validate:
validation.validate(settings)
if self.args.verbose:
print("- Set verbose configuration")
settings.verbose_debug = True
else:
settings.verbose_debug = False # Override Defaults detected
if self.args.debug_oc:
print("- Set OpenCore DEBUG configuration")
settings.opencore_debug = True
settings.opencore_build = "DEBUG"
if self.args.debug_kext:
print("- Set kext DEBUG configuration")
settings.kext_debug = True
if self.args.hide_picker:
print("- Set HidePicker configuration")
settings.showpicker = False
if self.args.disable_sip:
print("- Set Disable SIP configuration")
settings.sip_status = False
else:
settings.sip_status = True # Override Defaults detected
if self.args.disable_smb:
print("- Set Disable SecureBootModel configuration")
settings.secure_status = False
else:
settings.secure_status = True # Override Defaults detected
if self.args.vault:
print("- Set Vault configuration")
settings.vault = True
if self.args.firewire:
print("- Set FireWire Boot configuration")
settings.firewire_boot = True
if self.args.nvme:
print("- Set NVMe Boot configuration")
settings.nvme_boot = True
# if self.args.disable_amfi:
# print("- Set Disable AMFI configuration")
# settings.amfi_status = False
if self.args.wlan:
print("- Set Wake on WLAN configuration")
settings.enable_wake_on_wlan = True
if self.args.disable_tb:
print("- Set Disable Thunderbolt configuration")
settings.disable_tb = True
if self.args.force_surplus:
print("- Forcing SurPlus override configuration")
settings.force_surplus = True
if self.args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
settings.serial_settings = "Moderate"
if self.args.smbios_spoof:
if self.args.smbios_spoof == "Minimal":
settings.serial_settings = "Minimal"
elif self.args.smbios_spoof == "Moderate":
settings.serial_settings = "Moderate"
elif self.args.smbios_spoof == "Advanced":
settings.serial_settings = "Advanced"
else:
print(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}")
if self.args.support_all:
print("- Building for natively supported model")
settings.allow_oc_everywhere = True
settings.serial_settings = "None"
# Avoid running the root patcher if we're just building
if self.args.build:
build.BuildOpenCore(settings.custom_model or settings.computer.real_model, settings).build_opencore()
elif self.args.patch_sys_vol:
if self.args.moj_cat_accel:
print("- Set Mojave/Catalina root patch configuration")
settings.moj_cat_accel = True
print("- Set System Volume patching")
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings).start_patch()
elif self.args.unpatch_sys_vol:
print("- Set System Volume unpatching")
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings).start_unpatch()

View File

@@ -14,7 +14,8 @@ import ast
from pathlib import Path
from datetime import date
from Resources import Constants, ModelArray, Utilities, device_probe
from resources import constants, utilities, device_probe, generate_smbios
from data import smbios_data, bluetooth_data, cpu_data, os_data, model_array
def rmtree_handler(func, path, exc_info):
@@ -27,57 +28,10 @@ class BuildOpenCore:
def __init__(self, model, versions):
self.model = model
self.config = None
self.constants: Constants.Constants = versions
self.constants: constants.Constants = versions
self.computer = self.constants.computer
self.gfx0_path = None
def smbios_set(self, model):
print("- Setting macOS Monterey Supported SMBIOS")
if model in ModelArray.MacBookAir_11:
return "MacBookAir7,1"
elif model in ModelArray.MacBookAir_13:
return "MacBookAir7,2"
elif model in ModelArray.MacBook_12:
return "MacBook9,1"
elif model in ModelArray.MacBookPro_13:
return "MacBookPro12,1"
elif model in ModelArray.MacBookPro_15_iGPU:
return "MacBookPro11,4"
elif model in ModelArray.MacBookPro_15_dGPU:
return "MacBookPro11,5"
elif model in ModelArray.Macmini:
return "Macmini7,1"
elif model in ModelArray.iMac_iGPUless:
return "iMacPro1,1"
elif model in ModelArray.iMac_dGPU:
# Check for upgraded GPUs on iMacs
if self.constants.drm_support is True:
return "iMacPro1,1"
else:
return "iMac17,1"
elif model in ModelArray.iMac_iGPU:
return "iMac16,1"
elif model in ModelArray.MacPro:
return "MacPro7,1"
else:
return model
def fw_feature_detect(self, model):
# Values based off OpenCorePkg's Firmwarefeatures and FirmwarefeaturesMask
# Additionally, APFS bit(19) flipped
# https://github.com/acidanthera/OpenCorePkg/blob/0.6.9/Include/Apple/IndustryStandard/AppleFeatures.h#L136
if model == "iMac7,1":
fw_feature = b"\x07\x14\x08\xc0\x00\x00\x00\x00"
fw_mask = b"\xff\x1f\x08\xc0\x00\x00\x00\x00"
elif model in ["MacPro4,1", "Xserve3,1"]:
fw_feature = b"7\xf5\t\xe0\x00\x00\x00\x00"
fw_mask = b"7\xff\x0b\xc0\x00\x00\x00\x00"
else:
fw_feature = b"\x03\x14\x08\xc0\x00\x00\x00\x00"
fw_mask = b"\xff\x3f\x08\xc0\x00\x00\x00\x00"
return fw_feature, fw_mask
def disk_type(self):
drive_host_info = plistlib.loads(subprocess.run(f"diskutil info -plist {self.constants.disk}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
sd_type = drive_host_info["MediaName"]
@@ -101,7 +55,7 @@ class BuildOpenCore:
shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder)
def build_efi(self):
Utilities.cls()
utilities.cls()
if not self.constants.custom_model:
print(f"Building Configuration on model: {self.model}")
else:
@@ -145,14 +99,19 @@ class BuildOpenCore:
# 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),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in ModelArray.MacPro),
("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),
# CPU patches
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: self.model in ModelArray.DualSocket),
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: self.model in ModelArray.SSEEmulator),
("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: self.model in ModelArray.MissingSSE42),
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: self.model.startswith("MacPro") or self.model.startswith("Xserve")),
("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",
self.constants.telemetrap_version,
self.constants.telemetrap_path,
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value,
),
(
"CPUFriend.kext",
self.constants.cpufriend_version,
@@ -160,30 +119,60 @@ class BuildOpenCore:
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,
),
# Ethernet patches
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: self.model in ModelArray.EthernetNvidia),
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: self.model in ModelArray.EthernetMarvell),
("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path, lambda: self.model in ModelArray.EthernetBroadcom),
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"),
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell"),
# Legacy audio
("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: self.model in ModelArray.LegacyAudio or self.model in ModelArray.MacPro),
(
"AppleALC.kext",
self.constants.applealc_version,
self.constants.applealc_path,
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 ModelArray.IDEPatch),
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in model_array.IDEPatch),
# Misc
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: self.model in ModelArray.SidecarPatch),
(
"FeatureUnlock.kext",
self.constants.featureunlock_version,
self.constants.featureunlock_path,
lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake.value,
),
("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path, lambda: self.constants.kext_debug is True),
("latebloom.kext", self.constants.latebloom_version, self.constants.latebloom_path, lambda: self.model in ModelArray.PCIRaceCondition),
("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path, lambda: self.model in ["MacBook4,1", "MacBook5,2"]),
]:
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.get_kext_by_bundle_path("latebloom.kext")["Enabled"] is True:
print(f"- Setting latebloom delay of {self.constants.latebloom_delay}ms, range {self.constants.latebloom_range}ms, debug {bool(self.constants.latebloom_debug)}")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"][
"boot-args"
] += f" latebloom={self.constants.latebloom_delay}, lb_range={self.constants.latebloom_range}, lb_debug={self.constants.latebloom_debug}"
# Ethernet Patch Sets
if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom":
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
# Required due to Big Sur's BCM5701 requiring VT-x support
# Applicable for pre-Ivy Bridge models
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in ModelArray.MacPro):
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:
# Ref: https://github.com/reenigneorcim/SurPlus
# Enable for all systems missing RDRAND support
print("- Adding SurPlus Patch for Race Condition")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["Enabled"] = True
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["Enabled"] = True
if self.constants.force_surplus is True:
# Syncretic forces SurPlus to only run on Beta 7 and older by default for saftey reasons
# If users desires, allow forcing in newer OSes
print("- Allowing SurPlus on all newer OSes")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in model_array.MacPro):
# Use Innie's same logic:
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
for i, controller in enumerate(self.computer.storage):
@@ -200,8 +189,8 @@ class BuildOpenCore:
if not self.constants.custom_model:
nvme_devices = [i for i in self.computer.storage if isinstance(i, device_probe.NVMeController)]
for i, controller in enumerate(nvme_devices):
print(f"- Found 3rd Party NVMe SSD ({i + 1}): {Utilities.friendly_hex(controller.vendor_id)}:{Utilities.friendly_hex(controller.device_id)}")
self.config["#Revision"][f"Hardware-NVMe-{i}"] = f"{Utilities.friendly_hex(controller.vendor_id)}:{Utilities.friendly_hex(controller.device_id)}"
print(f"- Found 3rd Party NVMe SSD ({i + 1}): {utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}")
self.config["#Revision"][f"Hardware-NVMe-{i}"] = f"{utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}"
# Disable Bit 0 (L0s), enable Bit 1 (L1)
nvme_aspm = (controller.aspm & (~0b11)) | 0b10
@@ -223,29 +212,32 @@ class BuildOpenCore:
def wifi_fake_id(self):
self.enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
# self.get_kext_by_bundle_path("AirportBrcmFixup.kext/Contents/PlugIns/AirPortBrcmNIC_Injector.kext")["Enabled"] = True
self.get_kext_by_bundle_path("AirportBrcmFixup.kext/Contents/PlugIns/AirPortBrcmNIC_Injector.kext")["Enabled"] = True
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.pci_path:
arpt_path = self.computer.wifi.pci_path
print(f"- Found ARPT device at {arpt_path}")
else:
if self.model in ModelArray.nvidiaHDEF:
try:
smbios_data.smbios_dictionary[self.model]["nForce Chipset"]
# Nvidia chipsets all have the same path to ARPT
arpt_path = "PciRoot(0x0)/Pci(0x15,0x0)/Pci(0x0,0x0)"
elif self.model in ("iMac7,1", "iMac8,1", "MacPro3,1", "MacBookPro4,1"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x4)/Pci(0x0,0x0)"
elif self.model in ("iMac13,1", "iMac13,2"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x3)/Pci(0x0,0x0)"
elif self.model in ("MacPro4,1", "MacPro5,1"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x5)/Pci(0x0,0x0)"
else:
# Assumes we have a laptop with Intel chipset
# iMac11,x-12,x also apply
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
except KeyError:
if self.model in ("iMac7,1", "iMac8,1", "MacPro3,1", "MacBookPro4,1"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x4)/Pci(0x0,0x0)"
elif self.model in ("iMac13,1", "iMac13,2"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x3)/Pci(0x0,0x0)"
elif self.model in ("MacPro4,1", "MacPro5,1"):
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x5)/Pci(0x0,0x0)"
else:
# Assumes we have a laptop with Intel chipset
# iMac11,x-12,x also apply
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
print(f"- Using known DevicePath {arpt_path}")
self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba"}
# self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba"}
if not self.constants.custom_model and self.computer.wifi and self.constants.validate is False and self.computer.wifi.country_code:
print(f"- Applying fake ID for WiFi, setting Country Code: {self.computer.wifi.country_code}")
self.config["DeviceProperties"]["Add"][arpt_path].update({"brcmfx-country": self.computer.wifi.country_code})
self.config["DeviceProperties"]["Add"][arpt_path] = {"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"
@@ -254,14 +246,12 @@ class BuildOpenCore:
# 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 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)}"
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 self.constants.wifi_build is True:
print("- Skipping Wifi patches on request")
elif not self.constants.custom_model and self.computer.wifi:
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:
@@ -279,29 +269,37 @@ class BuildOpenCore:
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
wifi_fake_id(self)
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
self.get_kext_by_bundle_path("IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
elif isinstance(self.computer.wifi, device_probe.Atheros) and self.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40:
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
else:
if self.model in ModelArray.WifiBCM94331:
if smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
print("- Enabling BCM943224 and BCM94331 Networking Support")
wifi_fake_id(self)
elif self.model in ModelArray.WifiBCM94322:
self.enable_kext("IO80211Mojave.kext", self.constants.io80211mojave_version, self.constants.io80211mojave_path)
self.get_kext_by_bundle_path("IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
elif self.model in ModelArray.WifiBCM94328:
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
print("- Enabling BCM94328 Networking Support")
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 smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
print("- Enabling BCM94328 Networking Support")
self.enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
self.enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
self.get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
elif self.model in ModelArray.WifiAtheros:
self.enable_kext("IO80211HighSierra.kext", self.constants.io80211high_sierra_version, self.constants.io80211high_sierra_path)
self.get_kext_by_bundle_path("IO80211HighSierra.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
else:
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Atheros.Chipsets.AirPortAtheros40:
print("- Enabling Atheros Networking Support")
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
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirportBrcmNIC:
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}")
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
@@ -318,18 +316,20 @@ class BuildOpenCore:
self.get_kext_by_bundle_path("CPUFriendDataProvider.kext")["Enabled"] = True
# HID patches
if self.model in ModelArray.LegacyHID:
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
# SSDT patches
if self.model in ModelArray.pciSSDT:
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")):
# Applicable for consumer Nehalem
print("- Adding SSDT-CPBG.aml")
self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True
shutil.copy(self.constants.pci_ssdt_path, self.constants.acpi_path)
if self.model in ModelArray.windows_audio:
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
# Based on: https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/
# Applicable for Sandy and Ivy Bridge Macs
print("- Enabling Windows 10 UEFI Audio support")
self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-PCI.aml")["Enabled"] = True
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True
@@ -341,8 +341,8 @@ class BuildOpenCore:
if (
usb_map_path.exists()
and self.constants.allow_oc_everywhere is False
and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"]
and (self.model in ModelArray.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
and self.model not in ["Xserve2,1", "Dortania1,1"]
and (self.model in model_array.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
):
print("- Adding USB-Map.kext")
Path(self.constants.map_kext_folder).mkdir()
@@ -360,7 +360,7 @@ class BuildOpenCore:
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 ModelArray.NoAGPMSupport:
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()
@@ -368,7 +368,7 @@ class BuildOpenCore:
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 ModelArray.AGDPSupport:
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()
@@ -377,7 +377,7 @@ class BuildOpenCore:
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
# AGPM Patch
if self.model in ModelArray.DualGPUPatch:
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
@@ -387,7 +387,7 @@ class BuildOpenCore:
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 ModelArray.IntelNvidiaDRM and self.constants.drm_support is True:
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)"] = {
@@ -398,44 +398,56 @@ class BuildOpenCore:
else:
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
if self.model in ["iMac13,1", "iMac13,2", "iMac13,3"]:
if self.computer.dgpu:
if self.constants.allow_ivy_igpu is False:
print("- Disabling iGPU to fix sleep support in macOS 12")
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:
print("- Enabling iGPU upon request")
# Audio Patch
if self.model in ModelArray.LegacyAudio:
print("- Adding audio properties")
hdef_path = "PciRoot(0x0)/Pci(0x8,0x0)" if self.model in ModelArray.nvidiaHDEF else "PciRoot(0x0)/Pci(0x1b,0x0)"
# In AppleALC, MacPro3,1's original layout is already in use, forcing layout 13 instead
if self.model == "MacPro3,1":
self.config["DeviceProperties"]["Add"][hdef_path] = {
"apple-layout-id": 90,
"use-apple-layout-id": 1,
"alc-layout-id": 13,
}
else:
self.config["DeviceProperties"]["Add"][hdef_path] = {
"apple-layout-id": 90,
"use-apple-layout-id": 1,
"use-layout-id": 1,
}
if self.constants.set_alc_usage is True:
if smbios_data.smbios_dictionary[self.model]["Max OS Supported"] <= os_data.os_data.high_sierra:
# Models dropped in Mojave also lost Audio support
# Xserves and MacPro4,1 are exceptions
# iMac7,1 and iMac8,1 require AppleHDA/IOAudioFamily downgrade
if not (self.model.startswith("Xserve") or self.model in ["MacPro4,1", "iMac7,1", "iMac8,1"]):
try:
smbios_data.smbios_dictionary[self.model]["nForce Chipset"]
hdef_path = "PciRoot(0x0)/Pci(0x8,0x0)"
except KeyError:
hdef_path = "PciRoot(0x0)/Pci(0x1b,0x0)"
# In AppleALC, MacPro3,1's original layout is already in use, forcing layout 13 instead
if self.model == "MacPro3,1":
self.config["DeviceProperties"]["Add"][hdef_path] = {
"apple-layout-id": 90,
"use-apple-layout-id": 1,
"alc-layout-id": 13,
}
else:
self.config["DeviceProperties"]["Add"][hdef_path] = {
"apple-layout-id": 90,
"use-apple-layout-id": 1,
"use-layout-id": 1,
}
self.enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
elif self.model.startswith("MacPro") or self.model.startswith("Xserve"):
# Used to enable Audio support for non-standard dGPUs
self.enable_kext("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path)
# Enable FireWire Boot Support
if self.constants.firewire_boot is True and self.model not in ModelArray.NoFireWireSupport:
def check_firewire(model):
# MacBooks never supported FireWire
# Pre-Thunderbolt MacBook Airs as well
if model.startswith("MacBook"):
return False
elif model.startswith("MacBookAir"):
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
return False
else:
return True
if self.constants.firewire_boot is True and check_firewire(self.model) is True:
# Enable FireWire Boot Support
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
print("- Enabling FireWire Boot Support")
self.enable_kext("IOFireWireFamily.kext", self.constants.fw_kext, self.constants.fw_family_path)
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:
@@ -452,7 +464,6 @@ class BuildOpenCore:
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
def nvidia_patch(self, backlight_path):
self.constants.custom_mxm_gpu = True
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] = {
@@ -493,7 +504,6 @@ class BuildOpenCore:
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
def amd_patch(self, backlight_path):
self.constants.custom_mxm_gpu = True
print("- Adding AMD DRM patches")
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 80, "unfairgva": 1}
if self.constants.custom_model and self.model == "iMac11,2":
@@ -508,7 +518,18 @@ class BuildOpenCore:
"class-code": binascii.unhexlify("FFFFFFFF"),
}
elif self.model == "iMac10,1":
self.enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
if self.get_kext_by_bundle_path("AAAMouSSE.kext")["Enabled"] is False:
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].update({
"rebuild-device-tree": 1,
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
"CAIL,CAIL_DisableUVDPowerGating": 1,
"CAIL,CAIL_DisableVCEPowerGating": 1,
})
# Check GPU Vendor
if self.constants.metal_build is True:
@@ -520,10 +541,12 @@ class BuildOpenCore:
nvidia_patch(self, self.gfx0_path)
else:
print("- Failed to find vendor")
elif not self.constants.custom_model and self.model in ModelArray.LegacyGPU and self.computer.dgpu:
print(f"- Detected dGPU: {Utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{Utilities.friendly_hex(self.computer.dgpu.device_id)}")
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
print(f"- Detected dGPU: {utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
if self.computer.dgpu.arch in [
device_probe.AMD.Archs.Legacy_GCN,
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,
@@ -533,20 +556,20 @@ class BuildOpenCore:
elif self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
backlight_path_detection(self)
nvidia_patch(self, self.gfx0_path)
if self.model in ModelArray.MacPro:
if self.model in model_array.MacPro:
if not self.constants.custom_model:
for i, device in enumerate(self.computer.gpus):
print(f"- Found dGPU ({i + 1}): {Utilities.friendly_hex(device.vendor_id)}:{Utilities.friendly_hex(device.device_id)}")
self.config["#Revision"][f"Hardware-MacPro-dGPU-{i + 1}"] = f"{Utilities.friendly_hex(device.vendor_id)}:{Utilities.friendly_hex(device.device_id)}"
print(f"- Found dGPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
self.config["#Revision"][f"Hardware-MacPro-dGPU-{i + 1}"] = f"{utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}"
if device.pci_path:
if device.pci_path and device.acpi_path:
print(f"- Found dGPU ({i + 1}) at {device.pci_path}")
if isinstance(device, device_probe.AMD):
print("- Adding Mac Pro, Xserve DRM patches")
self.config["DeviceProperties"]["Add"][device.pci_path] = {"shikigva": 128, "unfairgva": 1, "rebuild-device-tree": 1}
self.config["DeviceProperties"]["Add"][device.pci_path] = {"shikigva": 128, "unfairgva": 1, "rebuild-device-tree": 1, "agdpmod": "pikera"}
elif isinstance(device, device_probe.NVIDIA):
print("- Enabling Nvidia Output Patch")
self.config["DeviceProperties"]["Add"][device.pci_path] = {"rebuild-device-tree": 1}
self.config["DeviceProperties"]["Add"][device.pci_path] = {"rebuild-device-tree": 1, "agdpmod": "vit9696"}
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
@@ -556,14 +579,14 @@ class BuildOpenCore:
print("- Adding Mac Pro, Xserve DRM patches")
if "shikigva=128 unfairgva=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
print("- Falling back to boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1" + (
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 agdpmod=pikera" + (
" -wegtree" if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] else ""
)
elif isinstance(device, device_probe.NVIDIA):
print("- Enabling Nvidia Output Patch")
if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
if "-wegtree agdpmod=vit9696" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
print("- Falling back to boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -wegtree"
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -wegtree agdpmod=vit9696"
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
@@ -574,46 +597,75 @@ class BuildOpenCore:
print("- Adding Mac Pro, Xserve DRM patches")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
# Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected
# TODO: Fix XhciDxe to work on pre UEFI 2.0 Macs
# Ref: https://github.com/acidanthera/bugtracker/issues/1663
# if self.model not in ModelArray.XhciSupport and not self.constants.custom_model:
# devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
# try:
# devices = [i for i in devices if i["class-code"] == binascii.unhexlify(self.constants.classcode_xhci)]
# vendor_id = Utilities.hexswap(binascii.hexlify(devices[0]["vendor-id"]).decode()[:4])
# device_id = Utilities.hexswap(binascii.hexlify(devices[0]["device-id"]).decode()[:4])
# print("- Found XHCI Controller, adding Boot Support")
# shutil.copy(self.constants.xhci_driver_path, self.constants.drivers_path)
# self.config["UEFI"]["Drivers"] += ["XhciDxe.efi"]
# except ValueError:
# print("- No XHCI Controller Found (V)")
# except IndexError:
# print("- No XHCI Controller Found (I)")
if self.constants.disable_tb is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
print("- Disabling 2013-2014 laptop Thunderbolt Controller")
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
# 15" dGPU models: IOACPIPlane:/_SB/PCI0@0/PEG1@10001/UPSB@0/DSB0@0/NHI0@0
tb_device_path = "PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"
else:
# 13" and 15" iGPU 2013-2014 models: IOACPIPlane:/_SB/PCI0@0/P0P2@10000/UPSB@0/DSB0@0/NHI0@0
tb_device_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
if self.constants.software_demux is True and self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
print("- Enabling software demux")
# Add ACPI patches
self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-DGPU.aml")["Enabled"] = True
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "_INI to XINI")["Enabled"] = True
shutil.copy(self.constants.demux_ssdt_path, self.constants.acpi_path)
# Disable dGPU
# IOACPIPlane:/_SB/PCI0@0/P0P2@10000/GFX0@0
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000"), "IOName": "Dortania Disabled Card", "name": "Dortania Disabled Card"}
self.config["DeviceProperties"]["Delete"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = ["class-code", "device-id", "IOName", "name"]
# Add AMDGPUWakeHandler
self.enable_kext("AMDGPUWakeHandler.kext", self.constants.gpu_wake_version, self.constants.gpu_wake_path)
# Bluetooth Detection
if not self.constants.custom_model and self.computer.bluetooth_chipset:
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
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 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)
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value:
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
if self.constants.nvme_boot is True:
print("- Enabling NVMe boot support")
shutil.copy(self.constants.nvme_driver_path, self.constants.drivers_path)
self.config["UEFI"]["Drivers"] += ["NvmExpressDxe.efi"]
self.get_efi_binary_by_path("NvmExpressDxe.efi", "UEFI", "Drivers")["Enabled"] = True
# Add OpenCanopy
print("- Adding OpenCanopy GUI")
shutil.rmtree(self.constants.resources_path, onerror=rmtree_handler)
shutil.copy(self.constants.gui_path, self.constants.oc_folder)
self.config["UEFI"]["Drivers"] += ["OpenCanopy.efi", "OpenRuntime.efi"]
self.get_efi_binary_by_path("OpenCanopy.efi", "UEFI", "Drivers")["Enabled"] = True
self.get_efi_binary_by_path("OpenRuntime.efi", "UEFI", "Drivers")["Enabled"] = True
self.get_efi_binary_by_path("OpenLinuxBoot.efi", "UEFI", "Drivers")["Enabled"] = True
# Exfat check
if self.model in ModelArray.NoExFat:
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
# Sandy Bridge and newer Macs natively support ExFat
print("- Adding ExFatDxeLegacy.efi")
shutil.copy(self.constants.exfat_legacy_driver_path, self.constants.drivers_path)
self.config["UEFI"]["Drivers"] += ["ExFatDxeLegacy.efi"]
self.get_efi_binary_by_path("ExFatDxeLegacy.efi", "UEFI", "Drivers")["Enabled"] = True
# Add UGA to GOP layer
if self.model in ModelArray.UGAtoGOP:
try:
smbios_data.smbios_dictionary[self.model]["UGA Graphics"]
print("- Adding UGA to GOP Patch")
self.config["UEFI"]["Output"]["GopPassThrough"] = "Apple"
except KeyError:
pass
# ThirdPartDrives Check
if self.model in ModelArray.SATAPatch and self.constants.allow_oc_everywhere is False:
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
@@ -635,19 +687,28 @@ class BuildOpenCore:
print("- Enabling ShowPicker")
self.config["Misc"]["Boot"]["ShowPicker"] = True
else:
print("- Hiding picker and enabling PollAppleHotKeys")
print("- Hiding OpenCore picker")
self.config["Misc"]["Boot"]["ShowPicker"] = False
if self.constants.vault is True:
print("- Setting Vault configuration")
self.config["Misc"]["Security"]["Vault"] = "Secure"
self.get_tool_by__path("OpenShell.efi")["Enabled"] = False
if self.constants.sip_status is False:
self.get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
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("- Disabling SIP")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = binascii.unhexlify("EF0F0000")
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["csr-active-config"]
if self.constants.disable_amfi is True:
print("- Disabling AMFI")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi_get_out_of_my_way=1"
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"
if self.constants.disable_cs_lv is True:
print("- Disabling Library Validation")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable Library Validation Enforcement")["Enabled"] = True
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_amfi"
# CSLVFixup simply patches out __RESTRICT and __restrict out of the Music.app Binary
# Ref: https://pewpewthespells.com/blog/blocking_code_injection_on_ios_and_os_x.html
self.enable_kext("CSLVFixup.kext", self.constants.cslvfixup_version, self.constants.cslvfixup_path)
if self.constants.secure_status is False:
print("- Disabling SecureBootModel")
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
@@ -673,16 +734,41 @@ class BuildOpenCore:
if self.constants.validate is False:
print("- Adding bootmgfw.efi BlessOverride")
self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"]
try:
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
except KeyError:
pass
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
# Note this function was added in 11.3 (20E232, 20.4), older builds do not support this (ie. 11.2.3)
print("- Allowing FileVault on Root Patched systems")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
# Lets us check in sys_patch.py if config supports FileVault
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
if self.constants.disable_msr_power_ctl is True and self.model.startswith("MacBook"):
print("- Disabling Battery Throttling")
if 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.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
self.enable_kext("EFICheckDisabler.kext", self.constants.restrictevents_version, self.constants.efi_disabler_path)
def set_smbios(self):
spoofed_model = self.model
if self.constants.override_smbios == "Default":
spoofed_model = self.smbios_set(self.model)
print(f"- Spoofing to {spoofed_model}")
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}")
try:
spoofed_board = self.constants.board_id[spoofed_model]
spoofed_board = smbios_data.smbios_dictionary[spoofed_model]["Board ID"]
print(f"- Using Board ID: {spoofed_board}")
except KeyError:
spoofed_board = ""
@@ -693,21 +779,45 @@ class BuildOpenCore:
# Setup menu
def minimal_serial_patch(self):
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
self.config["PlatformInfo"]["SMBIOS"]["ProcessorType"] = 1537
if self.model in ModelArray.NoAPFSsupport:
fw_feature, fw_mask = self.fw_feature_detect(self.model)
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeaturesMask"] = fw_mask
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeaturesMask"] = fw_mask
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["run-efi-updater"] = "No"
# Generate Firmware Features
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
# fw_feature = self.patch_firmware_feature()
fw_feature = hex(fw_feature).lstrip("0x").rstrip("L").strip()
print(f"- Setting Firmware Feature: {fw_feature}")
fw_feature = utilities.string_to_hex(fw_feature)
# FirmwareFeatures
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeaturesMask"] = fw_feature
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeaturesMask"] = fw_feature
# Board ID
self.config["PlatformInfo"]["DataHub"]["BoardProduct"] = self.spoofed_board
self.config["PlatformInfo"]["PlatformNVRAM"]["BID"] = self.spoofed_board
self.config["PlatformInfo"]["SMBIOS"]["BoardProduct"] = self.spoofed_board
# Model (ensures tables are not mismatched, even if we're not spoofing)
self.config["PlatformInfo"]["DataHub"]["SystemProductName"] = self.model
self.config["PlatformInfo"]["SMBIOS"]["SystemProductName"] = self.model
self.config["PlatformInfo"]["SMBIOS"]["BoardVersion"] = self.model
# ProcessorType (when RestrictEvent's CPU naming is used)
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
self.config["PlatformInfo"]["SMBIOS"]["ProcessorType"] = 1537
# Avoid incorrect Firmware Updates
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["run-efi-updater"] = "No"
self.config["PlatformInfo"]["SMBIOS"]["BIOSVersion"] = "9999.999.999.999.999"
# Update tables
self.config["PlatformInfo"]["UpdateNVRAM"] = True
self.config["PlatformInfo"]["UpdateSMBIOS"] = True
# Updating DataHub breaks hibernation, disabling for time being
# self.config["PlatformInfo"]["UpdateDataHub"] = True
# self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
def moderate_serial_patch(self):
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
@@ -747,17 +857,11 @@ class BuildOpenCore:
self.spoofed_model = self.model
minimal_serial_patch(self)
if self.constants.download_ram is False:
self.config["PlatformInfo"].pop("Memory")
else:
print("- Inserting 1.5TB of RAM into your Mac")
self.config["PlatformInfo"]["CustomMemory"] = True
# USB Map and CPUFriend Patching
if (
self.constants.allow_oc_everywhere is False
and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"]
and (self.model in ModelArray.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
and self.model not in ["Xserve2,1", "Dortania1,1"]
and (self.model in model_array.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
):
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
map_config = plistlib.load(Path(new_map_ls).open("rb"))
@@ -793,18 +897,36 @@ class BuildOpenCore:
new_amc_ls = Path(self.constants.amc_contents_folder) / Path("Info.plist")
amc_config = plistlib.load(Path(new_amc_ls).open("rb"))
amc_config["IOKitPersonalities"]["AppleMuxControl"]["ConfigMap"][self.spoofed_board] = amc_config["IOKitPersonalities"]["AppleMuxControl"]["ConfigMap"].pop(self.model)
for entry in list(amc_config["IOKitPersonalities"]["AppleMuxControl"]["ConfigMap"]):
if not entry.startswith(self.spoofed_board):
amc_config["IOKitPersonalities"]["AppleMuxControl"]["ConfigMap"].pop(entry)
plistlib.dump(amc_config, Path(new_amc_ls).open("wb"), sort_keys=True)
if self.model not in ModelArray.NoAGPMSupport:
if self.model not in model_array.NoAGPMSupport:
new_agpm_ls = Path(self.constants.agpm_contents_folder) / Path("Info.plist")
agpm_config = plistlib.load(Path(new_agpm_ls).open("rb"))
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board] = agpm_config["IOKitPersonalities"]["AGPM"]["Machines"].pop(self.model)
if self.model == "MacBookPro6,2":
# Force G State to not exceed moderate state
# Ref: https://github.com/fabioiop/MBP-2010-GPU-Panic-fix
print("- Patching G State for MacBookPro6,2")
for gpu in ["Vendor10deDevice0a34", "Vendor10deDevice0a29"]:
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostPState"] = [2, 2, 2, 2]
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostTime"] = [2, 2, 2, 2]
for entry in list(agpm_config["IOKitPersonalities"]["AGPM"]["Machines"]):
if not entry.startswith(self.spoofed_board):
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"].pop(entry)
plistlib.dump(agpm_config, Path(new_agpm_ls).open("wb"), sort_keys=True)
if self.model in ModelArray.AGDPSupport:
if self.model in model_array.AGDPSupport:
new_agdp_ls = Path(self.constants.agdp_contents_folder) / Path("Info.plist")
agdp_config = plistlib.load(Path(new_agdp_ls).open("rb"))
agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"][self.spoofed_board] = agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"].pop(
self.model
)
for entry in list(agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"]):
if not entry.startswith(self.spoofed_board):
agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"].pop(entry)
plistlib.dump(agdp_config, Path(new_agdp_ls).open("wb"), sort_keys=True)
@staticmethod
@@ -823,12 +945,12 @@ class BuildOpenCore:
raise IndexError
return kext
def get_tool_by__path(self, bundle_path):
tool = self.get_item_by_kv(self.config["Misc"]["Tools"], "Path", bundle_path)
if not tool:
print(f"- Could not find Tool {bundle_path}!")
def get_efi_binary_by_path(self, bundle_path, entry_location, efi_type):
efi_binary = self.get_item_by_kv(self.config[entry_location][efi_type], "Path", bundle_path)
if not efi_binary:
print(f"- Could not find {efi_type}: {bundle_path}!")
raise IndexError
return tool
return efi_binary
def enable_kext(self, kext_name, kext_version, kext_path, check=False):
kext = self.get_kext_by_bundle_path(kext_name)
@@ -844,6 +966,7 @@ class BuildOpenCore:
def cleanup(self):
print("- Cleaning up files")
# Remove unused entries
# TODO: Consolidate into a single for loop
for entry in list(self.config["ACPI"]["Add"]):
if not entry["Enabled"]:
self.config["ACPI"]["Add"].remove(entry)
@@ -856,6 +979,12 @@ class BuildOpenCore:
for entry in list(self.config["Kernel"]["Patch"]):
if not entry["Enabled"]:
self.config["Kernel"]["Patch"].remove(entry)
for entry in list(self.config["Misc"]["Tools"]):
if not entry["Enabled"]:
self.config["Misc"]["Tools"].remove(entry)
for entry in list(self.config["UEFI"]["Drivers"]):
if not entry["Enabled"]:
self.config["UEFI"]["Drivers"].remove(entry)
plistlib.dump(self.config, Path(self.constants.plist_path).open("wb"), sort_keys=True)
for kext in self.constants.kexts_path.rglob("*.zip"):
@@ -877,12 +1006,20 @@ 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()
self.set_smbios()
if self.constants.allow_oc_everywhere is False:
self.set_smbios()
self.cleanup()
self.sign_files()
print("")
@@ -893,11 +1030,11 @@ class BuildOpenCore:
input("Press [Enter] to go back.\n")
def copy_efi(self):
Utilities.cls()
Utilities.header(["Installing OpenCore to Drive"])
utilities.cls()
utilities.header(["Installing OpenCore to Drive"])
if not self.constants.opencore_release_folder.exists():
Utilities.TUIOnlyPrint(
utilities.TUIOnlyPrint(
["Installing OpenCore to Drive"],
"Press [Enter] to go back.\n",
[
@@ -933,7 +1070,7 @@ Please build OpenCore first!"""
# Avoid crashing with CDs installed
continue
# TODO: Advanced mode
menu = Utilities.TUIMenu(
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."],
@@ -943,7 +1080,7 @@ Please build OpenCore first!"""
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:])
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})", key=disk[4:])
response = menu.start()
@@ -953,7 +1090,7 @@ Please build OpenCore first!"""
disk_identifier = "disk" + response
selected_disk = all_disks[disk_identifier]
menu = Utilities.TUIMenu(
menu = utilities.TUIMenu(
["Select Partition"],
"Please select the partition you would like to install OpenCore to: ",
return_number_instead_of_direct_call=True,
@@ -963,7 +1100,7 @@ Please build OpenCore first!"""
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'])})"
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:
@@ -995,7 +1132,7 @@ Please build OpenCore first!"""
# cancelled prompt
return
else:
Utilities.TUIOnlyPrint(
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
@@ -1010,8 +1147,8 @@ Please build OpenCore first!"""
ssd_type = False
mount_path = Path(partition_info["MountPoint"])
disk_type = partition_info["BusProtocol"]
Utilities.cls()
Utilities.header(["Copying OpenCore"])
utilities.cls()
utilities.header(["Copying OpenCore"])
if mount_path.exists():
if (mount_path / Path("EFI/Microsoft")).exists():
@@ -1068,4 +1205,4 @@ Please build OpenCore first!"""
print("\nPress [Enter] to continue.\n")
input()
else:
Utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!", "Please report this to the devs at GitHub."]).start()
utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!", "Please report this to the devs at GitHub."]).start()

1103
resources/cli_menu.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -7,98 +7,160 @@ from __future__ import print_function
from pathlib import Path
from typing import Optional
from Resources import device_probe
from resources import device_probe
class Constants:
def __init__(self):
self.patcher_version = "0.2.4"
self.opencore_commit = "be2d9fe - 07-2-2021"
self.opencore_version = "0.7.1"
self.lilu_version = "1.5.4"
self.whatevergreen_version = "1.5.1"
self.airportbcrmfixup_version = "2.1.3"
self.bcm570_version = "1.0.1"
self.marvel_version = "1.0.0"
self.nforce_version = "1.0.0"
self.mce_version = "1.0.0"
self.mousse_version = "0.95"
self.telemetrap_version = "1.0.0"
self.corecaptureelcap_version = "1.0.0"
self.io80211elcap_version = "1.0.0"
self.io80211high_sierra_version = "1.0.0"
self.io80211mojave_version = "1.0.0"
self.applealc_version = "1.6.2"
self.restrictevents_version = "1.0.3"
self.restrictevents_mbp_version = "1.0.3"
self.piixata_version = "1.0.0"
self.backlight_version = "1.0.1"
self.backlight_injector_version = "1.0.0"
self.cpufriend_version = "1.2.4"
self.nightshift_version = "1.1.0"
self.smcspoof_version = "1.0.0"
self.nvmefix_version = "1.0.9"
self.featureunlock_version = "1.0.3"
self.debugenhancer_version = "1.0.3"
self.innie_version = "1.3.0"
self.fw_kext = "1.0.0"
self.latebloom_version = "0.19"
self.disk = ""
self.patch_disk = ""
self.patcher_support_pkg_version = "0.0.15" # PatcherSupportPkg
# Patcher Versioning
self.patcher_version = "0.3.1" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.1.12" # 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"
# Kext Versioning
## Acidanthera
## https://github.com/acidanthera
self.lilu_version = "1.5.6" # Lilu
self.whatevergreen_version = "1.5.3" # 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.debugenhancer_version = "1.0.4" # DebugEnhancer
self.cpufriend_version = "1.2.4" # CPUFriend
self.bluetool_version = "2.6.1" # BlueToolFixup
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
## Apple - Dortania Modified
self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet
self.corecaptureelcap_version = "1.0.1" # corecaptureElCap
self.io80211elcap_version = "2.0.0" # IO80211ElCap
self.io80211high_sierra_version = "1.0.1" # IO80211HighSierra
self.io80211mojave_version = "1.0.1" # IO80211Mojave
## Dortania
## https://github.com/dortania
self.backlight_injector_version = "1.1.0" # BacklightInjector
self.smcspoof_version = "1.0.0" # SMC-Spoof
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
self.btspoof_version = "1.0.0" # Bluetooth-Spoof
## Syncretic
## https://forums.macrumors.com/members/syncretic.1173816/
## https://github.com/reenigneorcim/latebloom
self.latebloom_version = "0.22" # Latebloom
self.mousse_version = "0.95" # MouSSE
self.telemetrap_version = "1.0.0" # telemetrap
## cdf
## https://github.com/cdf/Innie
self.innie_version = "1.3.0" # Innie
## arter97
## https://github.com/arter97/SimpleMSR/
self.simplemsr_version = "1.0.0" # SimpleMSR
## blackgate
## https://github.com/blackgate/AMDGPUWakeHandler
self.gpu_wake_version = "1.0.0"
# Get resource path
self.current_path = Path(__file__).parent.parent.resolve()
self.payload_path = self.current_path / Path("payloads")
# Hardware
self.computer: device_probe.Computer = None # type: ignore
self.custom_model: Optional[str] = None
self.custom_mxm_gpu: bool = False
# Patcher Settings
self.allow_oc_everywhere = False # Set whether Patcher can be run on unsupported Macs
self.gui_mode = False # Determine whether running in a GUI or TUI
self.disk = "" # Set installation ESP
self.patch_disk = "" # Set Root Volume to patch
self.validate = False # Enable validation testing for CI
self.recovery_status = False # Detect if booted into RecoveryOS
## Hardware
self.computer: device_probe.Computer = None # type: ignore
self.custom_model: Optional[str] = None
## OpenCore Settings
self.opencore_debug = False
self.opencore_build = "RELEASE"
self.kext_debug = False
self.verbose_debug = False
self.showpicker = True # Show or Hide OpenCore's Boot Picker
self.boot_efi = False # Use EFI/BOOT/BOOTx64.efi bootstrap
## Kext Settings
self.kext_debug = False # Enables Lilu debug and DebugEnhancer
## NVRAM Settings
self.verbose_debug = False # -v
## 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.override_smbios = "Default" # Set SMBIOS model used
## Latebloom Settings
self.latebloom_status = False # Latebloom Enabled
self.latebloom_delay = 0 # Delay between each PCIe Probe
self.latebloom_range = 0 # Range each delay can differ
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
## OS Settings
self.os_support = 12.0
self.metal_build = False
self.imac_vendor = "None"
self.wifi_build = False
self.gui_mode = False
self.serial_settings = "Minimal"
self.showpicker = True
self.vault = False
self.sip_status = True
self.secure_status = False
self.detected_os = 0
self.detected_os_minor = 0
self.boot_efi = False
self.drm_support = False
self.allow_oc_everywhere = False
self.custom_cpu_model = 2
self.custom_cpu_model_value = ""
self.custom_color = ""
self.download_ram = False
self.disallow_cpufriend = False
self.recovery_status = False
self.override_smbios = "Default"
self.apecid_support = False
self.firewire_boot = False
self.nvme_boot = False
self.disable_amfi = False
self.terascale_2_patch = False
self.enable_wake_on_wlan = False
self.allow_ivy_igpu = False
self.moj_cat_accel = False
self.latebloom_status = False
self.latebloom_delay = 0
self.latebloom_range = 0
self.latebloom_debug = 0
self.validate = False
self.detected_os = 0 # Major Kernel Version
self.detected_os_minor = 0 # Minor Kernel Version
self.detected_os_build = "" # OS Build
self.allow_fv_root = False # Allow FileVault on broken sealed snapshots
## Boot Volume Settings
self.firewire_boot = False # Allow macOS FireWire Boot
self.nvme_boot = False # Allow UEFI NVMe Boot
## Graphics Settings
self.metal_build = False # Set MXM Build support
self.imac_vendor = "None" # Set MXM GPU vendor
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
self.custom_sip_value = None # Set custom SIP value
# OS Versions
## Based off Major Kernel Version
self.tiger = 8
self.leopard = 9
self.snow_leopard = 10
@@ -114,36 +176,11 @@ class Constants:
self.big_sur = 20
self.monterey = 21
# Vendor IDs
self.pci_nvidia = "10DE"
self.pci_amd_ati = "1002"
self.pci_intel = "8086"
self.pci_broadcom = "14E4"
self.pci_atheros = "168C"
self.pci_apple = "106B"
# Class Codes
# https://pci-ids.ucw.cz/read/PD
self.classcode_sata = "01060100"
self.classcode_nvme = "02080100"
self.classcode_nvme_generic = "02800100"
self.classcode_wifi = "00800200"
self.classcode_gpu = "00000300"
self.classcode_gpu_variant = "00800300"
self.classcode_xhci = "30030C00"
# Nvidia GPU Architecture
self.arch_tesla = "NV50"
self.arch_fermi = "GF100"
self.arch_kepler = "GK100"
# External Files
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.legacy_accel_support = [
self.mojave,
self.catalina,
self.big_sur,
self.monterey,
]
# Payload Location
@@ -169,6 +206,10 @@ class Constants:
@property
def windows_ssdt_path(self):
return self.payload_path / Path("ACPI/SSDT-PCI.aml")
@property
def demux_ssdt_path(self):
return self.payload_path / Path("ACPI/SSDT-DGPU.aml")
# Drivers
@property
@@ -204,6 +245,10 @@ class Constants:
def restrictevents_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-v{self.restrictevents_version}.zip")
@property
def efi_disabler_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/EFICheckDisabler-v{self.restrictevents_version}.zip")
@property
def restrictevents_mbp_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/RestrictEvents-MBP91-v{self.restrictevents_mbp_version}.zip")
@@ -256,10 +301,6 @@ class Constants:
def piixata_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleIntelPIIXATA-v{self.piixata_version}.zip")
@property
def backlight_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleBacklightFixup-v{self.backlight_version}.zip")
@property
def backlight_injector_path(self):
return self.payload_kexts_path / Path(f"Misc/BacklightInjector-v{self.backlight_injector_version}.zip")
@@ -268,14 +309,14 @@ class Constants:
def cpufriend_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/CPUFriend-v{self.cpufriend_version}.zip")
@property
def nightshift_path(self):
return self.payload_kexts_path / Path(f"Misc/NightShiftEnabler-v{self.nightshift_version}.zip")
@property
def smcspoof_path(self):
return self.payload_kexts_path / Path(f"Misc/SMC-Spoof-v{self.smcspoof_version}.zip")
@property
def btspoof_path(self):
return self.payload_kexts_path / Path(f"Misc/Bluetooth-Spoof-v{self.btspoof_version}.zip")
@property
def nvmefix_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/NVMeFix-v{self.nvmefix_version}.zip")
@@ -288,14 +329,34 @@ class Constants:
def debugenhancer_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/DebugEnhancer-v{self.debugenhancer_version}.zip")
@property
def bluetool_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/BlueToolFixup-v{self.bluetool_version}.zip")
@property
def cslvfixup_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/CSLVFixup-v{self.cslvfixup_version}.zip")
@property
def innie_path(self):
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
@property
def simplemsr_path(self):
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
@property
def gpu_wake_path(self):
return self.payload_kexts_path / Path(f"Misc/AMDGPUWakeHandler-v{self.gpu_wake_version}.zip")
@property
def latebloom_path(self):
return self.payload_kexts_path / Path(f"Misc/latebloom-v{self.latebloom_version}.zip")
@property
def apple_trackpad_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleUSBTrackpad-v{self.apple_trackpad}.zip")
@property
def plist_folder_path(self):
return self.payload_kexts_path / Path("Plists")
@@ -413,7 +474,7 @@ class Constants:
# Icons
@property
def app_icon_path(self):
return self.current_path / Path("OC-Patcher.icns")
return self.payload_path / Path("OC-Patcher.icns")
@property
def icon_path_external(self):
@@ -449,6 +510,18 @@ class Constants:
def payload_apple_kexts_path(self):
return self.payload_apple_root_path / Path("Extensions")
@property
def payload_apple_coreservices_path(self):
return self.payload_apple_root_path / Path("CoreServices")
@property
def payload_apple_usr_path(self):
return self.payload_apple_root_path / Path("usr")
@property
def payload_apple_libexec_path(self):
return self.payload_apple_usr_path / Path("libexec")
@property
def payload_apple_frameworks_path(self):
return self.payload_apple_root_path / Path("Frameworks")
@@ -493,11 +566,21 @@ class Constants:
def payload_apple_private_frameworks_path_brightness(self):
return self.payload_apple_private_frameworks_path / Path("Brightness-Control")
@property
def payload_apple_private_frameworks_path_legacy_drm(self):
return self.payload_apple_private_frameworks_path / Path("Legacy-GVA")
# Apple Extensions
# El Capitan Extensions
@property
def audio_path(self):
return self.payload_apple_kexts_path / Path("Audio")
# High Sierra Extensions
@property
def audio_v2_path(self):
return self.payload_apple_kexts_path / Path("Audio-v2")
# GPU Kexts and Bundles
@property
@@ -540,58 +623,36 @@ class Constants:
def legacy_brightness(self):
return self.payload_apple_kexts_path / Path("Brightness-Control")
csr_values = {
# Source: macOS 11.4 (XNU's csr.h)
# https://opensource.apple.com/source/xnu/xnu-7195.121.3/bsd/sys/csr.h.auto.html
"CSR_ALLOW_UNTRUSTED_KEXTS": False, # 0x1 - Allows Unsigned Kexts - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_UNRESTRICTED_FS": False, # 0x2 - File System Access - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_TASK_FOR_PID": False, # 0x4 - Unrestricted task_for_pid() - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_KERNEL_DEBUGGER": False, # 0x8 - Allow Kernel Debugger - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_APPLE_INTERNAL": False, # 0x10 - Set AppleInternal Features - Introduced in El Capitan # noqa: E241
# "CSR_ALLOW_DESTRUCTIVE_DTRACE": False, # 0x20 - Allow destructive DTrace - Deprecated # noqa: E241
"CSR_ALLOW_UNRESTRICTED_DTRACE": False, # 0x20 - Unrestricted DTrace usage - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_UNRESTRICTED_NVRAM": False, # 0x40 - Unrestricted NVRAM write - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_DEVICE_CONFIGURATION": False, # 0x80 - Allow custom DeviceTree (iOS) - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_ANY_RECOVERY_OS": False, # 0x100 - Skip BaseSystem Verification - Introduced in Sierra # noqa: E241
"CSR_ALLOW_UNAPPROVED_KEXTS": False, # 0x200 - Allow Unnotarized Kexts - Introduced in High Sierra # noqa: E241
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE": False, # 0x400 - Override Executable Policy - Introduced in Mojave # noqa: E241
"CSR_ALLOW_UNAUTHENTICATED_ROOT": False, # 0x800 - Allow Root Volume Mounting - Introduced in Big Sur # noqa: E241
}
@property
def legacy_mux_path(self):
return self.payload_apple_kexts_path / Path("Legacy-Mux")
root_patch_sip_mojave = [
# Variables required to root patch in Mojave and Catalina
"CSR_ALLOW_UNTRUSTED_KEXTS",
"CSR_ALLOW_UNRESTRICTED_FS",
"CSR_ALLOW_UNAPPROVED_KEXTS",
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE",
]
@property
def legacy_wifi_coreservices(self):
return self.payload_apple_coreservices_path / Path("Legacy-Wifi")
root_patch_sip_big_sur = [
# Variables required to root patch in Big Sur and Monterey
"CSR_ALLOW_UNTRUSTED_KEXTS",
"CSR_ALLOW_UNRESTRICTED_FS",
"CSR_ALLOW_UNAPPROVED_KEXTS",
"CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE",
"CSR_ALLOW_UNAUTHENTICATED_ROOT",
]
@property
def legacy_wifi_libexec(self):
return self.payload_apple_libexec_path / Path("Legacy-Wifi")
sbm_values = [
"j137", # iMacPro1,1
"j680", # MacBookPro15,1
"j132", # MacBookPro15,2
"j174", # Macmini8,1
"j140k", # MacBookAir8,1
"j780", # MacBookPro15,3
"j213", # MacBookPro15,4
"j140a", # MacBookAir8,2
"j152f", # MacBookPro16,1
"j160", # MacPro7,1
"j230k", # MacBookAir9,1
"j214k", # MacBookPro16,2
"j223", # MacBookPro16,3
"j215", # MacBookPro16,4
"j185", # iMac20,1
"j185f", # iMac20,2
"j137ap", # iMacPro1,1
"j680ap", # MacBookPro15,1
"j132ap", # MacBookPro15,2
"j174ap", # Macmini8,1
"j140kap", # MacBookAir8,1
"j780ap", # MacBookPro15,3
"j213ap", # MacBookPro15,4
"j140aap", # MacBookAir8,2
"j152fap", # MacBookPro16,1
"j160ap", # MacPro7,1
"j230kap", # MacBookAir9,1
"j214kap", # MacBookPro16,2
"j223ap", # MacBookPro16,3
"j215ap", # MacBookPro16,4
"j185ap", # iMac20,1
"j185fap", # iMac20,2
# "x86legacy", # non-T2 Macs/VMs, Monterey's boot.efi enforces this on all Macs
]
sandy_board_id = [
@@ -603,127 +664,17 @@ class Constants:
"Mac-7BA5B2D9E42DDD94", # iMacPro1,1
]
board_id = {
"MacBook1,1": "Mac-F4208CC8",
"MacBook2,1": "Mac-F4208CA9",
"MacBook3,1": "Mac-F22788C8",
"MacBook4,1": "Mac-F22788A9",
"MacBook5,1": "Mac-F42D89C8",
"MacBook5,2": "Mac-F22788AA",
"MacBook6,1": "Mac-F22C8AC8",
"MacBook7,1": "Mac-F22C89C8",
"MacBook8,1": "Mac-BE0E8AC46FE800CC",
"MacBook9,1": "Mac-9AE82516C7C6B903",
"MacBook10,1": "Mac-EE2EBD4B90B839A8",
"MacBookAir1,1": "Mac-F42C8CC8",
"MacBookAir2,1": "Mac-F42D88C8",
"MacBookAir3,1": "Mac-942452F5819B1C1B",
"MacBookAir3,2": "Mac-942C5DF58193131B",
"MacBookAir4,1": "Mac-C08A6BB70A942AC2",
"MacBookAir4,2": "Mac-742912EFDBEE19B3",
"MacBookAir5,1": "Mac-66F35F19FE2A0D05",
"MacBookAir5,2": "Mac-2E6FAB96566FE58C",
"MacBookAir6,1": "Mac-35C1E88140C3E6CF",
"MacBookAir6,2": "Mac-7DF21CB3ED6977E5",
"MacBookAir7,1": "Mac-9F18E312C5C2BF0B",
"MacBookAir7,2": "Mac-937CB26E2E02BB01",
"MacBookAir8,1": "Mac-827FAC58A8FDFA22",
"MacBookAir8,2": "Mac-226CB3C6A851A671",
"MacBookAir9,1": "Mac-0CFF9C7C2B63DF8D",
"MacBookPro1,1": "Mac-F425BEC8",
"MacBookPro1,2": "Mac-F42DBEC8",
"MacBookPro2,1": "Mac-F42189C8",
"MacBookPro2,2": "Mac-F42187C8",
"MacBookPro3,1": "Mac-F4238BC8",
"MacBookPro4,1": "Mac-F42C89C8",
"MacBookPro5,1": "Mac-F42D86C8",
"MacBookPro5,2": "Mac-F2268EC8",
"MacBookPro5,3": "Mac-F22587C8",
"MacBookPro5,4": "Mac-F22587A1",
"MacBookPro5,5": "Mac-F2268AC8",
"MacBookPro6,1": "Mac-F22589C8",
"MacBookPro6,2": "Mac-F22586C8",
"MacBookPro7,1": "Mac-F222BEC8",
"MacBookPro8,1": "Mac-94245B3640C91C81",
"MacBookPro8,2": "Mac-94245A3940C91C80",
"MacBookPro8,3": "Mac-942459F5819B171B",
"MacBookPro9,1": "Mac-4B7AC7E43945597E",
"MacBookPro9,2": "Mac-6F01561E16C75D06",
"MacBookPro10,1": "Mac-C3EC7CD22292981F",
"MacBookPro10,2": "Mac-AFD8A9D944EA4843",
"MacBookPro11,1": "Mac-189A3D4F975D5FFC",
"MacBookPro11,2": "Mac-3CBD00234E554E41",
"MacBookPro11,3": "Mac-2BD1B31983FE1663",
"MacBookPro11,4": "Mac-06F11FD93F0323C5",
"MacBookPro11,5": "Mac-06F11F11946D27C5",
"MacBookPro12,1": "Mac-E43C1C25D4880AD6",
"MacBookPro13,1": "Mac-473D31EABEB93F9B",
"MacBookPro13,2": "Mac-66E35819EE2D0D05",
"MacBookPro13,3": "Mac-A5C67F76ED83108C",
"MacBookPro14,1": "Mac-B4831CEBD52A0C4C",
"MacBookPro14,2": "Mac-CAD6701F7CEA0921",
"MacBookPro14,3": "Mac-551B86E5744E2388",
"MacBookPro15,1": "Mac-937A206F2EE63C01",
"MacBookPro15,2": "Mac-827FB448E656EC26",
"MacBookPro15,3": "Mac-1E7E29AD0135F9BC",
"MacBookPro15,4": "Mac-53FDB3D8DB8CA971",
"MacBookPro16,1": "Mac-E1008331FDC96864",
"MacBookPro16,2": "Mac-5F9802EFE386AA28",
"MacBookPro16,3": "Mac-E7203C0F68AA0004",
"MacBookPro16,4": "Mac-A61BADE1FDAD7B05",
"Macmini1,1": "Mac-F4208EC8",
"Macmini2,1": "Mac-F4208EAA",
"Macmini3,1": "Mac-F22C86C8",
"Macmini4,1": "Mac-F2208EC8",
"Macmini5,1": "Mac-8ED6AF5B48C039E1",
"Macmini5,2": "Mac-4BC72D62AD45599E",
"Macmini5,3": "Mac-7BA5B2794B2CDB12",
"Macmini6,1": "Mac-031AEE4D24BFF0B1",
"Macmini6,2": "Mac-F65AE981FFA204ED",
"Macmini7,1": "Mac-35C5E08120C7EEAF",
"Macmini8,1": "Mac-7BA5B2DFE22DDD8C",
"iMac4,1": "Mac-F42786C8",
"iMac4,2": "Mac-F4218EC8",
"iMac5,1": "Mac-F4228EC8",
"iMac5,2": "Mac-F4218EC8",
"iMac6,1": "Mac-F4218FC8",
"iMac7,1": "Mac-F42386C8",
"iMac8,1": "Mac-F227BEC8",
"iMac9,1": "Mac-F2218FA9",
"iMac10,1": "Mac-F221DCC8",
# "iMac10,1": "Mac-F2268CC8",
"iMac11,1": "Mac-F2268DAE",
"iMac11,2": "Mac-F2238AC8",
"iMac11,3": "Mac-F2238BAE",
"iMac12,1": "Mac-942B5BF58194151B",
"iMac12,2": "Mac-942B59F58194171B",
"iMac13,1": "Mac-00BE6ED71E35EB86",
"iMac13,2": "Mac-FC02E91DDD3FA6A4",
"iMac13,3": "Mac-7DF2A3B5E5D671ED",
"iMac14,1": "Mac-031B6874CF7F642A",
"iMac14,2": "Mac-27ADBB7B4CEE8E61",
"iMac14,3": "Mac-77EB7D7DAF985301",
"iMac14,4": "Mac-81E3E92DD6088272",
"iMac15,1": "Mac-42FD25EABCABB274",
"iMac16,1": "Mac-A369DDC4E67F1C45",
"iMac16,2": "Mac-FFE5EF870D7BA81A",
"iMac17,1": "Mac-DB15BD556843C820",
"iMac18,1": "Mac-4B682C642B45593E",
"iMac18,2": "Mac-77F17D7DA9285301",
"iMac18,3": "Mac-BE088AF8C5EB4FA2",
"iMac19,1": "Mac-AA95B1DDAB278B95",
"iMac19,2": "Mac-63001698E7A34814",
"iMac20,1": "Mac-CFF7D910A743CAAF",
"iMac20,2": "Mac-AF89B6D9451A490B",
"iMacPro1,1": "Mac-7BA5B2D9E42DDD94",
"MacPro1,1": "Mac-F4208DC8",
"MacPro2,1": "Mac-F4208DA9",
"MacPro3,1": "Mac-F42C88C8",
"MacPro4,1": "Mac-F221BEC8",
"MacPro5,1": "Mac-F221BEC8",
"MacPro6,1": "Mac-F60DEB81FF30ACF6",
"MacPro7,1": "Mac-27AD2F918AE68F61",
"Xserve1,1": "Mac-F4208AC8",
"Xserve2,1": "Mac-F42289C8",
"Xserve3,1": "Mac-F223BEC8",
}
sandy_board_id_stock = [
"Mac-94245B3640C91C81", # MacBookPro8,1
"Mac-94245A3940C91C80", # MacBookPro8,2
"Mac-942459F5819B171B", # MacBookPro8,3
"Mac-C08A6BB70A942AC2", # MacBookAir4,1
"Mac-742912EFDBEE19B3", # MacBookAir4,2
"Mac-8ED6AF5B48C039E1", # Macmini5,1
"Mac-4BC72D62AD45599E", # Macmini5,2
"Mac-7BA5B2794B2CDB12", # Macmini5,3
"Mac-942B5BF58194151B", # iMac12,1
"Mac-942B59F58194171B", # iMac12,2
"Mac-94245AF5819B141B", # AppleInternal MacBookPro8,3
"Mac-942B5B3A40C91381", # AppleInternal iMac12,2
]

75
resources/defaults.py Normal file
View File

@@ -0,0 +1,75 @@
# Generate Default Data
from resources import utilities, device_probe
from data import model_array
class generate_defaults:
def probe(model, host_is_target, settings):
# Generate Default Data
# Takes in Settings data set, and returns updated Settings
settings.sip_status = True
settings.secure_status = False # Default false for Monterey
settings.amfi_status = True
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 (
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):
settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal
elif model in model_array.LegacyGPU:
settings.disable_cs_lv = True
if model in model_array.LegacyGPU:
if host_is_target and utilities.check_metal_support(device_probe, settings.computer) is True:
# Building on device and we have a native, supported GPU
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
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
settings.amfi_status = False # Unsigned binaries
settings.allow_fv_root = True # Allow FileVault on broken seal
if model in model_array.ModernGPU:
# Systems with Ivy or Kepler GPUs, Monterey requires root patching for accel
settings.sip_status = False # Unsigned kexts
settings.secure_status = False # Modified root volume
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
settings.custom_cpu_model = 1
settings.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
if "-v" in (utilities.get_nvram("boot-args") or ""):
settings.verbose_debug = True
if utilities.amfi_status() is False:
settings.amfi_status = False
if model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Users disabling TS2 most likely have a faulty dGPU
# users can override this in settings
settings.allow_ts2_accel = False
# Check if running in RecoveryOS
settings.recovery_status = utilities.check_recovery()

View File

@@ -10,7 +10,8 @@ import subprocess
from dataclasses import dataclass, field
from typing import Any, ClassVar, Optional, Type, Union
from Resources import PCIIDArray, Utilities, ioreg
from resources import utilities, ioreg
from data import pci_data
@dataclass
@@ -25,11 +26,12 @@ class PCIDevice:
vendor_id: int # The vendor ID of this PCI device
device_id: int # The device ID of this PCI device
class_code: int # The class code of this PCI device
class_code: int # The class code of this PCI device - https://pci-ids.ucw.cz/read/PD
# ioregistryentry: Optional[ioreg.IORegistryEntry] = None
name: Optional[str] = None # Name of IORegistryEntry
model: Optional[str] = None # model property
acpi_path: Optional[str] = None
pci_path: Optional[str] = None
# def __getstate__(self):
@@ -48,6 +50,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()
device.populate_pci_path(entry)
return device
@@ -156,6 +160,7 @@ class NVIDIA(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
Curie = "Curie"
Fermi = "Fermi"
Tesla = "Tesla"
Kepler = "Kepler"
@@ -165,11 +170,13 @@ class NVIDIA(GPU):
def detect_arch(self):
# G80/G80GL
if self.device_id in PCIIDArray.nvidia_ids.tesla_ids:
if self.device_id in pci_data.nvidia_ids.curie_ids:
self.arch = NVIDIA.Archs.Curie
elif self.device_id in pci_data.nvidia_ids.tesla_ids:
self.arch = NVIDIA.Archs.Tesla
elif self.device_id in PCIIDArray.nvidia_ids.fermi_ids:
elif self.device_id in pci_data.nvidia_ids.fermi_ids:
self.arch = NVIDIA.Archs.Fermi
elif self.device_id in PCIIDArray.nvidia_ids.kepler_ids:
elif self.device_id in pci_data.nvidia_ids.kepler_ids:
self.arch = NVIDIA.Archs.Kepler
else:
self.arch = NVIDIA.Archs.Unknown
@@ -181,9 +188,12 @@ class AMD(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
Legacy_GCN = "Legacy GCN"
R500 = "R500"
TeraScale_1 = "TeraScale 1"
TeraScale_2 = "TeraScale 2"
Legacy_GCN_7000 = "Legacy GCN v1"
Legacy_GCN_8000 = "Legacy GCN v2"
Legacy_GCN_9000 = "Legacy GCN v3"
Polaris = "Polaris"
Vega = "Vega"
Navi = "Navi"
@@ -192,17 +202,23 @@ class AMD(GPU):
arch: Archs = field(init=False)
def detect_arch(self):
if self.device_id in PCIIDArray.amd_ids.legacy_gcn_ids:
self.arch = AMD.Archs.Legacy_GCN
elif self.device_id in PCIIDArray.amd_ids.terascale_1_ids:
if self.device_id in pci_data.amd_ids.r500_ids:
self.arch = AMD.Archs.R500
elif self.device_id in pci_data.amd_ids.gcn_7000_ids:
self.arch = AMD.Archs.Legacy_GCN_7000
elif self.device_id in pci_data.amd_ids.gcn_8000_ids:
self.arch = AMD.Archs.Legacy_GCN_8000
elif self.device_id in pci_data.amd_ids.gcn_9000_ids:
self.arch = AMD.Archs.Legacy_GCN_9000
elif self.device_id in pci_data.amd_ids.terascale_1_ids:
self.arch = AMD.Archs.TeraScale_1
elif self.device_id in PCIIDArray.amd_ids.terascale_2_ids:
elif self.device_id in pci_data.amd_ids.terascale_2_ids:
self.arch = AMD.Archs.TeraScale_2
elif self.device_id in PCIIDArray.amd_ids.polaris_ids:
elif self.device_id in pci_data.amd_ids.polaris_ids:
self.arch = AMD.Archs.Polaris
elif self.device_id in PCIIDArray.amd_ids.vega_ids:
elif self.device_id in pci_data.amd_ids.vega_ids:
self.arch = AMD.Archs.Vega
elif self.device_id in PCIIDArray.amd_ids.navi_ids:
elif self.device_id in pci_data.amd_ids.navi_ids:
self.arch = AMD.Archs.Navi
else:
self.arch = AMD.Archs.Unknown
@@ -214,20 +230,47 @@ class Intel(GPU):
class Archs(enum.Enum):
# pylint: disable=invalid-name
GMA_950 = "GMA 950"
GMA_X3100 = "GMA X3100"
Iron_Lake = "Iron Lake"
Sandy_Bridge = "Sandy Bridge"
Ivy_Bridge = "Ivy Bridge"
Haswell = "Haswell"
Broadwell = "Broadwell"
Skylake = "Skylake"
Kaby_Lake = "Kaby Lake"
Coffee_Lake = "Coffee Lake"
Comet_Lake = "Comet Lake"
Ice_Lake = "Ice Lake"
Unknown = "Unknown"
arch: Archs = field(init=False)
def detect_arch(self):
if self.device_id in PCIIDArray.intel_ids.iron_ids:
if self.device_id in pci_data.intel_ids.gma_950_ids:
self.arch = Intel.Archs.GMA_950
elif self.device_id in pci_data.intel_ids.gma_x3100_ids:
self.arch = Intel.Archs.GMA_X3100
elif self.device_id in pci_data.intel_ids.iron_ids:
self.arch = Intel.Archs.Iron_Lake
elif self.device_id in PCIIDArray.intel_ids.sandy_ids:
elif self.device_id in pci_data.intel_ids.sandy_ids:
self.arch = Intel.Archs.Sandy_Bridge
elif self.device_id in PCIIDArray.intel_ids.ivy_ids:
elif self.device_id in pci_data.intel_ids.ivy_ids:
self.arch = Intel.Archs.Ivy_Bridge
elif self.device_id in pci_data.intel_ids.haswell_ids:
self.arch = Intel.Archs.Haswell
elif self.device_id in pci_data.intel_ids.broadwell_ids:
self.arch = Intel.Archs.Broadwell
elif self.device_id in pci_data.intel_ids.skylake_ids:
self.arch = Intel.Archs.Skylake
elif self.device_id in pci_data.intel_ids.kaby_lake_ids:
self.arch = Intel.Archs.Kaby_Lake
elif self.device_id in pci_data.intel_ids.coffee_lake_ids:
self.arch = Intel.Archs.Coffee_Lake
elif self.device_id in pci_data.intel_ids.comet_lake_ids:
self.arch = Intel.Archs.Comet_Lake
elif self.device_id in pci_data.intel_ids.ice_lake_ids:
self.arch = Intel.Archs.Ice_Lake
else:
self.arch = Intel.Archs.Unknown
@@ -238,6 +281,7 @@ class Broadcom(WirelessCard):
class Chipsets(enum.Enum):
# pylint: disable=invalid-name
AppleBCMWLANBusInterfacePCIe = "AppleBCMWLANBusInterfacePCIe supported"
AirportBrcmNIC = "AirportBrcmNIC supported"
AirPortBrcm4360 = "AirPortBrcm4360 supported"
AirPortBrcm4331 = "AirPortBrcm4331 supported"
@@ -247,13 +291,15 @@ class Broadcom(WirelessCard):
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in PCIIDArray.broadcom_ids.AirPortBrcmNIC:
if self.device_id in pci_data.broadcom_ids.AppleBCMWLANBusInterfacePCIe:
self.chipset = Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe
elif self.device_id in pci_data.broadcom_ids.AirPortBrcmNIC:
self.chipset = Broadcom.Chipsets.AirportBrcmNIC
elif self.device_id in PCIIDArray.broadcom_ids.AirPortBrcm4360:
elif self.device_id in pci_data.broadcom_ids.AirPortBrcm4360:
self.chipset = Broadcom.Chipsets.AirPortBrcm4360
elif self.device_id in PCIIDArray.broadcom_ids.AirPortBrcm4331:
elif self.device_id in pci_data.broadcom_ids.AirPortBrcm4331:
self.chipset = Broadcom.Chipsets.AirPortBrcm4331
elif self.device_id in PCIIDArray.broadcom_ids.AppleAirPortBrcm43224:
elif self.device_id in pci_data.broadcom_ids.AppleAirPortBrcm43224:
self.chipset = Broadcom.Chipsets.AirPortBrcm43224
else:
self.chipset = Broadcom.Chipsets.Unknown
@@ -272,7 +318,7 @@ class Atheros(WirelessCard):
chipset: Chipsets = field(init=False)
def detect_chipset(self):
if self.device_id in PCIIDArray.atheros_ids.AtherosWifi:
if self.device_id in pci_data.atheros_ids.AtherosWifi:
self.chipset = Atheros.Chipsets.AirPortAtheros40
else:
self.chipset = Atheros.Chipsets.Unknown
@@ -292,6 +338,7 @@ class Computer:
cpu: Optional[CPU] = None
oclp_version: Optional[str] = None
opencore_version: Optional[str] = None
bluetooth_chipset: Optional[str] = None
@staticmethod
def probe():
@@ -303,6 +350,7 @@ class Computer:
computer.storage_probe()
computer.smbios_probe()
computer.cpu_probe()
computer.bluetooth_probe()
return computer
def gpu_probe(self):
@@ -346,7 +394,7 @@ class Computer:
devices = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault,
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": {"class-code": binascii.a2b_hex(Utilities.hexswap(hex(WirelessCard.CLASS_CODE)[2:].zfill(8)))}},
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": {"class-code": binascii.a2b_hex(utilities.hexswap(hex(WirelessCard.CLASS_CODE)[2:].zfill(8)))}},
None,
)[1]
)
@@ -362,7 +410,7 @@ class Computer:
sata_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
ioreg.kIOMasterPortDefault,
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": [{"class-code": binascii.a2b_hex(Utilities.hexswap(hex(SATAController.CLASS_CODE)[2:].zfill(8)))}]},
{"IOProviderClass": "IOPCIDevice", "IOPropertyMatch": [{"class-code": binascii.a2b_hex(utilities.hexswap(hex(SATAController.CLASS_CODE)[2:].zfill(8)))}]},
None,
)[1]
)
@@ -404,15 +452,26 @@ class Computer:
# Real model
# TODO: We previously had logic for OC users using iMacPro1,1 with incorrect ExposeSensitiveData. Add logic?
self.real_model = Utilities.get_nvram("oem-product", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_model
self.real_board_id = Utilities.get_nvram("oem-board", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_board_id
self.real_model = utilities.get_nvram("oem-product", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_model
self.real_board_id = utilities.get_nvram("oem-board", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_board_id
# OCLP version
self.oclp_version = Utilities.get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
self.opencore_version = Utilities.get_nvram("opencore-version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
self.oclp_version = utilities.get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
self.opencore_version = utilities.get_nvram("opencore-version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
def cpu_probe(self):
self.cpu = CPU(
subprocess.run("sysctl machdep.cpu.brand_string".split(), stdout=subprocess.PIPE).stdout.decode().partition(": ")[2].strip(),
subprocess.run("sysctl machdep.cpu.features".split(), stdout=subprocess.PIPE).stdout.decode().partition(": ")[2].strip().split(" "),
)
def bluetooth_probe(self):
usb_data: str = subprocess.run("system_profiler SPUSBDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if "BRCM2070 Hub" in usb_data:
self.bluetooth_chipset = "BRCM2070 Hub"
elif "BRCM2046 Hub" in usb_data:
self.bluetooth_chipset = "BRCM2046 Hub"
elif "BRCM20702 Hub" in usb_data:
self.bluetooth_chipset = "BRCM20702 Hub"
elif "Bluetooth":
self.bluetooth_chipset = "Generic"

View File

@@ -0,0 +1,100 @@
from data import smbios_data, os_data
from resources import utilities
def set_smbios_model_spoof(model):
try:
smbios_data.smbios_dictionary[model]["Screen Size"]
# Found mobile SMBIOS
if model.startswith("MacBookAir"):
if smbios_data.smbios_dictionary[model]["Screen Size"] == 13:
return "MacBookAir7,2"
elif smbios_data.smbios_dictionary[model]["Screen Size"] == 11:
return "MacBookAir7,1"
else:
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
elif model.startswith("MacBookPro"):
if smbios_data.smbios_dictionary[model]["Screen Size"] == 13:
return "MacBookPro12,1"
elif smbios_data.smbios_dictionary[model]["Screen Size"] >= 15:
# 15" and 17"
try:
smbios_data.smbios_dictionary[model]["Switchable GPUs"]
return "MacBookPro11,5"
except KeyError:
return "MacBookPro11,4"
else:
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
elif model.startswith("MacBook"):
if smbios_data.smbios_dictionary[model]["Screen Size"] == 13:
return "MacBookAir7,2"
elif smbios_data.smbios_dictionary[model]["Screen Size"] == 12:
return "MacBook9,1"
else:
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
else:
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
except KeyError:
# Found desktop model
if model.startswith("MacPro") or model.startswith("Xserve"):
return "MacPro7,1"
elif model.startswith("Macmini"):
return "Macmini7,1"
elif model.startswith("iMac"):
if smbios_data.smbios_dictionary[model]["Max OS Supported"] <= os_data.os_data.high_sierra:
# Models dropped in Mojave either do not have an iGPU, or should have them disabled
return "iMacPro1,1"
else:
return "iMac17,1"
else:
# Unknown Model
raise Exception(f"Unknown SMBIOS for spoofing: {model}")
def update_firmware_features(firmwarefeature):
# Adjust FirmwareFeature to support everything macOS requires
# APFS Bit (19/20): 10.13+ (OSInstall)
# Large BaseSystem Bit (35): 12.0 B7+ (patchd)
# https://github.com/acidanthera/OpenCorePkg/tree/2f76673546ac3e32d2e2d528095fddcd66ad6a23/Include/Apple/IndustryStandard/AppleFeatures.h
firmwarefeature |= 2 ** 19 # FW_FEATURE_SUPPORTS_APFS
firmwarefeature |= 2 ** 20 # FW_FEATURE_SUPPORTS_APFS_EXTRA
firmwarefeature |= 2 ** 35 # FW_FEATURE_SUPPORTS_LARGE_BASESYSTEM
return firmwarefeature
def generate_fw_features(model, custom):
if not custom:
firmwarefeature = utilities.get_rom("firmware-features")
if not firmwarefeature:
print("- Failed to find FirmwareFeatures, falling back on defaults")
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
else:
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
firmwarefeature = update_firmware_features(firmwarefeature)
return firmwarefeature
def find_model_off_board(board):
# Find model based off Board ID provided
# Return none if unknown
# Strip extra data from Target Types (ap, uppercase)
if not (board.startswith("Mac-") or board.startswith("VMM-")):
if board.lower().endswith("ap"):
board = board[:-2]
board = board.lower()
for key in smbios_data.smbios_dictionary:
if board in [smbios_data.smbios_dictionary[key]["Board ID"], smbios_data.smbios_dictionary[key]["SecureBootModel"]]:
if key.endswith("_v2") or key.endswith("_v3") or key.endswith("_v4"):
# smbios_data has duplicate SMBIOS to handle multiple board IDs
key = key[:-3]
if key == "MacPro4,1":
# 4,1 and 5,1 have the same board ID, best to return the newer ID
key = "MacPro5,1"
return key
return None

View File

@@ -4,8 +4,17 @@
from __future__ import annotations
from typing import NewType, Union
import subprocess
try:
import objc
except ImportError:
subprocess.run(["pip3", "install", "pyobjc"], stdout=subprocess.PIPE)
try:
import objc
except ImportError:
raise Exception("Missing PyObjc library!\nPlease run the following before starting OCLP:\npip3 install pyobjc")
import objc
from CoreFoundation import CFRelease, kCFAllocatorDefault # type: ignore # pylint: disable=no-name-in-module
from Foundation import NSBundle # type: ignore # pylint: disable=no-name-in-module
from PyObjCTools import Conversion

Some files were not shown because too many files have changed in this diff Show More