From ba2149407ddf6a21188c6112faad022168a4bd31 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:28:29 -0600 Subject: [PATCH] Update comments --- Resources/Build.py | 19 ++++--------------- Resources/Utilities.py | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Resources/Build.py b/Resources/Build.py index b3095da7e..e262a9fb3 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -63,22 +63,11 @@ class BuildOpenCore: 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 patch_firmware_feature(self): + # 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/blob/0.6.9/Include/Apple/IndustryStandard/AppleFeatures.h if not self.constants.custom_model: firmwarefeature = Utilities.get_rom("firmware-features") if not firmwarefeature: diff --git a/Resources/Utilities.py b/Resources/Utilities.py index f4775af38..7a22d6950 100644 --- a/Resources/Utilities.py +++ b/Resources/Utilities.py @@ -140,16 +140,17 @@ def friendly_hex(integer: int): def amfi_status(): amfi_1 = "amfi_get_out_of_my_way=0x1" amfi_2 = "amfi_get_out_of_my_way=1" - if ( - ( - get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False) and "-allow_amfi" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) - ) or - ( - 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 + + if get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=False): + if "-allow_amfi" in get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True): + return False + else: + return True + elif get_nvram("boot-args", decode=False): + if amfi_1 in get_nvram("boot-args", decode=False) or amfi_2 in get_nvram("boot-args", decode=False): + return False + else: + return True def check_oclp_boot():