Skip to content

Commit bbd379a

Browse files
committed
Allow Root Patches by default on legacy GPUs
1 parent 2b04a06 commit bbd379a

File tree

6 files changed

+111
-91
lines changed

6 files changed

+111
-91
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Strip unused kext entries during build
1919
- Add gfxutil support for better DeviceProperty path detection
2020
- Add basic CLI support
21+
- Disable SIP and SecureBootModel by default on legacy GPUs
2122

2223
## 0.0.22
2324
- Add ExFat support for models missing driver

OCLP-CLI.command

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class OpenCoreLegacyPatcher():
2727
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
2828
if self.current_model in ModelArray.NoAPFSsupport:
2929
self.constants.serial_settings = "Moderate"
30+
if self.current_model in ModelArray.LegacyGPU:
31+
Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False)
32+
if not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs) or not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs):
33+
self.constants.sip_status = False
34+
self.constants.secure_status = False
3035

3136
# Logic for when user runs custom OpenCore build and do not expose it
3237
# Note: This logic currently only applies for iMacPro1,1 users, see below threads on the culprits:
@@ -152,4 +157,4 @@ class OpenCoreLegacyPatcher():
152157
OpenCoreLegacyPatcher()
153158

154159
# Example arg for OCLP command line
155-
# ./OCLP --build --verbose --debug_oc --debug_kext --model iMac11,2
160+
# ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2

OpenCore-Patcher.command

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class OpenCoreLegacyPatcher():
2525
self.constants.detected_os = int(platform.uname().release.partition(".")[0])
2626
if self.current_model in ModelArray.NoAPFSsupport:
2727
self.constants.serial_settings = "Moderate"
28+
if self.current_model in ModelArray.LegacyGPU:
29+
Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False)
30+
if not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs) or not (self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs):
31+
self.constants.sip_status = False
32+
self.constants.secure_status = False
2833

2934
# Logic for when user runs custom OpenCore build and do not expose it
3035
# Note: This logic currently only applies for iMacPro1,1 users, see below threads on the culprits:

Resources/Build.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,30 @@ def hexswap(self, input_hex: str):
4343
hex_str = "".join(["".join(x) for x in hex_rev])
4444
return hex_str.upper()
4545

46-
def check_pciid(self):
46+
def check_pciid(self, print_status):
4747
try:
48-
self.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
49-
self.igpu_devices = [i for i in self.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
50-
self.igpu_vendor = self.hexswap(binascii.hexlify(self.igpu_devices[0]["vendor-id"]).decode()[:4])
51-
self.igpu_device = self.hexswap(binascii.hexlify(self.igpu_devices[0]["device-id"]).decode()[:4])
52-
print(f"- Detected iGPU: {self.igpu_vendor}:{self.igpu_device}")
48+
self.constants.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
49+
self.constants.igpu_devices = [i for i in self.constants.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
50+
self.constants.igpu_vendor = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["vendor-id"]).decode()[:4])
51+
self.constants.igpu_device = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["device-id"]).decode()[:4])
52+
if print_status is True:
53+
print(f"- Detected iGPU: {self.constants.igpu_vendor}:{self.constants.igpu_device}")
5354
except ValueError:
54-
print("- No iGPU detected")
55-
self.igpu_devices = ""
55+
if print_status is True:
56+
print("- No iGPU detected")
57+
self.constants.igpu_devices = ""
5658

5759
try:
58-
self.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
59-
self.dgpu_devices = [i for i in self.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
60-
self.dgpu_vendor = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["vendor-id"]).decode()[:4])
61-
self.dgpu_device = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["device-id"]).decode()[:4])
62-
print(f"- Detected dGPU: {self.dgpu_vendor}:{self.dgpu_device}")
60+
self.constants.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
61+
self.constants.dgpu_devices = [i for i in self.constants.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")]
62+
self.constants.dgpu_vendor = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["vendor-id"]).decode()[:4])
63+
self.constants.dgpu_device = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["device-id"]).decode()[:4])
64+
if print_status is True:
65+
print(f"- Detected dGPU: {self.constants.dgpu_vendor}:{self.constants.dgpu_device}")
6366
except ValueError:
64-
print("- No dGPU detected")
65-
self.dgpu_devices = ""
67+
if print_status is True:
68+
print("- No dGPU detected")
69+
self.constants.dgpu_devices = ""
6670

6771
def build_efi(self):
6872
Utilities.cls()
@@ -310,10 +314,10 @@ def amd_patch(self):
310314
else:
311315
print("- Failed to find vendor")
312316
elif self.constants.custom_model == "None":
313-
self.check_pciid()
314-
if self.dgpu_devices and self.dgpu_vendor == self.constants.pci_amd_ati and self.dgpu_device in ModelArray.AMDMXMGPUs:
317+
self.check_pciid(True)
318+
if self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs:
315319
amd_patch(self)
316-
elif self.dgpu_devices and self.dgpu_vendor == self.constants.pci_nvidia and self.dgpu_device in ModelArray.NVIDIAMXMGPUs:
320+
elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs:
317321
nvidia_patch(self)
318322
elif self.model in ModelArray.MacPro71:
319323
print("- Adding Mac Pro, Xserve DRM patches")

Resources/Constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def __init__(self):
4444
self.custom_mxm_gpu: str = None
4545
self.current_gpuv: str = None
4646
self.current_gpud: str = None
47+
self.igpu_vendor = ""
48+
self.igpu_device = ""
49+
self.dgpu_vendor = ""
50+
self.dgpu_device = ""
4751

4852
# Patcher Settings
4953
self.opencore_debug = False

Resources/ModelArray.py

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@
332332
"Macmini5,2", # AMD 6000
333333
"Macmini5,3", # Intel 3000
334334
"iMac7,1", # AMD 2000
335-
"iMac8,1", # Nvidia and AMD 2400
335+
"iMac8,1", # Nvidia and AMD 2400
336336
"iMac9,1", # Nvidia 9000
337-
"iMac10,1", # Nvidia 9000 and AMD 4000
337+
"iMac10,1", # Nvidia 9000 and AMD 4000
338338
"iMac11,1", # AMD 4000
339339
"iMac11,2", # AMD 4000 and 5000
340340
"iMac11,3", # AMD 5000
@@ -712,6 +712,7 @@
712712
"67E8", # AMD WX 4130/WX 4150
713713
"67E0", # AMD WX 4170
714714
"67C0", # AMD WX 7100
715+
"67DF", # AMD RX 480
715716
]
716717

717718
BCM4360Wifi = [
@@ -1041,83 +1042,83 @@
10411042
# List supported IDs
10421043

10431044
TeraScale1pciid = [
1044-
"9400",
1045-
"9401",
1046-
"9402",
1047-
"9403",
1048-
"9581",
1049-
"9583",
1050-
"9588",
1051-
"94c8",
1052-
"94c9",
1053-
"9500",
1054-
"9501",
1055-
"9505",
1056-
"9507",
1057-
"9504",
1058-
"9506",
1059-
"9598",
1060-
"9488",
1061-
"9599",
1062-
"9591",
1063-
"9593",
1064-
"9440",
1065-
"9442",
1066-
"944A",
1067-
"945A",
1068-
"9490",
1069-
"949E",
1070-
"9480",
1071-
"9540",
1072-
"9541",
1073-
"954E",
1074-
"954F",
1075-
"9552",
1076-
"9553",
1077-
"94a0",
1045+
"9400",
1046+
"9401",
1047+
"9402",
1048+
"9403",
1049+
"9581",
1050+
"9583",
1051+
"9588",
1052+
"94c8",
1053+
"94c9",
1054+
"9500",
1055+
"9501",
1056+
"9505",
1057+
"9507",
1058+
"9504",
1059+
"9506",
1060+
"9598",
1061+
"9488",
1062+
"9599",
1063+
"9591",
1064+
"9593",
1065+
"9440",
1066+
"9442",
1067+
"944A",
1068+
"945A",
1069+
"9490",
1070+
"949E",
1071+
"9480",
1072+
"9540",
1073+
"9541",
1074+
"954E",
1075+
"954F",
1076+
"9552",
1077+
"9553",
1078+
"94a0",
10781079
]
10791080

10801081
TeraScale2pciid = [
1081-
"6738",
1082-
"6739",
1083-
"6720",
1084-
"6722",
1085-
"6768",
1086-
"6770",
1087-
"6779",
1088-
"6760",
1089-
"6761",
1090-
"68E0",
1091-
"6898",
1092-
"6899",
1093-
"68B8",
1094-
"68B0",
1095-
"68B1",
1096-
"68A0",
1097-
"68A1",
1098-
"6840",
1099-
"6841",
1100-
"68D8",
1101-
"68C0",
1102-
"68C1",
1103-
"68D9",
1104-
"6750",
1105-
"6758",
1106-
"6759",
1107-
"6740",
1108-
"6741",
1109-
"6745",
1082+
"6738",
1083+
"6739",
1084+
"6720",
1085+
"6722",
1086+
"6768",
1087+
"6770",
1088+
"6779",
1089+
"6760",
1090+
"6761",
1091+
"68E0",
1092+
"6898",
1093+
"6899",
1094+
"68B8",
1095+
"68B0",
1096+
"68B1",
1097+
"68A0",
1098+
"68A1",
1099+
"6840",
1100+
"6841",
1101+
"68D8",
1102+
"68C0",
1103+
"68C1",
1104+
"68D9",
1105+
"6750",
1106+
"6758",
1107+
"6759",
1108+
"6740",
1109+
"6741",
1110+
"6745",
11101111
]
11111112

11121113
IronLakepciid = [
1113-
"0044",
1114-
"0046",
1114+
"0044",
1115+
"0046",
11151116
]
11161117

11171118
SandyBridgepiciid = [
1118-
"0106",
1119-
"0601",
1120-
"0116",
1121-
"0102",
1122-
"0126",
1119+
"0106",
1120+
"0601",
1121+
"0116",
1122+
"0102",
1123+
"0126",
11231124
]

0 commit comments

Comments
 (0)