Add user configurable Bootstrap setting

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/138
This commit is contained in:
Mykola Grymalyuk
2021-04-10 22:45:22 -06:00
parent af940152a1
commit 6a18334663
8 changed files with 59 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
- Enhance Wifi model detection - Enhance Wifi model detection
- Hide OpenShell.efi by default - Hide OpenShell.efi by default
- Add Brightness Control patches for legacy Nvidia and Intel GPUs - Add Brightness Control patches for legacy Nvidia and Intel GPUs
- Add user configurable Bootstrap setting
## 0.0.22 ## 0.0.22
- Add ExFat support for models missing driver - Add ExFat support for models missing driver

View File

@@ -87,7 +87,8 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault], [f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault],
[f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_sip], [f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_sip],
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial], [f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial],
[f"Set Custom Patch Repo", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_repo], [f"Set Generic Bootstrap:\t\t{self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
["Set Custom Patch Repo", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_repo],
] ]
for option in options: for option in options:

View File

@@ -215,7 +215,7 @@ running, however this will enforce iMac Nvidia Build Patches.
def custom_repo(self): def custom_repo(self):
utilities.cls() utilities.cls()
utilities.header(["Swet custom patch repo"]) utilities.header(["Set custom patch repo"])
print(f"""For users participating in OpenCore Patcher betas, this is print(f"""For users participating in OpenCore Patcher betas, this is
where you can add custom repos such as Google Drive links. where you can add custom repos such as Google Drive links.
@@ -235,5 +235,32 @@ Current repo:
elif change_menu == "2": elif change_menu == "2":
if self.constants.url_backup != "": if self.constants.url_backup != "":
self.constants.url_apple_binaries = self.constants.url_backup self.constants.url_apple_binaries = self.constants.url_backup
else:
print("Invalid option")
def bootstrap_setting(self):
utilities.cls()
utilities.header(["Set Bootstrap method"])
print("""Sets OpenCore's bootstrap method, currently the patcher supports the
following options.
Valid options:
1. System/Library/CoreServices/boot.efi (default)
2. EFI/BOOT/BOOTx64.efi
3. Exit
Note: S*/L*/C*/boot.efi method is only installed to the EFI partition only
and not to macOS itself.
Recommended to set to BOOTx64.efi in situations where your Mac cannot
see the EFI Boot entry in the boot picker.
""")
change_menu = input("Set Bootstrap method: ")
if change_menu == "1":
self.constants.boot_efi = False
elif change_menu == "2":
self.constants.boot_efi = True
else: else:
print("Invalid option") print("Invalid option")

View File

@@ -63,6 +63,7 @@ class Constants:
self.sip_status = True self.sip_status = True
self.secure_status = True self.secure_status = True
self.detected_os = 0 self.detected_os = 0
self.boot_efi = False
# OS Versions # OS Versions
self.tiger = 8 self.tiger = 8

View File

@@ -332,7 +332,7 @@ LegacyGPU = [
"Macmini5,2", # AMD 6000 "Macmini5,2", # AMD 6000
"Macmini5,3", # Intel 3000 "Macmini5,3", # Intel 3000
"iMac7,1", # AMD 2000 "iMac7,1", # AMD 2000
"iMac8,1", # AMD 2000 #"iMac8,1", # AMD 2000 and AMD 2400
"iMac9,1", # Nvidia 9000 "iMac9,1", # Nvidia 9000
#"iMac10,1", # Nvidia 9000 and AMD 4000 #"iMac10,1", # Nvidia 9000 and AMD 4000
"iMac11,1", # AMD 4000 "iMac11,1", # AMD 4000

View File

@@ -122,8 +122,8 @@ class PatchSysVolume:
print("- Merging legacy Intel 2nd Gen Kexts and Bundles") print("- Merging legacy Intel 2nd Gen Kexts and Bundles")
self.delete_old_binaries(ModelArray.DeleteNvidiaAccel11) self.delete_old_binaries(ModelArray.DeleteNvidiaAccel11)
self.add_new_binaries(ModelArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path) self.add_new_binaries(ModelArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
# iMac10,1 came in both AMD and Nvidia GPU models, so we must do hardware detection # iMac8,1 and iMac10,1 came in both AMD and Nvidia GPU models, so we must do hardware detection
if self.model == "iMac10,1": if self.model in ("iMac8,1", "iMac10,1"):
if self.constants.current_gpuv == "AMD (0x1002)": if self.constants.current_gpuv == "AMD (0x1002)":
print("- Merging legacy AMD Kexts and Bundles") print("- Merging legacy AMD Kexts and Bundles")
self.delete_old_binaries(ModelArray.DeleteAMDAccel11) self.delete_old_binaries(ModelArray.DeleteAMDAccel11)
@@ -188,16 +188,29 @@ class PatchSysVolume:
print("- Detected legacy GPU, attempting legacy acceleration patches") print("- Detected legacy GPU, attempting legacy acceleration patches")
self.gpu_accel_patches_11() self.gpu_accel_patches_11()
else: else:
print("- Adding Brightness Control patches")
if self.model in ModelArray.LegacyGPUNvidia: if self.model in ModelArray.LegacyGPUNvidia:
print("- Adding Nvidia Brightness Control patches")
self.add_new_binaries(ModelArray.AddNvidiaBrightness11, self.constants.legacy_nvidia_path) self.add_new_binaries(ModelArray.AddNvidiaBrightness11, self.constants.legacy_nvidia_path)
#elif self.model in ModelArray.LegacyGPUNvidia: #elif self.model in ModelArray.LegacyGPUAMD:
# self.add_new_binaries(ModelArray.AddAMDBrightness11, self.constants.legacy_amd_path) # self.add_new_binaries(ModelArray.AddAMDBrightness11, self.constants.legacy_amd_path)
if self.model in ModelArray.LegacyGPUIntelGen1: if self.model in ModelArray.LegacyGPUIntelGen1:
print("- Adding Intel Ironlake Brightness Control patches")
self.add_new_binaries(ModelArray.AddIntelGen1Brightness, self.constants.legacy_intel_gen1_path) self.add_new_binaries(ModelArray.AddIntelGen1Brightness, self.constants.legacy_intel_gen1_path)
elif self.model in ModelArray.LegacyGPUIntelGen2: elif self.model in ModelArray.LegacyGPUIntelGen2:
print("- Adding Intel Sandy Bridge Brightness Control patches")
self.add_new_binaries(ModelArray.AddIntelGen2Brightness, self.constants.legacy_intel_gen2_path) self.add_new_binaries(ModelArray.AddIntelGen2Brightness, self.constants.legacy_intel_gen2_path)
if self.model in ("iMac8,1", "iMac10,1"):
if self.constants.current_gpuv == "NVIDIA (0x10de)":
print("- Adding Nvidia Brightness Control patches")
self.add_new_binaries(ModelArray.AddNvidiaBrightness11, self.constants.legacy_nvidia_path)
if self.model in ModelArray.LegacyBrightness:
print("- Merging legacy Brightness Control Patches")
self.delete_old_binaries(ModelArray.DeleteBrightness)
self.add_new_binaries(ModelArray.AddBrightness, self.constants.legacy_brightness)
subprocess.run(f"sudo ditto {self.constants.payload_apple_private_frameworks_path_brightness} {self.mount_private_frameworks}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chmod -R 755 {self.mount_private_frameworks}/DisplayServices.framework".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
subprocess.run(f"sudo chown -R root:wheel {self.mount_private_frameworks}/DisplayServices.framework".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
rebuild_required = True rebuild_required = True
if rebuild_required is True: if rebuild_required is True:

View File

@@ -8,6 +8,7 @@ import shutil
import subprocess import subprocess
import uuid import uuid
import zipfile import zipfile
import os
from pathlib import Path from pathlib import Path
from datetime import date from datetime import date
@@ -663,6 +664,13 @@ Please build OpenCore first!"""
print("- Coping OpenCore onto EFI partition") print("- Coping OpenCore onto EFI partition")
shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC")) shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC"))
shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System")) shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System"))
if self.constants.boot_efi is True:
print("- Converting Bootstrap to BOOTx64.efi")
if (mount_path / Path("EFI/BOOT")).exists():
shutil.rmtree(mount_path / Path("EFI/BOOT"), onerror=rmtree_handler)
Path(mount_path / Path("EFI/BOOT")).mkdir()
shutil.move(mount_path / Path("System/Library/CoreServices/boot.efi"), mount_path / Path("EFI/BOOT/BOOTx64.efi"))
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
# Array filled with common SD Card names # Array filled with common SD Card names
# Note most USB-based SD Card readers generally report as "Storage Device", and no reliable way to detect further # Note most USB-based SD Card readers generally report as "Storage Device", and no reliable way to detect further
if sd_type in ["SD Card Reader", "SD/MMC"]: if sd_type in ["SD Card Reader", "SD/MMC"]:

View File

@@ -120,6 +120,7 @@ module.exports = {
collapsable: false, collapsable: false,
sidebarDepth: 1, sidebarDepth: 1,
children: [ children: [
'TESTED',
'TERMS', 'TERMS',
'HOW', 'HOW',
'PATCHEXPLAIN', 'PATCHEXPLAIN',