diff --git a/Build-Binary.command b/Build-Binary.command index df8ab6fe7..2df61ff3e 100755 --- a/Build-Binary.command +++ b/Build-Binary.command @@ -3,14 +3,15 @@ # Generate stand alone application for OpenCore-Patcher # Copyright (C) 2022-2023 - Mykola Grymalyuk -from pathlib import Path +import os +import sys import time import argparse -import os -import subprocess import plistlib -import time -import sys +import platform +import subprocess + +from pathlib import Path from resources import constants @@ -30,11 +31,13 @@ class CreateBinary: def __init__(self): start = time.time() - print("Starting build script") + self._set_cwd() + self._is_x86_64() + print("Starting build script") self.args = self._parse_arguments() - self._set_cwd() + print(f"Current Working Directory:\n- {os.getcwd()}") self._preflight_processes() self._build_binary() @@ -42,13 +45,44 @@ class CreateBinary: print(f"Build script completed in {str(round(time.time() - start, 2))} seconds") + def _is_x86_64(self): + """ + Check if invoked as x86_64 + Some of our dependancies are not universal, so we'll create a new virtual environment and invoke as Rosetta + """ + + if platform.machine() != "arm64": + return + + print("Detected ARM64, creating x86_64 environment") + + args = sys.argv[:] + if "python" in args[0].lower(): + args.pop(0) + + if not Path(".x86_64_venv").exists(): + print("Creating new venv") + subprocess.run(["arch", "-x86_64", sys.executable, "-m", "venv", ".x86_64_venv"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + print("Installing requirements") + subprocess.run(["arch", "-x86_64", ".x86_64_venv/bin/pip3", "install", "-r", "requirements.txt"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + print("Relaunching as x86_64") + result = subprocess.run(["arch", "-x86_64", ".x86_64_venv/bin/python3"] + args) + + if result.returncode != 0: + if result.stdout: + print("STDOUT: " + result.stdout.decode("utf-8")) + if result.stderr: + print("STDERR: " + result.stderr.decode("utf-8")) + sys.exit(result.returncode) + + def _set_cwd(self): """ Initialize current working directory to parent of this script """ os.chdir(Path(__file__).resolve().parent) - print(f"Current Working Directory:\n- {os.getcwd()}") def _parse_arguments(self): diff --git a/CHANGELOG.md b/CHANGELOG.md index bbe3f37b6..cb5bd4fe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # OpenCore Legacy Patcher changelog ## 0.6.9 +- Resolve BCM2046 and BCM2070 support on macOS 13.3 and newer +- Increment Binaries: + - OpenCorePkg 0.9.3 - release + - Lilu 1.6.6 - release + - WhateverGreen 1.6.5 - release + - RestrictEvents 1.1.2 - release + - FeatureUnlock 1.1.5 - release + - DebugEnhancer 1.0.8 - release + - CPUFriend 1.2.7 - release + - BlueToolFixup 2.6.8 - rolling (2305aaa) + - CryptexFixup 1.0.2 - release ## 0.6.8 - Update non-Metal Binaries: diff --git a/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-DEBUG.zip b/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-DEBUG.zip new file mode 100644 index 000000000..c7e459b5c Binary files /dev/null and b/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-RELEASE.zip b/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-RELEASE.zip new file mode 100644 index 000000000..77e831db1 Binary files /dev/null and b/payloads/Kexts/Acidanthera/BlueToolFixup-v2.6.8-RELEASE.zip differ diff --git a/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-DEBUG.zip b/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-DEBUG.zip index 29034ebeb..28be75a6b 100644 Binary files a/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-DEBUG.zip and b/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-RELEASE.zip b/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-RELEASE.zip index 93ed08b3d..a3a62d538 100644 Binary files a/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-RELEASE.zip and b/payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-RELEASE.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-DEBUG.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-DEBUG.zip index 88ccd08c8..95d9867c8 100644 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-DEBUG.zip and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-DEBUG.zip differ diff --git a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-RELEASE.zip b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-RELEASE.zip index 698ce81bd..1ae0869d8 100644 Binary files a/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-RELEASE.zip and b/payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-RELEASE.zip differ diff --git a/payloads/OpenCore/OpenCore-DEBUG.zip b/payloads/OpenCore/OpenCore-DEBUG.zip index 62ef6282f..7fa012e3b 100644 Binary files a/payloads/OpenCore/OpenCore-DEBUG.zip and b/payloads/OpenCore/OpenCore-DEBUG.zip differ diff --git a/payloads/OpenCore/OpenCore-RELEASE.zip b/payloads/OpenCore/OpenCore-RELEASE.zip index 88c9b9aee..ab0941707 100644 Binary files a/payloads/OpenCore/OpenCore-RELEASE.zip and b/payloads/OpenCore/OpenCore-RELEASE.zip differ diff --git a/resources/constants.py b/resources/constants.py index c12c6ca3b..6eccd4d0b 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -43,7 +43,7 @@ class Constants: self.featureunlock_version: str = "1.1.5" # FeatureUnlock self.debugenhancer_version: str = "1.0.8" # DebugEnhancer self.cpufriend_version: str = "1.2.7" # CPUFriend - self.bluetool_version: str = "2.6.7" # BlueToolFixup (BrcmPatchRAM) + self.bluetool_version: str = "2.6.8" # BlueToolFixup (BrcmPatchRAM) self.cslvfixup_version: str = "2.6.1" # CSLVFixup self.autopkg_version: str = "1.0.3" # AutoPkgInstaller self.cryptexfixup_version: str = "1.0.2" # CryptexFixup diff --git a/resources/sys_patch/sys_patch.py b/resources/sys_patch/sys_patch.py index 52c82746d..b957dd871 100644 --- a/resources/sys_patch/sys_patch.py +++ b/resources/sys_patch/sys_patch.py @@ -280,6 +280,8 @@ class PatchSysVolume: if self.needs_kmutil_exemptions is True: logging.info("Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded") self.constants.root_patcher_succeeded = True + return True + return False def _rebuild_kernel_collection(self) -> bool: @@ -418,9 +420,11 @@ class PatchSysVolume: """ Unmount root volume """ - - logging.info("- Unmounting Root Volume (Don't worry if this fails)") - utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode() + if self.root_mount_path: + logging.info("- Unmounting Root Volume (Don't worry if this fails)") + utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode() + else: + logging.info("- Skipping Root Volume unmount") def _rebuild_dyld_shared_cache(self) -> None: diff --git a/resources/wx_gui/gui_settings.py b/resources/wx_gui/gui_settings.py index 5697250c1..777962606 100644 --- a/resources/wx_gui/gui_settings.py +++ b/resources/wx_gui/gui_settings.py @@ -4,8 +4,10 @@ import pprint import logging import py_sip_xnu import subprocess +import os from pathlib import Path +from resources.sys_patch.sys_patch import PatchSysVolume from resources.wx_gui import ( gui_support, @@ -806,6 +808,9 @@ class SettingsFrame(wx.Frame): }, }, "Developer": { + "Validation": { + "type": "title", + }, "Install latest nightly build ๐Ÿงช": { "type": "button", "function": self.on_nightly, @@ -831,6 +836,28 @@ class SettingsFrame(wx.Frame): "Export constants.py values to a txt file.", ], }, + "Developer Root Volume Patching": { + "type": "title", + }, + "Mount Root Volume": { + "type": "button", + "function": self.on_mount_root_vol, + "description": [ + "Life's too short to type 'sudo mount -o", + "nobrowse -t apfs /dev/diskXsY", + "/System/Volumes/Update/mnt1' every time.", + ], + }, + "wrap_around 2": { + "type": "wrap_around", + }, + "Save Root Volume": { + "type": "button", + "function": self.on_bless_root_vol, + "description": [ + "Rebuild kernel cache and bless snapshot ๐Ÿ™", + ], + }, }, } @@ -1267,3 +1294,23 @@ Hardware Information: def on_test_exception(self, event: wx.Event) -> None: raise Exception("Test Exception") + + def on_mount_root_vol(self, event: wx.Event) -> None: + if os.geteuid() != 0: + wx.MessageDialog(self.parent, "Please relaunch as Root to mount the Root Volume", "Error", wx.OK | wx.ICON_ERROR).ShowModal() + else: + #Don't need to pass model as we're bypassing all logic + if PatchSysVolume("",self.constants)._mount_root_vol() == True: + wx.MessageDialog(self.parent, "Root Volume Mounted, remember to fix permissions before saving the Root Volume", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal() + else: + wx.MessageDialog(self.parent, "Root Volume Mount Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal() + + def on_bless_root_vol(self, event: wx.Event) -> None: + if os.geteuid() != 0: + wx.MessageDialog(self.parent, "Please relaunch as Root to save changes", "Error", wx.OK | wx.ICON_ERROR).ShowModal() + else: + #Don't need to pass model as we're bypassing all logic + if PatchSysVolume("",self.constants)._rebuild_root_volume() == True: + wx.MessageDialog(self.parent, "Root Volume saved, please reboot to apply changes", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal() + else: + wx.MessageDialog(self.parent, "Root Volume update Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal() \ No newline at end of file