diff --git a/CHANGELOG.md b/CHANGELOG.md index 965c5924e..c526399b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - Strip unused kext entries during build - Add gfxutil support for better DeviceProperty path detection - Add basic CLI support +- Disable SIP and SecureBootModel by default on legacy GPUs ## 0.0.22 - Add ExFat support for models missing driver diff --git a/OCLP-CLI.command b/OCLP-CLI.command index 3bf51fbcc..4276fbcb4 100755 --- a/OCLP-CLI.command +++ b/OCLP-CLI.command @@ -27,6 +27,11 @@ class OpenCoreLegacyPatcher(): self.constants.detected_os = int(platform.uname().release.partition(".")[0]) if self.current_model in ModelArray.NoAPFSsupport: self.constants.serial_settings = "Moderate" + if self.current_model in ModelArray.LegacyGPU: + Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False) + 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): + self.constants.sip_status = False + self.constants.secure_status = False # Logic for when user runs custom OpenCore build and do not expose it # Note: This logic currently only applies for iMacPro1,1 users, see below threads on the culprits: @@ -152,4 +157,4 @@ class OpenCoreLegacyPatcher(): OpenCoreLegacyPatcher() # Example arg for OCLP command line -# ./OCLP --build --verbose --debug_oc --debug_kext --model iMac11,2 \ No newline at end of file +# ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2 \ No newline at end of file diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 1f8422aeb..86d6f5f59 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -25,6 +25,11 @@ class OpenCoreLegacyPatcher(): self.constants.detected_os = int(platform.uname().release.partition(".")[0]) if self.current_model in ModelArray.NoAPFSsupport: self.constants.serial_settings = "Moderate" + if self.current_model in ModelArray.LegacyGPU: + Build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).check_pciid(False) + 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): + self.constants.sip_status = False + self.constants.secure_status = False # Logic for when user runs custom OpenCore build and do not expose it # Note: This logic currently only applies for iMacPro1,1 users, see below threads on the culprits: diff --git a/Resources/Build.py b/Resources/Build.py index ab861f60e..1737bea87 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -43,26 +43,30 @@ class BuildOpenCore: hex_str = "".join(["".join(x) for x in hex_rev]) return hex_str.upper() - def check_pciid(self): + def check_pciid(self, print_status): try: - self.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) - self.igpu_devices = [i for i in self.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")] - self.igpu_vendor = self.hexswap(binascii.hexlify(self.igpu_devices[0]["vendor-id"]).decode()[:4]) - self.igpu_device = self.hexswap(binascii.hexlify(self.igpu_devices[0]["device-id"]).decode()[:4]) - print(f"- Detected iGPU: {self.igpu_vendor}:{self.igpu_device}") + self.constants.igpu_devices = plistlib.loads(subprocess.run("ioreg -r -n IGPU -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) + self.constants.igpu_devices = [i for i in self.constants.igpu_devices if i["class-code"] == binascii.unhexlify("00000300")] + self.constants.igpu_vendor = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["vendor-id"]).decode()[:4]) + self.constants.igpu_device = self.hexswap(binascii.hexlify(self.constants.igpu_devices[0]["device-id"]).decode()[:4]) + if print_status is True: + print(f"- Detected iGPU: {self.constants.igpu_vendor}:{self.constants.igpu_device}") except ValueError: - print("- No iGPU detected") - self.igpu_devices = "" + if print_status is True: + print("- No iGPU detected") + self.constants.igpu_devices = "" try: - self.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) - self.dgpu_devices = [i for i in self.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")] - self.dgpu_vendor = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["vendor-id"]).decode()[:4]) - self.dgpu_device = self.hexswap(binascii.hexlify(self.dgpu_devices[0]["device-id"]).decode()[:4]) - print(f"- Detected dGPU: {self.dgpu_vendor}:{self.dgpu_device}") + self.constants.dgpu_devices = plistlib.loads(subprocess.run("ioreg -r -n GFX0 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) + self.constants.dgpu_devices = [i for i in self.constants.dgpu_devices if i["class-code"] == binascii.unhexlify("00000300")] + self.constants.dgpu_vendor = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["vendor-id"]).decode()[:4]) + self.constants.dgpu_device = self.hexswap(binascii.hexlify(self.constants.dgpu_devices[0]["device-id"]).decode()[:4]) + if print_status is True: + print(f"- Detected dGPU: {self.constants.dgpu_vendor}:{self.constants.dgpu_device}") except ValueError: - print("- No dGPU detected") - self.dgpu_devices = "" + if print_status is True: + print("- No dGPU detected") + self.constants.dgpu_devices = "" def build_efi(self): Utilities.cls() @@ -310,10 +314,10 @@ class BuildOpenCore: else: print("- Failed to find vendor") elif self.constants.custom_model == "None": - self.check_pciid() - if self.dgpu_devices and self.dgpu_vendor == self.constants.pci_amd_ati and self.dgpu_device in ModelArray.AMDMXMGPUs: + self.check_pciid(True) + if self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_amd_ati and self.constants.dgpu_device in ModelArray.AMDMXMGPUs: amd_patch(self) - elif self.dgpu_devices and self.dgpu_vendor == self.constants.pci_nvidia and self.dgpu_device in ModelArray.NVIDIAMXMGPUs: + elif self.constants.dgpu_devices and self.constants.dgpu_vendor == self.constants.pci_nvidia and self.constants.dgpu_device in ModelArray.NVIDIAMXMGPUs: nvidia_patch(self) elif self.model in ModelArray.MacPro71: print("- Adding Mac Pro, Xserve DRM patches") diff --git a/Resources/Constants.py b/Resources/Constants.py index 2b1898d5b..b7d7b06b2 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -44,6 +44,10 @@ class Constants: self.custom_mxm_gpu: str = None self.current_gpuv: str = None self.current_gpud: str = None + self.igpu_vendor = "" + self.igpu_device = "" + self.dgpu_vendor = "" + self.dgpu_device = "" # Patcher Settings self.opencore_debug = False diff --git a/Resources/ModelArray.py b/Resources/ModelArray.py index 966264f54..275ed9449 100644 --- a/Resources/ModelArray.py +++ b/Resources/ModelArray.py @@ -332,9 +332,9 @@ LegacyGPU = [ "Macmini5,2", # AMD 6000 "Macmini5,3", # Intel 3000 "iMac7,1", # AMD 2000 - "iMac8,1", # Nvidia and AMD 2400 + "iMac8,1", # Nvidia and AMD 2400 "iMac9,1", # Nvidia 9000 - "iMac10,1", # Nvidia 9000 and AMD 4000 + "iMac10,1", # Nvidia 9000 and AMD 4000 "iMac11,1", # AMD 4000 "iMac11,2", # AMD 4000 and 5000 "iMac11,3", # AMD 5000 @@ -712,6 +712,7 @@ AMDMXMGPUs = [ "67E8", # AMD WX 4130/WX 4150 "67E0", # AMD WX 4170 "67C0", # AMD WX 7100 + "67DF", # AMD RX 480 ] BCM4360Wifi = [ @@ -1041,83 +1042,83 @@ AddBrightness = [ # List supported IDs TeraScale1pciid = [ - "9400", - "9401", - "9402", - "9403", - "9581", - "9583", - "9588", - "94c8", - "94c9", - "9500", - "9501", - "9505", - "9507", - "9504", - "9506", - "9598", - "9488", - "9599", - "9591", - "9593", - "9440", - "9442", - "944A", - "945A", - "9490", - "949E", - "9480", - "9540", - "9541", - "954E", - "954F", - "9552", - "9553", - "94a0", + "9400", + "9401", + "9402", + "9403", + "9581", + "9583", + "9588", + "94c8", + "94c9", + "9500", + "9501", + "9505", + "9507", + "9504", + "9506", + "9598", + "9488", + "9599", + "9591", + "9593", + "9440", + "9442", + "944A", + "945A", + "9490", + "949E", + "9480", + "9540", + "9541", + "954E", + "954F", + "9552", + "9553", + "94a0", ] TeraScale2pciid = [ - "6738", - "6739", - "6720", - "6722", - "6768", - "6770", - "6779", - "6760", - "6761", - "68E0", - "6898", - "6899", - "68B8", - "68B0", - "68B1", - "68A0", - "68A1", - "6840", - "6841", - "68D8", - "68C0", - "68C1", - "68D9", - "6750", - "6758", - "6759", - "6740", - "6741", - "6745", + "6738", + "6739", + "6720", + "6722", + "6768", + "6770", + "6779", + "6760", + "6761", + "68E0", + "6898", + "6899", + "68B8", + "68B0", + "68B1", + "68A0", + "68A1", + "6840", + "6841", + "68D8", + "68C0", + "68C1", + "68D9", + "6750", + "6758", + "6759", + "6740", + "6741", + "6745", ] IronLakepciid = [ - "0044", - "0046", + "0044", + "0046", ] SandyBridgepiciid = [ - "0106", - "0601", - "0116", - "0102", - "0126", + "0106", + "0601", + "0116", + "0102", + "0126", ]