Merge pull request #777 from dortania/5k-patch

Add 5k Display Output Support
This commit is contained in:
Mykola Grymalyuk
2021-12-08 11:14:02 -07:00
committed by GitHub
6 changed files with 79 additions and 7 deletions
+23
View File
@@ -1787,6 +1787,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Marvell", "Ethernet Chipset": "Marvell",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
@@ -1806,6 +1807,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Marvell", "Ethernet Chipset": "Marvell",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
@@ -1825,6 +1827,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Marvell", "Ethernet Chipset": "Marvell",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
@@ -1844,6 +1847,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Marvell", "Ethernet Chipset": "Marvell",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
@@ -1932,6 +1936,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Nvidia", "Ethernet Chipset": "Nvidia",
"nForce Chipset": True, "nForce Chipset": True,
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
], ],
@@ -1949,6 +1954,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Nvidia", "Ethernet Chipset": "Nvidia",
"nForce Chipset": True, "nForce Chipset": True,
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
], ],
@@ -1966,6 +1972,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Nvidia", "Ethernet Chipset": "Nvidia",
"nForce Chipset": True, "nForce Chipset": True,
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Tesla,
], ],
@@ -1982,6 +1989,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
], ],
@@ -1998,6 +2006,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2, device_probe.AMD.Archs.TeraScale_2,
@@ -2015,6 +2024,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1, device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2, device_probe.AMD.Archs.TeraScale_2,
@@ -2032,6 +2042,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.Intel.Archs.Sandy_Bridge, device_probe.Intel.Archs.Sandy_Bridge,
device_probe.AMD.Archs.TeraScale_2, device_probe.AMD.Archs.TeraScale_2,
@@ -2049,6 +2060,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.Intel.Archs.Sandy_Bridge, device_probe.Intel.Archs.Sandy_Bridge,
device_probe.AMD.Archs.TeraScale_2, device_probe.AMD.Archs.TeraScale_2,
@@ -2068,6 +2080,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Broadcom", "Ethernet Chipset": "Broadcom",
"Socketed GPUs": "MXM",
"Stock GPUs": [ "Stock GPUs": [
device_probe.Intel.Archs.Sandy_Bridge, device_probe.Intel.Archs.Sandy_Bridge,
device_probe.AMD.Archs.TeraScale_2, device_probe.AMD.Archs.TeraScale_2,
@@ -2535,6 +2548,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Intel 80003ES2LAN", "Ethernet Chipset": "Intel 80003ES2LAN",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Curie device_probe.NVIDIA.Archs.Curie
], ],
@@ -2553,6 +2567,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Intel 80003ES2LAN", "Ethernet Chipset": "Intel 80003ES2LAN",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Curie device_probe.NVIDIA.Archs.Curie
], ],
@@ -2571,6 +2586,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2045,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Intel 80003ES2LAN", "Ethernet Chipset": "Intel 80003ES2LAN",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_1 device_probe.AMD.Archs.TeraScale_1
], ],
@@ -2588,6 +2604,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40, "Wireless Model": device_probe.Atheros.Chipsets.AirPortAtheros40,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Intel 82574L", "Ethernet Chipset": "Intel 82574L",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Tesla device_probe.NVIDIA.Archs.Tesla
], ],
@@ -2604,6 +2621,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Broadcom.Chipsets.AirPortBrcm4331, "Wireless Model": device_probe.Broadcom.Chipsets.AirPortBrcm4331,
"Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046, "Bluetooth Model": bluetooth_data.bluetooth_data.BRCM2046,
"Ethernet Chipset": "Intel 82574L", "Ethernet Chipset": "Intel 82574L",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.TeraScale_2 device_probe.AMD.Archs.TeraScale_2
], ],
@@ -2636,6 +2654,7 @@ smbios_dictionary = {
"Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe, "Wireless Model": device_probe.Broadcom.Chipsets.AppleBCMWLANBusInterfacePCIe,
"Bluetooth Model": bluetooth_data.bluetooth_data.UART, "Bluetooth Model": bluetooth_data.bluetooth_data.UART,
"Ethernet Chipset": "Aquantia", "Ethernet Chipset": "Aquantia",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.Polaris, device_probe.AMD.Archs.Polaris,
device_probe.AMD.Archs.Vega, device_probe.AMD.Archs.Vega,
@@ -2656,6 +2675,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable, "Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Intel 80003ES2LAN", "Ethernet Chipset": "Intel 80003ES2LAN",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.R500 device_probe.AMD.Archs.R500
], ],
@@ -2674,6 +2694,7 @@ smbios_dictionary = {
"Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable, "Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable,
"UGA Graphics": True, "UGA Graphics": True,
"Ethernet Chipset": "Intel 80003ES2LAN", "Ethernet Chipset": "Intel 80003ES2LAN",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.AMD.Archs.R500 device_probe.AMD.Archs.R500
], ],
@@ -2691,6 +2712,7 @@ smbios_dictionary = {
"Wireless Model": None, "Wireless Model": None,
"Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable, "Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable,
"Ethernet Chipset": "Intel 82574L", "Ethernet Chipset": "Intel 82574L",
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.NVIDIA.Archs.Tesla device_probe.NVIDIA.Archs.Tesla
], ],
@@ -2706,6 +2728,7 @@ smbios_dictionary = {
"Max OS Supported": os_data.os_data.leopard, "Max OS Supported": os_data.os_data.leopard,
"Wireless Model": None, "Wireless Model": None,
"Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable, "Bluetooth Model": bluetooth_data.bluetooth_data.NonApplicable,
"Socketed GPUs": "PCIe",
"Stock GPUs": [ "Stock GPUs": [
device_probe.Intel.Archs.GMA_950 device_probe.Intel.Archs.GMA_950
], ],
Binary file not shown.
+34
View File
@@ -54,6 +54,16 @@ class BuildOpenCore:
print("- Adding Internal Drive icon") print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder) shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder)
def chainload_diags(self):
Path(self.constants.opencore_release_folder / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers")).mkdir(parents=True, exist_ok=True)
if self.constants.boot_efi is True:
path_oc_loader = self.constants.opencore_release_folder / Path("EFI/BOOT/BOOTx64.efi")
else:
path_oc_loader = self.constants.opencore_release_folder / Path("System/Library/CoreServices/boot.efi")
shutil.move(path_oc_loader, self.constants.opencore_release_folder / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi"))
shutil.copy(self.constants.diags_launcher_path, self.constants.opencore_release_folder)
shutil.move(self.constants.opencore_release_folder / Path("diags.efi"), self.constants.opencore_release_folder / Path("boot.efi"))
def build_efi(self): def build_efi(self):
utilities.cls() utilities.cls()
if not self.constants.custom_model: if not self.constants.custom_model:
@@ -726,6 +736,30 @@ class BuildOpenCore:
except KeyError: except KeyError:
pass pass
# Check if model has 5K display
# Apple has 2 modes for display handling on 5K iMacs and iMac Pro
# If at any point in the boot chain an "unsupported" entry is loaded, 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 Product.efi under '/System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers/Product.efi'
# The reason chainloading via ./Drivers/HardwareDrivers is possible is thanks to it being loaded via an encrypted file buffer
# whereas other drivers like ./qa_logger.efi is invoked via Device Path.
try:
smbios_data.smbios_dictionary[self.model]["5K Display"]
print("- Adding 5K Display Patch")
# Set LauncherPath to '/boot.efi'
# This is to ensure that only the Mac's firmware presents the boot option, but not OpenCore
# https://github.com/acidanthera/OpenCorePkg/blob/0.7.6/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c#L50-L73
self.config["Misc"]["Boot"]["LauncherPath"] = "\\boot.efi"
# Setup diags.efi chainloading
self.chainload_diags()
except KeyError:
pass
# ThirdPartDrives Check # ThirdPartDrives Check
for drive in ["SATA 2.5", "SATA 3.5", "mSATA"]: for drive in ["SATA 2.5", "SATA 3.5", "mSATA"]:
if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]: if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
+10 -6
View File
@@ -125,12 +125,12 @@ class Constants:
self.latebloom_debug = 0 # Debug Setting self.latebloom_debug = 0 # Debug Setting
## Security Settings ## Security Settings
self.apecid_support = False # ApECID self.apecid_support = False # ApECID
self.amfi_status = True # Apple Mobile File Integrity self.amfi_status = True # Apple Mobile File Integrity
self.sip_status = True # System Integrity Protection self.sip_status = True # System Integrity Protection
self.secure_status = False # Secure Boot Model self.secure_status = False # Secure Boot Model
self.vault = False # EFI Vault self.vault = False # EFI Vault
self.disable_cs_lv = False # Disable Library validation self.disable_cs_lv = False # Disable Library validation
## OS Settings ## OS Settings
self.os_support = 12.0 self.os_support = 12.0
@@ -215,6 +215,10 @@ class Constants:
def xhci_driver_path(self): def xhci_driver_path(self):
return self.payload_path / Path("Drivers/XhciDxe.efi") return self.payload_path / Path("Drivers/XhciDxe.efi")
@property
def diags_launcher_path(self):
return self.payload_path / Path("Drivers/diags.efi")
# Kexts # Kexts
@property @property
def payload_kexts_path(self): def payload_kexts_path(self):
+5 -1
View File
@@ -41,7 +41,11 @@ class generate_defaults:
device_probe.AMD.Archs.Navi, device_probe.AMD.Archs.Navi,
]: ]:
# Allow H.265 on AMD # Allow H.265 on AMD
settings.serial_settings = "Minimal" try:
smbios_data.smbios_dictionary[model]["Socketed GPUs"]
settings.serial_settings = "Minimal"
except KeyError:
pass
break break
elif model in ["MacPro4,1", "MacPro5,1"]: elif model in ["MacPro4,1", "MacPro5,1"]:
# Allow H.265 on AMD # Allow H.265 on AMD
+7
View File
@@ -5,6 +5,7 @@
import plistlib import plistlib
import subprocess import subprocess
import shutil import shutil
import os
from pathlib import Path from pathlib import Path
from resources import utilities, constants from resources import utilities, constants
from data import os_data from data import os_data
@@ -168,9 +169,14 @@ Please build OpenCore first!"""
if (mount_path / Path("System")).exists(): if (mount_path / Path("System")).exists():
print("- Removing preexisting System folder") print("- Removing preexisting System folder")
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler) shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
if (mount_path / Path("boot.efi")).exists():
print("- Removing preexisting boot.efi")
os.remove(mount_path / Path("boot.efi"))
print("- Copying OpenCore onto EFI partition") print("- Copying OpenCore onto EFI partition")
shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC")) shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC"))
shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System")) shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System"))
if Path(self.constants.opencore_release_folder / Path("boot.efi")).exists():
shutil.copy(self.constants.opencore_release_folder / Path("boot.efi"), mount_path / Path("boot.efi"))
if self.constants.boot_efi is True: if self.constants.boot_efi is True:
print("- Converting Bootstrap to BOOTx64.efi") print("- Converting Bootstrap to BOOTx64.efi")
if (mount_path / Path("EFI/BOOT")).exists(): if (mount_path / Path("EFI/BOOT")).exists():
@@ -190,6 +196,7 @@ Please build OpenCore first!"""
else: else:
print("- Adding Internal Drive icon") print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, mount_path) shutil.copy(self.constants.icon_path_internal, mount_path)
print("- Cleaning install location") print("- Cleaning install location")
if not self.constants.recovery_status: if not self.constants.recovery_status:
print("- Unmounting EFI partition") print("- Unmounting EFI partition")