Allow amfi_get_out_of_my_way=1

This commit is contained in:
Mykola Grymalyuk
2021-03-11 10:31:50 -07:00
parent 231d478ff3
commit 629a1469cb
5 changed files with 20 additions and 6 deletions

View File

@@ -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

View File

@@ -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]

View File

@@ -55,6 +55,7 @@ class Constants:
self.vault = True
self.sip_status = True
self.secure_status = True
self.detected_os = 0.0
# Payload Location
# OpenCore

View File

@@ -94,8 +94,13 @@ class BuildOpenCore:
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 @@ class BuildOpenCore:
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 @@ Please build OpenCore first!"""
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())

BIN
images/OC-Picker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB