mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 04:38:20 +10:00
Fix misc issues
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import print_function
|
||||
|
||||
import subprocess, sys, time, platform
|
||||
|
||||
from Resources import build, ModelArray, Constants, utilities
|
||||
from Resources import build, ModelArray, Constants, SysPatch, utilities
|
||||
|
||||
|
||||
class OpenCoreLegacyPatcher():
|
||||
@@ -288,6 +288,25 @@ running, however this will enforce iMac Nvidia Build Patches.
|
||||
- Slice:\t\tVoodooHDA
|
||||
- cdf:\t\tNightShiftEnabler"""]).start()
|
||||
|
||||
def PatchVolume(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Patching System Volume"])
|
||||
print("""Patches Root volume to fix misc issues such as:
|
||||
|
||||
- Audio
|
||||
- Ethernet
|
||||
|
||||
Note: When the system volume is patched, you can no longer have Delta
|
||||
updates or have FileVault enabled. Please think carefully if this is
|
||||
desired.
|
||||
""")
|
||||
change_kext_menu = input("Patch System Volume?(y/n): ")
|
||||
if change_kext_menu in {"y", "Y", "yes", "Yes"}:
|
||||
SysPatch.PatchSysVolume(self.constants.custom_model or self.current_model, self.constants).start_patch()
|
||||
else:
|
||||
print("Returning to main menu")
|
||||
|
||||
|
||||
def main_menu(self):
|
||||
response = None
|
||||
ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS11
|
||||
@@ -325,6 +344,7 @@ running, however this will enforce iMac Nvidia Build Patches.
|
||||
["Install OpenCore to USB/internal drive", self.install_opencore],
|
||||
["Change Model", self.change_model],
|
||||
["Patcher Settings", self.patcher_settings],
|
||||
#["Patch Volume", self.PatchVolume],
|
||||
["Credits", self.credits]
|
||||
]
|
||||
|
||||
|
||||
@@ -812,4 +812,23 @@ NoAPFSsupport = [
|
||||
"MacPro4,1",
|
||||
"Xserve3,1",
|
||||
"Dortania1,1"
|
||||
]
|
||||
|
||||
NoRootPatch11 = [
|
||||
"MacBookAir5,1",
|
||||
"MacBookAir5,2",
|
||||
"MacBookPro9,1",
|
||||
"MacBookPro9,2",
|
||||
"MacBookPro10,1",
|
||||
"MacBookPro10,2",
|
||||
"Macmini6,1",
|
||||
"Macmini6,2",
|
||||
"iMac13,1",
|
||||
"iMac13,2",
|
||||
"iMac14,1",
|
||||
"iMac14,2",
|
||||
"iMac14,3",
|
||||
"MacPro4,1",
|
||||
"MacPro5,1",
|
||||
"Xserve3,1",
|
||||
]
|
||||
@@ -126,6 +126,8 @@ class PatchSysVolume:
|
||||
|
||||
def patch_root_vol(self):
|
||||
print(f"- Detecting patches for {self.model}")
|
||||
print("- Creating backup snapshot")
|
||||
subprocess.run("tmutil snapshot".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
|
||||
# Start Patch engine
|
||||
if self.model in ModelArray.LegacyAudio:
|
||||
@@ -137,13 +139,14 @@ class PatchSysVolume:
|
||||
if self.model in ModelArray.EthernetBroadcom:
|
||||
print("- Attempting AppleBCM5701Ethernet Patch")
|
||||
subprocess.run(f"sudo rm -R {self.mount_extensions}/IONetworkingFamily.kext/Contents/PlugIns/AppleBCM5701Ethernet.kext".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
subprocess.run(f"sudo cp -R {self.constants.applebcm_path} {self.mount_extensions}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
subprocess.run(f"sudo cp -R {self.constants.applebcm_path} {self.mount_extensions}/IONetworkingFamily.kext/Contents/PlugIns/".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
rebuild_required = True
|
||||
|
||||
if self.model in ModelArray.LegacyGPU:
|
||||
print("- Attemping Legacy GPU Patches")
|
||||
#TODO: Re-enable when GPU patches are public
|
||||
#self.gpu_accel_patches()
|
||||
#rebuild_required = True
|
||||
|
||||
if rebuild_required is True:
|
||||
self.rebuild_snapshot()
|
||||
@@ -158,7 +161,9 @@ class PatchSysVolume:
|
||||
def start_patch(self):
|
||||
# Check SIP
|
||||
if self.constants.custom_model != None:
|
||||
print("Cannot patch for another machine!")
|
||||
print("Root Patching must be done on target machine!")
|
||||
elif self.model in ModelArray.NoRootPatch11:
|
||||
print("Root Patching not required for this machine!")
|
||||
elif self.model not in ModelArray.SupportedSMBIOS:
|
||||
print("Cannot run on this machine!")
|
||||
elif self.constants.detected_os < 10.16:
|
||||
@@ -169,13 +174,26 @@ class PatchSysVolume:
|
||||
sip_status = nvram_dump["csr-active-config"]
|
||||
except KeyError:
|
||||
print("- csr-active-config var is missing")
|
||||
sip_status = "00000000"
|
||||
print(sip_status)
|
||||
if sip_status != "EF0F0000":
|
||||
sip_status = b'\x00\x00\x00\x00'
|
||||
|
||||
smb_model: str = subprocess.run("nvram 94B73556-2197-4702-82A8-3E1337DAFBFB:HardwareModel ".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
if not smb_model.startswith("nvram: Error getting variable"):
|
||||
smb_model = [line.strip().split(":HardwareModel ", 1)[1] for line in smb_model.split("\n") if line.strip().startswith("94B73556-2197-4702-82A8-3E1337DAFBFB:")][0]
|
||||
if smb_model.startswith("j137"):
|
||||
smb_status = "Enabled"
|
||||
else:
|
||||
smb_status = "Disabled"
|
||||
else:
|
||||
smb_status = "Disabled"
|
||||
|
||||
if (sip_status == b'\xef\x0f\x00\x00') and (smb_status == "Disabled"):
|
||||
print("- Detected SIP is disabled, continuing")
|
||||
input("\nPress [ENTER] to continue")
|
||||
self.find_mount_root_vol()
|
||||
print("- Patching complete")
|
||||
print("\nPlease reboot the machine for patches to take effect")
|
||||
else:
|
||||
print("- SIP enabled, unable to patch")
|
||||
print("\nPlease disable SIP in Patcher Settings, build OpenCore again and reinstall OpenCore")
|
||||
print("- SIP and SecureBootModel set incorrectly, unable to patch")
|
||||
print("\nPlease disable SIP and SecureBootModel in Patcher Settings")
|
||||
print("Then build OpenCore again, reinstall OpenCore to your drive and reboot.")
|
||||
input("Press [Enter] to go exit.")
|
||||
@@ -86,9 +86,9 @@ class BuildOpenCore:
|
||||
# Ethernet patches
|
||||
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: self.model in ModelArray.EthernetNvidia),
|
||||
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: self.model in ModelArray.EthernetMarvell),
|
||||
("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path, lambda: self.model in ModelArray.EthernetBroadcom),
|
||||
#("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path, lambda: self.model in ModelArray.EthernetBroadcom),
|
||||
# Legacy audio
|
||||
("VoodooHDA.kext", self.constants.voodoohda_version, self.constants.voodoohda_path, lambda: self.model in ModelArray.LegacyAudio),
|
||||
#("VoodooHDA.kext", self.constants.voodoohda_version, self.constants.voodoohda_path, lambda: self.model in ModelArray.LegacyAudio),
|
||||
# IDE patch
|
||||
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in ModelArray.IDEPatch),
|
||||
]:
|
||||
|
||||
Reference in New Issue
Block a user