mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-17 21:24:40 +10:00
Add inital 5k Patchset
This commit is contained in:
@@ -726,6 +726,26 @@ class BuildOpenCore:
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# Check if model has 5K display
|
||||
# Apple has 2 modes for display handling on 5K iMacs and iMac Pro
|
||||
# If at during any point in the boot chain an "unsupported" entry is booted, the firmware will tell the
|
||||
# Display Controller to enter a 4K compatible mode that only uses a single DisplayPort 1.2 stream internally.
|
||||
# This is to prevent situations where the system would boot into an enviroment that cannot handle the custom
|
||||
# dual DisplayPort 1.2 streams the 5k Display uses
|
||||
|
||||
# To work around this issue, we trick the firmware into loading OpenCore through Apple's Hardware Diagnostic Tests
|
||||
# Specifically hiding as diags_gui.efi under '/System/Library/CoreServices/.diagnostics/GUI/diags_gui.efi'
|
||||
|
||||
try:
|
||||
smbios_data.smbios_dictionary[self.model]["5K Display"]
|
||||
print("- Adding 5K Display Patch")
|
||||
# Set LauncherPath to '/System/Library/CoreServices/boot.efi'
|
||||
self.config["Misc"]["Boot"]["LauncherPath"] = "\\System\\Library\\CoreServices\\boot.efi"
|
||||
# Set Diagnostics Flag
|
||||
self.constants.force_diagnostics = True
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# ThirdPartDrives Check
|
||||
for drive in ["SATA 2.5", "SATA 3.5", "mSATA"]:
|
||||
if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
|
||||
|
||||
@@ -125,12 +125,13 @@ class Constants:
|
||||
self.latebloom_debug = 0 # Debug Setting
|
||||
|
||||
## Security Settings
|
||||
self.apecid_support = False # ApECID
|
||||
self.amfi_status = True # Apple Mobile File Integrity
|
||||
self.sip_status = True # System Integrity Protection
|
||||
self.secure_status = False # Secure Boot Model
|
||||
self.vault = False # EFI Vault
|
||||
self.disable_cs_lv = False # Disable Library validation
|
||||
self.apecid_support = False # ApECID
|
||||
self.amfi_status = True # Apple Mobile File Integrity
|
||||
self.sip_status = True # System Integrity Protection
|
||||
self.secure_status = False # Secure Boot Model
|
||||
self.vault = False # EFI Vault
|
||||
self.disable_cs_lv = False # Disable Library validation
|
||||
self.force_diagnostics = False # Force diags.efi chainloading for 5k iMacs and iMac Pro
|
||||
|
||||
## OS Settings
|
||||
self.os_support = 12.0
|
||||
@@ -215,6 +216,10 @@ class Constants:
|
||||
def xhci_driver_path(self):
|
||||
return self.payload_path / Path("Drivers/XhciDxe.efi")
|
||||
|
||||
@property
|
||||
def diags_launcher_path(self):
|
||||
return self.payload_path / Path("Drivers/diags.efi")
|
||||
|
||||
# Kexts
|
||||
@property
|
||||
def payload_kexts_path(self):
|
||||
|
||||
@@ -190,6 +190,20 @@ Please build OpenCore first!"""
|
||||
else:
|
||||
print("- Adding Internal Drive icon")
|
||||
shutil.copy(self.constants.icon_path_internal, mount_path)
|
||||
|
||||
if self.constants.force_diagnostics is True:
|
||||
# Chainload Diagnostics
|
||||
# Required for 5k iMacs
|
||||
print("- Adding 5K Display Patch")
|
||||
Path(mount_path / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers")).mkdir(parents=True, exist_ok=True)
|
||||
if self.constants.boot_efi is True:
|
||||
path_boot_efi = mount_path / Path("EFI/BOOT/BOOTx64.efi")
|
||||
else:
|
||||
path_boot_efi = mount_path / Path("System/Library/CoreServices/boot.efi")
|
||||
shutil.move(path_boot_efi, mount_path / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi"))
|
||||
shutil.copy(self.constants.diags_launcher_path, mount_path / Path("System/Library/CoreServices"))
|
||||
shutil.move(mount_path / Path("System/Library/CoreServices/diags.efi"), mount_path / Path("System/Library/CoreServices/boot.efi"))
|
||||
|
||||
print("- Cleaning install location")
|
||||
if not self.constants.recovery_status:
|
||||
print("- Unmounting EFI partition")
|
||||
|
||||
Reference in New Issue
Block a user