Add inital 5k Patchset

This commit is contained in:
Mykola Grymalyuk
2021-12-07 20:14:01 -07:00
parent 67ddb619c7
commit ca734ff055
4 changed files with 45 additions and 6 deletions

View File

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

View File

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

View File

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