Skip to content

Commit 1419c91

Browse files
committed
amfi pass fix
1 parent 9118ec9 commit 1419c91

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

oclp_plus/efi_builder/security.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def _build(self) -> None:
3939
Kick off Security Build Process
4040
"""
4141

42+
amfipass_eligible = False
43+
if self.model in smbios_data.smbios_dictionary:
44+
amfipass_eligible = smbios_data.smbios_dictionary[self.model]["Max OS Supported"] < os_data.os_data.sonoma
45+
amfipass_prefer_over_amfi_arg = amfipass_eligible and self.constants.detected_os >= os_data.os_data.tahoe
46+
4247
if self.constants.sip_status is False or self.constants.custom_sip_value:
4348
# Work-around 12.3 bug where Electron apps no longer launch with SIP lowered
4449
# Unknown whether this is intended behavior or not, revisit with 12.4
@@ -73,8 +78,11 @@ def _build(self) -> None:
7378
# In Ventura, LV patch broke. For now, add AMFI arg
7479
# Before merging into mainline, this needs to be resolved
7580
if self.constants.disable_amfi is True:
76-
logging.info("- Disabling AMFI")
77-
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
81+
if amfipass_prefer_over_amfi_arg:
82+
logging.info("- AMFIPass enabled on Tahoe, skipping amfi=0x80")
83+
else:
84+
logging.info("- Disabling AMFI")
85+
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
7886
else:
7987
logging.info("- Disabling Library Validation")
8088
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable Library Validation Enforcement")["Enabled"] = True
@@ -88,6 +96,13 @@ def _build(self) -> None:
8896
logging.info("- Disabling SecureBootModel")
8997
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
9098

91-
if smbios_data.smbios_dictionary[self.model]["Max OS Supported"] < os_data.os_data.sonoma:
99+
if amfipass_eligible:
92100
logging.info("- Enabling AMFIPass")
93101
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AMFIPass.kext", self.constants.amfipass_version, self.constants.amfipass_path)
102+
103+
if amfipass_prefer_over_amfi_arg:
104+
nvram_guid = "7C436110-AB2A-4BBB-A880-FE41995C9F82"
105+
boot_args = self.config["NVRAM"]["Add"][nvram_guid]["boot-args"]
106+
if "amfi=0x80" in boot_args:
107+
logging.info("- Removing amfi=0x80 from boot-args (AMFIPass)")
108+
self.config["NVRAM"]["Add"][nvram_guid]["boot-args"] = " ".join([arg for arg in boot_args.split() if arg != "amfi=0x80"])

0 commit comments

Comments
 (0)