From 1b2eea6b505d234d37911599a2fd227554e5543b Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com> Date: Tue, 21 Sep 2021 18:59:50 -0600 Subject: [PATCH] Add better FV patch detection --- OpenCore-Patcher.command | 2 +- Resources/Build.py | 2 ++ Resources/Constants.py | 2 ++ Resources/SysPatch.py | 2 +- Resources/Utilities.py | 8 +++++++- payloads/Config/config.plist | 3 +++ 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index a1184dafd..ca95a31eb 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -33,7 +33,7 @@ class OpenCoreLegacyPatcher: self.constants.disable_cs_lv = True if model in ModelArray.LegacyGPU: - if Utilities.check_metal_support(device_probe, self.computer) is True: + if host_is_target and Utilities.check_metal_support(device_probe, self.computer) is True: # Building on device and we have a native, supported GPU self.constants.sip_status = True # self.constants.secure_status = True # Monterey diff --git a/Resources/Build.py b/Resources/Build.py index 2c14fe203..ad1ac8f29 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -710,6 +710,8 @@ class BuildOpenCore: # 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 SysPatch.py if config supports FileVault + self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += "-allow_fv" def set_smbios(self): spoofed_model = self.model diff --git a/Resources/Constants.py b/Resources/Constants.py index f6f038939..fb19565fe 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -781,6 +781,8 @@ class Constants: "iMac16,1": "Mac-A369DDC4E67F1C45", "iMac16,2": "Mac-FFE5EF870D7BA81A", "iMac17,1": "Mac-DB15BD556843C820", + # iMac17,1": "Mac-65CE76090165799A", + # iMac17,1": "Mac-B809C3757DA9BB8D", "iMac18,1": "Mac-4B682C642B45593E", "iMac18,2": "Mac-77F17D7DA9285301", "iMac18,3": "Mac-BE088AF8C5EB4FA2", diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index 67d72d730..bd3f3b4f0 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -422,7 +422,7 @@ set million colour before rebooting""" ) 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)) - elif Utilities.check_oclp_boot() is False: + elif Utilities.check_filevault_skip() is False: # Assume non-OCLP Macs don't have _cs_require_lv print("- Disabling Library Validation") Utilities.process_status( diff --git a/Resources/Utilities.py b/Resources/Utilities.py index 03317207b..9cf7ebdf9 100644 --- a/Resources/Utilities.py +++ b/Resources/Utilities.py @@ -165,6 +165,12 @@ def check_metal_support(device_probe, computer): else: return True +def check_filevault_skip(): + # Check whether we can skip FileVault check with Root Patching + if get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False) and "-allow_fv" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False): + return True + else: + return False def patching_status(os_sip, os): # Detection for Root Patching @@ -190,7 +196,7 @@ def patching_status(os_sip, os): 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 - if os > Constants.Constants().catalina and not check_oclp_boot(): + if os > Constants.Constants().catalina and not check_filevault_skip(): # Assume non-OCLP Macs do not have our APFS seal patch fv_status: str = subprocess.run("fdesetup status".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode() if "FileVault is Off" in fv_status: diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist index 03130a5cf..099c037fb 100644 --- a/payloads/Config/config.plist +++ b/payloads/Config/config.plist @@ -1292,6 +1292,8 @@ OCLP-Version + OCLP-Settings + 7C436110-AB2A-4BBB-A880-FE41995C9F82 @@ -1312,6 +1314,7 @@ 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 OCLP-Version + OCLP-Settings revcpu revcpuname