Merge pull request #163 from dortania/test-sandy

Misc fixes
This commit is contained in:
Mykola Grymalyuk
2021-04-21 18:14:24 -06:00
committed by GitHub
8 changed files with 91 additions and 7 deletions

View File

@@ -9,6 +9,8 @@
- Add public beta support for Legacy GPU Acceleration (v0.0.3)
- Note ATI/AMD TeraScale 2 unsupported (HD 5/6000)
- Add better kmutil crash handling
- Fix build crashing when no wifi card is present
- Allow Legacy Acceleration Patches on Mac Pros and Xserves
## 0.1.0
- Fix crash on iMacs with Metal GPUs

View File

@@ -93,6 +93,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\t{self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
[f"Set Accleration Patches:\t\t{self.constants.legacy_acceleration_patch}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).accel_setting],
[f"Assume Legacy GPU:\t\t\t{self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting],
]
for option in options:

View File

@@ -166,11 +166,14 @@ class BuildOpenCore:
vendor_atheros = binascii.unhexlify("E4140000")
vendor_broadcom = binascii.unhexlify("8C160000")
wifi_devices = [i for i in wifi_devices if i["vendor-id"] == vendor_atheros or i["vendor-id"] == vendor_broadcom and i["class-code"] == binascii.unhexlify("00800200")]
wifi_vendor = self.hexswap(binascii.hexlify(wifi_devices[0]["vendor-id"]).decode()[:4])
wifi_device = self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4])
wifi_ioname = wifi_devices[0]["IOName"]
if not self.constants.custom_model:
print(f"- Detected Wifi Card: {wifi_vendor}:{wifi_device}")
try:
wifi_vendor = self.hexswap(binascii.hexlify(wifi_devices[0]["vendor-id"]).decode()[:4])
wifi_device = self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4])
wifi_ioname = wifi_devices[0]["IOName"]
if not self.constants.custom_model:
print(f"- Detected Wifi Card: {wifi_vendor}:{wifi_device}")
except IndexError:
wifi_devices = ""
else:
wifi_devices = ""
@@ -507,6 +510,26 @@ class BuildOpenCore:
plistlib.dump(agpm_config, Path(new_agpm_ls).open("wb"), sort_keys=True)
plistlib.dump(amc_config, Path(new_amc_ls).open("wb"), sort_keys=True)
#if self.model in ModelArray.SandyIGPU:
# print("- Adding AppleIntelSNBGraphicsFB patch")
# if self.model == "MacBookPro8,1":
# x = b'Mac-94245B3640C91C81'
# elif self.model == "MacBookPro8,2":
# x = b'Mac-94245A3940C91C80'
# elif self.model == "MacBookPro8,3":
# x = b'Mac-942459F5819B171B'
# elif self.model == "MacBookAir4,1":
# x = b'Mac-C08A6BB70A942AC2'
# elif self.model == "MacBookAir4,2":
# x = b'Mac-742912EFDBEE19B3'
# elif self.model == "Macmini5,1":
# x = b'Mac-8ED6AF5B48C039E1'
# elif self.model == "Macmini5,3":
# x = b'Mac-7BA5B2794B2CDB12'
# self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleIntelSNBGraphicsFB")["Enabled"] = True
# self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleIntelSNBGraphicsFB")["Find"] = binascii.unhexlify(str(binascii.hexlify(x),'ascii'))
# self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleIntelSNBGraphicsFB")["Replace"] = binascii.unhexlify(str(binascii.hexlify(self.spoofed_board.encode()),'ascii'))
@staticmethod
def get_item_by_kv(iterable, key, value):
item = None

View File

@@ -293,5 +293,22 @@ important data backed up in case of emergencies
self.constants.legacy_acceleration_patch = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.legacy_acceleration_patch = False
else:
print("Invalid option")
def force_accel_setting(self):
Utilities.cls()
Utilities.header(["Assume Legacy GPU"])
print("""Allows any model to force install Legacy Acceleration
patches. Only required for Mac Pro and Xserve users.
DO NOT RUN IF METAL GPU IS INSTALLED
""")
change_menu = input("Enable Beta Acceleration Patches(y/n): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.assume_legacy = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.assume_legacy = False
else:
print("Invalid option")

View File

@@ -71,6 +71,7 @@ class Constants:
self.boot_efi = False
self.drm_support = False
self.legacy_acceleration_patch = False
self.assume_legacy = False
# OS Versions
self.tiger = 8

View File

@@ -872,6 +872,16 @@ NoExFat = [
"Dortania1,1"
]
SandyIGPU = [
"MacBookAir4,1",
"MacBookAir4,2",
"MacBookPro8,1",
"MacBookPro8,2",
"MacBookPro8,3",
"Macmini5,1",
"Macmini5,3",
]
DeleteNvidiaAccel11 = [
"AMDRadeonX4000.kext",
"AMDRadeonX4000HWServices.kext",

View File

@@ -205,7 +205,7 @@ class PatchSysVolume:
print("- Preparing Files")
subprocess.run(f"sudo find {self.constants.payload_apple_root_path} -name '.DS_Store' -delete".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
if self.model in ModelArray.LegacyGPU:
if self.model in ModelArray.LegacyGPU or self.constants.assume_legacy is True:
self.check_pciid()
if self.dgpu_devices and self.dgpu_vendor == self.constants.pci_amd_ati and self.dgpu_device in ModelArray.AMDMXMGPUs:
print("- Detected Metal-based AMD GPU, skipping legacy patches")
@@ -351,7 +351,7 @@ class PatchSysVolume:
# Check SIP
if self.constants.custom_model is not None:
print("Root Patching must be done on target machine!")
elif self.model in ModelArray.NoRootPatch11:
elif self.model in ModelArray.NoRootPatch11 and self.constants.assume_legacy is False:
print("Root Patching not required for this machine!")
elif self.model not in ModelArray.SupportedSMBIOS:
print("Cannot run on this machine, model is unsupported!")

View File

@@ -848,6 +848,36 @@
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>Patch AppleIntelSNBGraphicsFB</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data></data>
<key>Identifier</key>
<string>com.apple.driver.AppleIntelSNBGraphicsFB</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.0.0</string>
<key>Replace</key>
<data></data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
<key>Quirks</key>
<dict>