diff --git a/CHANGELOG.md b/CHANGELOG.md index 65da6472d..45305ca9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Enhance Wifi model detection - Hide OpenShell.efi by default - Add Brightness Control patches for legacy Nvidia and Intel GPUs +- Add user configurable Bootstrap setting ## 0.0.22 - Add ExFat support for models missing driver diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index ba89665b8..92b2d1989 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -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 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 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: diff --git a/Resources/CliMenu.py b/Resources/CliMenu.py index e6e6fbe9f..0e9314f00 100644 --- a/Resources/CliMenu.py +++ b/Resources/CliMenu.py @@ -215,7 +215,7 @@ running, however this will enforce iMac Nvidia Build Patches. def custom_repo(self): 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 where you can add custom repos such as Google Drive links. @@ -235,5 +235,32 @@ Current repo: elif change_menu == "2": if 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: print("Invalid option") \ No newline at end of file diff --git a/Resources/Constants.py b/Resources/Constants.py index 511499643..41ca46aca 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -63,6 +63,7 @@ class Constants: self.sip_status = True self.secure_status = True self.detected_os = 0 + self.boot_efi = False # OS Versions self.tiger = 8 diff --git a/Resources/ModelArray.py b/Resources/ModelArray.py index a99c3e75e..b1ca8f846 100644 --- a/Resources/ModelArray.py +++ b/Resources/ModelArray.py @@ -332,7 +332,7 @@ LegacyGPU = [ "Macmini5,2", # AMD 6000 "Macmini5,3", # Intel 3000 "iMac7,1", # AMD 2000 - "iMac8,1", # AMD 2000 + #"iMac8,1", # AMD 2000 and AMD 2400 "iMac9,1", # Nvidia 9000 #"iMac10,1", # Nvidia 9000 and AMD 4000 "iMac11,1", # AMD 4000 diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index 84119f8eb..36c2fe972 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -122,8 +122,8 @@ class PatchSysVolume: print("- Merging legacy Intel 2nd Gen Kexts and Bundles") self.delete_old_binaries(ModelArray.DeleteNvidiaAccel11) 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 - if self.model == "iMac10,1": + # iMac8,1 and iMac10,1 came in both AMD and Nvidia GPU models, so we must do hardware detection + if self.model in ("iMac8,1", "iMac10,1"): if self.constants.current_gpuv == "AMD (0x1002)": print("- Merging legacy AMD Kexts and Bundles") self.delete_old_binaries(ModelArray.DeleteAMDAccel11) @@ -188,16 +188,29 @@ class PatchSysVolume: print("- Detected legacy GPU, attempting legacy acceleration patches") self.gpu_accel_patches_11() else: - print("- Adding Brightness Control patches") if self.model in ModelArray.LegacyGPUNvidia: + print("- Adding Nvidia Brightness Control patches") 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) 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) 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) + 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 if rebuild_required is True: diff --git a/Resources/build.py b/Resources/build.py index 70e7b3c77..aff6809b8 100644 --- a/Resources/build.py +++ b/Resources/build.py @@ -8,6 +8,7 @@ import shutil import subprocess import uuid import zipfile +import os from pathlib import Path from datetime import date @@ -663,6 +664,13 @@ Please build OpenCore first!""" 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("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 # 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"]: diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 604b4e396..0c35175ce 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -120,6 +120,7 @@ module.exports = { collapsable: false, sidebarDepth: 1, children: [ + 'TESTED', 'TERMS', 'HOW', 'PATCHEXPLAIN',