Implement VMM Patching

This commit is contained in:
Mykola Grymalyuk
2021-10-05 11:51:32 -06:00
parent f6ef7583ee
commit 84bd66fd92
5 changed files with 255 additions and 83 deletions

View File

@@ -178,7 +178,32 @@
<key>MmioWhitelist</key> <key>MmioWhitelist</key>
<array/> <array/>
<key>Patch</key> <key>Patch</key>
<array/> <array>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>Skip Board ID check</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AFAAbABhAHQAZgBvAHIAbQBTAHUAcABwAG8AcgB0AC4AcABsAGkAcwB0</data>
<key>Identifier</key>
<string>Apple</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>Replace</key>
<data>AC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAuAC4ALgAu</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
</array>
<key>Quirks</key> <key>Quirks</key>
<dict> <dict>
<key>AllowRelocationBlock</key> <key>AllowRelocationBlock</key>
@@ -1122,27 +1147,21 @@
<key>Enabled</key> <key>Enabled</key>
<false/> <false/>
<key>Find</key> <key>Find</key>
<data> <data>AHQjSIs=</data>
AHQjSIs=
</data>
<key>Identifier</key> <key>Identifier</key>
<string>kernel</string> <string>kernel</string>
<key>Limit</key> <key>Limit</key>
<integer>800</integer> <integer>800</integer>
<key>Mask</key> <key>Mask</key>
<data> <data></data>
</data>
<key>MaxKernel</key> <key>MaxKernel</key>
<string>21.1.0</string> <string>21.1.0</string>
<key>MinKernel</key> <key>MinKernel</key>
<string>20.4.0</string> <string>20.4.0</string>
<key>Replace</key> <key>Replace</key>
<data> <data>AOsjSIs=</data>
AOsjSIs=
</data>
<key>ReplaceMask</key> <key>ReplaceMask</key>
<data> <data></data>
</data>
<key>Skip</key> <key>Skip</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
@@ -1158,27 +1177,111 @@
<key>Enabled</key> <key>Enabled</key>
<false/> <false/>
<key>Find</key> <key>Find</key>
<data> <data>ukgBAAAx9g==</data>
ukgBAAAx9g==
</data>
<key>Identifier</key> <key>Identifier</key>
<string>kernel</string> <string>kernel</string>
<key>Limit</key> <key>Limit</key>
<integer>256</integer> <integer>256</integer>
<key>Mask</key> <key>Mask</key>
<data> <data></data>
</data>
<key>MaxKernel</key> <key>MaxKernel</key>
<string>21.1.0</string> <string>21.1.0</string>
<key>MinKernel</key> <key>MinKernel</key>
<string>20.4.0</string> <string>20.4.0</string>
<key>Replace</key> <key>Replace</key>
<data> <data>ukgBAADrBQ==</data>
ukgBAADrBQ==
</data>
<key>ReplaceMask</key> <key>ReplaceMask</key>
<data> <data></data>
</data> <key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>Reroute kern.hv_vmm_present patch (1)</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AGRpcmVjdF9oYW5kb2ZmAEVuYWJsZSBkaXJlY3QgaGFuZG9mZiBmb3IgcmVhbHRpbWUgdGhyZWFkcwA=</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>AGh2X3ZtbV9wcmVzZW50AEVuYWJsZSBkaXJlY3QgaGFuZG9mZiBmb3IgcmVhbHRpbWUgdGhyZWFkcwA=</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string></string>
<key>Comment</key>
<string>Reroute kern.hv_vmm_present patch (2)</string>
<key>Count</key>
<integer>1</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data>AGh2X2Rpc2FibGUAaHZfdm1tX3ByZXNlbnQA</data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>AGh2X2Rpc2FibGUAZGlyZWN0X2hhbmRvZmYA</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key>
<integer>0</integer>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Base</key>
<string>_IOGetVMMPresent</string>
<key>Comment</key>
<string>Force IOGetVMMPresent</string>
<key>Count</key>
<integer>0</integer>
<key>Enabled</key>
<false/>
<key>Find</key>
<data></data>
<key>Identifier</key>
<string>kernel</string>
<key>Limit</key>
<integer>0</integer>
<key>Mask</key>
<data></data>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>20.4.0</string>
<key>Replace</key>
<data>uAEAAADD</data>
<key>ReplaceMask</key>
<data></data>
<key>Skip</key> <key>Skip</key>
<integer>0</integer> <integer>0</integer>
</dict> </dict>
@@ -1198,7 +1301,7 @@
<key>DisableIoMapper</key> <key>DisableIoMapper</key>
<false/> <false/>
<key>DisableLinkeditJettison</key> <key>DisableLinkeditJettison</key>
<true/> <false/>
<key>DisableRtcChecksum</key> <key>DisableRtcChecksum</key>
<false/> <false/>
<key>ExtendBTFeatureFlags</key> <key>ExtendBTFeatureFlags</key>

View File

@@ -98,20 +98,20 @@ class BuildOpenCore:
for name, version, path, check in [ for name, version, path, check in [
# Essential kexts # Essential kexts
("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path, lambda: True), ("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path, lambda: True),
("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False), ("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro), ("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro),
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching # Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path, lambda: self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1"]), ("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path, lambda: self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1"]),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False), ("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
# CPU patches # CPU patches
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: self.model.startswith("MacPro") or self.model.startswith("Xserve")), ("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: (self.model.startswith("MacPro") or self.model.startswith("Xserve")) and self.constants.serial_settings != "None"),
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value), ("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value), ("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
( (
"CPUFriend.kext", "CPUFriend.kext",
self.constants.cpufriend_version, self.constants.cpufriend_version,
self.constants.cpufriend_path, self.constants.cpufriend_path,
lambda: self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.disallow_cpufriend is False, lambda: self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None",
), ),
# Ethernet patches # Ethernet patches
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"), ("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"),
@@ -128,7 +128,20 @@ class BuildOpenCore:
self.enable_kext(name, version, path, check) self.enable_kext(name, version, path, check)
if self.constants.allow_oc_everywhere is False: if self.constants.allow_oc_everywhere is False:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True if self.constants.serial_settings == "None":
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
print("- Enabling Board ID exemption patch")
self.get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
print("- Enabling VMM exemption patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2)")["Enabled"] = True
else:
print("- Enabling SMC exemption patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
if self.get_kext_by_bundle_path("Lilu.kext")["Enabled"] is False:
# Required for Lilu in 11.0+
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
# Ethernet Patch Sets # Ethernet Patch Sets
if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom": if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom":
@@ -137,7 +150,7 @@ class BuildOpenCore:
# Applicable for pre-Ivy Bridge models # Applicable for pre-Ivy Bridge models
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path) self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
if self.constants.allow_oc_everywhere is False: if self.constants.allow_oc_everywhere is False or self.constants.serial_settings != "None":
if (smbios_data.smbios_dictionary[generate_smbios.set_smbios_model_spoof(self.model) or self.constants.override_smbios]["SecureBootModel"]) != None: if (smbios_data.smbios_dictionary[generate_smbios.set_smbios_model_spoof(self.model) or self.constants.override_smbios]["SecureBootModel"]) != None:
# Monterey T2 SMBIOS don't get OS updates without a T2 SBM # Monterey T2 SMBIOS don't get OS updates without a T2 SBM
# Forces VMM patch instead # Forces VMM patch instead
@@ -293,8 +306,8 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl" self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
# CPUFriend # CPUFriend
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist") if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False: pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
Path(self.constants.pp_kext_folder).mkdir() Path(self.constants.pp_kext_folder).mkdir()
Path(self.constants.pp_contents_folder).mkdir() Path(self.constants.pp_contents_folder).mkdir()
shutil.copy(pp_map_path, self.constants.pp_contents_folder) shutil.copy(pp_map_path, self.constants.pp_contents_folder)
@@ -336,54 +349,57 @@ class BuildOpenCore:
self.get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True self.get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
if self.constants.allow_oc_everywhere is False: if self.constants.allow_oc_everywhere is False:
if self.model == "MacBookPro9,1": if self.constants.serial_settings != "None":
print("- Adding AppleMuxControl Override") if self.model == "MacBookPro9,1":
amc_map_path = Path(self.constants.plist_folder_path) / Path("AppleMuxControl/Info.plist") print("- Adding AppleMuxControl Override")
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"} amc_map_path = Path(self.constants.plist_folder_path) / Path("AppleMuxControl/Info.plist")
Path(self.constants.amc_kext_folder).mkdir() self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
Path(self.constants.amc_contents_folder).mkdir() Path(self.constants.amc_kext_folder).mkdir()
shutil.copy(amc_map_path, self.constants.amc_contents_folder) Path(self.constants.amc_contents_folder).mkdir()
self.get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True shutil.copy(amc_map_path, self.constants.amc_contents_folder)
elif self.model == "MacBookPro10,1": self.get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"} elif self.model == "MacBookPro10,1":
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
if self.model not in model_array.NoAGPMSupport: if self.model not in model_array.NoAGPMSupport:
print("- Adding AppleGraphicsPowerManagement Override") print("- Adding AppleGraphicsPowerManagement Override")
agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist") agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist")
Path(self.constants.agpm_kext_folder).mkdir() Path(self.constants.agpm_kext_folder).mkdir()
Path(self.constants.agpm_contents_folder).mkdir() Path(self.constants.agpm_contents_folder).mkdir()
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder) shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
self.get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True self.get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
if self.model in model_array.AGDPSupport: if self.model in model_array.AGDPSupport:
print("- Adding AppleGraphicsDevicePolicy Override") print("- Adding AppleGraphicsDevicePolicy Override")
agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist") agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist")
Path(self.constants.agdp_kext_folder).mkdir() Path(self.constants.agdp_kext_folder).mkdir()
Path(self.constants.agdp_contents_folder).mkdir() Path(self.constants.agdp_contents_folder).mkdir()
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder) shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
# AGPM Patch
if self.model in model_array.DualGPUPatch: if self.constants.serial_settings != "None":
print("- Adding dual GPU patch") # AGPM Patch
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path: if self.model in model_array.DualGPUPatch:
self.gfx0_path = self.computer.dgpu.pci_path print("- Adding dual GPU patch")
print(f"- Found GFX0 Device Path: {self.gfx0_path}") if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
else: self.gfx0_path = self.computer.dgpu.pci_path
if not self.constants.custom_model: print(f"- Found GFX0 Device Path: {self.gfx0_path}")
print("- Failed to find GFX0 Device path, falling back on known logic") else:
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)" if not self.constants.custom_model:
print("- Failed to find GFX0 Device path, falling back on known logic")
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True: if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True:
print("- Prioritizing DRM support over Intel QuickSync") print("- Prioritizing DRM support over Intel QuickSync")
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256} self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256}
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = { self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
"name": binascii.unhexlify("23646973706C6179"), "name": binascii.unhexlify("23646973706C6179"),
"IOName": "#display", "IOName": "#display",
"class-code": binascii.unhexlify("FFFFFFFF"), "class-code": binascii.unhexlify("FFFFFFFF"),
} }
else: else:
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"} self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
# Audio Patch # Audio Patch
if self.constants.set_alc_usage is True: if self.constants.set_alc_usage is True:
@@ -458,8 +474,13 @@ class BuildOpenCore:
"@0,backlight-control": binascii.unhexlify("01000000"), "@0,backlight-control": binascii.unhexlify("01000000"),
"@0,built-in": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000"),
"shikigva": 256, "shikigva": 256,
"agdpmod": "vit9696", # "agdpmod": "vit9696",
} }
if self.constants.serial_settings != "None":
self.config["DeviceProperties"]["Add"][backlight_path] += {
"agdpmod": "vit9696",
}
if self.constants.custom_model and self.model == "iMac11,2": if self.constants.custom_model and self.model == "iMac11,2":
# iMac11,2 can have either PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0) or PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0) # iMac11,2 can have either PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0) or PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)
# Set both properties when we cannot run hardware detection # Set both properties when we cannot run hardware detection
@@ -468,8 +489,12 @@ class BuildOpenCore:
"@0,backlight-control": binascii.unhexlify("01000000"), "@0,backlight-control": binascii.unhexlify("01000000"),
"@0,built-in": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000"),
"shikigva": 256, "shikigva": 256,
"agdpmod": "vit9696", #"agdpmod": "vit9696",
} }
if self.constants.serial_settings != "None":
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"] += {
"agdpmod": "vit9696",
}
elif self.model in ["iMac12,1", "iMac12,2"]: elif self.model in ["iMac12,1", "iMac12,2"]:
print("- Adding Nvidia Brightness Control and DRM patches") print("- Adding Nvidia Brightness Control and DRM patches")
self.config["DeviceProperties"]["Add"][backlight_path] = { self.config["DeviceProperties"]["Add"][backlight_path] = {
@@ -477,8 +502,12 @@ class BuildOpenCore:
"@0,backlight-control": binascii.unhexlify("01000000"), "@0,backlight-control": binascii.unhexlify("01000000"),
"@0,built-in": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000"),
"shikigva": 256, "shikigva": 256,
"agdpmod": "vit9696", #"agdpmod": "vit9696",
} }
if self.constants.serial_settings != "None":
self.config["DeviceProperties"]["Add"][backlight_path] += {
"agdpmod": "vit9696",
}
print("- Disabling unsupported iGPU") print("- Disabling unsupported iGPU")
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = { self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
"name": binascii.unhexlify("23646973706C6179"), "name": binascii.unhexlify("23646973706C6179"),
@@ -712,8 +741,9 @@ class BuildOpenCore:
def set_smbios(self): def set_smbios(self):
spoofed_model = self.model spoofed_model = self.model
if self.constants.override_smbios == "Default": if self.constants.override_smbios == "Default":
print("- Setting macOS Monterey Supported SMBIOS") if self.constants.serial_settings != "None":
spoofed_model = generate_smbios.set_smbios_model_spoof(self.model) print("- Setting macOS Monterey Supported SMBIOS")
spoofed_model = generate_smbios.set_smbios_model_spoof(self.model)
else: else:
spoofed_model = self.constants.override_smbios spoofed_model = self.constants.override_smbios
print(f"- Using Model ID: {spoofed_model}") print(f"- Using Model ID: {spoofed_model}")
@@ -795,6 +825,23 @@ class BuildOpenCore:
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0] self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0]
self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1] self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1]
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper() self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
def no_smbios_patch(self):
# Still ensure Firmware Features are updated correctly
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
fw_feature = hex(fw_feature).lstrip("0x").rstrip("L").strip()
print(f"- Setting Firmware Feature: {fw_feature}")
fw_feature = utilities.string_to_hex(fw_feature)
# FirmwareFeatures
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["PlatformNVRAM"]["FirmwareFeaturesMask"] = fw_feature
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeatures"] = fw_feature
self.config["PlatformInfo"]["SMBIOS"]["FirmwareFeaturesMask"] = fw_feature
# Update tables
self.config["PlatformInfo"]["UpdateNVRAM"] = True
self.config["PlatformInfo"]["UpdateSMBIOS"] = True
if self.constants.serial_settings == "Moderate": if self.constants.serial_settings == "Moderate":
print("- Using Moderate SMBIOS patching") print("- Using Moderate SMBIOS patching")
@@ -806,6 +853,10 @@ class BuildOpenCore:
print("- Using Minimal SMBIOS patching") print("- Using Minimal SMBIOS patching")
self.spoofed_model = self.model self.spoofed_model = self.model
minimal_serial_patch(self) minimal_serial_patch(self)
elif self.constants.serial_settings == "None":
if self.constants.allow_oc_everywhere is False:
print("- Using Basic FirmwareFeatures patching")
no_smbios_patch(self)
# USB Map and CPUFriend Patching # USB Map and CPUFriend Patching
if ( if (
@@ -832,7 +883,7 @@ class BuildOpenCore:
except KeyError: except KeyError:
continue continue
plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True) plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True)
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False: if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
# Adjust CPU Friend Data to correct SMBIOS # Adjust CPU Friend Data to correct SMBIOS
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist") new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")
cpu_config = plistlib.load(Path(new_cpu_ls).open("rb")) cpu_config = plistlib.load(Path(new_cpu_ls).open("rb"))
@@ -842,7 +893,7 @@ class BuildOpenCore:
cpu_config["IOKitPersonalities"]["CPUFriendDataProvider"]["cf-frequency-data"] = string_stuff cpu_config["IOKitPersonalities"]["CPUFriendDataProvider"]["cf-frequency-data"] = string_stuff
plistlib.dump(cpu_config, Path(new_cpu_ls).open("wb"), sort_keys=True) plistlib.dump(cpu_config, Path(new_cpu_ls).open("wb"), sort_keys=True)
if self.constants.allow_oc_everywhere is False: if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
if self.model == "MacBookPro9,1": if self.model == "MacBookPro9,1":
new_amc_ls = Path(self.constants.amc_contents_folder) / Path("Info.plist") new_amc_ls = Path(self.constants.amc_contents_folder) / Path("Info.plist")
amc_config = plistlib.load(Path(new_amc_ls).open("rb")) amc_config = plistlib.load(Path(new_amc_ls).open("rb"))
@@ -923,6 +974,9 @@ class BuildOpenCore:
for entry in list(self.config["ACPI"]["Patch"]): for entry in list(self.config["ACPI"]["Patch"]):
if not entry["Enabled"]: if not entry["Enabled"]:
self.config["ACPI"]["Patch"].remove(entry) self.config["ACPI"]["Patch"].remove(entry)
for entry in list(self.config["Booter"]["Patch"]):
if not entry["Enabled"]:
self.config["Booter"]["Patch"].remove(entry)
for entry in list(self.config["Kernel"]["Add"]): for entry in list(self.config["Kernel"]["Add"]):
if not entry["Enabled"]: if not entry["Enabled"]:
self.config["Kernel"]["Add"].remove(entry) self.config["Kernel"]["Add"].remove(entry)

View File

@@ -95,6 +95,7 @@ Recommended for adanced users who want control how serials are handled
Valid options: Valid options:
0. None:\tOnly update FirmwareFeatures
1. Minimal:\tUse original serials and minimally update SMBIOS 1. Minimal:\tUse original serials and minimally update SMBIOS
2. Moderate:\tReplace entire SMBIOS but keep original serials 2. Moderate:\tReplace entire SMBIOS but keep original serials
3. Advanced:\tReplace entire SMBIOS and generate new serials 3. Advanced:\tReplace entire SMBIOS and generate new serials
@@ -104,7 +105,9 @@ Note: For new users we recommend leaving as default(1. Minimal)
""" """
) )
change_menu = input("Set SMBIOS Spoof Level(ie. 1): ") change_menu = input("Set SMBIOS Spoof Level(ie. 1): ")
if change_menu == "1": if change_menu == "0":
self.constants.serial_settings = "None"
elif change_menu == "1":
self.constants.serial_settings = "Minimal" self.constants.serial_settings = "Minimal"
elif change_menu == "2": elif change_menu == "2":
self.constants.serial_settings = "Moderate" self.constants.serial_settings = "Moderate"

View File

@@ -101,7 +101,7 @@ class Constants:
## SMBIOS Settings ## SMBIOS Settings
self.custom_cpu_model = 2 # Patch type value self.custom_cpu_model = 2 # Patch type value
self.custom_cpu_model_value = "" # New CPU name within About This Mac self.custom_cpu_model_value = "" # New CPU name within About This Mac
self.serial_settings = "Minimal" # Set SMBIOS level used self.serial_settings = "None" # Set SMBIOS level used
self.override_smbios = "Default" # Set SMBIOS model used self.override_smbios = "Default" # Set SMBIOS model used
## Latebloom Settings ## Latebloom Settings
@@ -144,6 +144,7 @@ class Constants:
self.set_alc_usage = True # Set AppleALC usage self.set_alc_usage = True # Set AppleALC usage
self.dGPU_switch = True # Set Display GPU Switching for Windows self.dGPU_switch = True # Set Display GPU Switching for Windows
self.force_surplus = False # Force SurPlus patch in newer OSes self.force_surplus = False # Force SurPlus patch in newer OSes
self.set_kext_usage = True # Set Kext usage
# OS Versions # OS Versions
## Based off Major Kernel Version ## Based off Major Kernel Version

View File

@@ -14,6 +14,7 @@ class generate_defaults():
if utilities.check_metal_support(device_probe, settings.computer) is False: if utilities.check_metal_support(device_probe, settings.computer) is False:
settings.disable_cs_lv = True settings.disable_cs_lv = True
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler: if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
# 12.0 (B7+): Kepler are now unsupported
settings.sip_status = False settings.sip_status = False
settings.amfi_status = True settings.amfi_status = True
settings.allow_fv_root = True # Allow FileVault on broken seal settings.allow_fv_root = True # Allow FileVault on broken seal
@@ -21,8 +22,18 @@ class generate_defaults():
isinstance(settings.computer.wifi, device_probe.Broadcom) isinstance(settings.computer.wifi, device_probe.Broadcom)
and settings.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224] and settings.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
) or (isinstance(settings.computer.wifi, device_probe.Atheros) and settings.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40): ) or (isinstance(settings.computer.wifi, device_probe.Atheros) and settings.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
# 12.0: Legacy Wireless chipsets require root patching
settings.sip_status = False settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal settings.allow_fv_root = True # Allow FileVault on broken seal
if settings.computer.dgpu and settings.computer.dgpu.arch in [device_probe.AMD.Archs.Polaris, device_probe.AMD.Archs.Vega, device_probe.AMD.Archs.Navi]:
# Allow H.265 on AMD
settings.serial_settings = "Minimal"
elif model in ["MacPro4,1", "MacPro5,1"]:
# Allow H.265 on AMD
# Assume 2009+ machines have Polaris on pre-builts (internal testing)
# Hardware Detection will never hit this
settings.serial_settings = "Minimal"
elif model in model_array.LegacyGPU: elif model in model_array.LegacyGPU:
settings.disable_cs_lv = True settings.disable_cs_lv = True