Add upgraded GPU checks

This commit is contained in:
Mykola Grymalyuk
2021-03-01 20:08:40 -07:00
parent 9ce2e2add1
commit 83df3e3e12
5 changed files with 91 additions and 12 deletions

View File

@@ -7,6 +7,8 @@
- Increment binaries
- OpenCore cbd2fa3(0.6.7 release)
- WhateverGreen 2e19d1b(1.4.8 release)
- Rework SMBIOS allowing both original and custom serials(Should resolve all iMessage issues)
- Support upgraded GPU detection in iMac10,x-12,x
## 0.0.10
- Increment binaries

View File

@@ -12,7 +12,6 @@ PATCHER_VERSION = "0.0.11"
class OpenCoreLegacyPatcher():
def __init__(self):
self.constants = Constants.Constants()
self.custom_model: str = None
self.current_model: str = None
opencore_model: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if not opencore_model.startswith("nvram: Error getting variable"):
@@ -23,10 +22,10 @@ class OpenCoreLegacyPatcher():
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]
def build_opencore(self):
build.BuildOpenCore(self.custom_model or self.current_model, self.constants).build_opencore()
build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).build_opencore()
def install_opencore(self):
build.BuildOpenCore(self.custom_model or self.current_model, self.constants).copy_efi()
build.BuildOpenCore(self.constants.custom_model or self.current_model, self.constants).copy_efi()
def change_model(self):
utilities.cls()
@@ -36,7 +35,7 @@ Tip: Run the following command on the target machine to find the model identifie
system_profiler SPHardwareDataType | grep 'Model Identifier'
""")
self.custom_model = input("Please enter the model identifier of the target machine: ").strip()
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
def credits(self):
utilities.TUIOnlyPrint(["Credits"], "Press [Enter] to go back.\n",
@@ -53,23 +52,23 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
while not (response and response == -1):
title = [
f"OpenCore Legacy Patcher v{self.constants.patcher_version}",
f"Selected Model: {self.custom_model or self.current_model}"
f"Selected Model: {self.constants.custom_model or self.current_model}"
]
if (self.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS:
if (self.constants.custom_model or self.current_model) not in ModelArray.SupportedSMBIOS:
in_between = [
'Your model is not supported by this patcher!',
'',
'If you plan to create the USB for another machine, please select the "Change Model" option in the menu.'
]
elif not self.custom_model and self.current_model in ("MacPro3,1", "iMac7,1") and \
elif not self.constants.custom_model and self.current_model in ("MacPro3,1", "iMac7,1") and \
"SSE4.1" not in subprocess.run("sysctl machdep.cpu.features".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode():
in_between = [
'Your model requires a CPU upgrade to a CPU supporting SSE4.1+ to be supported by this patcher!',
'',
f'If you plan to create the USB for another {self.current_model} with SSE4.1+, please select the "Change Model" option in the menu.'
]
elif self.custom_model in ("MacPro3,1", "iMac7,1"):
elif self.constants.custom_model in ("MacPro3,1", "iMac7,1"):
in_between = ["This model is supported",
"However please ensure the CPU has been upgraded to support SSE4.1+"
]
@@ -78,7 +77,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
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.custom_model or self.current_model) in ModelArray.SupportedSMBIOS) else []) + [
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],
["Change Model", self.change_model],
["Credits", self.credits]

View File

@@ -30,6 +30,8 @@ class Constants:
self.current_path = Path(__file__).parent.parent.resolve()
self.payload_path = self.current_path / Path("payloads")
self.custom_model: str = None
self.custom_mxm_gpu: str = None
# Payload Location
# OpenCore
@property

View File

@@ -710,4 +710,52 @@ IHEHC2 = [
IH = [
"MacPro6,1"
]
upgradableMXMGPUs = [
"iMac10,1"
"iMac11,1",
"iMac11,2",
"iMac11,3",
"iMac12,1",
"iMac12,2",
"Xserve3,1",
]
# Reference: https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/
NVIDIAMXMGPUs = [
"0x12b9",#Quadro K610M
"0x0ff6",#Quadro K1100M
"0x11fc",#Quadro K2100M
"0x0ffc",#Quadro K1000M
"0x0ffb",#Quadro K2000M
"0x11b6",#Quadro K3100M
"0x11b7",#Quadro K4100M
"0x11bc",#Quadro K5000M
"0x11b8",#Quadro K5100M
"0x11e1",#GTX 765M
"0x11e2",#GTX 765M
"0x11e0",#GTX 770M
"0x119e",#GTX 780M Mac Edition
"0x119e",#GTX 780M
"0x119f",#GTX 880M
"0x119a",#GTX 860M
"0x1392",#GTX 860M
"0x1199",#GTX 870M
"0x11a9",#GTX 870M
"0x731f",
]
AMDMXMGPUs = [
"0x67EF",#AMD RX 460
"0x67e8",#AMD WX 4130/WX 4150
"0x67e0",#AMD WX 4170
"0x67c0",#AMD WX 7100
"0x731f",
]
nativeWifi = [
"0x43ba",#BCM43602
"0x43a3",#BCM4350
"0x43a0",#BCM4360
]

View File

@@ -137,6 +137,28 @@ class BuildOpenCore:
if self.model in ModelArray.HiDPIpicker:
print("- Setting HiDPI picker")
self.config["NVRAM"]["Add"]["4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"]["UIScale"] = binascii.unhexlify("02")
# Check GPU Vendor
if self.constants.custom_model != "None":
#current_gpu: str = subprocess.run("system_profiler SPDisplaysDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
#current_gpuv = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Vendor"))][0]
#current_gpud = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Device ID"))][0]
current_gpuv = "NVIDIA (0x10de)"
current_gpud = "0x11a9"
print(f"- Detected GPU: {current_gpuv} {current_gpud}")
if (current_gpuv == "AMD (0x1002)") & (current_gpud in ModelArray.AMDMXMGPUs):
self.constants.custom_mxm_gpu = True
print("- Adding AMD DRM patches")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=80 unfairgva=1"
elif (current_gpuv == "NVIDIA (0x10de)") & (current_gpud in ModelArray.NVIDIAMXMGPUs):
self.constants.custom_mxm_gpu = True
print("- Adding Brightness Control patches")
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3"]:
backlight_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")}
elif self.model in ["iMac12,1", "iMac12,2"]:
backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")}
# Add OpenCanopy
print("- Adding OpenCanopy GUI")
@@ -168,9 +190,14 @@ class BuildOpenCore:
spoofed_model = "Macmini7,1"
spoofed_board = "Mac-35C5E08120C7EEAF"
elif self.model in ModelArray.iMac151:
print("- Spoofing to iMac15,1")
spoofed_model = "iMac15,1"
spoofed_board = "Mac-42FD25EABCABB274"
if self.constants.custom_mxm_gpu == True:
print("- Spoofing to iMacPro1,1")
spoofed_model = "iMacPro1,1"
spoofed_board = "Mac-7BA5B2D9E42DDD94"
else:
print("- Spoofing to iMac15,1")
spoofed_model = "iMac15,1"
spoofed_board = "Mac-42FD25EABCABB274"
elif self.model in ModelArray.iMac144:
print("- Spoofing to iMac14,4")
spoofed_model = "iMac14,4"
@@ -198,6 +225,7 @@ class BuildOpenCore:
self.config["PlatformInfo"]["Automatic"] = True
self.config["PlatformInfo"]["UpdateDataHub"] = True
self.config["PlatformInfo"]["UpdateNVRAM"] = True
self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = spoofed_model
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0]
self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1]