Add new SMBIOS patching options

This commit is contained in:
Mykola Grymalyuk
2021-03-08 18:01:19 -07:00
parent 04c88ab7af
commit 61e815565a
5 changed files with 72 additions and 32 deletions
+7
View File
@@ -1,5 +1,12 @@
# OpenCore Legacy Patcher changelog # OpenCore Legacy Patcher changelog
## 0.0.16
- Move Serial selection to Patcher Settings
- Add new SMBIOS patching options:
- Minimal: Only update board ID and BIOSVersion, keep original serials
- Moderate: Update entire SMBIOS, keep original serials
- Advanced: Update entire SMBIOS, generate new serials
## 0.0.15 ## 0.0.15
- Add user-configurable OpenCore DEBUG builds - Add user-configurable OpenCore DEBUG builds
- Add user-configurable Wifi and GPU patches - Add user-configurable Wifi and GPU patches
+25 -3
View File
@@ -128,6 +128,30 @@ option is for those patching on a different machine.
else: else:
print("Invalid option") print("Invalid option")
def change_serial(self):
utilities.cls()
utilities.header(["Set SMBIOS Mode"])
print("""This section is for setting how OpenCore generates the SMBIOS
Recommended for adanced users who want control how serials are handled
Valid options:
1. Minimal:\tUse original serials and minimally update SMBIOS
2. Moderate:\tReplave entire SMBIOS but keep original serials
3. Advanced:\tReplace entire SMBIOS and generate new serials
Note: For new users we recommend leaving as default(1. Minimal)
""")
change_serial_menu = input("Set SMBIOS Mode(ie. 1): ")
if change_serial_menu == "1":
self.constants.serial_settings = "Minimal"
elif change_serial_menu == "2":
self.constants.serial_settings = "Moderate"
elif change_serial_menu == "3":
self.constants.serial_settings = "Advanced"
else:
print("Invalid option")
def patcher_settings(self): def patcher_settings(self):
response = None response = None
while not (response and response == -1): while not (response and response == -1):
@@ -143,6 +167,7 @@ option is for those patching on a different machine.
[f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", self.change_kext], [f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", self.change_kext],
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.kext_debug}", self.change_metal], [f"Assume Metal GPU Always:\t\tCurrently {self.constants.kext_debug}", self.change_metal],
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.kext_debug}", self.change_wifi], [f"Assume Upgraded Wifi Always:\tCurrently {self.constants.kext_debug}", self.change_wifi],
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", self.change_serial],
] ]
for option in options: for option in options:
@@ -150,9 +175,6 @@ option is for those patching on a different machine.
response = menu.start() response = menu.start()
input("Press any key to continue...")
def credits(self): def credits(self):
utilities.TUIOnlyPrint(["Credits"], "Press [Enter] to go back.\n", utilities.TUIOnlyPrint(["Credits"], "Press [Enter] to go back.\n",
["""Many thanks to the following: ["""Many thanks to the following:
+2
View File
@@ -48,6 +48,8 @@ class Constants:
self.max_os_support = 11.0 self.max_os_support = 11.0
self.metal_build = False self.metal_build = False
self.wifi_build = False self.wifi_build = False
self.gui_mode = False
self.serial_settings = "Minimal"
# Payload Location # Payload Location
# OpenCore # OpenCore
+35 -26
View File
@@ -269,36 +269,44 @@ class BuildOpenCore:
print("- Spoofing to MacPro7,1") print("- Spoofing to MacPro7,1")
spoofed_model = "MacPro7,1" spoofed_model = "MacPro7,1"
spoofed_board = "Mac-27AD2F918AE68F61" spoofed_board = "Mac-27AD2F918AE68F61"
self.config["#Revision"]["Spoofed-Model"] = spoofed_model self.spoofed_model = spoofed_model
macserial_output = subprocess.run([self.constants.macserial_path] + f"-g -m {spoofed_model} -n 1".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.spoofed_board = spoofed_board
macserial_output = macserial_output.stdout.decode().strip().split(" | ") self.config["#Revision"]["Spoofed-Model"] = self.spoofed_model
macserial_output = subprocess.run([self.constants.macserial_path] + f"-g -m {self.spoofed_model} -n 1".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.macserial_output = macserial_output.stdout.decode().strip().split(" | ")
# Setup menu # Setup menu
smbios_mod = True def minimal_serial_patch(self):
while smbios_mod == True: self.config["PlatformInfo"]["PlatformNVRAM"]["BID"] = self.spoofed_board
print("Use original or generate new serials") self.config["PlatformInfo"]["SMBIOS"]["BoardProduct"] = self.spoofed_board
print("For new users, we recommend use originals(ie. y)") self.config["PlatformInfo"]["UpdateNVRAM"] = True
smbios_mod = input("Use original serials?(y, n): ") def moderate_serial_patch(self):
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"] = self.spoofed_model
def adanced_serial_patch(self):
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"]["ROM"] = binascii.unhexlify("112233445566")
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = self.macserial_output[0]
self.config["PlatformInfo"]["Generic"]["MLB"] = self.macserial_output[1]
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
if smbios_mod in {"y", "Y", "yes", "Yes"}: if self.constants.serial_settings == "Moderate":
spoofed_model = self.model moderate_serial_patch(self)
self.config["PlatformInfo"]["PlatformNVRAM"]["BID"] = spoofed_board elif self.constants.serial_settings == "Advanced":
self.config["PlatformInfo"]["SMBIOS"]["BoardProduct"] = spoofed_board adanced_serial_patch(self)
self.config["PlatformInfo"]["UpdateNVRAM"] = True else:
elif smbios_mod in {"n", "N", "no", "No"}: self.spoofed_model = self.model
self.config["PlatformInfo"]["Automatic"] = True minimal_serial_patch(self)
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]
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
else:
smbios_mod = True
# USB Map Patching # USB Map Patching
self.new_map_ls = Path(self.constants.map_contents_folder) / Path(f"Info.plist") self.new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
self.map_config = plistlib.load(Path(self.new_map_ls).open("rb")) self.map_config = plistlib.load(Path(self.new_map_ls).open("rb"))
self.map_config["IOKitPersonalities_x86_64"][self.model]["model"] = spoofed_model self.map_config["IOKitPersonalities_x86_64"][self.model]["model"] = spoofed_model
@@ -382,7 +390,8 @@ class BuildOpenCore:
print("Your OpenCore EFI has been built at:") print("Your OpenCore EFI has been built at:")
print(f" {self.constants.opencore_release_folder}") print(f" {self.constants.opencore_release_folder}")
print("") print("")
input("Press [Enter] to go back.\n") if self.constants.gui_mode == False:
input("Press [Enter] to go back.\n")
def copy_efi(self): def copy_efi(self):
utilities.cls() utilities.cls()
+1 -1
View File
@@ -930,7 +930,7 @@
<key>ProcessorType</key> <key>ProcessorType</key>
<integer>0</integer> <integer>0</integer>
<key>ROM</key> <key>ROM</key>
<data>ESIzRFVm</data> <data></data>
<key>SpoofVendor</key> <key>SpoofVendor</key>
<true/> <true/>
<key>SystemProductName</key> <key>SystemProductName</key>