diff --git a/CHANGELOG.md b/CHANGELOG.md index f2930874ea..2546ccf26e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Fix GPU vendor user-configuration - Fix custom EFI Boot icon in Mac Boot Picker - Enable UserInterfaceTheme to ensure DefaultBackgroundColor is respected +- Enable `amfi_get_out_of_my_way=1` when SIP is disabled ## 0.0.15 - Add user-configurable OpenCore DEBUG builds diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 42ee5395b0..0d8f3debb4 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -2,7 +2,7 @@ from __future__ import print_function -import subprocess, sys, time +import subprocess, sys, time, platform from Resources import build, ModelArray, Constants, utilities @@ -18,6 +18,8 @@ class OpenCoreLegacyPatcher(): else: self.current_model = subprocess.run("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.current_model = [line.strip().split(": ", 1)[1] for line in self.current_model.stdout.decode().split("\n") if line.strip().startswith("Model Identifier")][0] + self.constants.detected_os, _, _ = platform.mac_ver() + self.constants.detected_os = float('.'.join(self.constants.detected_os.split('.')[:2])) def build_opencore(self): build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).build_opencore() @@ -203,6 +205,8 @@ however to patch the root volume both of these must be disabled. Only disable is absolutely necessary. Note: for minor changes, SIP can be adjusted in recovery like normal. +Additionally, when disabling SIP via the patcher amfi_get_out_of_my_way=1 +will be added to boot-args. Valid options: @@ -287,7 +291,7 @@ running, however this will enforce iMac Nvidia Build Patches. title = [ f"OpenCore Legacy Patcher v{self.constants.patcher_version}", f"Selected Model: {self.constants.custom_model or self.current_model}", - f"Target OS: macOS {self.constants.os_support}" + f"Target OS: macOS {self.constants.os_support}", ] if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS: @@ -312,8 +316,8 @@ running, however this will enforce iMac Nvidia Build Patches. 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.current_model) in ModelArray.SupportedSMBIOS) else []) + [ - ["Install OpenCore to USB/internal drive", self.install_opencore], + options = ( + [["Build OpenCore", self.build_opencore]] if ((self.constants.custom_model or self.current_model) in ModelArray.SupportedSMBIOS) else []) + ([["Install OpenCore to USB/internal drive", self.install_opencore]] if (self.constants.detected_os > 10.12) else []) + [ ["Change Model", self.change_model], ["Patcher Settings", self.patcher_settings], ["Credits", self.credits] diff --git a/Resources/Constants.py b/Resources/Constants.py index b4b2bcd91b..2583b505b9 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -55,6 +55,7 @@ def __init__(self): self.vault = True self.sip_status = True self.secure_status = True + self.detected_os = 0.0 # Payload Location # OpenCore diff --git a/Resources/build.py b/Resources/build.py index 0abd3d3127..2d8439ae0e 100644 --- a/Resources/build.py +++ b/Resources/build.py @@ -94,8 +94,13 @@ def build_efi(self): self.enable_kext(name, version, path, check) # WiFi patches - wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) - wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")] + # TODO: -a is not supported in Lion and older, need to add proper fix + if self.constants.detected_os < 10.8: + print(f"- Unable to run Wifi detection on {self.constants.detected_os}") + wifi_devices = ["NULL", "NULL"] + else: + wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) + wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")] if self.constants.wifi_build is True: print("- Skipping Wifi patches on request") elif not self.constants.custom_model and wifi_devices and self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4]) in ModelArray.nativeWifi: @@ -251,6 +256,7 @@ def amd_patch(self): print("- Disabling SIP") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = binascii.unhexlify("FF0F0000") self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["csr-active-config"] + self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi_get_out_of_my_way=1" if self.constants.secure_status is False: print("- Disabling SecureBootModel") self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled" @@ -459,6 +465,8 @@ def copy_efi(self): print("\nDisk picker is loading...") all_disks = {} + # TODO: physical is not supported in Sierra and older + # AllDisksAndPartitions is not supported in Yosemite(?) and older disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) for disk in disks["AllDisksAndPartitions"]: disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) diff --git a/images/OC-Picker.png b/images/OC-Picker.png new file mode 100644 index 0000000000..09fe0d3e9b Binary files /dev/null and b/images/OC-Picker.png differ