mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 22:00:00 +10:00
Merge branch 'main' into ventura-alpha
This commit is contained in:
@@ -1237,6 +1237,8 @@ class BuildOpenCore:
|
||||
self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = self.constants.custom_serial_number
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = self.constants.custom_board_serial_number
|
||||
self.config["PlatformInfo"]["Generic"]["MaxBIOSVersion"] = False
|
||||
self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-SN"] = self.constants.custom_serial_number
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-MLB"] = self.constants.custom_board_serial_number
|
||||
|
||||
|
||||
+27
-1
@@ -3,6 +3,7 @@ from pathlib import Path
|
||||
import plistlib
|
||||
import subprocess
|
||||
import requests
|
||||
import tempfile
|
||||
from resources import utilities, tui_helpers
|
||||
|
||||
def list_local_macOS_installers():
|
||||
@@ -331,8 +332,10 @@ def list_disk_to_format():
|
||||
})
|
||||
return list_disks
|
||||
|
||||
# Create global tmp directory
|
||||
tmp_dir = tempfile.TemporaryDirectory()
|
||||
|
||||
def generate_installer_creation_script(script_location, installer_path, disk):
|
||||
def generate_installer_creation_script(tmp_location, installer_path, disk):
|
||||
# Creates installer.sh to be piped to OCLP-Helper and run as admin
|
||||
# Goals:
|
||||
# - Format provided disk as HFS+ GPT
|
||||
@@ -341,6 +344,29 @@ def generate_installer_creation_script(script_location, installer_path, disk):
|
||||
# OCLP-Helper once to avoid nagging the user about permissions
|
||||
|
||||
additional_args = ""
|
||||
script_location = Path(tmp_location) / Path("Installer.sh")
|
||||
|
||||
# Due to a bug in createinstallmedia, running from '/Applications' may sometimes error:
|
||||
# 'Failed to extract AssetData/boot/Firmware/Manifests/InstallerBoot/*'
|
||||
# This affects native Macs as well even when manually invoking createinstallmedia
|
||||
|
||||
# To resolve, we'll copy into our temp directory and run from there
|
||||
|
||||
# Create a new tmp directory
|
||||
# Our current one is a disk image, thus CoW will not work
|
||||
global tmp_dir
|
||||
ia_tmp = tmp_dir.name
|
||||
|
||||
print(f"Creating temporary directory at {ia_tmp}")
|
||||
# Delete all files in tmp_dir
|
||||
for file in Path(ia_tmp).glob("*"):
|
||||
subprocess.run(["rm", "-rf", str(file)])
|
||||
|
||||
# Copy installer to tmp (use CoW to avoid extra disk writes)
|
||||
subprocess.run(["cp", "-cR", installer_path, ia_tmp])
|
||||
|
||||
# Adjust installer_path to point to the copied installer
|
||||
installer_path = Path(ia_tmp) / Path(Path(installer_path).name)
|
||||
|
||||
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
|
||||
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))
|
||||
|
||||
@@ -28,20 +28,23 @@ class sys_patch_helpers:
|
||||
board_to_patch_hex = bytes.fromhex(board_to_patch.encode('utf-8').hex())
|
||||
reported_board_hex = bytes.fromhex(self.constants.computer.reported_board_id.encode('utf-8').hex())
|
||||
|
||||
if len(board_to_patch_hex) != len(reported_board_hex):
|
||||
print(f"- Error: Board ID {self.constants.computer.reported_board_id} is not the same length as {board_to_patch}")
|
||||
raise Exception("Host's Board ID is not the same length as the kext's Board ID, cannot patch!!!")
|
||||
if len(board_to_patch_hex) > len(reported_board_hex):
|
||||
# Pad the reported Board ID with zeros to match the length of the board to patch
|
||||
reported_board_hex = reported_board_hex + bytes(len(board_to_patch_hex) - len(reported_board_hex))
|
||||
elif len(board_to_patch_hex) < len(reported_board_hex):
|
||||
print(f"- Error: Board ID {self.constants.computer.reported_board_id} is longer than {board_to_patch}")
|
||||
raise Exception("Host's Board ID is longer than the kext's Board ID, cannot patch!!!")
|
||||
|
||||
path = source_files_path + "/10.13.6/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS/AppleIntelSNBGraphicsFB"
|
||||
if Path(path).exists():
|
||||
with open(path, 'rb') as f:
|
||||
data = f.read()
|
||||
data = data.replace(board_to_patch_hex, reported_board_hex)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(data)
|
||||
else:
|
||||
path = source_files_path + "/10.13.6/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/MacOS/AppleIntelSNBGraphicsFB"
|
||||
if Path(path).exists():
|
||||
with open(path, 'rb') as f:
|
||||
data = f.read()
|
||||
data = data.replace(board_to_patch_hex, reported_board_hex)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(data)
|
||||
else:
|
||||
print(f"- Error: Could not find {path}")
|
||||
raise Exception("Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!")
|
||||
print(f"- Error: Could not find {path}")
|
||||
raise Exception("Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!")
|
||||
|
||||
|
||||
def generate_patchset_plist(self, patchset, file_name):
|
||||
|
||||
Reference in New Issue
Block a user