mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-15 13:18:56 +10:00
Compare commits
217 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29d3e98b81 | ||
|
|
462fff9d66 | ||
|
|
158f6f2da9 | ||
|
|
a57c29d35e | ||
|
|
bc18bdce03 | ||
|
|
ef9b5bb64a | ||
|
|
c225b77400 | ||
|
|
b69cf09556 | ||
|
|
85203aef5b | ||
|
|
ec80afdd17 | ||
|
|
e288e27b7b | ||
|
|
961c9c7a68 | ||
|
|
55abbab145 | ||
|
|
2986aea152 | ||
|
|
0135d6cccf | ||
|
|
fd2f58da84 | ||
|
|
efb1d81231 | ||
|
|
7fe0432a47 | ||
|
|
88fa7a4b7a | ||
|
|
e0e74ee494 | ||
|
|
e579199246 | ||
|
|
1108d248e5 | ||
|
|
6013eaffe9 | ||
|
|
ea96c546ca | ||
|
|
531fc8ab18 | ||
|
|
35a6f5183c | ||
|
|
afd1b5d2a7 | ||
|
|
d5ffa9a8cf | ||
|
|
0c68618ddf | ||
|
|
ea80d41ff6 | ||
|
|
483819caef | ||
|
|
0ca8ccd3dc | ||
|
|
a1f1da25b5 | ||
|
|
e105d6077e | ||
|
|
eedd4d771a | ||
|
|
3f2aadc016 | ||
|
|
e980054a5d | ||
|
|
a89a7740ca | ||
|
|
2767f35fc5 | ||
|
|
48cf258366 | ||
|
|
8e7706fb12 | ||
|
|
2eb6542931 | ||
|
|
e66e851933 | ||
|
|
9bfcf78ff9 | ||
|
|
8d3ab82ddd | ||
|
|
7b7f68453a | ||
|
|
adec8ebd05 | ||
|
|
ca24aa6ce5 | ||
|
|
e8f44e4eaa | ||
|
|
6a3023301a | ||
|
|
44369e2faa | ||
|
|
0d7186236e | ||
|
|
8806d29a35 | ||
|
|
12b7cf7fcd | ||
|
|
0f7f079dd8 | ||
|
|
040edfdd25 | ||
|
|
2e7afae29b | ||
|
|
b81899092b | ||
|
|
418a966081 | ||
|
|
520c9c315c | ||
|
|
cffc463bde | ||
|
|
2f7965440c | ||
|
|
56efd9743d | ||
|
|
b5b4d84bc9 | ||
|
|
594f6dcbe5 | ||
|
|
c5eb52ac5e | ||
|
|
e83e260db7 | ||
|
|
66a5f5a9ad | ||
|
|
4154b01d40 | ||
|
|
925003e3f1 | ||
|
|
d40d6607b3 | ||
|
|
3aadfe6002 | ||
|
|
d305515c28 | ||
|
|
48471ce4d3 | ||
|
|
f9c7273106 | ||
|
|
e076260a1a | ||
|
|
0671828c9b | ||
|
|
61e5ff1c83 | ||
|
|
3b5e4f10f6 | ||
|
|
dd06932fe5 | ||
|
|
7ee631859d | ||
|
|
7be168bf14 | ||
|
|
6b86e64b5b | ||
|
|
4ae494db86 | ||
|
|
c5f72c10ff | ||
|
|
971a2b0d02 | ||
|
|
8b18c59d8a | ||
|
|
0d38bc0edf | ||
|
|
4c4cacf114 | ||
|
|
dd1afd77e4 | ||
|
|
2a91b2a11c | ||
|
|
b3ed101ad9 | ||
|
|
7b33e77947 | ||
|
|
ea35eaca2e | ||
|
|
b5c613242f | ||
|
|
2eb98b6327 | ||
|
|
6629e9dcef | ||
|
|
6c441e835c | ||
|
|
fe8a2d253a | ||
|
|
68af20d2fa | ||
|
|
625da17f1e | ||
|
|
118d635264 | ||
|
|
bd471df48f | ||
|
|
d70daaf5a4 | ||
|
|
7fc9f3af7c | ||
|
|
6f4c110318 | ||
|
|
dfdb5b4c68 | ||
|
|
5ac3343205 | ||
|
|
42dddfdccf | ||
|
|
ace93b8a3e | ||
|
|
6081ec0d73 | ||
|
|
fc85789f86 | ||
|
|
52fbe23a16 | ||
|
|
99968dbb57 | ||
|
|
b141452005 | ||
|
|
b97a3bc4d8 | ||
|
|
f4ed623c76 | ||
|
|
ad9ae96c7f | ||
|
|
bece5d4b3b | ||
|
|
f915199b92 | ||
|
|
cba9d1e224 | ||
|
|
4782ccdab1 | ||
|
|
1ab2409176 | ||
|
|
3d8bae1142 | ||
|
|
baf25319d7 | ||
|
|
43ef3e18ec | ||
|
|
08710bc47b | ||
|
|
6c294902c2 | ||
|
|
976f14eeb3 | ||
|
|
eb1e29f95b | ||
|
|
4d89c220bf | ||
|
|
571f297906 | ||
|
|
7bf4fd0150 | ||
|
|
d4f42c8b32 | ||
|
|
664972fd2e | ||
|
|
f33cc2d5bb | ||
|
|
da45a964cb | ||
|
|
6c555db237 | ||
|
|
c093f400a6 | ||
|
|
92d57cb6d5 | ||
|
|
3a6f87c9c8 | ||
|
|
08a67e5d37 | ||
|
|
6ed55ff462 | ||
|
|
ef912277b6 | ||
|
|
cef860dbf1 | ||
|
|
e5b89e9c6b | ||
|
|
7ebdb83af7 | ||
|
|
da2fc5c4c3 | ||
|
|
94cfeabdfd | ||
|
|
e7727adcc6 | ||
|
|
8becb554fc | ||
|
|
97024361cd | ||
|
|
71ca6731fa | ||
|
|
ac2147684a | ||
|
|
e16b6e4c22 | ||
|
|
e84f3425d0 | ||
|
|
e1b99b9084 | ||
|
|
b3775d35a5 | ||
|
|
498042ccb3 | ||
|
|
7d4ee0d110 | ||
|
|
cff1aaf3f4 | ||
|
|
a776535e72 | ||
|
|
f7dea97289 | ||
|
|
37e99ba49c | ||
|
|
288b827616 | ||
|
|
e8a6f45329 | ||
|
|
a1ffadf582 | ||
|
|
a6c4890d0f | ||
|
|
00b47aef47 | ||
|
|
92f85feda5 | ||
|
|
21778e8d92 | ||
|
|
57d2597c86 | ||
|
|
20baf8c417 | ||
|
|
99a145e7cb | ||
|
|
28b9948b45 | ||
|
|
79f4ba17d9 | ||
|
|
659d842023 | ||
|
|
037ff0f2c3 | ||
|
|
fac1298a6e | ||
|
|
273910b69a | ||
|
|
1974cd6341 | ||
|
|
bef429b758 | ||
|
|
bebbf646e1 | ||
|
|
6504442d4f | ||
|
|
ff0012e214 | ||
|
|
91e7ff40e4 | ||
|
|
07d09d8eb2 | ||
|
|
b95ab91b43 | ||
|
|
4cc9e414d2 | ||
|
|
a5d56147c0 | ||
|
|
3e8963c372 | ||
|
|
f4d6ef1741 | ||
|
|
abbb9c1c66 | ||
|
|
22b66e0a87 | ||
|
|
fd6c3d818d | ||
|
|
5fa0636f5c | ||
|
|
cefdd1df66 | ||
|
|
fcda4a26bf | ||
|
|
60f6482d43 | ||
|
|
c316e6f5fe | ||
|
|
d30972e5ef | ||
|
|
5206028478 | ||
|
|
00043087c4 | ||
|
|
d7ecdf3871 | ||
|
|
6fe7ed614c | ||
|
|
09f77490a5 | ||
|
|
1cc6d50474 | ||
|
|
549cb9fc9a | ||
|
|
a8ef84acf9 | ||
|
|
f55d3ba5b2 | ||
|
|
e46a5213a6 | ||
|
|
2331aeb6d9 | ||
|
|
1277fef735 | ||
|
|
5fdde346cf | ||
|
|
907ce75295 | ||
|
|
915d38eab1 | ||
|
|
8678200385 |
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -95,7 +95,6 @@ body:
|
||||
description: What variant of our software are you running?
|
||||
options:
|
||||
- GUI (Graphical User Interface)
|
||||
- TUI (Text User Interface)
|
||||
- CLI (Command Line Interface)
|
||||
- Other/Non-Applicable
|
||||
validations:
|
||||
|
||||
12
.github/workflows/build-app-wxpython.yml
vendored
12
.github/workflows/build-app-wxpython.yml
vendored
@@ -10,16 +10,21 @@ jobs:
|
||||
build:
|
||||
name: Build wxPython
|
||||
runs-on: x86_64_mojave
|
||||
if: github.repository_owner == 'dortania'
|
||||
|
||||
env:
|
||||
branch: ${{ github.ref }}
|
||||
commiturl: ${{ github.event.head_commit.url }}${{ github.event.release.html_url }}
|
||||
commitdate: ${{ github.event.head_commit.timestamp }}${{ github.event.release.published_at }}
|
||||
MAC_NOTARIZATION_USERNAME: ${{ secrets.MAC_NOTARIZATION_USERNAME }}
|
||||
MAC_NOTARIZATION_PASSWORD: ${{ secrets.MAC_NOTARIZATION_PASSWORD }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --reset_binaries --branch "${{ env.branch }}" --commit "${{ env.commiturl }}" --commit_date "${{ env.commitdate }}"
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 Build-Binary.command --reset_binaries --branch "${{ env.branch }}" --commit "${{ env.commiturl }}" --commit_date "${{ env.commitdate }}"
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||
- run: cd dist; ditto -c -k --sequesterRsrc --keepParent OpenCore-Patcher.app ../OpenCore-Patcher-wxPython.app.zip
|
||||
- run: ./../sign-wxpython.sh
|
||||
- run: xcrun altool --notarize-app --primary-bundle-id "com.dortania.opencore-legacy-patcher" --username "${{ env.MAC_NOTARIZATION_USERNAME }}" --password "${{ env.MAC_NOTARIZATION_PASSWORD }}" --file OpenCore-Patcher-wxPython.app.zip
|
||||
- run: packagesbuild ./payloads/InstallPackage/AutoPkg-Assets-Setup.pkgproj
|
||||
- run: mv ./OpenCore-Patcher-wxPython.app.zip ./OpenCore-Patcher-GUI.app.zip
|
||||
- name: Upload App to Artifacts
|
||||
@@ -27,11 +32,13 @@ jobs:
|
||||
with:
|
||||
name: OpenCore-Patcher.app (GUI)
|
||||
path: OpenCore-Patcher-GUI.app.zip
|
||||
|
||||
- name: Upload Package to Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AutoPkg-Assets.pkg
|
||||
path: ./dist/AutoPkg-Assets.pkg
|
||||
|
||||
- name: Upload Binary to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
@@ -40,6 +47,7 @@ jobs:
|
||||
file: OpenCore-Patcher-GUI.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
|
||||
- name: Upload Package to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
|
||||
30
.github/workflows/build-app.yml
vendored
30
.github/workflows/build-app.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: CI - Build TUI
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build TUI
|
||||
runs-on: x86_64_mojave
|
||||
env:
|
||||
branch: ${{ github.ref }}
|
||||
commiturl: ${{ github.event.head_commit.url }}${{ github.event.release.html_url }}
|
||||
commitdate: ${{ github.event.head_commit.timestamp }}${{ github.event.release.published_at }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --build_tui --reset_binaries --branch "${{ env.branch }}" --commit "${{ env.commiturl }}" --commit_date "${{ env.commitdate }}"
|
||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
||||
- run: ./../sign-tui.sh
|
||||
- name: Upload App to Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: OpenCore-Patcher-TUI.app
|
||||
path: OpenCore-Patcher-TUI.app.zip
|
||||
|
||||
- name: Validate OpenCore
|
||||
run: ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher --validate
|
||||
1
.github/workflows/build-site.yml
vendored
1
.github/workflows/build-site.yml
vendored
@@ -9,6 +9,7 @@ jobs:
|
||||
build:
|
||||
name: Build Site and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'dortania'
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
|
||||
20
.github/workflows/validate.yml
vendored
Normal file
20
.github/workflows/validate.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: CI - Validation
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Validate
|
||||
runs-on: x86_64_mojave
|
||||
if: github.repository_owner == 'dortania'
|
||||
env:
|
||||
branch: ${{ github.ref }}
|
||||
commiturl: ${{ github.event.head_commit.url }}${{ github.event.release.html_url }}
|
||||
commitdate: ${{ github.event.head_commit.timestamp }}${{ github.event.release.published_at }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 OpenCore-Patcher-GUI.command --validate
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -32,3 +32,4 @@ __pycache__/
|
||||
/payloads.dmg
|
||||
/payloads/OpenCore-Legacy-Patcher-*.plist
|
||||
/payloads/KDK.dmg
|
||||
*.log
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# This script's main purpose is to handle the following:
|
||||
# - Download PatcherSupportPkg resources
|
||||
# - Convert payloads directory into DMG (GUI only)
|
||||
# - Build Binary via Pyinstaller
|
||||
# - Add Launcher.sh (TUI only)
|
||||
# - Patch 'LC_VERSION_MIN_MACOSX' to OS X 10.10
|
||||
# - Add commit data to Info.plist
|
||||
|
||||
# Copyright (C) 2022 - Mykola Grymalyuk
|
||||
# Generate stand alone application for OpenCore-Patcher
|
||||
# Copyright (C) 2022-2023 - Mykola Grymalyuk
|
||||
|
||||
from pathlib import Path
|
||||
import time
|
||||
@@ -21,26 +14,49 @@ import sys
|
||||
|
||||
from resources import constants
|
||||
|
||||
class create_binary:
|
||||
|
||||
class CreateBinary:
|
||||
"""
|
||||
Library for creating OpenCore-Patcher application
|
||||
|
||||
This script's main purpose is to handle the following:
|
||||
- Download external dependancies (ex. PatcherSupportPkg)
|
||||
- Convert payloads directory into DMG
|
||||
- Build Binary via Pyinstaller
|
||||
- Patch 'LC_VERSION_MIN_MACOSX' to OS X 10.10
|
||||
- Add commit data to Info.plist
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
start = time.time()
|
||||
print("- Starting build script")
|
||||
self.set_cwd()
|
||||
self.args = self.parse_arguments()
|
||||
|
||||
self.preflight_processes()
|
||||
self.build_binary()
|
||||
self.postflight_processes()
|
||||
self.args = self._parse_arguments()
|
||||
|
||||
self._set_cwd()
|
||||
|
||||
self._preflight_processes()
|
||||
self._build_binary()
|
||||
self._postflight_processes()
|
||||
print(f"- Build script completed in {str(round(time.time() - start, 2))} seconds")
|
||||
|
||||
def set_cwd(self):
|
||||
|
||||
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\t{os.getcwd()}")
|
||||
|
||||
def parse_arguments(self):
|
||||
|
||||
def _parse_arguments(self):
|
||||
"""
|
||||
Parse arguments passed to script
|
||||
"""
|
||||
|
||||
parser = argparse.ArgumentParser(description='Builds OpenCore-Patcher binary')
|
||||
parser.add_argument('--build_tui', action='store_true', help='Builds TUI binary, if omitted GUI binary is built')
|
||||
parser.add_argument('--branch', type=str, help='Git branch name')
|
||||
parser.add_argument('--commit', type=str, help='Git commit URL')
|
||||
parser.add_argument('--commit_date', type=str, help='Git commit date')
|
||||
@@ -48,7 +64,12 @@ class create_binary:
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
def setup_pathing(self):
|
||||
|
||||
def _setup_pathing(self):
|
||||
"""
|
||||
Initialize pathing for pyinstaller
|
||||
"""
|
||||
|
||||
python_path = sys.executable
|
||||
python_binary = python_path.split("/")[-1]
|
||||
python_bin_dir = python_path.strip(python_binary)
|
||||
@@ -70,23 +91,36 @@ class create_binary:
|
||||
|
||||
self.pyinstaller_path = pyinstaller_path
|
||||
|
||||
def preflight_processes(self):
|
||||
|
||||
def _preflight_processes(self):
|
||||
"""
|
||||
Start preflight processes
|
||||
"""
|
||||
|
||||
print("- Starting preflight processes")
|
||||
self.setup_pathing()
|
||||
self.delete_extra_binaries()
|
||||
self.download_resources()
|
||||
if not self.args.build_tui:
|
||||
# payloads.dmg is only needed for GUI builds
|
||||
self.generate_payloads_dmg()
|
||||
self._setup_pathing()
|
||||
self._delete_extra_binaries()
|
||||
self._download_resources()
|
||||
self._generate_payloads_dmg()
|
||||
|
||||
|
||||
def _postflight_processes(self):
|
||||
"""
|
||||
Start postflight processes
|
||||
"""
|
||||
|
||||
def postflight_processes(self):
|
||||
print("- Starting postflight processes")
|
||||
if self.args.build_tui:
|
||||
self.move_launcher()
|
||||
self.patch_load_command()
|
||||
self.add_commit_data()
|
||||
self._patch_load_command()
|
||||
self._add_commit_data()
|
||||
self._post_flight_cleanup()
|
||||
self._mini_validate()
|
||||
|
||||
|
||||
def _build_binary(self):
|
||||
"""
|
||||
Build binary via pyinstaller
|
||||
"""
|
||||
|
||||
def build_binary(self):
|
||||
if Path(f"./dist/OpenCore-Patcher.app").exists():
|
||||
print("- Found OpenCore-Patcher.app, removing...")
|
||||
rm_output = subprocess.run(
|
||||
@@ -99,12 +133,8 @@ class create_binary:
|
||||
raise Exception("Remove failed")
|
||||
|
||||
|
||||
if self.args.build_tui:
|
||||
print("- Building TUI binary...")
|
||||
build_args = [self.pyinstaller_path, "./OpenCore-Patcher.spec", "--noconfirm"]
|
||||
else:
|
||||
print("- Building GUI binary...")
|
||||
build_args = [self.pyinstaller_path, "./OpenCore-Patcher-GUI.spec", "--noconfirm"]
|
||||
print("- Building GUI binary...")
|
||||
build_args = [self.pyinstaller_path, "./OpenCore-Patcher-GUI.spec", "--noconfirm"]
|
||||
|
||||
build_result = subprocess.run(build_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if build_result.returncode != 0:
|
||||
@@ -112,27 +142,52 @@ class create_binary:
|
||||
print(build_result.stderr.decode('utf-8'))
|
||||
raise Exception("Build failed")
|
||||
|
||||
def delete_extra_binaries(self):
|
||||
delete_files = [
|
||||
"AutoPkg-Assets.pkg",
|
||||
"AutoPkg-Assets.pkg.zip",
|
||||
"InstallAssistant.pkg",
|
||||
"InstallAssistant.pkg.integrityDataV1",
|
||||
"KDK.dmg",
|
||||
|
||||
def _delete_extra_binaries(self):
|
||||
"""
|
||||
Delete extra binaries from payloads directory
|
||||
"""
|
||||
|
||||
whitelist_folders = [
|
||||
"ACPI",
|
||||
"Config",
|
||||
"Drivers",
|
||||
"Icon",
|
||||
"InstallPackage",
|
||||
"Kexts",
|
||||
"OpenCore",
|
||||
"Tools",
|
||||
]
|
||||
|
||||
whitelist_files = [
|
||||
"com.dortania.opencore-legacy-patcher.auto-patch.plist",
|
||||
"entitlements.plist",
|
||||
"launcher.sh",
|
||||
"OC-Patcher-TUI.icns",
|
||||
"OC-Patcher.icns",
|
||||
"Universal-Binaries.zip",
|
||||
]
|
||||
|
||||
|
||||
print("- Deleting extra binaries...")
|
||||
for file in Path("payloads").glob(pattern="*"):
|
||||
if file.name in delete_files or file.name.startswith("OpenCore-Legacy-Patcher"):
|
||||
if file.is_dir():
|
||||
if file.name in whitelist_folders:
|
||||
continue
|
||||
print(f" - Deleting {file.name}")
|
||||
file.unlink()
|
||||
elif (Path(file) / Path("Contents/Resources/createinstallmedia")).exists():
|
||||
print(f" - Deleting {file}")
|
||||
subprocess.run(["rm", "-rf", file])
|
||||
elif Path(file).is_dir() and file.name == "Universal-Binaries":
|
||||
print(f" - Deleting {file}")
|
||||
subprocess.run(["rm", "-rf", file])
|
||||
else:
|
||||
if file.name in whitelist_files:
|
||||
continue
|
||||
print(f" - Deleting {file.name}")
|
||||
subprocess.run(["rm", "-f", file])
|
||||
|
||||
|
||||
def _download_resources(self):
|
||||
"""
|
||||
Download required dependencies
|
||||
"""
|
||||
|
||||
def download_resources(self):
|
||||
patcher_support_pkg_version = constants.Constants().patcher_support_pkg_version
|
||||
required_resources = [
|
||||
"Universal-Binaries.zip"
|
||||
@@ -179,21 +234,29 @@ class create_binary:
|
||||
print(mv_output.stderr.decode('utf-8'))
|
||||
raise Exception("Move failed")
|
||||
|
||||
def generate_payloads_dmg(self):
|
||||
|
||||
def _generate_payloads_dmg(self):
|
||||
"""
|
||||
Generate disk image containing all payloads
|
||||
Disk image will be password protected due to issues with
|
||||
Apple's notarization system and inclusion of kernel extensions
|
||||
"""
|
||||
|
||||
if Path("./payloads.dmg").exists():
|
||||
if self.args.reset_binaries:
|
||||
print(" - Removing old payloads.dmg")
|
||||
rm_output = subprocess.run(
|
||||
["rm", "-rf", "./payloads.dmg"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
if rm_output.returncode != 0:
|
||||
print("- Remove failed")
|
||||
print(rm_output.stderr.decode('utf-8'))
|
||||
raise Exception("Remove failed")
|
||||
else:
|
||||
if not self.args.reset_binaries:
|
||||
print(" - payloads.dmg already exists, skipping creation")
|
||||
return
|
||||
|
||||
print(" - Removing old payloads.dmg")
|
||||
rm_output = subprocess.run(
|
||||
["rm", "-rf", "./payloads.dmg"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
if rm_output.returncode != 0:
|
||||
print("- Remove failed")
|
||||
print(rm_output.stderr.decode('utf-8'))
|
||||
raise Exception("Remove failed")
|
||||
|
||||
print(" - Generating DMG...")
|
||||
dmg_output = subprocess.run([
|
||||
'hdiutil', 'create', './payloads.dmg',
|
||||
@@ -211,7 +274,12 @@ class create_binary:
|
||||
|
||||
print(" - DMG generation complete")
|
||||
|
||||
def add_commit_data(self):
|
||||
|
||||
def _add_commit_data(self):
|
||||
"""
|
||||
Add commit data to Info.plist
|
||||
"""
|
||||
|
||||
if not self.args.branch and not self.args.commit and not self.args.commit_date:
|
||||
print(" - No commit data provided, adding source info")
|
||||
branch = "Built from source"
|
||||
@@ -231,20 +299,25 @@ class create_binary:
|
||||
}
|
||||
plistlib.dump(plist, Path(plist_path).open("wb"), sort_keys=True)
|
||||
|
||||
def patch_load_command(self):
|
||||
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
||||
#
|
||||
# By default Pyinstaller will create binaries supporting 10.13+
|
||||
# However this limitation is entirely arbitrary for our libraries
|
||||
# and instead we're able to support 10.10 without issues.
|
||||
#
|
||||
# To verify set version:
|
||||
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
|
||||
#
|
||||
# cmd LC_VERSION_MIN_MACOSX
|
||||
# cmdsize 16
|
||||
# version 10.13
|
||||
# sdk 10.9
|
||||
|
||||
def _patch_load_command(self):
|
||||
"""
|
||||
Patch LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
||||
|
||||
By default Pyinstaller will create binaries supporting 10.13+
|
||||
However this limitation is entirely arbitrary for our libraries
|
||||
and instead we're able to support 10.10 without issues.
|
||||
|
||||
To verify set version:
|
||||
otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
|
||||
|
||||
cmd LC_VERSION_MIN_MACOSX
|
||||
cmdsize 16
|
||||
version 10.13
|
||||
sdk 10.9
|
||||
|
||||
"""
|
||||
|
||||
print(" - Patching LC_VERSION_MIN_MACOSX")
|
||||
path = './dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher'
|
||||
find = b'\x00\x0D\x0A\x00' # 10.13 (0xA0D)
|
||||
@@ -255,16 +328,39 @@ class create_binary:
|
||||
with open(path, 'wb') as f:
|
||||
f.write(data)
|
||||
|
||||
def move_launcher(self):
|
||||
print(" - Adding TUI launcher")
|
||||
mv_output = subprocess.run(
|
||||
["cp", "./payloads/launcher.sh", "./dist/OpenCore-Patcher.app/Contents/MacOS/Launcher"],
|
||||
|
||||
def _post_flight_cleanup(self):
|
||||
"""
|
||||
Post flight cleanup
|
||||
"""
|
||||
|
||||
path = "./dist/OpenCore-Patcher"
|
||||
print(f" - Removing {path}")
|
||||
rm_output = subprocess.run(
|
||||
["rm", "-rf", path],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
if mv_output.returncode != 0:
|
||||
print(" - Move failed")
|
||||
print(mv_output.stderr.decode('utf-8'))
|
||||
raise Exception("Move failed")
|
||||
if rm_output.returncode != 0:
|
||||
print(f" - Remove failed: {path}")
|
||||
print(rm_output.stderr.decode('utf-8'))
|
||||
raise Exception(f"Remove failed: {path}")
|
||||
|
||||
|
||||
def _mini_validate(self):
|
||||
"""
|
||||
Validate generated binary
|
||||
"""
|
||||
|
||||
print(" - Validating binary")
|
||||
validate_output = subprocess.run(
|
||||
["./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher", "--build", "--model", "MacPro3,1"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
if validate_output.returncode != 0:
|
||||
print(" - Validation failed")
|
||||
print(validate_output.stderr.decode('utf-8'))
|
||||
raise Exception("Validation failed")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_binary()
|
||||
CreateBinary()
|
||||
131
CHANGELOG.md
131
CHANGELOG.md
@@ -1,5 +1,136 @@
|
||||
# OpenCore Legacy Patcher changelog
|
||||
|
||||
## 0.6.2
|
||||
- Work around Black Box rendering issues on certain Display Color Profiles
|
||||
- Limited to Ventura currently due to limitations with other color profiles
|
||||
- Applicable for HD3000-based machines (ex. MacBookAir4,x, MacBookPro8,x, Macmini5,x)
|
||||
- Ensure `Moraea_BlurBeta` is set on non-Metal systems
|
||||
- Implement proper Root Unpatching verification in GUI
|
||||
- Removes arbitrary patch requirements used against unpatching (ex. network connection)
|
||||
- Implement Kernel Debug Kit installation during OS installs
|
||||
- Avoids network requirement for first time installs
|
||||
- Paired along side AutoPkgInstaller
|
||||
- Implement Kernel Debug Kit backup system
|
||||
- Allows for easy restoration of KDKs if OS updates corrupted installed KDKs
|
||||
- Update Wireless binaries
|
||||
- Fixed WiFi preferences crash with legacy wifi patches
|
||||
- Update non-Metal Binaries
|
||||
- Improved menubar blur saturation
|
||||
- Fixed System Settings hover effects, including Bluetooth connect button
|
||||
- Add Books hacks (reimplement cover image generation, disable broken page curl animation)
|
||||
- Fixed unresponsive buttons
|
||||
- Implement Hardware Encoding support for AMD GCN 1-3, Polaris and Vega GPUs
|
||||
- Applicable for pre-Haswell Macs on macOS Ventura
|
||||
- Resolves DRM playback issues on Netflix, Disney+, etc.
|
||||
- Note: GCN 1-3 DRM is functional, however hardware video encoding is still experimental
|
||||
- AppleTV+ may be unstable due to this
|
||||
- Implement support for AMD Navi and Lexa MXM GPUs in 2009-2011 iMacs
|
||||
- Primarily applicable for MXM 3.0 variants of AMD WX3200 (0x6981) and AMD RX5500XT (0x7340)
|
||||
- Credit to [Ausdauersportler](https://github.com/Ausdauersportler) for implementation
|
||||
- Implement Continuity Camera Unlocking for pre-Kaby Lake CPUs
|
||||
- Applicable for all legacy Macs in macOS Ventura
|
||||
- Resolve boot support for 3802-based GPUs with macOS 13.3
|
||||
- Applicable for following GPUs:
|
||||
- Intel Ivy Bridge and Haswell iGPUs
|
||||
- Nvidia Kepler dGPUs
|
||||
- Note: patchset now requires AMFI to be disabled, patchset still in active development to remove this requirement
|
||||
- Backend Changes:
|
||||
- Refactored kdk_handler.py
|
||||
- Prioritizes KdkSupportPkg repository for downloads
|
||||
- Skips calls to Apple's now defunct Developer Portal API
|
||||
- Support local loose matching when no network connection is available
|
||||
- Implement pkg receipt verification to validate integrity of KDKs
|
||||
- Implemented logging framework usage for more reliable logging
|
||||
- Logs are stored under `~/Library/Logs/OpenCore-Patcher.log`
|
||||
- Subsequent runs are appended to the log, allowing for easy debugging
|
||||
- Implemented new network_handler.py module
|
||||
- Allows for more reliable network calls and downloads
|
||||
- Better supports network timeouts and disconnects
|
||||
- Dramatically less noise in console during downloads
|
||||
- Implemented new macOS Installer handler
|
||||
- Removed unused modules:
|
||||
- sys_patch_downloader.py
|
||||
- run.py
|
||||
- TUI modules
|
||||
- Build Server Changes:
|
||||
- Upgrade Python backend to 3.10.9
|
||||
- Upgrade Python modules:
|
||||
- requests - 2.28.2
|
||||
- pyobjc - 9.0.1
|
||||
- wxpython - 4.2.0
|
||||
- pyinstaller - 5.7.0
|
||||
- packaging - 23.0
|
||||
- Increment Binaries:
|
||||
- PatcherSupportPkg 0.8.7 - release
|
||||
- AutoPkgInstaller 1.0.2 - release
|
||||
- FeatureUnlock 1.1.4 - rolling (0e8d87f)
|
||||
- Lilu 1.6.4 - release
|
||||
- WhateverGreen 1.6.4 - release
|
||||
- NVMeFix 1.1.0 - release
|
||||
- Innie 1.3.1 - release
|
||||
- OpenCorePkg 0.9.0 - release
|
||||
|
||||
## 0.6.1
|
||||
- Avoid usage of KDKlessWorkaround on hardware not requiring it
|
||||
- Resolves AMD Graphics Regression from 0.5.3
|
||||
- Increment Binaries:
|
||||
- KDKlessWorkaround 1.0.0 - rolling (8e41f39)
|
||||
|
||||
## 0.6.0
|
||||
- Resolve external NVMe reporting regression from 0.5.2
|
||||
- Implement Legacy Wireless support for Ventura
|
||||
- Applicable for BCM94328, BCM94322 and Atheros chipsets
|
||||
- Implement Wifi-only patches when no internet connection available but required (ie. KDKs)
|
||||
- Allows users to install Legacy Wireless patches, then connect to the internet to install remaining patches
|
||||
- Resolve `/Library/Extensions` not being cleaned on KDK-less root patches
|
||||
- Add AMD Vega Graphics support for pre-AVX2.0 systems on Ventura
|
||||
- ex. AMD Vega 56 and 64, AMD Radeon VII
|
||||
- Note: As with Polaris, Vega GPUs cannot be mixed with AMD GCN 1-3 patches
|
||||
- Patcher will prioritize the AMD GCN 1-3 (assumption that GCN is primary GPU, ex. MacPro6,1)
|
||||
- Implement proper `APPLE SSD TS0128F/256F` detection
|
||||
- Allows all Macs to utilize patch if required
|
||||
- Avoids usage of patch when host lacks affected drive (ex. MacBookAir6,x with upgraded SSD)
|
||||
- Prompt with auto patcher when booted OpenCore is out of date to root patcher
|
||||
- ex. Booted OCLP is 0.5.2, root patcher is 0.5.3
|
||||
- Disable native AMD Graphics on pre-Haswell Macs in Ventura
|
||||
- Allows for easy root patching, dropping reliance on Safe Mode to boot
|
||||
- Primarily applicable for iMacs and Mac Pros with AMD Polaris and Vega GPUs
|
||||
- Implement mini validation during GUI build
|
||||
- Add early UHCI/OHCI support (USB1.1)
|
||||
- Implemented via Root Volume patching, ie. no installer support at this time
|
||||
- Support should be seen as experimental, especially for laptops
|
||||
- Applicable for Penryn Macs and Cheese Grater Mac Pros (MacPro3,1 - MacPro5,1)
|
||||
- See associated issue for current limitations: [Legacy UHCI/OHCI support in Ventura](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021)
|
||||
- USB 3.0 controllers cannot be used along side USB 1.1 patches, OCLP will prioritize USB 3.0 support
|
||||
- Add early non-Metal Graphics Acceleration support for macOS Ventura
|
||||
- Applicable for following GPU architectures:
|
||||
- Intel Ironlake and Sandy Bridge
|
||||
- Nvidia Tesla, Maxwell and Pascal
|
||||
- AMD TeraScale 1 and 2
|
||||
- Notes:
|
||||
- Bluetooth Pairing is currently semi-functional, see here for work around: [Tab+Space work-around](https://forums.macrumors.com/threads/macos-13-ventura-on-unsupported-macs-thread.2346881/post-31858759)
|
||||
- AMFI currently needs to be outright disabled in Ventura
|
||||
- Overall non-Metal improvements:
|
||||
- Improved fake rim
|
||||
- Fixed full screen animation
|
||||
- Fixed split screen
|
||||
- Improved menubar blur
|
||||
- Add Nvidia Kepler GOP Driver injection
|
||||
- Primarily for GPUs lacking GOPs and can't have a newer VBIOS flashed
|
||||
- Resolve Rapid Security Response support for Haswell+ Macs requiring KDKs
|
||||
- Implemented via:
|
||||
- Userspace: [RSRRepair](https://github.com/flagersgit/RSRRepair) at `/etc/rc.server` (2b1c9e3)
|
||||
- Kernelspace: [RSRHelper.kext](https://github.com/khronokernel/RSRHelper) (cbe1be9)
|
||||
- Add APFS Trim Configuration
|
||||
- Settings -> Misc Settings -> APFS Trim
|
||||
- Increment Binaries:
|
||||
- OpenCorePkg 0.8.8 - release
|
||||
- PatcherSupportPkg 0.8.2 - release
|
||||
- KDKlessWorkaround 1.0.0 - rolling (4924276)
|
||||
- FeatureUnlock 1.1.2 - release
|
||||
- CPUFriend 1.2.6 - release
|
||||
- Lilu 1.6.3 - release
|
||||
|
||||
## 0.5.3
|
||||
- Integrate FixPCIeLinkrate.efi v0.1.0
|
||||
- Fixes link rate for PCIe 3.0 devices on MacPro3,1
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
from resources import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
main.OpenCoreLegacyPatcher(True)
|
||||
main.OpenCoreLegacyPatcher()
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
from resources import main
|
||||
|
||||
if __name__ == '__main__':
|
||||
main.OpenCoreLegacyPatcher()
|
||||
@@ -1,44 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import sys, os
|
||||
sys.path.append(os.path.abspath(os.getcwd()))
|
||||
from resources import constants
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(['OpenCore-Patcher.command'],
|
||||
pathex=['resources', 'data'],
|
||||
binaries=[],
|
||||
datas=[('payloads', 'payloads')],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=['wxPython', 'wxpython'],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='OpenCore-Patcher',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True )
|
||||
app = BUNDLE(exe,
|
||||
name='OpenCore-Patcher.app',
|
||||
icon="payloads/OC-Patcher-TUI.icns",
|
||||
bundle_identifier="com.dortania.opencore-legacy-patcher-tui",
|
||||
info_plist={
|
||||
"CFBundleShortVersionString": constants.Constants().patcher_version,
|
||||
"CFBundleExecutable": "MacOS/Launcher",
|
||||
"NSHumanReadableCopyright": constants.Constants().copyright_date,
|
||||
})
|
||||
@@ -15,7 +15,7 @@ Our project's main goal is to breath new life to Macs no longer supported by App
|
||||
|
||||
Noteworthy features of OpenCore Legacy Patcher:
|
||||
|
||||
* Support for macOS Big Sur and Monterey
|
||||
* Support for macOS Big Sur, Monterey and Ventura
|
||||
* Native Over the Air(OTA) System Updates
|
||||
* Supports Penryn and newer Macs
|
||||
* Full support for WPA Wifi and Personal Hotspot on BCM943224 and newer chipsets
|
||||
@@ -32,7 +32,7 @@ Note: Only clean-installs and upgrades are supported, macOS Big Sur installs alr
|
||||
|
||||
* You can however reinstall macOS with this patcher and retain your original data
|
||||
|
||||
Note 2: Currently OpenCore Legacy Patcher officially supports patching to run macOS Big Sur and Monterey installs. For older OSes, OpenCore may function however support is currently not provided from Dortania.
|
||||
Note 2: Currently OpenCore Legacy Patcher officially supports patching to run macOS Big Sur through Ventura installs. For older OSes, OpenCore may function however support is currently not provided from Dortania.
|
||||
|
||||
* For macOS Mojave and Catalina support, we recommend the use of [dosdude1's patchers](http://dosdude1.com)
|
||||
|
||||
|
||||
24
SOURCE.md
24
SOURCE.md
@@ -1,11 +1,10 @@
|
||||
# Build and run from source
|
||||
|
||||
OpenCore Legacy Patcher at its core is a python-based TUI/CLI based application. This means that to run the project from source, you simply need to invoke the OpenCore-Patcher.command file via Python.
|
||||
OpenCore Legacy Patcher at its core is a python-based GUI/CLI based application. This means that to run the project from source, you simply need to invoke the OpenCore-Patcher-GUI.command file via Python.
|
||||
|
||||
For developers wishing to validate mainline changes, you may use these nightly links:
|
||||
|
||||
* [GUI (Graphical Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/OpenCore-Patcher.app%20%28GUI%29.zip)
|
||||
* [TUI (Text Based App)](https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app/main/OpenCore-Patcher-TUI.app.zip)
|
||||
|
||||
**Warning**: These binaries should not be used without first consulting the [CHANGELOG](./CHANGELOG.md). Do not distribute these links in forums, instead direct to this file.
|
||||
|
||||
@@ -32,41 +31,31 @@ pip3 install -r requirements.txt
|
||||
|
||||
If you have installation error, see following troubleshooting options:
|
||||
|
||||
* Use Python 3.9
|
||||
* Currently our build server uses py3.9 for generating binaries used in releases
|
||||
* Use Python 3.10
|
||||
* Currently our build server uses py3.10 for generating binaries used in releases
|
||||
* Use .whl snapshots for installing additional dependencies
|
||||
* [wxPython 4.1.1 wheel for py3.9](https://files.pythonhosted.org/packages/2c/a8/7027e8ca3ba20dc2ed2acd556e31941cb44097ab87d6f81d646a79de4eab/wxPython-4.1.1-cp39-cp39-macosx_10_10_x86_64.whl)
|
||||
* [PyObjc 8.5 wheel for py3](https://files.pythonhosted.org/packages/69/3d/786f379dd669a078cf0c4a686e242c9b643071c23367bfbd3d9a7eb589ec/pyobjc-8.5-py3-none-any.whl)
|
||||
* [Requests 2.27.1 for py2/py3](https://files.pythonhosted.org/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl)
|
||||
* [pyinstaller 5.3 for py3](https://files.pythonhosted.org/packages/65/70/625e86e5a45cb975a9c32a10a721394d10771275c69207308b80bc6a758e/pyinstaller-5.3-py3-none-macosx_10_13_universal2.whl)
|
||||
|
||||
|
||||
## Running OpenCore Legacy Patcher
|
||||
|
||||
To run the project from source, simply invoke via python3:
|
||||
|
||||
```sh
|
||||
# Launch TUI
|
||||
python3 OpenCore-Patcher.command
|
||||
```
|
||||
|
||||
```sh
|
||||
# Launch GUI
|
||||
python3 OpenCore-Patcher-GUI.command
|
||||
```
|
||||
|
||||
Note that the OpenCore-Patcher.command file can be run as both a TUI and a CLI utility for other programs to call. If no core arguments are passed, the TUI is initialized. Otherwise the CLI will start:
|
||||
Note that the OpenCore-Patcher-GUI.command file can be run as both a GUI and a CLI utility for other programs to call. If no core arguments are passed, the GUI is initialized. Otherwise the CLI will start:
|
||||
|
||||
```sh
|
||||
# Launch CLI
|
||||
python3 OpenCore-Patcher.command --build --model iMac12,2 --verbose
|
||||
python3 OpenCore-Patcher-GUI.command --build --model iMac12,2 --verbose
|
||||
```
|
||||
|
||||
See `-h`/`--help` for more information on supported CLI arguments.
|
||||
|
||||
## Generating prebuilt binaries
|
||||
|
||||
The main goal of generating prebuilt binaries is to strip the requirement of a local python installation for users. For developers, there's very little benefit besides enabling dark mode support in the GUI. For development, simply use the OpenCore-Patcher.command file with a python3 installation.
|
||||
The main goal of generating prebuilt binaries is to strip the requirement of a local python installation for users. For developers, there's very little benefit besides enabling dark mode support in the GUI. For development, simply use the OpenCore-Patcher-GUI.command file with a python3 installation.
|
||||
|
||||
* Note that due to PyInstaller's linking mechanism, binaries generated on Catalina and newer are not compatible with High Sierra and older
|
||||
* To ensure the largest compatibility, generate binaries on macOS Mojave. These binaries will be compatible with macOS 10.9 to macOS 12.
|
||||
@@ -79,7 +68,6 @@ pip3 install pyinstaller
|
||||
cd ~/Developer/OpenCore-Legacy-Patcher/
|
||||
# Create the pyinstaller based Application
|
||||
# Optional Arguments
|
||||
# '--build_tui': Create TUI vairant
|
||||
# '--reset_binaries': Redownload and generate support files
|
||||
python3 Build-Binary.command
|
||||
# Open build folder
|
||||
|
||||
@@ -6,19 +6,20 @@
|
||||
# - 0x3 used in 11.0.1 dyld source:
|
||||
# - https://github.com/apple-oss-distributions/dyld/blob/5c9192436bb195e7a8fe61f22a229ee3d30d8222/testing/test-cases/kernel-hello-world.dtest/main.c#L2
|
||||
|
||||
class apple_mobile_file_integrity:
|
||||
import enum
|
||||
|
||||
class AppleMobileFileIntegrity(enum.IntEnum):
|
||||
# Names set are solely for readability
|
||||
# Internal names are unknown
|
||||
amfi_values = {
|
||||
"AMFI_ALLOW_TASK_FOR_PID": False, # 0x1 - Allow Task for PID (alt. amfi_unrestrict_task_for_pid=0x1)
|
||||
"AMFI_ALLOW_INVALID_SIGNATURE": False, # 0x2 - Reduce sig enforcement (alt. amfi_allow_any_signature=0x1)
|
||||
"AMFI_LV_ENFORCE_THIRD_PARTY": False, # 0x4 - Don't mark external binaries as platform binaries
|
||||
"AMFI_UNKNOWN_1": False, # 0x8
|
||||
"AMFI_UNKNOWN_2": False, # 0x10
|
||||
"AMFI_UNKNOWN_3": False, # 0x20
|
||||
"AMFI_UNKNOWN_4": False, # 0x40
|
||||
"AMFI_ALLOW_EVERYTHING": False, # 0x80 - Disable sig enforcement and Library Validation (alt. amfi_get_out_of_my_way=0x1)
|
||||
},
|
||||
AMFI_ALLOW_TASK_FOR_PID: int = 0x1 # Allow Task for PID (alt. amfi_unrestrict_task_for_pid=0x1)
|
||||
AMFI_ALLOW_INVALID_SIGNATURE: int = 0x2 # Reduce sig enforcement (alt. amfi_allow_any_signature=0x1)
|
||||
AMFI_LV_ENFORCE_THIRD_PARTY: int = 0x4 # Don't mark external binaries as platform binaries
|
||||
AMFI_UNKNOWN_1: int = 0x8
|
||||
AMFI_UNKNOWN_2: int = 0x10
|
||||
AMFI_UNKNOWN_3: int = 0x20
|
||||
AMFI_UNKNOWN_4: int = 0x40
|
||||
AMFI_ALLOW_EVERYTHING: int = 0x80 # Disable sig enforcement and Library Validation (alt. amfi_get_out_of_my_way=0x1)
|
||||
|
||||
|
||||
# Internally within AMFI.kext, Apple references 0x2 and 0x80 as both 'Disable signature enforcement'
|
||||
# However 0x80 is a higher privilege than 0x2, and breaks TCC support in OS (ex. Camera, Microphone, etc prompts)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Data for SkyLightShim Plugin systems
|
||||
class shim_list:
|
||||
shim_pathing = {
|
||||
"CoreWLAN.dylib": "/System/Library/CoreServices/WiFiAgent.app/Contents/MacOS/WiFiAgent",
|
||||
"BacklightFixup.dylib": "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow",
|
||||
}
|
||||
|
||||
shim_legacy_accel = [
|
||||
"CoreWLAN.dylib",
|
||||
]
|
||||
|
||||
shim_legacy_accel_keyboard = [
|
||||
"BacklightFixup.dylib",
|
||||
]
|
||||
@@ -1,11 +0,0 @@
|
||||
# Mirrors of Apple's InstallAssistant.pkg
|
||||
# Currently only listing important Installers no longer on Apple's servers
|
||||
|
||||
Install_macOS_Big_Sur_11_2_3 = {
|
||||
"Version": "11.2.3",
|
||||
"Build": "20D91",
|
||||
"Link": "https://archive.org/download/install-assistant-20D91/InstallAssistant.pkg",
|
||||
"Size": 12211077798,
|
||||
"Source": "Archive.org",
|
||||
"integrity": None,
|
||||
}
|
||||
@@ -249,6 +249,9 @@ IntelNvidiaDRM = [
|
||||
# Mac Pro and Xserve
|
||||
MacPro = ["MacPro3,1", "MacPro4,1", "MacPro5,1", "Xserve2,1", "Xserve3,1", "Dortania1,1"]
|
||||
|
||||
# MXM iMac
|
||||
MXMiMac = ["iMac11,1", "iMac11,2", "iMac11,3", "iMac10,1", "iMac12,1", "iMac12,2", "Dortania1,1"]
|
||||
|
||||
NoAGPMSupport = ["MacBook4,1", "MacBookPro4,1", "iMac7,1", "iMac8,1", "MacPro3,1", "Xserve2,1", "Dortania1,1"]
|
||||
|
||||
AGDPSupport = [
|
||||
@@ -350,4 +353,4 @@ Missing_USB_Map_Ventura = [
|
||||
"iMac16,1",
|
||||
"iMac16,2",
|
||||
"iMac17,1",
|
||||
]
|
||||
]
|
||||
|
||||
@@ -796,6 +796,11 @@ class amd_ids:
|
||||
0x67CF, # Unknown
|
||||
]
|
||||
|
||||
polaris_spoof_ids = [
|
||||
# Polaris 12 (Lexa)
|
||||
0x6981, # Lexa XT [Radeon PRO WX 3200]
|
||||
]
|
||||
|
||||
vega_ids = [
|
||||
# GCN v5
|
||||
# AMDRadeonX5000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
11
data/video_bios_data.py
Normal file
11
data/video_bios_data.py
Normal file
File diff suppressed because one or more lines are too long
@@ -13,8 +13,9 @@
|
||||
* [Unable to allow Safari Extensions](#unable-to-allow-Safari-Extensions)
|
||||
* [Cannot Login on 2011 15" and 17" MacBook Pros](#cannot-login-on-2011-15-and-17-macbook-pros)
|
||||
* [Black Boxes on HD3000 iGPUs](#black-boxes-on-hd3000-igpus)
|
||||
* [Cannot Pair Bluetooth Devices](#cannot-pair-bluetooth-devices)
|
||||
|
||||
The below page is for users experiencing issues with their overall usage of macOS Big Sur / macOS Monterey and the Legacy Graphics Acceleration patches. Note that the following GPUs currently do not have acceleration support in Big Sur / Monterey:
|
||||
The below page is for users experiencing issues with their overall usage of macOS Big Sur / Monterey / Ventura and the Legacy Graphics Acceleration patches. Note that the following GPUs currently do not have acceleration support in Big Sur / Monterey / Ventura:
|
||||
|
||||
* Intel 3rd and 4th Gen - GMA series
|
||||
|
||||
@@ -22,7 +23,7 @@ For those unfamiliar with what is considered a non-Metal GPU, see the chart belo
|
||||
|
||||
::: details macOS GPU Chart
|
||||
|
||||
Metal is Apple's in-house graphics API that acts as a replacement for OpenGL/OpenCL, introduced in 2015. With the release of macOS Mojave, every system without a Metal-capable GPU was dropped.
|
||||
Metal is Apple's in-house graphics API that acts as a replacement for OpenGL/OpenCL, introduced in 2015. With the release of macOS Mojave, every system without a Metal-capable GPU was dropped.
|
||||
|
||||
| Graphics Vendor | Architecture | Series | Supports Metal |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
@@ -30,7 +31,7 @@ Metal is Apple's in-house graphics API that acts as a replacement for OpenGL/Ope
|
||||
| ^^ | TeraScale 2 | HD5000 - HD6000 | ^^ |
|
||||
| AMD | GCN (and newer) | HD7000+ | <span style="color:green">Yes</span> |
|
||||
| NVIDIA | Tesla | 8000GT - GT300 | <span style="color:red">No</span> |
|
||||
| ^^ | Fermi | GT400 - GT500 | ^^ |
|
||||
| ^^ | Fermi | GT400 - GT500 | ^^ |
|
||||
| ^^ | Kepler | GT600 - GT700 | <span style="color:green">Yes</span> |
|
||||
| Intel | GMA | GMA900 - GMA3000 | <span style="color:red">No</span> |
|
||||
| ^^ | Iron Lake | HD series | ^^ |
|
||||
@@ -101,7 +102,7 @@ Due to the Metal Backend, the enhanced color output of these apps seems to heavi
|
||||
|
||||
## Cannot press "Done" when editing a Sidebar Widget
|
||||
|
||||
Workaround: Press some combination of Tab, or Tab and then Shift-Tab, or just Shift-Tab until the "Done" button is highlighted. Then press spacebar to activate the button, the same as in any other dialog with a highlighted button halo.
|
||||
Workaround: Press some combination of Tab, or Tab and then Shift-Tab, or just Shift-Tab until the "Done" button is highlighted. Then press spacebar to activate the button, the same as in any other dialog with a highlighted button halo.
|
||||
|
||||
## Wake from sleep heavily distorted on AMD/ATI in macOS 11.3 and newer
|
||||
|
||||
@@ -179,8 +180,18 @@ A somewhat strange issue on Intel HD3000-based Macs, on 3rd party displays somet
|
||||
|
||||
* Mainly applicable for HDMI Displays, DVI and DisplayPort are generally unaffected.
|
||||
* If you're inside Setup Assistant, press `Cmd` + `Option` + `Control` + `T` to launch Terminal. From there, run `open /System/Applications/System\ Preferences.app`
|
||||
|
||||
* Issue has spread to more Macs with macOS Ventura, including MacBook Airs and MacBook Pros
|
||||
|
||||
| Default Color Profile | Display/Display P3 Profile |
|
||||
| :--- | :--- |
|
||||
|  |  |
|
||||
|
||||
## Cannot Pair Bluetooth Devices
|
||||
|
||||
In macOS Ventura, hover states may not function correctly which results in the "Connect" button not appearing in System Settings. To resolve:
|
||||
|
||||
1. Enable Keyboard Navigation in System Settings -> Keyboard
|
||||
2. Tab + space over Bluetooth devices in System Settings -> Bluetooth
|
||||
3. Pair button should appear
|
||||
|
||||
For more information, see [ASentientBot's post](https://forums.macrumors.com/threads/macos-13-ventura-on-unsupported-macs-thread.2346881/page-116?post=31858759#post-31858759).
|
||||
|
||||
@@ -10,6 +10,11 @@ Next, run the `OpenCore-Patcher.app`:
|
||||
|
||||

|
||||
|
||||
::: warning
|
||||
OpenCore configurations are hardware specific.
|
||||
If you're building OpenCore for a different model than you're currently running, it is absolutely necessary to select the proper model from Settings.
|
||||
:::
|
||||
|
||||
Here we'll select Build and Install OpenCore and start building:
|
||||
|
||||
| Start Building | Finished Building |
|
||||
|
||||
@@ -18,11 +18,11 @@ The below table will list all supported and unsupported functions of the patcher
|
||||
|
||||
Regarding OS support, see below:
|
||||
|
||||
* Machines listing `YES - Monterey and older` means they cannot run macOS Ventura at this time. Machines with only `YES` can run all of the supported macOS versions offered by OpenCore Legacy Patcher.
|
||||
* Machines listing `YES - Ventura and older` means they cannot run macOS Ventura at this time. Machines with only `YES` can run all of the supported macOS versions offered by OpenCore Legacy Patcher.
|
||||
|
||||
| Support Entry | Supported OSes | Description | Comment |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| HostOS | macOS 10.9 - macOS 13 | Refers to OSes where running OpenCore-Patcher.app are supported | Supports 10.7+ if [Python 3.9 or higher](https://www.python.org/downloads/) is manually installed, simply run the `OpenCore-Patcher.command` located in the repo |
|
||||
| HostOS | macOS 10.9 - macOS 13 | Refers to OSes where running OpenCore-Patcher.app are supported | Supports 10.7+ if [Python 3.9 or higher](https://www.python.org/downloads/) is manually installed, simply run the `OpenCore-Patcher-GUI.command` located in the repo |
|
||||
| TargetOS | macOS 11 - macOS 13 | Refers to OSes that can be patched to run with OpenCore | May support 10.4 and newer (in a potentially broken state). No support provided. |
|
||||
|
||||
### MacBook
|
||||
@@ -32,12 +32,12 @@ Regarding OS support, see below:
|
||||
| MacBook1,1 | Mid-2006 | <span style="color:red"> NO </span> | 32-Bit CPU limitation |
|
||||
| MacBook2,1 | Late 2006 | ^^ | 32-Bit Firmware limitation |
|
||||
| MacBook3,1 | Late 2007 | ^^ | ^^ |
|
||||
| MacBook4,1 | Early 2008 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - No GPU Acceleration in Mavericks and newer<br/>- No Keyboard and Trackpad<br/>- No USB |
|
||||
| MacBook5,1 | Late 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| MacBook4,1 | Early 2008 | ^^ | - No GPU Acceleration in Mavericks and newer<br/>- No Keyboard and Trackpad<br/>- No USB |
|
||||
| MacBook5,1 | Late 2008 | <span style="color:#30BCD5"> YES </span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| MacBook5,2 | Early 2009 | ^^ | ^^ |
|
||||
| MacBook6,1 | Late 2009 | ^^ | ^^ |
|
||||
| MacBook7,1 | Mid-2010 | ^^ | ^^ |
|
||||
| MacBook8,1 | Mid-2015 | <span style="color:#30BCD5"> YES </span> | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBook8,1 | Mid-2015 | ^^ | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBook9,1 | Early 2016 | ^^ | ^^ |
|
||||
|
||||
### MacBook Air
|
||||
@@ -45,12 +45,12 @@ Regarding OS support, see below:
|
||||
| SMBIOS | Year | Supported | Comment |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| MacBookAir1,1 | Early 2008 | <span style="color:red"> NO </span> | Requires SSE4.1 CPU |
|
||||
| MacBookAir2,1 | Late 2008 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| MacBookAir2,1 | Late 2008 | <span style="color:#30BCD5"> YES </span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| MacBookAir3,1 | Late 2010 | ^^ | ^^ |
|
||||
| MacBookAir3,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookAir4,1 | Mid-2011 | ^^ | ^^ |
|
||||
| MacBookAir4,1 | Mid-2011 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))|
|
||||
| MacBookAir4,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookAir5,1 | Mid-2012 | <span style="color:#30BCD5"> YES </span> | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBookAir5,1 | Mid-2012 | ^^ | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBookAir5,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookAir6,1 | Mid-2013, Early 2014 | ^^ | ^^ |
|
||||
| MacBookAir6,2 | ^^ | ^^ | ^^ |
|
||||
@@ -66,19 +66,19 @@ Regarding OS support, see below:
|
||||
| MacBookPro2,1 | Late 2006 | ^^ | 32-Bit Firmware limitation |
|
||||
| MacBookPro2,2 | Late 2006 | ^^ | ^^ |
|
||||
| MacBookPro3,1 | Mid-2007 | ^^ | Requires SSE4.1 CPU |
|
||||
| MacBookPro4,1 | Early 2008 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| MacBookPro4,1 | Early 2008 | <span style="color:#30BCD5"> YES </span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| MacBookPro5,1 | Late 2008 | ^^ | ^^ |
|
||||
| MacBookPro5,2 | Early 2009 | ^^ | ^^ |
|
||||
| MacBookPro5,3 | Mid-2009 | ^^ | ^^ |
|
||||
| MacBookPro5,4 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro5,5 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro6,1 | Mid-2010 | ^^ | ^^ |
|
||||
| MacBookPro6,1 | Mid-2010 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))|
|
||||
| MacBookPro6,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro7,1 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro8,1 | Early 2011 | ^^ | ^^ |
|
||||
| MacBookPro7,1 | ^^ | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| MacBookPro8,1 | Early 2011 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))|
|
||||
| MacBookPro8,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro8,3 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro9,1 | Mid-2012 | <span style="color:#30BCD5"> YES </span> | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBookPro9,1 | Mid-2012 | ^^ | <span style="color:green"> Everything is supported</span> |
|
||||
| MacBookPro9,2 | ^^ | ^^ | ^^ |
|
||||
| MacBookPro10,1 | Mid-2012, Early 2013 | ^^ | ^^ |
|
||||
| MacBookPro10,2 | Late 2012, Early 2013 | ^^ | ^^ |
|
||||
@@ -98,12 +98,12 @@ Regarding OS support, see below:
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| Macmini1,1 | Early 2006 | <span style="color:red"> NO </span> | 32-Bit CPU limitation |
|
||||
| Macmini2,1 | Mid-2007 | ^^ | 32-Bit Firmware limitation |
|
||||
| Macmini3,1 | Early 2009 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)) <br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md)) |
|
||||
| Macmini3,1 | Early 2009 | <span style="color:#30BCD5"> YES </span> | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| Macmini4,1 | Mid-2010 | ^^ | ^^ |
|
||||
| Macmini5,1 | Mid-2011 | ^^ | ^^ |
|
||||
| Macmini5,1 | Mid-2011 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))|
|
||||
| Macmini5,2 | ^^ | ^^ | ^^ |
|
||||
| Macmini5,3 | ^^ | ^^ | ^^ |
|
||||
| Macmini6,1 | Late 2012 | <span style="color:#30BCD5"> YES </span> | <span style="color:green"> Everything is supported</span> |
|
||||
| Macmini6,1 | Late 2012 | ^^ | <span style="color:green"> Everything is supported</span> |
|
||||
| Macmini6,2 | ^^ | ^^ | ^^ |
|
||||
| Macmini7,1 | Mid-2014 | ^^ | ^^ |
|
||||
|
||||
@@ -116,16 +116,16 @@ Regarding OS support, see below:
|
||||
| iMac5,1 | Late 2006 | ^^ | 32-Bit Firmware limitation |
|
||||
| iMac5,2 | ^^ | ^^ | ^^ |
|
||||
| iMac6,1 | ^^ | ^^ | ^^ |
|
||||
| iMac7,1 | Mid-2007 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - Requires an [SSE4.1 CPU Upgrade](https://lowendmac.com/2018/penryn-t9300-9500-cpu-upgrades-for-the-2007-imac/)<br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Stock Bluetooth 2.0 card non-functional<br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md)) |
|
||||
| iMac8,1 | Early 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)))<br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| iMac7,1 | Mid-2007 | <span style="color:#30BCD5"> YES </span> | - Requires an [SSE4.1 CPU Upgrade](https://lowendmac.com/2018/penryn-t9300-9500-cpu-upgrades-for-the-2007-imac/)<br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/>- Stock Bluetooth 2.0 card non-functional<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| iMac8,1 | Early 2008 | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))<br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| iMac9,1 | Early 2009 | ^^ | ^^ |
|
||||
| iMac10,1 | Late 2009 | ^^ | - GPU is socketed, [recommend upgrading to Metal GPU](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/?post=17425857#post-17425857) <br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)) <br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| iMac11,1 | ^^ | ^^ | ^^ |
|
||||
| iMac10,1 | Late 2009 | ^^ | - GPU is socketed, [recommend upgrading to Metal GPU](https://forums.macrumors.com/threads/2011-imac-graphics-card-upgrade.1596614/?post=17425857#post-17425857) <br/>- GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108)) <br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| iMac11,1 | ^^ | ^^ | - GPU Acceleration in Public Beta, see current issues ([#108](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/108))|
|
||||
| iMac11,2 | Mid-2010 | ^^ | ^^ |
|
||||
| iMac11,3 | ^^ | ^^ | ^^ |
|
||||
| iMac12,1 | Mid-2011 | ^^ | ^^ |
|
||||
| iMac12,2 | ^^ | ^^ | ^^ |
|
||||
| iMac13,1 | Late 2012 | <span style="color:#30BCD5"> YES </span> | <span style="color:green"> Everything is supported</span> |
|
||||
| iMac13,1 | Late 2012 | ^^ | <span style="color:green"> Everything is supported</span> |
|
||||
| iMac13,2 | ^^ | ^^ | ^^ |
|
||||
| iMac13,3 | ^^ | ^^ | ^^ |
|
||||
| iMac14,1 | Late 2013 | ^^ | ^^ |
|
||||
@@ -145,8 +145,8 @@ Regarding OS support, see below:
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| MacPro1,1 | Mid-2006 | <span style="color:red"> NO </span> | 32-Bit Firmware limitation |
|
||||
| MacPro2,1 | Mid-2007 | ^^ | ^^ |
|
||||
| MacPro3,1 | Early 2008 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - Potential boot issues with built-in USB 1.1 ports (recommend using a USB 2.0 hub or dedicated USB PCIe controller) <br/>- Potential boot issues with stock Bluetooth card, recommend removing to avoid kernel panics |
|
||||
| MacPro4,1 | Early 2009 | ^^ | - Everything is supported as long as GPU is Metal capable <br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md)) |
|
||||
| MacPro3,1 | Early 2008 | <span style="color:#30BCD5"> YES </span> | - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issesues/1021)) <br/>- Potential boot issues with stock Bluetooth card, recommend removing to avoid kernel panics |
|
||||
| MacPro4,1 | Early 2009 | ^^ | - Everything is supported as long as GPU is Metal capable <br/> - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issesues/1021))|
|
||||
| MacPro5,1 | Mid-2010, Mid-2012 | ^^ | ^^ |
|
||||
| MacPro6,1 | Late 2013 | ^^ | - CPU Power Management currently unsupported<br/> - No DRM support |
|
||||
|
||||
@@ -155,7 +155,7 @@ Regarding OS support, see below:
|
||||
| SMBIOS | Year | Supported | Comment |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| Xserve1,1 | Mid-2006 | <span style="color:red"> NO </span> | 32-Bit Firmware limitation |
|
||||
| Xserve2,1 | Early 2008 | <span style="color:#30BCD5"> YES - Monterey and older</span> | - Everything is supported as long as GPU is Metal capable <br/> - Supports macOS Monterey and older ([Ventura support in development](./VENTURA-DROP.md))|
|
||||
| Xserve2,1 | Early 2008 | <span style="color:#30BCD5"> YES </span> | - UHCI/OHCI support in Public Beta, see current issues ([#1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021))|
|
||||
| Xserve3,1 | Early 2009 | ^^ | ^^ |
|
||||
|
||||
# Once you've verified your hardware is supported, head to [Download and build macOS Installers](./INSTALLER.md)
|
||||
|
||||
@@ -20,14 +20,11 @@ And voila! No more USB drive required.
|
||||
|
||||
To do this, run the OpenCore Patcher and head to Patcher Settings:
|
||||
|
||||
| GUI Settings | TUI Settings
|
||||
| :--- | :--- |
|
||||
| |  |
|
||||

|
||||
|
||||
Here you can change different patcher settings, however the main interest is:
|
||||
|
||||
* Show Boot Picker (GUI)
|
||||
* Set ShowPicker Mode (TUI)
|
||||
* Show Boot Picker
|
||||
|
||||
Once you've toggled them both off, build your OpenCore EFI once again and install to your desired drive. Now to show the OpenCore selector, you can simply hold down the "ESC" key while clicking on EFI boot, and then you can release the "ESC" key when you see the cursor arrow at the top left.
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Here are some common errors users may experience while using this patcher:
|
||||
* [Cannot Disable SIP in recoveryOS](#cannot-disable-sip-in-recoveryos)
|
||||
* [Stuck on "Less than a minute remaining..."](#stuck-on-less-than-a-minute-remaining)
|
||||
* [No acceleration after a Metal GPU swap on Mac Pro](#no-acceleration-after-a-metal-gpu-swap-on-mac-pro)
|
||||
|
||||
* [Keyboard, Mouse and Trackpad not working in installer or after update](#keyboard-mouse-and-trackpad-not-working-in-installer-or-after-update)
|
||||
|
||||
|
||||
## OpenCore Legacy Patcher not launching
|
||||
@@ -161,3 +161,26 @@ Alternatively, you can remove "AutoPkg-Assets.pkg" from /Library/Packages on the
|
||||
|
||||
The reason for this is that the autopatcher will assume that you will be using the original graphics card and therefore does non-metal patching, which includes removing some drivers for other cards. This causes Metal cards to not accelerate after swapping.
|
||||
|
||||
## Keyboard, Mouse and Trackpad not working in installer or after update
|
||||
|
||||
For Macs using legacy USB 1.1 controllers, OpenCore Legacy Patcher can only restore support once it has performed root volume patches. Thus to install macOS, you need to hook up a USB hub between your Mac and Keyboard/Mouse.
|
||||
|
||||
* For MacBook users, you'll need to find an external keyboard/mouse in addition to the USB hub
|
||||
|
||||
More information can be found here:
|
||||
|
||||
* [Legacy UHCI/OHCI support in Ventura #1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021)
|
||||
|
||||
Applicable models include:
|
||||
|
||||
| Family | Year | Model | Notes |
|
||||
| :---------- | :--------------------| :---------------------------- | :----------------------------------------------- |
|
||||
| MacBook | Mid 2010 and older | MacBook4,1 - MacBook7,1 | |
|
||||
| MacBook Air | Late 2010 and older | MacBookAir2,1 - MacBookAir3,x | |
|
||||
| MacBook Pro | Mid 2010 and older | MacBookPro4,1 - MacBookPro7,x | Excludes Mid 2010 15" and 17" (MacBookPro6,x) |
|
||||
| iMac | Late 2009 and older | iMac7,1 - iMac10,x | Excludes Core i5/7 27" late 2009 iMac (iMac11,1) |
|
||||
| Mac mini | Mid 2011 and older | Macmini3,1 - Macmini5,x | |
|
||||
| Mac Pro | Mid 2010 and older | MacPro3,1 - MacPro5,1 | |
|
||||
|
||||
|
||||

|
||||
@@ -24,16 +24,12 @@ Ventura's release dropped a large amount of Intel hardware, thus requiring the u
|
||||
|
||||
## Current status
|
||||
|
||||
Overall, macOS Ventura is useable on most Metal-capable machines (ie. 2012 and newer). The graphics patches implemented have near feature parity to macOS Monterey, with patches still being under heavy development. See [Legacy Metal Graphics Support and macOS Ventura #1008](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1008) issue for more information.
|
||||
|
||||
<img width="625" alt="" src="../images/OCLP-051-Initial-Support.png">
|
||||
<img width="625" alt="" src="../images/OCLP-060-Initial-Support.png">
|
||||
|
||||
For older hardware, see below sections:
|
||||
|
||||
* [Currently Unsupported/Broken Hardware in Ventura](#currently-unsupportedbroken-hardware-in-ventura)
|
||||
* [AMD Polaris, Vega and Navi support on pre-2019 Mac Pros and pre-2012 iMacs](#amd-polaris-vega-and-navi-support-on-pre-2019-mac-pros-and-pre-2012-imacs)
|
||||
* [Non-Metal Graphics Acceleration](#non-metal-graphics-acceleration)
|
||||
* [Legacy Wireless Support](#legacy-wireless-support)
|
||||
* [USB 1.1 (OHCI/UHCI) Support](#usb-11-ohciuhci-support)
|
||||
* [Ethernet issue with Early 2008 Mac Pro](#ethernet-issue-with-early-2008-mac-pro)
|
||||
|
||||
@@ -47,22 +43,73 @@ For users with 2008 to 2013 Mac Pros (MacPro3,1-6,1) and 2009 to 2011 iMacs (iMa
|
||||
|
||||
* CPUs supporting AVX2.0 are Haswell or newer, which no pre-2019 Mac Pros can be upgraded with.
|
||||
|
||||
Currently at this time, OpenCore Legacy Patcher only supports patching the AMD Polaris Graphics stack to no longer require AVX2.0. However due to lack of hardware on-hand, we cannot support Navi on Ventura.
|
||||
|
||||
* If you have spare Navi GPU you'd like to donate, feel free to reach out: khronokernel@icloud.com
|
||||
* Thanks to a gracious user, we've gotten an AMD Vega 64 on-hand for testing. No time estimate can be provided for Vega support at this time.
|
||||
|
||||
Additionally, the native stack will crash over and over on macOS Ventura as it fails to load the AVX2.0-based binaries. Thus to patch Ventura, you will need to boot in Safe Mode and run OCLP's Root Volume Patcher
|
||||
|
||||
* To enter Safe Mode, hold Shift+Enter when selecting Ventura in OCLP's Boot Picker
|
||||
Currently at this time, OpenCore Legacy Patcher only supports patching the AMD Polaris and Vega Graphics stack to no longer require AVX2.0. We're recently received an AMD RX 6600 donation, so hopefully in the future the project can support AMD Navi with pre-Haswell Macs. However no time estimates can be given.
|
||||
|
||||
Following GPUs are applicable:
|
||||
|
||||
| GPU Architecture | Model Families | Supported |
|
||||
| :--- | :--- | :--- |
|
||||
| AMD Polaris | RX 4xx/5xx (10/20 series) | <span style="color:#30BCD5"> Supported with patching </span> |
|
||||
| AMD Vega | Vega 56/64/VII (10/20 series) | <span style="color:red"> Unsupported </span> |
|
||||
| AMD Navi | RX 5xxx/6xxx (10/20 series) | ^^ |
|
||||
| AMD Vega | Vega 56/64/VII (10/20 series) | ^^ |
|
||||
| AMD Navi | RX 5xxx/6xxx (10/20 series) | <span style="color:red"> Unsupported </span> |
|
||||
|
||||
|
||||
### USB 1.1 (OHCI/UHCI) Support
|
||||
|
||||
For Penryn systems and pre-2013 Mac Pros, USB 1.1 support was outright removed in macOS Ventura. While USB 1.1 may seem unimportant, it handles many important devices on your system. These include:
|
||||
|
||||
* Keyboard and Trackpad for laptops
|
||||
* IR Receivers
|
||||
* Bluetooth
|
||||
|
||||
With OpenCore Legacy Patcher v0.6.0, basic support has been implemented via Root Volume patching. However due to this, users will need to use a USB hub for installation and post-OS updates when patches are cleaned:
|
||||
|
||||

|
||||
|
||||
::: warning The following systems rely on USB 1.1
|
||||
|
||||
* iMac10,x and older
|
||||
* Macmini3,1 and older
|
||||
* MacBook7,1 and older
|
||||
* MacBookAir3,1 and older
|
||||
* MacBookPro7,1 and older
|
||||
* MacBookPro6,x is exempt
|
||||
* MacPro5,1 and older
|
||||
|
||||
:::
|
||||
|
||||
### Ethernet issue with Early 2008 Mac Pro
|
||||
|
||||
MacPro3,1 suffers from Ethernet driver dying after returning from sleep, current workaround is to use a USB Ethernet adapter or disable sleep.
|
||||
|
||||
|
||||
::: details Legacy Wireless Support (Resolved in v0.6.0 and newer)
|
||||
|
||||
|
||||
### Legacy Wireless Support
|
||||
|
||||
For systems that required Root Patches in macOS Monterey to achieve Wireless support, unfortunately macOS Ventura has broken the patch set. Currently the following Wifi cards are unsupported:
|
||||
|
||||
* Atheros: All models
|
||||
* Broadcom: BCM94328 and BCM94322
|
||||
|
||||
The following machines shipped stock with these cards:
|
||||
|
||||
* iMac12,x and older
|
||||
* Macmini3,1 and older
|
||||
* MacBook5,x and older
|
||||
* MacBookAir2,1 and older
|
||||
* MacBookPro7,1 and older
|
||||
* MacBookPro6,x is exempt
|
||||
* MacPro5,1 and older
|
||||
|
||||
|
||||
Currently BCM943224, BCM94331, BCM94360 and BCM943602 are still fully supported by OpenCore Legacy Patcher. Consider upgrading to these cards if possible.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
::: details Non-Metal Graphics Acceleration (Resolved in v0.6.0 and newer)
|
||||
|
||||
|
||||
### Non-Metal Graphics Acceleration
|
||||
@@ -84,8 +131,6 @@ The following GPUs are applicable:
|
||||
|
||||
The following machines shipped stock with an unsupported GPU:
|
||||
|
||||
::: warning Systems shipped with non-Metal Graphics Cards
|
||||
|
||||
* iMac7,1 - iMac12,x
|
||||
* MacBook4,1 - MacBook7,1
|
||||
* MacBookAir2,1 - MacBookAir4,x
|
||||
@@ -94,54 +139,5 @@ The following machines shipped stock with an unsupported GPU:
|
||||
* MacPro3,1 - MacPro5,1
|
||||
* Xserve2,1 - Xserve3,1
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Legacy Wireless Support
|
||||
|
||||
For systems that required Root Patches in macOS Monterey to achieve Wireless support, unfortunately macOS Ventura has broken the patch set. Currently the following Wifi cards are unsupported:
|
||||
|
||||
* Atheros: All models
|
||||
* Broadcom: BCM94328 and BCM94322
|
||||
|
||||
The following machines shipped stock with these cards:
|
||||
|
||||
::: warning Systems shipped with applicable cards
|
||||
|
||||
* iMac12,x and older
|
||||
* Macmini3,1 and older
|
||||
* MacBook5,x and older
|
||||
* MacBookAir2,1 and older
|
||||
* MacBookPro7,1 and older
|
||||
* MacBookPro6,x is exempt
|
||||
* MacPro5,1 and older
|
||||
|
||||
:::
|
||||
|
||||
Currently BCM943224, BCM94331, BCM94360 and BCM943602 are still fully supported by OpenCore Legacy Patcher. Consider upgrading to these cards if possible.
|
||||
|
||||
|
||||
### USB 1.1 (OHCI/UHCI) Support
|
||||
|
||||
For Penryn systems and pre-2013 Mac Pros, USB 1.1 support was outright removed in macOS Ventura. While USB 1.1 may seem unimportant, it handles many important devices on your system. These include:
|
||||
|
||||
* Keyboard and Trackpad for laptops
|
||||
* IR Receivers
|
||||
* Bluetooth
|
||||
|
||||
|
||||
::: warning The following systems rely on USB 1.1
|
||||
|
||||
* iMac10,x and older
|
||||
* Macmini3,1 and older
|
||||
* MacBook7,1 and older
|
||||
* MacBookAir3,1 and older
|
||||
* MacBookPro7,1 and older
|
||||
* MacBookPro6,x is exempt
|
||||
* MacPro5,1 and older
|
||||
|
||||
:::
|
||||
|
||||
### Ethernet issue with Early 2008 Mac Pro
|
||||
|
||||
MacPro3,1 suffers from Ethernet driver dying after returning from sleep, current workaround is to use a USB Ethernet adapter or disable sleep.
|
||||
:::
|
||||
BIN
images/OCLP-060-Initial-Support.png
Normal file
BIN
images/OCLP-060-Initial-Support.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 984 KiB |
BIN
images/usb11-chart.png
Normal file
BIN
images/usb11-chart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 787 KiB |
@@ -1545,6 +1545,24 @@
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Arch</key>
|
||||
<string>x86_64</string>
|
||||
<key>BundlePath</key>
|
||||
<string>RSRHelper.kext</string>
|
||||
<key>Comment</key>
|
||||
<string>RSRHelper</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>ExecutablePath</key>
|
||||
<string>Contents/MacOS/RSRHelper</string>
|
||||
<key>MaxKernel</key>
|
||||
<string></string>
|
||||
<key>MinKernel</key>
|
||||
<string>20.0.0</string>
|
||||
<key>PlistPath</key>
|
||||
<string>Contents/Info.plist</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>Block</key>
|
||||
<array/>
|
||||
@@ -2539,6 +2557,18 @@
|
||||
<key>LoadEarly</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
<key>Path</key>
|
||||
<string>NVGOP_GK.efi</string>
|
||||
<key>Enabled</key>
|
||||
<false/>
|
||||
<key>Arguments</key>
|
||||
<string></string>
|
||||
<key>LoadEarly</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Comment</key>
|
||||
<string></string>
|
||||
@@ -2669,6 +2699,8 @@
|
||||
<true/>
|
||||
<key>ResizeGpuBars</key>
|
||||
<integer>-1</integer>
|
||||
<key>ResizeUsePciRbIo</key>
|
||||
<false/>
|
||||
<key>TscSyncTimeout</key>
|
||||
<integer>0</integer>
|
||||
<key>UnblockFsConnect</key>
|
||||
|
||||
BIN
payloads/Drivers/NVGOP_GK.efi
Normal file
BIN
payloads/Drivers/NVGOP_GK.efi
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/AutoPkgInstaller-v1.0.2-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/AutoPkgInstaller-v1.0.2-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/AutoPkgInstaller-v1.0.2-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/AutoPkgInstaller-v1.0.2-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/CPUFriend-v1.2.6-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/CPUFriend-v1.2.6-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/CPUFriend-v1.2.6-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/CPUFriend-v1.2.6-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/FeatureUnlock-v1.1.4-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/FeatureUnlock-v1.1.4-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/FeatureUnlock-v1.1.4-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/FeatureUnlock-v1.1.4-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/Lilu-v1.6.4-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/Lilu-v1.6.4-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/Lilu-v1.6.4-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/Lilu-v1.6.4-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/NVMeFix-v1.1.0-RELEASE.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/RSRHelper-v1.0.0-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/RSRHelper-v1.0.0-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/RSRHelper-v1.0.0-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/RSRHelper-v1.0.0-RELEASE.zip
Normal file
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
Following patch required for iMacs with Navi MXM GPUs
|
||||
Source: https://github.com/kingo132/a51m-r2-5700m-hackintosh/issues/13
|
||||
3319
payloads/Kexts/Acidanthera/WhateverGreen-Navi-Backlight.patch
Normal file
3319
payloads/Kexts/Acidanthera/WhateverGreen-Navi-Backlight.patch
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-DEBUG.zip
Normal file
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-Navi-RELEASE.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-RELEASE.zip
Normal file
BIN
payloads/Kexts/Acidanthera/WhateverGreen-v1.6.4-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
payloads/Kexts/Misc/Innie-v1.3.1-DEBUG.zip
Normal file
BIN
payloads/Kexts/Misc/Innie-v1.3.1-DEBUG.zip
Normal file
Binary file not shown.
BIN
payloads/Kexts/Misc/Innie-v1.3.1-RELEASE.zip
Normal file
BIN
payloads/Kexts/Misc/Innie-v1.3.1-RELEASE.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
253
payloads/Kexts/Update-Kexts.command
Executable file
253
payloads/Kexts/Update-Kexts.command
Executable file
@@ -0,0 +1,253 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import requests
|
||||
import packaging.version
|
||||
import tempfile
|
||||
|
||||
|
||||
# For kexts with basic handling requirements
|
||||
KEXT_DICTIONARY = {
|
||||
|
||||
"Acidanthera": {
|
||||
"AirportBrcmFixup": {
|
||||
"Repository": "https://github.com/acidanthera/AirportBrcmFixup",
|
||||
"Constants Variable": "self.airportbcrmfixup_version",
|
||||
},
|
||||
# Due to issues with legacy Macs, don't update
|
||||
# "AppleALC": {
|
||||
# "Repository": "https://github.com/acidanthera/AppleALC",
|
||||
# "Constants Variable": "self.applealc_version",
|
||||
# },
|
||||
"BlueToolFixup": {
|
||||
"Repository": "https://github.com/acidanthera/BrcmPatchRAM",
|
||||
"Constants Variable": "self.bluetoolfixup_version",
|
||||
"Override": "BrcmPatchRAM",
|
||||
},
|
||||
"CPUFriend": {
|
||||
"Repository": "https://github.com/acidanthera/CPUFriend",
|
||||
"Constants Variable": "self.cpufriend_version",
|
||||
},
|
||||
"CryptexFixup": {
|
||||
"Repository": "https://github.com/acidanthera/CryptexFixup",
|
||||
"Constants Variable": "self.cryptexfixup_version",
|
||||
},
|
||||
"DebugEnhancer": {
|
||||
"Repository": "https://github.com/acidanthera/DebugEnhancer",
|
||||
"Constants Variable": "self.debugenhancer_version",
|
||||
},
|
||||
"FeatureUnlock": {
|
||||
"Repository": "https://github.com/acidanthera/FeatureUnlock",
|
||||
"Constants Variable": "self.featureunlock_version",
|
||||
},
|
||||
"Lilu": {
|
||||
"Repository": "https://github.com/acidanthera/Lilu",
|
||||
"Constants Variable": "self.lilu_version",
|
||||
},
|
||||
"NVMeFix": {
|
||||
"Repository": "https://github.com/acidanthera/NVMeFix",
|
||||
"Constants Variable": "self.nvmefix_version",
|
||||
},
|
||||
"RestrictEvents": {
|
||||
"Repository": "https://github.com/acidanthera/RestrictEvents",
|
||||
"Constants Variable": "self.restrictevents_version",
|
||||
},
|
||||
"RSRHelper": {
|
||||
"Repository": "https://github.com/khronokernel/RSRHelper",
|
||||
"Constants Variable": "self.rsrhelper_version",
|
||||
},
|
||||
"WhateverGreen": {
|
||||
"Repository": "https://github.com/acidanthera/WhateverGreen",
|
||||
"Constants Variable": "self.whatevergreen_version",
|
||||
},
|
||||
},
|
||||
|
||||
"Misc": {
|
||||
"Innie": {
|
||||
"Repository": "https://github.com/cdf/Innie",
|
||||
"Constants Variable": "self.innie_version",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
class GenerateKexts:
|
||||
|
||||
def __init__(self):
|
||||
self.weg_version = None
|
||||
self.weg_old = None
|
||||
self.lilu_version = None
|
||||
|
||||
self._set_cwd()
|
||||
self._iterate_over_kexts()
|
||||
self._special_kext_handling()
|
||||
|
||||
|
||||
def _set_cwd(self):
|
||||
# Set working directory to script location
|
||||
script_path = Path(__file__).parent.absolute()
|
||||
os.chdir(script_path)
|
||||
|
||||
def _special_kext_handling(self):
|
||||
# Generate custom WhateverGreen
|
||||
if self.weg_version is None or self.lilu_version is None or self.weg_old is None:
|
||||
raise Exception("Unable to find latest WEG version!")
|
||||
|
||||
if packaging.version.parse(self.weg_version) <= packaging.version.parse(self.weg_old):
|
||||
print(" WEG is up to date!")
|
||||
return
|
||||
|
||||
# WhateverGreen
|
||||
print("Building modified WhateverGreen...")
|
||||
# We have to compile WEG ourselves
|
||||
weg_source_url = f"https://github.com/acidanthera/WhateverGreen/archive/refs/tags/{self.weg_version}.zip"
|
||||
lilu_url = f"https://github.com/acidanthera/Lilu/releases/download/{self.lilu_version}/Lilu-{self.lilu_version}-DEBUG.zip"
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
# Download source
|
||||
weg_source_zip = f"{temp_dir}/WhateverGreen-{self.weg_version}.zip"
|
||||
subprocess.run(["curl", "-L", weg_source_url, "-o", weg_source_zip], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
# Unzip source
|
||||
subprocess.run(["unzip", weg_source_zip, "-d", temp_dir], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
# Git clone MacKernelSDK into source
|
||||
subprocess.run(["git", "clone", "https://github.com/acidanthera/MacKernelSDK", f"{temp_dir}/WhateverGreen-{self.weg_version}/MacKernelSDK"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
# Grab latest Lilu release, debug version
|
||||
lilu_zip = f"{temp_dir}/Lilu-{self.lilu_version}-DEBUG.zip"
|
||||
subprocess.run(["curl", "-L", lilu_url, "-o", lilu_zip], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
# Unzip Lilu into WEG source
|
||||
subprocess.run(["unzip", lilu_zip, "-d", f"{temp_dir}/WhateverGreen-{self.weg_version}"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
# Apply patch
|
||||
patch_path = Path("./Acidanthera/WhateverGreen-Navi-Backlight.patch").absolute()
|
||||
subprocess.run(["git", "apply", patch_path], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}")
|
||||
|
||||
# Build WEG
|
||||
for variant in ["Release", "Debug"]:
|
||||
subprocess.run(["xcodebuild", "-configuration", variant], cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}", check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
|
||||
# Zip Release
|
||||
for variant in ["RELEASE", "DEBUG"]:
|
||||
dst_path = Path(f"./Acidanthera/WhateverGreen-v{self.weg_version}-Navi-{variant}.zip").absolute()
|
||||
subprocess.run(["zip", "-r", dst_path, "WhateverGreen.kext"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=f"{temp_dir}/WhateverGreen-{self.weg_version}/build/{'Release' if variant == 'RELEASE' else 'Debug'}")
|
||||
if Path(f"./Acidanthera/WhateverGreen-v{self.weg_old}-Navi-{variant}.zip").exists():
|
||||
subprocess.run(["rm", f"./Acidanthera/WhateverGreen-v{self.weg_old}-Navi-{variant}.zip"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
self._update_constants_file("self.whatevergreen_navi_version", f"{self.weg_old}-Navi", f"{self.weg_version}-Navi")
|
||||
|
||||
|
||||
def _iterate_over_kexts(self):
|
||||
for kext_folder in KEXT_DICTIONARY:
|
||||
for kext_name in KEXT_DICTIONARY[kext_folder]:
|
||||
print(f"Checking {kext_name}...")
|
||||
if "Override" in KEXT_DICTIONARY[kext_folder][kext_name]:
|
||||
self._get_latest_release(kext_folder, kext_name, override_kext_zip_name=KEXT_DICTIONARY[kext_folder][kext_name]["Override"])
|
||||
else:
|
||||
self._get_latest_release(kext_folder, kext_name)
|
||||
|
||||
|
||||
def _get_latest_release(self, kext_folder, kext_name, override_kext_zip_name=None):
|
||||
# Get latest release from GitHub API
|
||||
repo_url = KEXT_DICTIONARY[kext_folder][kext_name]["Repository"].replace("https://github.com", "https://api.github.com/repos")
|
||||
latest_release = requests.get(f"{repo_url}/releases/latest").json()
|
||||
|
||||
for variant in ["RELEASE", "DEBUG"]:
|
||||
|
||||
if "tag_name" not in latest_release:
|
||||
print(f" Error: {latest_release['message']}")
|
||||
continue
|
||||
|
||||
remote_version = latest_release["tag_name"]
|
||||
if remote_version.startswith("v"):
|
||||
remote_version = remote_version[1:]
|
||||
|
||||
if kext_name == "WhateverGreen":
|
||||
self.weg_version = remote_version
|
||||
elif kext_name == "Lilu":
|
||||
self.lilu_version = remote_version
|
||||
|
||||
local_version = self._get_local_version(kext_folder, kext_name, variant)
|
||||
if kext_name == "WhateverGreen":
|
||||
self.weg_old = local_version
|
||||
|
||||
if packaging.version.parse(remote_version) <= packaging.version.parse(local_version):
|
||||
print(f" {kext_name} {variant} is up to date: v{local_version}")
|
||||
continue
|
||||
|
||||
for asset in latest_release["assets"]:
|
||||
if not asset["name"].endswith(f"{variant}.zip"):
|
||||
continue
|
||||
print(f" Downloading {kext_name} {variant}: v{remote_version}...")
|
||||
zip_name = f"{override_kext_zip_name}-v{remote_version}-{variant}.zip" if override_kext_zip_name else f"{kext_name}-v{remote_version}-{variant}.zip"
|
||||
|
||||
self._download_file(asset["browser_download_url"], f"./{kext_folder}/{zip_name}", f"{kext_name}.kext")
|
||||
if Path(f"./{kext_folder}/{zip_name}").exists():
|
||||
subprocess.run(["rm", "-rf", f"./{kext_folder}/{zip_name.replace(f'v{remote_version}', f'v{local_version}')}"])
|
||||
self._update_constants_file(KEXT_DICTIONARY[kext_folder][kext_name]["Constants Variable"], local_version, remote_version)
|
||||
|
||||
if override_kext_zip_name:
|
||||
# rename zip file
|
||||
os.rename(f"./{kext_folder}/{zip_name}", f"./{kext_folder}/{kext_name}-v{remote_version}-{variant}.zip")
|
||||
subprocess.run(["rm", "-rf", f"./{kext_folder}/{kext_name}-v{local_version}-{variant}.zip"])
|
||||
|
||||
|
||||
def _get_local_version(self, kext_folder, kext_name, variant):
|
||||
loose_name_start = f"{kext_name}-v"
|
||||
loose_name_end = f"-{variant}.zip"
|
||||
|
||||
for file in Path(f"./{kext_folder}").iterdir():
|
||||
if file.name.startswith(loose_name_start) and file.name.endswith(loose_name_end):
|
||||
local_version = file.name.replace(loose_name_start, "").replace(loose_name_end, "")
|
||||
if local_version.startswith("v"):
|
||||
local_version = local_version[1:]
|
||||
return local_version[:5]
|
||||
|
||||
raise Exception(f"Could not find local version for {kext_name} {variant}")
|
||||
|
||||
|
||||
def _download_file(self, url, file_path, file):
|
||||
# Download file
|
||||
if Path(file_path).exists():
|
||||
os.remove(file_path)
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
download = requests.get(url)
|
||||
with open(f"{temp_dir}/temp.zip", "wb") as f:
|
||||
f.write(download.content)
|
||||
|
||||
# Unzip file
|
||||
subprocess.run(["unzip", "-q", f"{temp_dir}/temp.zip", "-d", f"{temp_dir}"], check=True)
|
||||
|
||||
print(f" Moving {file} to {file_path}...")
|
||||
# Zip file
|
||||
subprocess.run(["zip", "-q", "-r", Path(file_path).name, file], cwd=f"{temp_dir}", check=True)
|
||||
|
||||
# Move file
|
||||
subprocess.run(["mv", f"{temp_dir}/{Path(file_path).name}", file_path], check=True)
|
||||
|
||||
|
||||
def _update_constants_file(self, variable_name, old_version, new_version):
|
||||
print(f" Updating {variable_name} to {new_version}...")
|
||||
constants_file = Path("../../resources/constants.py")
|
||||
if not constants_file.exists():
|
||||
raise Exception("Constants file does not exist")
|
||||
constants_file_contents = constants_file.read_text()
|
||||
|
||||
# Replace version
|
||||
for line in constants_file_contents.splitlines():
|
||||
if variable_name in line:
|
||||
constants_file_contents = constants_file_contents.replace(line, line.replace(old_version, new_version))
|
||||
break
|
||||
|
||||
# Write file
|
||||
constants_file.write_text(constants_file_contents)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
GenerateKexts()
|
||||
Binary file not shown.
Binary file not shown.
286
payloads/OpenCore/Update-OpenCore.command
Executable file
286
payloads/OpenCore/Update-OpenCore.command
Executable file
@@ -0,0 +1,286 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Script to download and generate valid OpenCorePkg folder/file structure for use with OpenCore-Legacy-Patcher
|
||||
# To use:
|
||||
# - Download OpenCore-{VERSION}-{VARIANT}.zip
|
||||
# - If no files are found, the script will download the latest version
|
||||
# - Place zips in same directory as this script
|
||||
# - Run script
|
||||
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import requests
|
||||
|
||||
REPO_URL = "https://api.github.com/repos/acidanthera/OpenCorePkg/releases/latest"
|
||||
|
||||
BUILD_VARIANTS = [
|
||||
"DEBUG",
|
||||
"RELEASE"
|
||||
]
|
||||
|
||||
UNUSED_DRIVERS = [
|
||||
"AudioDxe.efi",
|
||||
"BiosVideo.efi",
|
||||
"CrScreenshotDxe.efi",
|
||||
"Ext4Dxe.efi",
|
||||
"HiiDatabase.efi",
|
||||
"NvmExpressDxe.efi",
|
||||
"OpenHfsPlus.efi",
|
||||
"OpenNtfsDxe.efi",
|
||||
"OpenPartitionDxe.efi",
|
||||
"OpenUsbKbDxe.efi",
|
||||
"OpenVariableRuntimeDxe.efi",
|
||||
"Ps2KeyboardDxe.efi",
|
||||
"Ps2MouseDxe.efi",
|
||||
"ToggleSipEntry.efi",
|
||||
"UsbMouseDxe.efi",
|
||||
"XhciDxe.efi",
|
||||
"Udp4Dxe.efi",
|
||||
"TcpDxe.efi",
|
||||
"SnpDxe.efi",
|
||||
"MnpDxe.efi",
|
||||
"Ip4Dxe.efi",
|
||||
"HttpUtilitiesDxe.efi",
|
||||
"HttpDxe.efi",
|
||||
"HttpBootDxe.efi",
|
||||
"DpcDxe.efi",
|
||||
"DnsDxe.efi",
|
||||
"Dhcp4Dxe.efi",
|
||||
"ArpDxe.efi",
|
||||
]
|
||||
|
||||
UNUSED_TOOLS = [
|
||||
"ChipTune.efi",
|
||||
"CleanNvram.efi",
|
||||
"ControlMsrE2.efi",
|
||||
"GopStop.efi",
|
||||
"KeyTester.efi",
|
||||
"MmapDump.efi",
|
||||
"OpenControl.efi",
|
||||
"ResetSystem.efi",
|
||||
"RtcRw.efi",
|
||||
"CsrUtil.efi",
|
||||
"TpmInfo.efi",
|
||||
]
|
||||
|
||||
IMPORTANT_UTILITIES = [
|
||||
"macserial",
|
||||
"ocvalidate",
|
||||
]
|
||||
|
||||
|
||||
|
||||
class GenerateOpenCore:
|
||||
|
||||
def __init__(self):
|
||||
print("Generating new OpenCore bundles...")
|
||||
|
||||
self.working_dir = None
|
||||
|
||||
self.set_directory()
|
||||
self.validate_files()
|
||||
self.generate()
|
||||
|
||||
print("New OpenCore bundles generated!")
|
||||
|
||||
def set_directory(self):
|
||||
self.working_dir = Path(__file__).parent.absolute()
|
||||
print(f"Working directory: {self.working_dir}")
|
||||
|
||||
self.debug_zip = None
|
||||
self.release_zip = None
|
||||
|
||||
# Find OpenCore DEBUG zip
|
||||
for file in self.working_dir.iterdir():
|
||||
if file.name.endswith("DEBUG.zip") and file.name != "OpenCore-DEBUG.zip":
|
||||
print(f" Found DEBUG zip: {file.name}")
|
||||
self.debug_zip = file
|
||||
|
||||
# Find OpenCore RELEASE zip
|
||||
for file in self.working_dir.iterdir():
|
||||
if file.name.endswith("RELEASE.zip") and file.name != "OpenCore-RELEASE.zip":
|
||||
print(f" Found RELEASE zip: {file.name}")
|
||||
self.release_zip = file
|
||||
|
||||
if self.debug_zip is None:
|
||||
self.download_new_binaries("DEBUG")
|
||||
|
||||
if self.release_zip is None:
|
||||
self.download_new_binaries("RELEASE")
|
||||
|
||||
|
||||
# Unzip both, rename to OpenCore-DEBUG and OpenCore-RELEASE
|
||||
print("Unzipping DEBUG zip...")
|
||||
subprocess.run (
|
||||
["unzip", f"{self.debug_zip}", "-d", f"{self.working_dir}/OpenCore-DEBUG-ROOT"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
print("Unzipping RELEASE zip...")
|
||||
subprocess.run (
|
||||
["unzip", f"{self.release_zip}", "-d", f"{self.working_dir}/OpenCore-RELEASE-ROOT"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
for variant in BUILD_VARIANTS:
|
||||
print(f"Moving {variant} folder...")
|
||||
subprocess.run (
|
||||
["mv", f"{self.working_dir}/OpenCore-{variant}-ROOT/X64", f"{self.working_dir}/OpenCore-{variant}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
if variant == "DEBUG":
|
||||
for utility in IMPORTANT_UTILITIES:
|
||||
print(f"Moving {utility} from {variant} variant...")
|
||||
subprocess.run (
|
||||
["rm", "-rf", f"{self.working_dir}/{utility}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
subprocess.run (
|
||||
["mv", f"{self.working_dir}/OpenCore-{variant}-ROOT/Utilities/{utility}/{utility}", f"{self.working_dir}/{utility}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Remove root folder
|
||||
subprocess.run (
|
||||
["rm", "-rf", f"{self.working_dir}/OpenCore-{variant}-ROOT"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Remove zip files
|
||||
print("Removing zip files...")
|
||||
# remove debug_zip
|
||||
subprocess.run (
|
||||
["rm", "-rf", self.debug_zip],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
# remove release_zip
|
||||
subprocess.run (
|
||||
["rm", "-rf", self.release_zip],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
def download_new_binaries(self, variant):
|
||||
# Get latest release
|
||||
print(f"Getting latest {variant}...")
|
||||
latest_release = requests.get(REPO_URL).json()
|
||||
|
||||
# Get latest release download url
|
||||
print(f" Getting latest {variant} download url...")
|
||||
for asset in latest_release["assets"]:
|
||||
if asset["name"].endswith(f"{variant}.zip"):
|
||||
download_url = asset["browser_download_url"]
|
||||
print(f" Download url: {download_url}")
|
||||
break
|
||||
|
||||
if variant == "DEBUG":
|
||||
self.debug_zip = f"{self.working_dir}/{asset['name']}"
|
||||
elif variant == "RELEASE":
|
||||
self.release_zip = f"{self.working_dir}/{asset['name']}"
|
||||
else:
|
||||
raise ValueError("Invalid variant!")
|
||||
|
||||
# Download latest release
|
||||
print(f" Downloading latest {variant}...")
|
||||
download = requests.get(download_url)
|
||||
with open(f"{self.working_dir}/{asset['name']}", "wb") as f:
|
||||
f.write(download.content)
|
||||
|
||||
def clean_old_bundles(self):
|
||||
print("Cleaning old bundles...")
|
||||
for variant in BUILD_VARIANTS:
|
||||
if (self.working_dir / f"OpenCore-{variant}").exists():
|
||||
print(f" Deleting old {variant} variant...")
|
||||
subprocess.run (
|
||||
["rm", "-rf", f"{self.working_dir}/OpenCore-{variant}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
def validate_files(self):
|
||||
for variant in BUILD_VARIANTS:
|
||||
if not (self.working_dir / f"OpenCore-{variant}").exists():
|
||||
raise FileNotFoundError(f"OpenCore-{variant} folder not found!")
|
||||
|
||||
def generate(self):
|
||||
for variant in BUILD_VARIANTS:
|
||||
print(f"Generating {variant} variant...")
|
||||
self.generate_opencore(variant)
|
||||
|
||||
def generate_opencore(self, variant):
|
||||
# Create S/L/C
|
||||
print(" Creating SLC folder")
|
||||
subprocess.run (
|
||||
["mkdir", "-p", f"{self.working_dir}/OpenCore-{variant}/System/Library/CoreServices"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Relocate contents of /EFI/BOOT to /S/L/C
|
||||
print(" Relocating BOOT folder to SLC")
|
||||
for file in (self.working_dir / f"OpenCore-{variant}/EFI/BOOT").iterdir():
|
||||
subprocess.run (
|
||||
["mv", f"{file}", f"{self.working_dir}/OpenCore-{variant}/System/Library/CoreServices"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Rename BOOTx64.efi to boot.efi
|
||||
print(" Renaming BOOTx64.efi to boot.efi")
|
||||
subprocess.run (
|
||||
["mv", f"{self.working_dir}/OpenCore-{variant}/System/Library/CoreServices/BOOTx64.efi", f"{self.working_dir}/OpenCore-{variant}/System/Library/CoreServices/boot.efi"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Delete BOOT folder
|
||||
print(" Deleting BOOT folder")
|
||||
subprocess.run (
|
||||
["rm", "-rf", f"{self.working_dir}/OpenCore-{variant}/EFI/BOOT"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Delete unused drivers
|
||||
print(" Deleting unused drivers")
|
||||
for driver in UNUSED_DRIVERS:
|
||||
if Path(f"{self.working_dir}/OpenCore-{variant}/EFI/OC/Drivers/{driver}").exists():
|
||||
print(f" Deleting {driver}")
|
||||
subprocess.run (
|
||||
["rm", f"{self.working_dir}/OpenCore-{variant}/EFI/OC/Drivers/{driver}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
else:
|
||||
print(f" {driver} not found")
|
||||
|
||||
# Delete unused tools
|
||||
print(" Deleting unused tools")
|
||||
for tool in UNUSED_TOOLS:
|
||||
if Path(f"{self.working_dir}/OpenCore-{variant}/EFI/OC/Tools/{tool}").exists():
|
||||
print(f" Deleting {tool}")
|
||||
subprocess.run (
|
||||
["rm", f"{self.working_dir}/OpenCore-{variant}/EFI/OC/Tools/{tool}"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
else:
|
||||
print(f" {tool} not found")
|
||||
|
||||
# Rename OpenCore-<variant> to OpenCore-Build
|
||||
print(" Renaming OpenCore folder")
|
||||
subprocess.run (
|
||||
["mv", f"{self.working_dir}/OpenCore-{variant}", f"{self.working_dir}/OpenCore-Build"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Create OpenCore-<variant>.zip
|
||||
print(" Creating OpenCore.zip")
|
||||
subprocess.run (
|
||||
["ditto", "-c", "-k", "--sequesterRsrc", "--keepParent", f"{self.working_dir}/OpenCore-Build", f"{self.working_dir}/OpenCore-{variant}.zip"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
# Delete OpenCore-Build
|
||||
print(" Deleting OpenCore-Build")
|
||||
subprocess.run (
|
||||
["rm", "-rf", f"{self.working_dir}/OpenCore-Build"],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
GenerateOpenCore()
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Simple script to delete unnecessary files from OpenCore and move into place
|
||||
# To use, simply :
|
||||
# - Download an OpenCore build
|
||||
# - Place the X64 folder in the /payloads/OpenCore folder
|
||||
# - Rename to OpenCore-VERSION (ie. DEBUG or RELEASE)
|
||||
# - Run script
|
||||
# - Rename folders to appropriate versions (ie. OpenCore-Build)
|
||||
# - Zip folders
|
||||
# TODO:
|
||||
# - Download latest builds from dortania.github.io
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
build_types = [
|
||||
"DEBUG",
|
||||
"RELEASE",
|
||||
]
|
||||
|
||||
bad_drivers = [
|
||||
"AudioDxe.efi",
|
||||
"BiosVideo.efi",
|
||||
"CrScreenshotDxe.efi",
|
||||
"Ext4Dxe.efi",
|
||||
"HiiDatabase.efi",
|
||||
"NvmExpressDxe.efi",
|
||||
"OpenHfsPlus.efi",
|
||||
"OpenNtfsDxe.efi",
|
||||
"OpenPartitionDxe.efi",
|
||||
"OpenUsbKbDxe.efi",
|
||||
"OpenVariableRuntimeDxe.efi",
|
||||
"Ps2KeyboardDxe.efi",
|
||||
"Ps2MouseDxe.efi",
|
||||
"ToggleSipEntry.efi",
|
||||
"UsbMouseDxe.efi",
|
||||
"XhciDxe.efi",
|
||||
"Udp4Dxe.efi",
|
||||
"TcpDxe.efi",
|
||||
"SnpDxe.efi",
|
||||
"MnpDxe.efi",
|
||||
"Ip4Dxe.efi",
|
||||
"HttpUtilitiesDxe.efi",
|
||||
"HttpDxe.efi",
|
||||
"HttpBootDxe.efi",
|
||||
"DpcDxe.efi",
|
||||
"DnsDxe.efi",
|
||||
"Dhcp4Dxe.efi",
|
||||
"ArpDxe.efi",
|
||||
]
|
||||
|
||||
bad_tools = [
|
||||
"ChipTune.efi",
|
||||
"CleanNvram.efi",
|
||||
"ControlMsrE2.efi",
|
||||
"GopStop.efi",
|
||||
"KeyTester.efi",
|
||||
"MmapDump.efi",
|
||||
"OpenControl.efi",
|
||||
"ResetSystem.efi",
|
||||
"RtcRw.efi",
|
||||
"CsrUtil.efi",
|
||||
"TpmInfo.efi",
|
||||
]
|
||||
|
||||
for version in build_types:
|
||||
print("- Creating S/L/C")
|
||||
subprocess.run(f"mkdir -p ./OpenCore-{version}/System/Library/CoreServices".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
print("- Creating boot.efi Bootstrap")
|
||||
subprocess.run(f"cp ./OpenCore-{version}/EFI/BOOT/BOOTx64.efi ./OpenCore-{version}/System/Library/CoreServices/boot.efi".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
print("- Deleting old BOOTx64.efi")
|
||||
subprocess.run(f"rm -R ./OpenCore-{version}/EFI/BOOT/".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
for delete_drivers in bad_drivers:
|
||||
if Path(f"./OpenCore-{version}/EFI/OC/Drivers/{delete_drivers}").exists():
|
||||
print(f"- Deleting {delete_drivers}")
|
||||
subprocess.run(f"rm ./OpenCore-{version}/EFI/OC/Drivers/{delete_drivers}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
else:
|
||||
print(f"- Unable to find {delete_drivers}, skipping")
|
||||
for delete_tools in bad_tools:
|
||||
if Path(f".//OpenCore-{version}/EFI/OC/Tools/{delete_tools}").exists():
|
||||
print(f"- Deleting {delete_tools}")
|
||||
subprocess.run(f"rm ./OpenCore-{version}/EFI/OC/Tools/{delete_tools}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
else:
|
||||
print(f"- Unable to find {delete_tools}, skipping")
|
||||
|
||||
print("- Renaming folder to OpenCore-Build and zipping")
|
||||
subprocess.run(f"mv ./OpenCore-{version} ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
subprocess.run(f"zip -r ./OpenCore-{version}.zip ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
subprocess.run(f"rm -rf ./OpenCore-Build".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
BIN
payloads/OpenCore/macserial
Executable file
BIN
payloads/OpenCore/macserial
Executable file
Binary file not shown.
BIN
payloads/OpenCore/ocvalidate
Executable file
BIN
payloads/OpenCore/ocvalidate
Executable file
Binary file not shown.
BIN
payloads/Tools/RSRRepair
Executable file
BIN
payloads/Tools/RSRRepair
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,27 +1,55 @@
|
||||
# Determine AppleMobileFileIntegrity's OS configuration
|
||||
# Copyright (C) 2022-2023, Mykola Grymalyuk
|
||||
|
||||
import enum
|
||||
from resources import utilities
|
||||
|
||||
class amfi_configuration_detection:
|
||||
|
||||
def __init__(self):
|
||||
self.AMFI_ALLOW_TASK_FOR_PID = False
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE = False
|
||||
self.AMFI_LV_ENFORCE_THIRD_PARTY = False
|
||||
self.AMFI_ALLOW_EVERYTHING = False
|
||||
self.SKIP_LIBRARY_VALIDATION = False
|
||||
|
||||
self.boot_args = []
|
||||
self.oclp_args = []
|
||||
|
||||
self.init_nvram_dicts()
|
||||
|
||||
self.parse_amfi_bitmask()
|
||||
self.parse_amfi_boot_args()
|
||||
self.parse_oclp_configuration()
|
||||
from data import amfi_data
|
||||
|
||||
|
||||
def init_nvram_dicts(self):
|
||||
class AmfiConfigDetectLevel(enum.IntEnum):
|
||||
"""
|
||||
Configuration levels used by AmfiConfigurationDetection
|
||||
"""
|
||||
|
||||
NO_CHECK: int = 0
|
||||
LIBRARY_VALIDATION: int = 1 # For Ventura, use LIBRARY_VALIDATION_AND_SIG
|
||||
LIBRARY_VALIDATION_AND_SIG: int = 2
|
||||
ALLOW_ALL: int = 3
|
||||
|
||||
|
||||
class AmfiConfigurationDetection:
|
||||
"""
|
||||
Detect AppleMobileFileIntegrity's OS configuration
|
||||
|
||||
Usage:
|
||||
|
||||
>>> import amfi_detect
|
||||
>>> can_patch = amfi_detect.AmfiConfigurationDetection().check_config(amfi_detect.AmfiConfigDetectLevel.ALLOW_ALL)
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.AMFI_ALLOW_TASK_FOR_PID: bool = False
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE: bool = False
|
||||
self.AMFI_LV_ENFORCE_THIRD_PARTY: bool = False
|
||||
self.AMFI_ALLOW_EVERYTHING: bool = False
|
||||
self.SKIP_LIBRARY_VALIDATION: bool = False
|
||||
|
||||
self.boot_args: list = []
|
||||
self.oclp_args: list = []
|
||||
|
||||
self._init_nvram_dicts()
|
||||
|
||||
self._parse_amfi_bitmask()
|
||||
self._parse_amfi_boot_args()
|
||||
self._parse_oclp_configuration()
|
||||
|
||||
|
||||
def _init_nvram_dicts(self) -> None:
|
||||
"""
|
||||
Initialize the boot-args and OCLP-Settings NVRAM dictionaries
|
||||
"""
|
||||
|
||||
boot_args = utilities.get_nvram("boot-args", decode=True)
|
||||
oclp_args = utilities.get_nvram("OCLP-Settings", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
|
||||
|
||||
@@ -32,40 +60,47 @@ class amfi_configuration_detection:
|
||||
self.oclp_args = oclp_args.split(" ")
|
||||
|
||||
|
||||
def parse_amfi_bitmask(self):
|
||||
# See data/amfi_data.py for more information
|
||||
def _parse_amfi_bitmask(self) -> None:
|
||||
"""
|
||||
Parse the AMFI bitmask from boot-args
|
||||
See data/amfi_data.py for more information
|
||||
"""
|
||||
|
||||
amfi_value = 0
|
||||
for arg in self.boot_args:
|
||||
if arg.startswith("amfi="):
|
||||
try:
|
||||
amfi_value = arg.split("=")
|
||||
if len(amfi_value) != 2:
|
||||
return
|
||||
amfi_value = amfi_value[1]
|
||||
if amfi_value.startswith("0x"):
|
||||
amfi_value = int(amfi_value, 16)
|
||||
else:
|
||||
amfi_value = int(amfi_value)
|
||||
except:
|
||||
if not arg.startswith("amfi="):
|
||||
continue
|
||||
try:
|
||||
amfi_value = arg.split("=")
|
||||
if len(amfi_value) != 2:
|
||||
return
|
||||
break
|
||||
amfi_value = amfi_value[1]
|
||||
if amfi_value.startswith("0x"):
|
||||
amfi_value = int(amfi_value, 16)
|
||||
else:
|
||||
amfi_value = int(amfi_value)
|
||||
except:
|
||||
return
|
||||
break
|
||||
|
||||
if amfi_value == 0:
|
||||
return
|
||||
|
||||
if amfi_value & 0x1:
|
||||
self.AMFI_ALLOW_TASK_FOR_PID = True
|
||||
if amfi_value & 0x2:
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE = True
|
||||
if amfi_value & 0x4:
|
||||
self.AMFI_LV_ENFORCE_THIRD_PARTY = True
|
||||
if amfi_value & 0x80:
|
||||
self.AMFI_ALLOW_EVERYTHING = True
|
||||
self.SKIP_LIBRARY_VALIDATION = True
|
||||
self.AMFI_ALLOW_TASK_FOR_PID: bool = amfi_value & amfi_data.AppleMobileFileIntegrity.AMFI_ALLOW_TASK_FOR_PID
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE: bool = amfi_value & amfi_data.AppleMobileFileIntegrity.AMFI_ALLOW_INVALID_SIGNATURE
|
||||
self.AMFI_LV_ENFORCE_THIRD_PARTY: bool = amfi_value & amfi_data.AppleMobileFileIntegrity.AMFI_LV_ENFORCE_THIRD_PARTY
|
||||
|
||||
if amfi_value & amfi_data.AppleMobileFileIntegrity.AMFI_ALLOW_EVERYTHING:
|
||||
self.AMFI_ALLOW_EVERYTHING = True
|
||||
self.SKIP_LIBRARY_VALIDATION = True
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE = True
|
||||
|
||||
|
||||
def parse_amfi_boot_args(self):
|
||||
def _parse_amfi_boot_args(self) -> None:
|
||||
"""
|
||||
Parse the AMFI boot-args
|
||||
"""
|
||||
|
||||
for arg in self.boot_args:
|
||||
if arg.startswith("amfi_unrestrict_task_for_pid"):
|
||||
value = arg.split("=")
|
||||
@@ -86,26 +121,34 @@ class amfi_configuration_detection:
|
||||
self.AMFI_ALLOW_INVALID_SIGNATURE = True
|
||||
|
||||
|
||||
def parse_oclp_configuration(self):
|
||||
def _parse_oclp_configuration(self) -> None:
|
||||
"""
|
||||
Parse the OCLP configuration
|
||||
"""
|
||||
|
||||
if "-allow_amfi" in self.oclp_args:
|
||||
self.SKIP_LIBRARY_VALIDATION = True
|
||||
|
||||
|
||||
def check_config(self, level):
|
||||
# Levels:
|
||||
# - 0: No checks
|
||||
# - 1. Library Validation (Monterey and Older)
|
||||
# - 2. Library Validation and Signature Checks (Ventura and Newer)
|
||||
# - 3. Disable all AMFI checks
|
||||
def check_config(self, level: int) -> bool:
|
||||
"""
|
||||
Check the AMFI configuration based on provided AMFI level
|
||||
See AmfiConfigLevel enum for valid levels
|
||||
|
||||
if level == 0:
|
||||
Parameters:
|
||||
level (int): The level of AMFI checks to check for
|
||||
|
||||
Returns:
|
||||
bool: True if the AMFI configuration matches the level, False otherwise
|
||||
"""
|
||||
|
||||
if level == AmfiConfigDetectLevel.NO_CHECK:
|
||||
return True
|
||||
|
||||
if level == 1:
|
||||
if level == AmfiConfigDetectLevel.LIBRARY_VALIDATION:
|
||||
return self.SKIP_LIBRARY_VALIDATION
|
||||
if level == 2:
|
||||
if level == AmfiConfigDetectLevel.LIBRARY_VALIDATION_AND_SIG:
|
||||
return bool(self.SKIP_LIBRARY_VALIDATION and self.AMFI_ALLOW_INVALID_SIGNATURE)
|
||||
if level == 3:
|
||||
if level == AmfiConfigDetectLevel.ALLOW_ALL:
|
||||
return self.AMFI_ALLOW_EVERYTHING
|
||||
|
||||
return False
|
||||
@@ -1,115 +1,186 @@
|
||||
import threading
|
||||
import time
|
||||
import logging
|
||||
import sys
|
||||
from resources import defaults, utilities, validation
|
||||
|
||||
from resources import defaults, utilities, validation, constants
|
||||
from resources.sys_patch import sys_patch, sys_patch_auto
|
||||
from resources.build import build
|
||||
from data import model_array
|
||||
import threading
|
||||
import time
|
||||
|
||||
|
||||
# Generic building args
|
||||
class arguments:
|
||||
def __init__(self):
|
||||
|
||||
def __init__(self, global_constants: constants.Constants) -> None:
|
||||
self.constants: constants.Constants = global_constants
|
||||
|
||||
self.args = utilities.check_cli_args()
|
||||
|
||||
def parse_arguments(self, settings):
|
||||
self._parse_arguments()
|
||||
|
||||
|
||||
def _parse_arguments(self) -> None:
|
||||
"""
|
||||
Parses arguments passed to the patcher
|
||||
"""
|
||||
|
||||
if self.args.validate:
|
||||
validation.validate(settings)
|
||||
elif self.args.build:
|
||||
self._validation_handler()
|
||||
return
|
||||
|
||||
if self.args.build:
|
||||
self._build_handler()
|
||||
return
|
||||
|
||||
if self.args.patch_sys_vol:
|
||||
self._sys_patch_handler()
|
||||
return
|
||||
|
||||
if self.args.unpatch_sys_vol:
|
||||
self._sys_unpatch_handler()
|
||||
return
|
||||
|
||||
if self.args.auto_patch:
|
||||
self._sys_patch_auto_handler()
|
||||
return
|
||||
|
||||
|
||||
def _validation_handler(self) -> None:
|
||||
"""
|
||||
Enter validation mode
|
||||
"""
|
||||
|
||||
validation.PatcherValidation(self.constants)
|
||||
|
||||
|
||||
def _sys_patch_handler(self) -> None:
|
||||
"""
|
||||
Start root volume patching
|
||||
"""
|
||||
|
||||
logging.info("- Set System Volume patching")
|
||||
if "Library/InstallerSandboxes/" in str(self.constants.payload_path):
|
||||
logging.info("- Running from Installer Sandbox")
|
||||
thread = threading.Thread(target=sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, None).start_patch)
|
||||
thread.start()
|
||||
while thread.is_alive():
|
||||
utilities.block_os_updaters()
|
||||
time.sleep(1)
|
||||
else:
|
||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, None).start_patch()
|
||||
|
||||
|
||||
def _sys_unpatch_handler(self) -> None:
|
||||
"""
|
||||
Start root volume unpatching
|
||||
"""
|
||||
logging.info("- Set System Volume unpatching")
|
||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, None).start_unpatch()
|
||||
|
||||
|
||||
def _sys_patch_auto_handler(self) -> None:
|
||||
"""
|
||||
Start root volume auto patching
|
||||
"""
|
||||
|
||||
logging.info("- Set Auto patching")
|
||||
sys_patch_auto.AutomaticSysPatch(self.constants).start_auto_patch()
|
||||
|
||||
|
||||
def _build_handler(self) -> None:
|
||||
"""
|
||||
Start config building process
|
||||
"""
|
||||
|
||||
if self.args.model:
|
||||
if self.args.model:
|
||||
if self.args.model:
|
||||
print(f"- Using custom model: {self.args.model}")
|
||||
settings.custom_model = self.args.model
|
||||
defaults.generate_defaults(settings.custom_model, False, settings)
|
||||
elif settings.computer.real_model not in model_array.SupportedSMBIOS and settings.allow_oc_everywhere is False:
|
||||
print(
|
||||
"""Your model is not supported by this patcher for running unsupported OSes!"
|
||||
logging.info(f"- Using custom model: {self.args.model}")
|
||||
self.constants.custom_model = self.args.model
|
||||
defaults.GenerateDefaults(self.constants.custom_model, False, self.constants)
|
||||
elif self.constants.computer.real_model not in model_array.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
|
||||
logging.info(
|
||||
"""Your model is not supported by this patcher for running unsupported OSes!"
|
||||
|
||||
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f"- Using detected model: {settings.computer.real_model}")
|
||||
defaults.generate_defaults(settings.custom_model, True, settings)
|
||||
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
logging.info(f"- Using detected model: {self.constants.computer.real_model}")
|
||||
defaults.GenerateDefaults(self.constants.custom_model, True, self.constants)
|
||||
|
||||
if self.args.disk:
|
||||
print(f"- Install Disk set: {self.args.disk}")
|
||||
settings.disk = self.args.disk
|
||||
if self.args.verbose:
|
||||
print("- Set verbose configuration")
|
||||
settings.verbose_debug = True
|
||||
else:
|
||||
settings.verbose_debug = False # Override Defaults detected
|
||||
if self.args.debug_oc:
|
||||
print("- Set OpenCore DEBUG configuration")
|
||||
settings.opencore_debug = True
|
||||
settings.opencore_build = "DEBUG"
|
||||
if self.args.debug_kext:
|
||||
print("- Set kext DEBUG configuration")
|
||||
settings.kext_debug = True
|
||||
if self.args.hide_picker:
|
||||
print("- Set HidePicker configuration")
|
||||
settings.showpicker = False
|
||||
if self.args.disable_sip:
|
||||
print("- Set Disable SIP configuration")
|
||||
settings.sip_status = False
|
||||
else:
|
||||
settings.sip_status = True # Override Defaults detected
|
||||
if self.args.disable_smb:
|
||||
print("- Set Disable SecureBootModel configuration")
|
||||
settings.secure_status = False
|
||||
else:
|
||||
settings.secure_status = True # Override Defaults detected
|
||||
if self.args.vault:
|
||||
print("- Set Vault configuration")
|
||||
settings.vault = True
|
||||
if self.args.firewire:
|
||||
print("- Set FireWire Boot configuration")
|
||||
settings.firewire_boot = True
|
||||
if self.args.nvme:
|
||||
print("- Set NVMe Boot configuration")
|
||||
settings.nvme_boot = True
|
||||
if self.args.wlan:
|
||||
print("- Set Wake on WLAN configuration")
|
||||
settings.enable_wake_on_wlan = True
|
||||
if self.args.disable_tb:
|
||||
print("- Set Disable Thunderbolt configuration")
|
||||
settings.disable_tb = True
|
||||
if self.args.force_surplus:
|
||||
print("- Forcing SurPlus override configuration")
|
||||
settings.force_surplus = True
|
||||
if self.args.moderate_smbios:
|
||||
print("- Set Moderate SMBIOS Patching configuration")
|
||||
settings.serial_settings = "Moderate"
|
||||
if self.args.smbios_spoof:
|
||||
if self.args.smbios_spoof == "Minimal":
|
||||
settings.serial_settings = "Minimal"
|
||||
elif self.args.smbios_spoof == "Moderate":
|
||||
settings.serial_settings = "Moderate"
|
||||
elif self.args.smbios_spoof == "Advanced":
|
||||
settings.serial_settings = "Advanced"
|
||||
else:
|
||||
print(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}")
|
||||
if self.args.verbose:
|
||||
logging.info("- Set verbose configuration")
|
||||
self.constants.verbose_debug = True
|
||||
else:
|
||||
self.constants.verbose_debug = False # Override Defaults detected
|
||||
|
||||
if self.args.support_all:
|
||||
print("- Building for natively supported model")
|
||||
settings.allow_oc_everywhere = True
|
||||
settings.serial_settings = "None"
|
||||
build.build_opencore(settings.custom_model or settings.computer.real_model, settings).build_opencore()
|
||||
elif self.args.patch_sys_vol:
|
||||
print("- Set System Volume patching")
|
||||
if self.args.debug_oc:
|
||||
logging.info("- Set OpenCore DEBUG configuration")
|
||||
self.constants.opencore_debug = True
|
||||
self.constants.opencore_build = "DEBUG"
|
||||
|
||||
if "Library/InstallerSandboxes/" in str(settings.payload_path):
|
||||
print("- Running from Installer Sandbox")
|
||||
thread = threading.Thread(target=sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings, None).start_patch)
|
||||
thread.start()
|
||||
while thread.is_alive():
|
||||
utilities.block_os_updaters()
|
||||
time.sleep(1)
|
||||
if self.args.debug_kext:
|
||||
logging.info("- Set kext DEBUG configuration")
|
||||
self.constants.kext_debug = True
|
||||
|
||||
if self.args.hide_picker:
|
||||
logging.info("- Set HidePicker configuration")
|
||||
self.constants.showpicker = False
|
||||
|
||||
if self.args.disable_sip:
|
||||
logging.info("- Set Disable SIP configuration")
|
||||
self.constants.sip_status = False
|
||||
else:
|
||||
self.constants.sip_status = True # Override Defaults detected
|
||||
|
||||
if self.args.disable_smb:
|
||||
logging.info("- Set Disable SecureBootModel configuration")
|
||||
self.constants.secure_status = False
|
||||
else:
|
||||
self.constants.secure_status = True # Override Defaults detected
|
||||
|
||||
if self.args.vault:
|
||||
logging.info("- Set Vault configuration")
|
||||
self.constants.vault = True
|
||||
|
||||
if self.args.firewire:
|
||||
logging.info("- Set FireWire Boot configuration")
|
||||
self.constants.firewire_boot = True
|
||||
|
||||
if self.args.nvme:
|
||||
logging.info("- Set NVMe Boot configuration")
|
||||
self.constants.nvme_boot = True
|
||||
|
||||
if self.args.wlan:
|
||||
logging.info("- Set Wake on WLAN configuration")
|
||||
self.constants.enable_wake_on_wlan = True
|
||||
|
||||
if self.args.disable_tb:
|
||||
logging.info("- Set Disable Thunderbolt configuration")
|
||||
self.constants.disable_tb = True
|
||||
|
||||
if self.args.force_surplus:
|
||||
logging.info("- Forcing SurPlus override configuration")
|
||||
self.constants.force_surplus = True
|
||||
|
||||
if self.args.moderate_smbios:
|
||||
logging.info("- Set Moderate SMBIOS Patching configuration")
|
||||
self.constants.serial_settings = "Moderate"
|
||||
|
||||
if self.args.smbios_spoof:
|
||||
if self.args.smbios_spoof == "Minimal":
|
||||
self.constants.serial_settings = "Minimal"
|
||||
elif self.args.smbios_spoof == "Moderate":
|
||||
self.constants.serial_settings = "Moderate"
|
||||
elif self.args.smbios_spoof == "Advanced":
|
||||
self.constants.serial_settings = "Advanced"
|
||||
else:
|
||||
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings, None).start_patch()
|
||||
elif self.args.unpatch_sys_vol:
|
||||
print("- Set System Volume unpatching")
|
||||
sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings, None).start_unpatch()
|
||||
elif self.args.auto_patch:
|
||||
print("- Set Auto patching")
|
||||
sys_patch_auto.AutomaticSysPatch(settings).start_auto_patch()
|
||||
logging.info(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}")
|
||||
|
||||
if self.args.support_all:
|
||||
logging.info("- Building for natively supported model")
|
||||
self.constants.allow_oc_everywhere = True
|
||||
self.constants.serial_settings = "None"
|
||||
|
||||
build.build_opencore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
|
||||
|
||||
@@ -5,6 +5,8 @@ from resources import constants, device_probe
|
||||
from resources.build import support
|
||||
from data import smbios_data, bluetooth_data
|
||||
|
||||
import logging
|
||||
|
||||
class build_bluetooth:
|
||||
|
||||
def __init__(self, model, versions, config):
|
||||
@@ -24,7 +26,7 @@ class build_bluetooth:
|
||||
|
||||
def on_model(self):
|
||||
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
||||
@@ -34,12 +36,12 @@ class build_bluetooth:
|
||||
# Due to this, BlueToolFixup is required to resolve Firmware Uploading on legacy chipsets
|
||||
if self.computer.wifi:
|
||||
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
elif self.computer.bluetooth_chipset == "3rd Party Bluetooth 4.0 Hub":
|
||||
print("- Detected 3rd Party Bluetooth Chipset")
|
||||
logging.info("- Detected 3rd Party Bluetooth Chipset")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
print("- Enabling Bluetooth FeatureFlags")
|
||||
logging.info("- Enabling Bluetooth FeatureFlags")
|
||||
self.config["Kernel"]["Quirks"]["ExtendBTFeatureFlags"] = True
|
||||
|
||||
|
||||
@@ -50,7 +52,7 @@ class build_bluetooth:
|
||||
return
|
||||
|
||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
logging.info("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value:
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -btlfxallowanyaddr"
|
||||
|
||||
@@ -8,6 +8,7 @@ import shutil
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
import logging
|
||||
|
||||
from resources import constants, utilities
|
||||
from resources.build import bluetooth, firmware, graphics_audio, support, storage, smbios, security, misc
|
||||
@@ -30,9 +31,9 @@ class build_opencore:
|
||||
def build_efi(self):
|
||||
utilities.cls()
|
||||
if not self.constants.custom_model:
|
||||
print(f"Building Configuration on model: {self.model}")
|
||||
logging.info(f"Building Configuration on model: {self.model}")
|
||||
else:
|
||||
print(f"Building Configuration for external model: {self.model}")
|
||||
logging.info(f"Building Configuration for external model: {self.model}")
|
||||
|
||||
self.generate_base()
|
||||
self.set_revision()
|
||||
@@ -54,31 +55,32 @@ class build_opencore:
|
||||
|
||||
# Work-around ocvalidate
|
||||
if self.constants.validate is False:
|
||||
print("- Adding bootmgfw.efi BlessOverride")
|
||||
logging.info("- Adding bootmgfw.efi BlessOverride")
|
||||
self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"]
|
||||
|
||||
|
||||
def generate_base(self):
|
||||
# Generate OpenCore base folder and config
|
||||
if not Path(self.constants.build_path).exists():
|
||||
print("Creating build folder")
|
||||
logging.info("Creating build folder")
|
||||
Path(self.constants.build_path).mkdir()
|
||||
else:
|
||||
print("Build folder already present, skipping")
|
||||
logging.info("Build folder already present, skipping")
|
||||
|
||||
if Path(self.constants.opencore_zip_copied).exists():
|
||||
print("Deleting old copy of OpenCore zip")
|
||||
logging.info("Deleting old copy of OpenCore zip")
|
||||
Path(self.constants.opencore_zip_copied).unlink()
|
||||
if Path(self.constants.opencore_release_folder).exists():
|
||||
print("Deleting old copy of OpenCore folder")
|
||||
logging.info("Deleting old copy of OpenCore folder")
|
||||
shutil.rmtree(self.constants.opencore_release_folder, onerror=rmtree_handler, ignore_errors=True)
|
||||
|
||||
print(f"\n- Adding OpenCore v{self.constants.opencore_version} {self.constants.opencore_build}")
|
||||
logging.info("")
|
||||
logging.info(f"- Adding OpenCore v{self.constants.opencore_version} {self.constants.opencore_build}")
|
||||
shutil.copy(self.constants.opencore_zip_source, self.constants.build_path)
|
||||
zipfile.ZipFile(self.constants.opencore_zip_copied).extractall(self.constants.build_path)
|
||||
|
||||
# Setup config.plist for editing
|
||||
print("- Adding config.plist for OpenCore")
|
||||
logging.info("- Adding config.plist for OpenCore")
|
||||
shutil.copy(self.constants.plist_template, self.constants.oc_folder)
|
||||
self.config = plistlib.load(Path(self.constants.plist_path).open("rb"))
|
||||
|
||||
@@ -115,9 +117,9 @@ class build_opencore:
|
||||
support.build_support(self.model, self.constants, self.config).sign_files()
|
||||
support.build_support(self.model, self.constants, self.config).validate_pathing()
|
||||
|
||||
print("")
|
||||
print(f"Your OpenCore EFI for {self.model} has been built at:")
|
||||
print(f" {self.constants.opencore_release_folder}")
|
||||
print("")
|
||||
logging.info("")
|
||||
logging.info(f"Your OpenCore EFI for {self.model} has been built at:")
|
||||
logging.info(f" {self.constants.opencore_release_folder}")
|
||||
logging.info("")
|
||||
if self.constants.gui_mode is False:
|
||||
input("Press [Enter] to continue\n")
|
||||
|
||||
@@ -5,7 +5,7 @@ from resources import constants, generate_smbios
|
||||
from resources.build import support
|
||||
from data import smbios_data, cpu_data
|
||||
|
||||
import binascii, shutil
|
||||
import binascii, shutil, logging
|
||||
from pathlib import Path
|
||||
|
||||
class build_firmware:
|
||||
@@ -50,7 +50,7 @@ class build_firmware:
|
||||
# This breaks AppleIntelCPUPowerManagement.kext matching as it no longer matches against the correct criteria
|
||||
#
|
||||
# To resolve, we patched AICPUPM to attach regardless of the value of 'intel_cpupm_matching'
|
||||
print("- Enabling legacy power management support")
|
||||
logging.info("- Enabling legacy power management support")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagement.kext", self.constants.aicpupm_version, self.constants.aicpupm_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AppleIntelCPUPowerManagementClient.kext", self.constants.aicpupm_version, self.constants.aicpupm_client_path)
|
||||
|
||||
@@ -60,14 +60,14 @@ class build_firmware:
|
||||
# This causes power management to break on pre-Ivy Bridge CPUs as they don't have correct
|
||||
# power management tables provided.
|
||||
# This patch will simply increase ASPP's 'IOProbeScore' to outmatch X86PP
|
||||
print("- Overriding ACPI SMC matching")
|
||||
logging.info("- Overriding ACPI SMC matching")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("ASPP-Override.kext", self.constants.aspp_override_version, self.constants.aspp_override_path)
|
||||
if self.constants.disable_xcpm is True:
|
||||
# Only inject on older OSes if user requests
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
|
||||
|
||||
if self.constants.disable_msr_power_ctl is True and smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
|
||||
print("- Disabling Firmware Throttling")
|
||||
logging.info("- Disabling Firmware Throttling")
|
||||
# Nehalem and newer systems force firmware throttling via MSR_POWER_CTL
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
|
||||
|
||||
@@ -82,14 +82,14 @@ class build_firmware:
|
||||
# CPBG device in ACPI is a Co-Processor Bridge Device, which is not actually physically present
|
||||
# IOPCIFamily will error when enumerating this device, thus we'll power it off via _STA (has no effect in older OSes)
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem.value and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
|
||||
print("- Adding SSDT-CPBG.aml")
|
||||
logging.info("- Adding SSDT-CPBG.aml")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True
|
||||
shutil.copy(self.constants.pci_ssdt_path, self.constants.acpi_path)
|
||||
|
||||
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value and self.model != "MacPro6,1":
|
||||
# Based on: https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/
|
||||
# Applicable for Sandy and Ivy Bridge Macs
|
||||
print("- Enabling Windows 10 UEFI Audio support")
|
||||
logging.info("- Enabling Windows 10 UEFI Audio support")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-PCI.aml")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True
|
||||
shutil.copy(self.constants.windows_ssdt_path, self.constants.acpi_path)
|
||||
@@ -110,7 +110,7 @@ class build_firmware:
|
||||
# Force Rosetta Cryptex installation in macOS Ventura
|
||||
# Restores support for CPUs lacking AVX2.0 support
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
|
||||
print("- Enabling Rosetta Cryptex support in Ventura")
|
||||
logging.info("- Enabling Rosetta Cryptex support in Ventura")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("CryptexFixup.kext", self.constants.cryptexfixup_version, self.constants.cryptexfixup_path)
|
||||
|
||||
# i3 Ivy Bridge iMacs don't support RDRAND
|
||||
@@ -119,13 +119,13 @@ class build_firmware:
|
||||
(smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value):
|
||||
# Ref: https://github.com/reenigneorcim/SurPlus
|
||||
# Enable for all systems missing RDRAND support
|
||||
print("- Adding SurPlus Patch for Race Condition")
|
||||
logging.info("- Adding SurPlus Patch for Race Condition")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["Enabled"] = True
|
||||
if self.constants.force_surplus is True:
|
||||
# Syncretic forces SurPlus to only run on Beta 7 and older by default for saftey reasons
|
||||
# If users desires, allow forcing in newer OSes
|
||||
print("- Allowing SurPlus on all newer OSes")
|
||||
logging.info("- Allowing SurPlus on all newer OSes")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
|
||||
|
||||
@@ -143,7 +143,7 @@ class build_firmware:
|
||||
|
||||
# HID patches
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
||||
print("- Adding IOHIDFamily patch")
|
||||
logging.info("- Adding IOHIDFamily patch")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
|
||||
|
||||
|
||||
@@ -157,20 +157,20 @@ class build_firmware:
|
||||
# Exfat check
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||
# Sandy Bridge and newer Macs natively support ExFat
|
||||
print("- Adding ExFatDxeLegacy.efi")
|
||||
logging.info("- Adding ExFatDxeLegacy.efi")
|
||||
shutil.copy(self.constants.exfat_legacy_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("ExFatDxeLegacy.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
# NVMe check
|
||||
if self.constants.nvme_boot is True:
|
||||
print("- Enabling NVMe boot support")
|
||||
logging.info("- Enabling NVMe boot support")
|
||||
shutil.copy(self.constants.nvme_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("NvmExpressDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
# USB check
|
||||
if self.constants.xhci_boot is True:
|
||||
print("- Adding USB 3.0 Controller Patch")
|
||||
print("- Adding XhciDxe.efi and UsbBusDxe.efi")
|
||||
logging.info("- Adding USB 3.0 Controller Patch")
|
||||
logging.info("- Adding XhciDxe.efi and UsbBusDxe.efi")
|
||||
shutil.copy(self.constants.xhci_driver_path, self.constants.drivers_path)
|
||||
shutil.copy(self.constants.usb_bus_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("XhciDxe.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
@@ -178,7 +178,7 @@ class build_firmware:
|
||||
|
||||
# PCIe Link Rate check
|
||||
if self.model == "MacPro3,1":
|
||||
print("- Adding PCIe Link Rate Patch")
|
||||
logging.info("- Adding PCIe Link Rate Patch")
|
||||
shutil.copy(self.constants.link_rate_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("FixPCIeLinkRate.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
@@ -193,7 +193,7 @@ class build_firmware:
|
||||
# Waiting for XNU source to be released to fix this properly
|
||||
# Ref: https://forums.macrumors.com/threads/opencore-on-the-mac-pro.2207814/
|
||||
if self.model in ["MacPro6,1", "iMac7,1", "iMac8,1", "MacBookPro4,1"] or self.constants.set_vmm_cpuid is True:
|
||||
print("- Enabling VMM patch")
|
||||
logging.info("- Enabling VMM patch")
|
||||
self.config["Kernel"]["Emulate"]["Cpuid1Data"] = binascii.unhexlify("00000000000000000000008000000000")
|
||||
self.config["Kernel"]["Emulate"]["Cpuid1Mask"] = binascii.unhexlify("00000000000000000000008000000000")
|
||||
self.config["Kernel"]["Emulate"]["MinKernel"] = "22.0.0"
|
||||
@@ -207,17 +207,17 @@ class build_firmware:
|
||||
):
|
||||
# Fix Virtual Machine support for non-macOS OSes
|
||||
# Haswell and Broadwell MacBooks lock out the VMX bit if booting UEFI Windows
|
||||
print("- Enabling VMX Bit for non-macOS OSes")
|
||||
logging.info("- Enabling VMX Bit for non-macOS OSes")
|
||||
self.config["UEFI"]["Quirks"]["EnableVmx"] = True
|
||||
|
||||
# Works-around Hibernation bug where connecting all firmware drivers breaks the transition from S4
|
||||
# Mainly applicable for MacBookPro9,1
|
||||
if self.constants.disable_connectdrivers is True:
|
||||
print("- Disabling ConnectDrivers")
|
||||
logging.info("- Disabling ConnectDrivers")
|
||||
self.config["UEFI"]["ConnectDrivers"] = False
|
||||
|
||||
if self.constants.nvram_write is False:
|
||||
print("- Disabling Hardware NVRAM Write")
|
||||
logging.info("- Disabling Hardware NVRAM Write")
|
||||
self.config["NVRAM"]["WriteFlash"] = False
|
||||
|
||||
if self.constants.serial_settings != "None":
|
||||
@@ -247,7 +247,7 @@ class build_firmware:
|
||||
if "5K Display" not in smbios_data.smbios_dictionary[self.model]:
|
||||
return
|
||||
|
||||
print("- Adding 5K Display Patch")
|
||||
logging.info("- Adding 5K Display Patch")
|
||||
# Set LauncherPath to '/boot.efi'
|
||||
# This is to ensure that only the Mac's firmware presents the boot option, but not OpenCore
|
||||
# https://github.com/acidanthera/OpenCorePkg/blob/0.7.6/Library/OcAppleBootPolicyLib/OcAppleBootPolicyLib.c#L50-L73
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
# Class for handling Graphics and Audio Patches, invocation from build.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
from resources import constants, device_probe, utilities
|
||||
from resources.build import support
|
||||
from data import smbios_data, model_array, os_data
|
||||
import shutil, binascii, logging
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import shutil, binascii
|
||||
from resources import constants, device_probe, utilities
|
||||
from resources.build import support
|
||||
from data import smbios_data, model_array, os_data, cpu_data, video_bios_data
|
||||
|
||||
|
||||
class build_graphics_audio:
|
||||
|
||||
@@ -21,57 +22,59 @@ class build_graphics_audio:
|
||||
|
||||
|
||||
def build(self):
|
||||
self.imac_mxm_patching()
|
||||
self.graphics_handling()
|
||||
self.audio_handling()
|
||||
self.firmware_handling()
|
||||
self.spoof_handling()
|
||||
self.imac_mxm_patching()
|
||||
self.ioaccel_workaround()
|
||||
|
||||
|
||||
def graphics_handling(self):
|
||||
if self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None":
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||
|
||||
# Mac Pro handling
|
||||
if self.model in model_array.MacPro:
|
||||
if not self.constants.custom_model:
|
||||
for i, device in enumerate(self.computer.gpus):
|
||||
print(f"- Found dGPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
|
||||
logging.info(f"- Found dGPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
|
||||
self.config["#Revision"][f"Hardware-MacPro-dGPU-{i + 1}"] = f"{utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}"
|
||||
|
||||
if device.pci_path and device.acpi_path:
|
||||
print(f"- Found dGPU ({i + 1}) at {device.pci_path}")
|
||||
logging.info(f"- Found dGPU ({i + 1}) at {device.pci_path}")
|
||||
if isinstance(device, device_probe.AMD):
|
||||
print("- Adding Mac Pro, Xserve DRM patches")
|
||||
logging.info("- Adding Mac Pro, Xserve DRM patches")
|
||||
self.config["DeviceProperties"]["Add"][device.pci_path] = {"shikigva": 128, "unfairgva": 1, "rebuild-device-tree": 1, "agdpmod": "pikera", "enable-gva-support": 1}
|
||||
elif isinstance(device, device_probe.NVIDIA):
|
||||
print("- Enabling Nvidia Output Patch")
|
||||
logging.info("- Enabling Nvidia Output Patch")
|
||||
self.config["DeviceProperties"]["Add"][device.pci_path] = {"rebuild-device-tree": 1, "agdpmod": "vit9696"}
|
||||
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
|
||||
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
|
||||
|
||||
else:
|
||||
print(f"- Failed to find Device path for dGPU {i + 1}")
|
||||
logging.info(f"- Failed to find Device path for dGPU {i + 1}")
|
||||
if isinstance(device, device_probe.AMD):
|
||||
print("- Adding Mac Pro, Xserve DRM patches")
|
||||
logging.info("- Adding Mac Pro, Xserve DRM patches")
|
||||
if "shikigva=128 unfairgva=1" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
|
||||
print("- Falling back to boot-args")
|
||||
logging.info("- Falling back to boot-args")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 agdpmod=pikera radgva=1" + (
|
||||
" -wegtree" if "-wegtree" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] else ""
|
||||
)
|
||||
elif isinstance(device, device_probe.NVIDIA):
|
||||
print("- Enabling Nvidia Output Patch")
|
||||
logging.info("- Enabling Nvidia Output Patch")
|
||||
if "-wegtree agdpmod=vit9696" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
|
||||
print("- Falling back to boot-args")
|
||||
logging.info("- Falling back to boot-args")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -wegtree agdpmod=vit9696"
|
||||
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
|
||||
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
|
||||
|
||||
if not self.computer.gpus:
|
||||
print("- No socketed dGPU found")
|
||||
logging.info("- No socketed dGPU found")
|
||||
|
||||
else:
|
||||
print("- Adding Mac Pro, Xserve DRM patches")
|
||||
logging.info("- Adding Mac Pro, Xserve DRM patches")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree"
|
||||
|
||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||
@@ -85,7 +88,7 @@ class build_graphics_audio:
|
||||
device.arch in [device_probe.NVIDIA.Archs.Fermi, device_probe.NVIDIA.Archs.Maxwell, device_probe.NVIDIA.Archs.Pascal] or
|
||||
(self.constants.force_nv_web is True and device.arch in [device_probe.NVIDIA.Archs.Tesla, device_probe.NVIDIA.Archs.Kepler])
|
||||
):
|
||||
print(f"- Enabling Web Driver Patches for GPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
|
||||
logging.info(f"- Enabling Web Driver Patches for GPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
|
||||
if device.pci_path and device.acpi_path:
|
||||
if device.pci_path in self.config["DeviceProperties"]["Add"]:
|
||||
self.config["DeviceProperties"]["Add"][device.pci_path].update({"disable-metal": 1, "force-compat": 1})
|
||||
@@ -103,14 +106,36 @@ class build_graphics_audio:
|
||||
if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]:
|
||||
self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"]
|
||||
|
||||
|
||||
def backlight_path_detection(self):
|
||||
|
||||
# self.constants.custom_model: iMac has been modded with new dGPU
|
||||
# self.computer.dgpu: dGPU has been found using the GFX0 path
|
||||
# self.computer.dgpu.pci_path:
|
||||
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
|
||||
self.gfx0_path = self.computer.dgpu.pci_path
|
||||
print(f"- Found GFX0 Device Path: {self.gfx0_path}")
|
||||
for i, device in enumerate(self.computer.gpus):
|
||||
logging.info(f"- Found dGPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}")
|
||||
self.config["#Revision"][f"Hardware-iMac-dGPU-{i + 1}"] = f"{utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}"
|
||||
|
||||
if device.pci_path != self.computer.dgpu.pci_path:
|
||||
logging.info("- device path and GFX0 Device path are different")
|
||||
self.gfx0_path = device.pci_path
|
||||
logging.info(f"- Set GFX0 Device Path: {self.gfx0_path}")
|
||||
self.computer.dgpu.device_id = device.device_id
|
||||
self.device_id = device.device_id
|
||||
logging.info(f"- Found GPU Arch: {device.arch}")
|
||||
if device.arch in [device_probe.AMD.Archs.Navi]:
|
||||
self.computer.dgpu.arch = device.arch
|
||||
|
||||
# self.computer.dgpu.vendor_id = device.vendor_id
|
||||
# self.vendor_id = device.vendor_id
|
||||
else:
|
||||
self.gfx0_path = self.computer.dgpu.pci_path
|
||||
logging.info(f"- Found GFX0 Device Path: {self.gfx0_path}")
|
||||
logging.info(f"- Found GPU Arch: {self.computer.dgpu.arch}")
|
||||
|
||||
else:
|
||||
if not self.constants.custom_model:
|
||||
print("- Failed to find GFX0 Device path, falling back on known logic")
|
||||
logging.info("- Failed to find GFX0 Device path, falling back on known logic")
|
||||
if self.model in ["iMac11,1", "iMac11,3"]:
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"
|
||||
elif self.model == "iMac10,1":
|
||||
@@ -122,9 +147,9 @@ class build_graphics_audio:
|
||||
def nvidia_mxm_patch(self, backlight_path):
|
||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||
# Ensure WEG is enabled as we need if for Backlight patching
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
||||
if self.model in ["iMac11,1", "iMac11,2", "iMac11,3", "iMac10,1"]:
|
||||
print("- Adding Nvidia Brightness Control and DRM patches")
|
||||
logging.info("- Adding Nvidia Brightness Control and DRM patches")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {
|
||||
"applbkl": binascii.unhexlify("01000000"),
|
||||
"@0,backlight-control": binascii.unhexlify("01000000"),
|
||||
@@ -143,7 +168,7 @@ class build_graphics_audio:
|
||||
"agdpmod": "vit9696",
|
||||
}
|
||||
elif self.model in ["iMac12,1", "iMac12,2"]:
|
||||
print("- Adding Nvidia Brightness Control and DRM patches")
|
||||
logging.info("- Adding Nvidia Brightness Control and DRM patches")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {
|
||||
"applbkl": binascii.unhexlify("01000000"),
|
||||
"@0,backlight-control": binascii.unhexlify("01000000"),
|
||||
@@ -151,10 +176,9 @@ class build_graphics_audio:
|
||||
"shikigva": 256,
|
||||
"agdpmod": "vit9696",
|
||||
}
|
||||
print("- Disabling unsupported iGPU")
|
||||
logging.info("- Disabling unsupported iGPU")
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
|
||||
"name": binascii.unhexlify("23646973706C6179"),
|
||||
"IOName": "#display",
|
||||
"class-code": binascii.unhexlify("FFFFFFFF"),
|
||||
}
|
||||
shutil.copy(self.constants.backlight_injector_path, self.constants.kexts_path)
|
||||
@@ -164,27 +188,40 @@ class build_graphics_audio:
|
||||
|
||||
|
||||
def amd_mxm_patch(self, backlight_path):
|
||||
print("- Adding AMD DRM patches")
|
||||
logging.info("- Adding AMD DRM patches")
|
||||
if not support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True:
|
||||
# Ensure WEG is enabled as we need if for Backlight patching
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path)
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1}
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_navi_version, self.constants.whatevergreen_navi_path)
|
||||
|
||||
if not self.constants.custom_model:
|
||||
if self.computer.dgpu.device_id == 0x7340:
|
||||
logging.info(f"- Adding AMD RX5500XT vBIOS injection")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K) }
|
||||
logging.info(f"- Adding AMD RX5500XT boot-args")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"
|
||||
elif self.computer.dgpu.device_id_unspoofed == 0x6981:
|
||||
logging.info(f"- Adding AMD WX3200 device spoofing")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "model": "AMD Radeon Pro WX 3200", "device-id": binascii.unhexlify("FF67")}
|
||||
else:
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1}
|
||||
else:
|
||||
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1}
|
||||
|
||||
if self.constants.custom_model and self.model == "iMac11,2":
|
||||
# iMac11,2 can have either PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0) or PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)
|
||||
# Set both properties when we cannot run hardware detection
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1}
|
||||
if self.model in ["iMac12,1", "iMac12,2"]:
|
||||
print("- Disabling unsupported iGPU")
|
||||
logging.info("- Disabling unsupported iGPU")
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
|
||||
"name": binascii.unhexlify("23646973706C6179"),
|
||||
"IOName": "#display",
|
||||
"class-code": binascii.unhexlify("FFFFFFFF"),
|
||||
}
|
||||
elif self.model == "iMac10,1":
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path)
|
||||
if self.computer and self.computer.dgpu:
|
||||
if self.computer.dgpu.arch == device_probe.AMD.Archs.Legacy_GCN_7000:
|
||||
print("- Adding Legacy GCN Power Gate Patches")
|
||||
logging.info("- Adding Legacy GCN Power Gate Patches")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path].update({
|
||||
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
|
||||
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
|
||||
@@ -192,7 +229,7 @@ class build_graphics_audio:
|
||||
"CAIL,CAIL_DisableVCEPowerGating": 1,
|
||||
})
|
||||
if self.constants.imac_model == "Legacy GCN":
|
||||
print("- Adding Legacy GCN Power Gate Patches")
|
||||
logging.info("- Adding Legacy GCN Power Gate Patches")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path].update({
|
||||
"CAIL,CAIL_DisableDrmdmaPowerGating": 1,
|
||||
"CAIL,CAIL_DisableGfxCGPowerGating": 1,
|
||||
@@ -206,7 +243,27 @@ class build_graphics_audio:
|
||||
"CAIL,CAIL_DisableUVDPowerGating": 1,
|
||||
"CAIL,CAIL_DisableVCEPowerGating": 1,
|
||||
})
|
||||
|
||||
elif self.constants.imac_model == "AMD Lexa":
|
||||
logging.info("- Adding Lexa Spoofing Patches")
|
||||
self.config["DeviceProperties"]["Add"][backlight_path].update({
|
||||
"model": "AMD Radeon Pro WX 3200",
|
||||
"device-id": binascii.unhexlify("FF67"),
|
||||
})
|
||||
if self.model == "iMac11,2":
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)"].update({
|
||||
"model": "AMD Radeon Pro WX 3200",
|
||||
"device-id": binascii.unhexlify("FF67"),
|
||||
})
|
||||
elif self.constants.imac_model == "AMD Navi":
|
||||
logging.info("- Adding Navi Spoofing Patches")
|
||||
navi_backlight_path = backlight_path+"/Pci(0x0,0x0)/Pci(0x0,0x0)"
|
||||
self.config["DeviceProperties"]["Add"][navi_backlight_path] = {
|
||||
"ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K),
|
||||
"shikigva": 128,
|
||||
"unfairgva": 1,
|
||||
"rebuild-device-tree": 1,
|
||||
"enable-gva-support": 1
|
||||
}
|
||||
|
||||
def audio_handling(self):
|
||||
if (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True:
|
||||
@@ -248,12 +305,12 @@ class build_graphics_audio:
|
||||
def firmware_handling(self):
|
||||
# Add UGA to GOP layer
|
||||
if "UGA Graphics" in smbios_data.smbios_dictionary[self.model]:
|
||||
print("- Adding UGA to GOP Patch")
|
||||
logging.info("- Adding UGA to GOP Patch")
|
||||
self.config["UEFI"]["Output"]["GopPassThrough"] = "Apple"
|
||||
|
||||
# GMUX handling
|
||||
if self.constants.software_demux is True and self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||
print("- Enabling software demux")
|
||||
logging.info("- Enabling software demux")
|
||||
# Add ACPI patches
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-DGPU.aml")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "_INI to XINI")["Enabled"] = True
|
||||
@@ -271,28 +328,35 @@ class build_graphics_audio:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AMDGPUWakeHandler.kext", self.constants.gpu_wake_version, self.constants.gpu_wake_path)
|
||||
|
||||
if self.constants.dGPU_switch is True and "Switchable GPUs" in smbios_data.smbios_dictionary[self.model]:
|
||||
print("- Allowing GMUX switching in Windows")
|
||||
logging.info("- Allowing GMUX switching in Windows")
|
||||
self.config["Booter"]["Quirks"]["SignalAppleOS"] = True
|
||||
|
||||
# Force Output support PC VBIOS on Mac Pros
|
||||
if self.constants.force_output_support is True:
|
||||
print("- Forcing GOP Support")
|
||||
logging.info("- Forcing GOP Support")
|
||||
self.config["UEFI"]["Quirks"]["ForgeUefiSupport"] = True
|
||||
self.config["UEFI"]["Quirks"]["ReloadOptionRoms"] = True
|
||||
|
||||
# AMD GOP VBIOS injection for AMD GCN 1-4 GPUs
|
||||
if self.constants.gop_injection is True:
|
||||
print("- Adding AMDGOP.efi")
|
||||
if self.constants.amd_gop_injection is True:
|
||||
logging.info("- Adding AMDGOP.efi")
|
||||
shutil.copy(self.constants.amd_gop_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("AMDGOP.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
# Nvidia Kepler GOP VBIOS injection
|
||||
if self.constants.nvidia_kepler_gop_injection is True:
|
||||
logging.info("- Adding NVGOP_GK.efi")
|
||||
shutil.copy(self.constants.nvidia_kepler_gop_driver_path, self.constants.drivers_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("NVGOP_GK.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
|
||||
def spoof_handling(self):
|
||||
if self.constants.serial_settings == "None":
|
||||
return
|
||||
|
||||
# AppleMuxControl Override
|
||||
if self.model == "MacBookPro9,1":
|
||||
print("- Adding AppleMuxControl Override")
|
||||
logging.info("- Adding AppleMuxControl Override")
|
||||
amc_map_path = Path(self.constants.plist_folder_path) / Path("AppleMuxControl/Info.plist")
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
|
||||
Path(self.constants.amc_kext_folder).mkdir()
|
||||
@@ -301,7 +365,7 @@ class build_graphics_audio:
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AMC-Override.kext")["Enabled"] = True
|
||||
|
||||
if self.model not in model_array.NoAGPMSupport:
|
||||
print("- Adding AppleGraphicsPowerManagement Override")
|
||||
logging.info("- Adding AppleGraphicsPowerManagement Override")
|
||||
agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist")
|
||||
Path(self.constants.agpm_kext_folder).mkdir()
|
||||
Path(self.constants.agpm_contents_folder).mkdir()
|
||||
@@ -309,7 +373,7 @@ class build_graphics_audio:
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
|
||||
|
||||
if self.model in model_array.AGDPSupport:
|
||||
print("- Adding AppleGraphicsDevicePolicy Override")
|
||||
logging.info("- Adding AppleGraphicsDevicePolicy Override")
|
||||
agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist")
|
||||
Path(self.constants.agdp_kext_folder).mkdir()
|
||||
Path(self.constants.agdp_contents_folder).mkdir()
|
||||
@@ -318,17 +382,17 @@ class build_graphics_audio:
|
||||
|
||||
# AGPM Patch
|
||||
if self.model in model_array.DualGPUPatch:
|
||||
print("- Adding dual GPU patch")
|
||||
logging.info("- Adding dual GPU patch")
|
||||
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
|
||||
self.gfx0_path = self.computer.dgpu.pci_path
|
||||
print(f"- Found GFX0 Device Path: {self.gfx0_path}")
|
||||
logging.info(f"- Found GFX0 Device Path: {self.gfx0_path}")
|
||||
else:
|
||||
if not self.constants.custom_model:
|
||||
print("- Failed to find GFX0 Device path, falling back on known logic")
|
||||
logging.info("- Failed to find GFX0 Device path, falling back on known logic")
|
||||
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
|
||||
|
||||
if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True:
|
||||
print("- Prioritizing DRM support over Intel QuickSync")
|
||||
logging.info("- Prioritizing DRM support over Intel QuickSync")
|
||||
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256}
|
||||
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
|
||||
"name": binascii.unhexlify("23646973706C6179"),
|
||||
@@ -336,7 +400,8 @@ class build_graphics_audio:
|
||||
"class-code": binascii.unhexlify("FFFFFFFF"),
|
||||
}
|
||||
elif self.constants.serial_settings != "None":
|
||||
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
|
||||
if self.gfx0_path not in self.config["DeviceProperties"]["Add"] or "agdpmod" not in self.config["DeviceProperties"]["Add"][self.gfx0_path]:
|
||||
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696"}
|
||||
|
||||
if self.model.startswith("iMac14,1"):
|
||||
# Ensure that agdpmod is applied to iMac14,x with iGPU only
|
||||
@@ -344,28 +409,111 @@ class build_graphics_audio:
|
||||
|
||||
|
||||
def imac_mxm_patching(self):
|
||||
self.backlight_path_detection()
|
||||
# Check GPU Vendor
|
||||
if self.constants.metal_build is True:
|
||||
self.backlight_path_detection()
|
||||
print("- Adding Metal GPU patches on request")
|
||||
logging.info("- Adding Metal GPU patches on request")
|
||||
if self.constants.imac_vendor == "AMD":
|
||||
self.amd_mxm_patch(self.gfx0_path)
|
||||
elif self.constants.imac_vendor == "Nvidia":
|
||||
self.nvidia_mxm_patch(self.gfx0_path)
|
||||
else:
|
||||
print("- Failed to find vendor")
|
||||
logging.info("- Failed to find vendor")
|
||||
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
|
||||
print(f"- Detected dGPU: {utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
|
||||
logging.info(f"- Detected dGPU: {utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
|
||||
if self.computer.dgpu.arch in [
|
||||
device_probe.AMD.Archs.Legacy_GCN_7000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_8000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_9000,
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
self.backlight_path_detection()
|
||||
self.amd_mxm_patch(self.gfx0_path)
|
||||
elif self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
|
||||
self.backlight_path_detection()
|
||||
self.nvidia_mxm_patch(self.gfx0_path)
|
||||
self.nvidia_mxm_patch(self.gfx0_path)
|
||||
|
||||
def ioaccel_workaround(self):
|
||||
# Handle misc IOAccelerator issues
|
||||
|
||||
# When MTL bundles are missing from disk, WindowServer will repeatedly crash
|
||||
# This primarily occurs when installing an RSR update, where root is cleaned but AuxKC is not
|
||||
gpu_dict = []
|
||||
if not self.constants.custom_model:
|
||||
gpu_dict = self.constants.computer.gpus
|
||||
else:
|
||||
if not self.model in smbios_data.smbios_dictionary:
|
||||
return
|
||||
gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"]
|
||||
|
||||
# Check if KDKless and KDK GPUs are present
|
||||
# We only want KDKless.kext if there are no KDK GPUs
|
||||
has_kdkless_gpu = False
|
||||
has_kdk_gpu = False
|
||||
for gpu in gpu_dict:
|
||||
if not self.constants.custom_model:
|
||||
gpu = gpu.arch
|
||||
if gpu in [
|
||||
device_probe.Intel.Archs.Ivy_Bridge,
|
||||
device_probe.Intel.Archs.Haswell,
|
||||
device_probe.Intel.Archs.Broadwell,
|
||||
device_probe.Intel.Archs.Skylake,
|
||||
device_probe.NVIDIA.Archs.Kepler,
|
||||
]:
|
||||
has_kdkless_gpu = True
|
||||
|
||||
# Non-Metal KDK
|
||||
if gpu in [
|
||||
device_probe.NVIDIA.Archs.Tesla,
|
||||
device_probe.NVIDIA.Archs.Maxwell,
|
||||
device_probe.NVIDIA.Archs.Pascal,
|
||||
device_probe.AMD.Archs.TeraScale_1,
|
||||
device_probe.AMD.Archs.TeraScale_2,
|
||||
device_probe.Intel.Archs.Iron_Lake,
|
||||
device_probe.Intel.Archs.Sandy_Bridge,
|
||||
]:
|
||||
has_kdk_gpu = True
|
||||
|
||||
if gpu in [
|
||||
# Metal KDK (always)
|
||||
device_probe.AMD.Archs.Legacy_GCN_7000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_8000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_9000,
|
||||
]:
|
||||
has_kdk_gpu = True
|
||||
|
||||
if gpu in [
|
||||
# Metal KDK (pre-AVX2.0)
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
if (
|
||||
self.model == "MacBookPro13,3" or
|
||||
smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value
|
||||
):
|
||||
# MacBookPro13,3 has AVX2.0 however the GPU has an unsupported framebuffer
|
||||
has_kdk_gpu = True
|
||||
|
||||
if has_kdkless_gpu is True and has_kdk_gpu is False:
|
||||
# KDKlessWorkaround is required for KDKless GPUs
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
||||
return
|
||||
|
||||
# KDKlessWorkaround supports disabling native AMD stack on Ventura for pre-AVX2.0 CPUs
|
||||
# Applicable for Polaris, Vega, Navi GPUs
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] > cpu_data.cpu_data.ivy_bridge.value:
|
||||
return
|
||||
for gpu in gpu_dict:
|
||||
if not self.constants.custom_model:
|
||||
gpu = gpu.arch
|
||||
if gpu in [
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
||||
return
|
||||
|
||||
@@ -5,7 +5,7 @@ from resources import constants, device_probe, generate_smbios, utilities
|
||||
from resources.build import support
|
||||
from data import model_array, smbios_data, cpu_data
|
||||
|
||||
import binascii, shutil
|
||||
import binascii, shutil, logging
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -33,13 +33,12 @@ class build_misc:
|
||||
self.debug_handling()
|
||||
self.cpu_friend_handling()
|
||||
self.general_oc_handling()
|
||||
self.aux_kc_workaround()
|
||||
|
||||
def feature_unlock_handling(self):
|
||||
if self.constants.fu_status is True:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
|
||||
if self.constants.fu_arguments is not None:
|
||||
print(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
|
||||
logging.info(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
|
||||
|
||||
def restrict_events_handling(self):
|
||||
@@ -50,7 +49,7 @@ class build_misc:
|
||||
if self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1", "MacBookPro10,1"]:
|
||||
block_args += "gmux,"
|
||||
if self.model in model_array.MacPro:
|
||||
print("- Disabling memory error reporting")
|
||||
logging.info("- Disabling memory error reporting")
|
||||
block_args += "pcie,"
|
||||
gpu_dict = []
|
||||
if not self.constants.custom_model:
|
||||
@@ -66,20 +65,20 @@ class build_misc:
|
||||
device_probe.Intel.Archs.Haswell,
|
||||
device_probe.NVIDIA.Archs.Kepler,
|
||||
]:
|
||||
print("- Disabling mediaanalysisd")
|
||||
logging.info("- Disabling mediaanalysisd")
|
||||
block_args += "media,"
|
||||
break
|
||||
if block_args.endswith(","):
|
||||
block_args = block_args[:-1]
|
||||
|
||||
if block_args != "":
|
||||
print(f"- Setting RestrictEvents block arguments: {block_args}")
|
||||
logging.info(f"- Setting RestrictEvents block arguments: {block_args}")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revblock"] = block_args
|
||||
|
||||
patch_args = ""
|
||||
if support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True and self.constants.set_content_caching is True:
|
||||
print("- Fixing Content Caching support")
|
||||
logging.info("- Fixing Content Caching support")
|
||||
patch_args += "asset,"
|
||||
|
||||
if patch_args.endswith(","):
|
||||
@@ -90,17 +89,17 @@ class build_misc:
|
||||
patch_args = "none"
|
||||
|
||||
if patch_args != "":
|
||||
print(f"- Setting RestrictEvents patch arguments: {patch_args}")
|
||||
logging.info(f"- Setting RestrictEvents patch arguments: {patch_args}")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revpatch"] = patch_args
|
||||
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpu"] = self.constants.custom_cpu_model
|
||||
if self.constants.custom_cpu_model_value != "":
|
||||
print(f"- Adding custom CPU Name: {self.constants.custom_cpu_model_value}")
|
||||
logging.info(f"- Adding custom CPU Name: {self.constants.custom_cpu_model_value}")
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpuname"] = self.constants.custom_cpu_model_value
|
||||
else:
|
||||
print("- Adding CPU Name Patch")
|
||||
logging.info("- Adding CPU Name Patch")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
|
||||
|
||||
if support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
|
||||
@@ -126,7 +125,7 @@ class build_misc:
|
||||
if self.constants.firewire_boot is True and generate_smbios.check_firewire(self.model) is True:
|
||||
# Enable FireWire Boot Support
|
||||
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
|
||||
print("- Enabling FireWire Boot Support")
|
||||
logging.info("- Enabling FireWire Boot Support")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireFamily.kext", self.constants.fw_kext, self.constants.fw_family_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
|
||||
@@ -149,7 +148,7 @@ class build_misc:
|
||||
|
||||
def thunderbolt_handling(self):
|
||||
if self.constants.disable_tb is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
|
||||
print("- Disabling 2013-2014 laptop Thunderbolt Controller")
|
||||
logging.info("- Disabling 2013-2014 laptop Thunderbolt Controller")
|
||||
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
|
||||
# 15" dGPU models: IOACPIPlane:/_SB/PCI0@0/PEG1@10001/UPSB@0/DSB0@0/NHI0@0
|
||||
tb_device_path = "PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"
|
||||
@@ -176,7 +175,7 @@ class build_misc:
|
||||
(self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura)
|
||||
or self.constants.serial_settings in ["Moderate", "Advanced"])
|
||||
):
|
||||
print("- Adding USB-Map.kext")
|
||||
logging.info("- Adding USB-Map.kext")
|
||||
Path(self.constants.map_kext_folder).mkdir()
|
||||
Path(self.constants.map_contents_folder).mkdir()
|
||||
shutil.copy(usb_map_path, self.constants.map_contents_folder)
|
||||
@@ -184,16 +183,35 @@ class build_misc:
|
||||
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"
|
||||
|
||||
# Add UHCI/OHCI drivers
|
||||
# All Penryn Macs lack an internal USB hub to route USB 1.1 devices to the EHCI controller
|
||||
# And MacPro4,1 and MacPro5,1 are the only post-Penryn Macs that lack an internal USB hub
|
||||
# - Ref: https://techcommunity.microsoft.com/t5/microsoft-usb-blog/reasons-to-avoid-companion-controllers/ba-p/270710
|
||||
#
|
||||
# Required downgrades:
|
||||
# - IOUSBHostFamily.kext (only kext itself, not plugins)
|
||||
# - AppleUSBHub.kext
|
||||
# - AppleUSBEHCI.kext
|
||||
if (
|
||||
smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value or \
|
||||
self.model in ["MacPro4,1", "MacPro5,1"]
|
||||
):
|
||||
logging.info("- Adding UHCI/OHCI USB support")
|
||||
shutil.copy(self.constants.apple_usb_11_injector_path, self.constants.kexts_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCI.kext")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCIPCI.kext")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCI.kext")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBUHCIPCI.kext")["Enabled"] = True
|
||||
|
||||
def debug_handling(self):
|
||||
# DEBUG Settings (OpenCorePkg and Kernel Space)
|
||||
|
||||
if self.constants.verbose_debug is True:
|
||||
print("- Enabling Verbose boot")
|
||||
logging.info("- Enabling Verbose boot")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -v"
|
||||
|
||||
if self.constants.kext_debug is True:
|
||||
print("- Enabling DEBUG Kexts")
|
||||
logging.info("- Enabling DEBUG Kexts")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -liludbgall liludump=90"
|
||||
# Disabled due to macOS Monterey crashing shortly after kernel init
|
||||
# Use DebugEnhancer.kext instead
|
||||
@@ -201,7 +219,7 @@ class build_misc:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path)
|
||||
|
||||
if self.constants.opencore_debug is True:
|
||||
print("- Enabling DEBUG OpenCore")
|
||||
logging.info("- Enabling DEBUG OpenCore")
|
||||
self.config["Misc"]["Debug"]["Target"] = 0x43
|
||||
self.config["Misc"]["Debug"]["DisplayLevel"] = 0x80000042
|
||||
|
||||
@@ -209,7 +227,7 @@ class build_misc:
|
||||
# OpenCorePkg Settings
|
||||
|
||||
# OpenCanopy Settings (GUI)
|
||||
print("- Adding OpenCanopy GUI")
|
||||
logging.info("- Adding OpenCanopy GUI")
|
||||
shutil.rmtree(self.constants.resources_path, onerror=self.rmtree_handler)
|
||||
shutil.copy(self.constants.gui_path, self.constants.oc_folder)
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenCanopy.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
@@ -218,34 +236,14 @@ class build_misc:
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("ResetNvramEntry.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
|
||||
if self.constants.showpicker is False:
|
||||
print("- Hiding OpenCore picker")
|
||||
logging.info("- Hiding OpenCore picker")
|
||||
self.config["Misc"]["Boot"]["ShowPicker"] = False
|
||||
|
||||
if self.constants.oc_timeout != 5:
|
||||
print(f"- Setting custom OpenCore picker timeout to {self.constants.oc_timeout} seconds")
|
||||
logging.info(f"- Setting custom OpenCore picker timeout to {self.constants.oc_timeout} seconds")
|
||||
self.config["Misc"]["Boot"]["Timeout"] = self.constants.oc_timeout
|
||||
|
||||
if self.constants.vault is True and utilities.check_command_line_tools() is True:
|
||||
print("- Setting Vault configuration")
|
||||
logging.info("- Setting Vault configuration")
|
||||
self.config["Misc"]["Security"]["Vault"] = "Secure"
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
|
||||
|
||||
def aux_kc_workaround(self):
|
||||
gpu_dict = []
|
||||
if not self.constants.custom_model:
|
||||
gpu_dict = self.constants.computer.gpus
|
||||
else:
|
||||
if self.model in smbios_data.smbios_dictionary:
|
||||
gpu_dict = smbios_data.smbios_dictionary[self.model]["Stock GPUs"]
|
||||
for gpu in gpu_dict:
|
||||
if not self.constants.custom_model:
|
||||
gpu = gpu.arch
|
||||
if gpu in [
|
||||
device_probe.Intel.Archs.Ivy_Bridge,
|
||||
device_probe.Intel.Archs.Haswell,
|
||||
device_probe.Intel.Archs.Broadwell,
|
||||
device_probe.Intel.Archs.Skylake,
|
||||
device_probe.NVIDIA.Archs.Kepler,
|
||||
]:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("KDKlessWorkaround.kext", self.constants.kdkless_version, self.constants.kdkless_path)
|
||||
break
|
||||
support.build_support(self.model, self.constants, self.config).get_efi_binary_by_path("OpenShell.efi", "Misc", "Tools")["Enabled"] = False
|
||||
@@ -5,6 +5,8 @@ from resources import constants, device_probe, utilities
|
||||
from resources.build import support
|
||||
from data import smbios_data
|
||||
|
||||
import logging
|
||||
|
||||
class build_wireless:
|
||||
|
||||
def __init__(self, model, versions, config):
|
||||
@@ -24,22 +26,22 @@ class build_wireless:
|
||||
|
||||
|
||||
def on_model(self):
|
||||
print(f"- Found Wireless Device {utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}")
|
||||
logging.info(f"- Found Wireless Device {utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}")
|
||||
self.config["#Revision"]["Hardware-Wifi"] = f"{utilities.friendly_hex(self.computer.wifi.vendor_id)}:{utilities.friendly_hex(self.computer.wifi.device_id)}"
|
||||
|
||||
if isinstance(self.computer.wifi, device_probe.Broadcom):
|
||||
# This works around OCLP spoofing the Wifi card and therefore unable to actually detect the correct device
|
||||
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AirportBrcmFixup.kext", self.constants.airportbcrmfixup_version, self.constants.airportbcrmfixup_path)
|
||||
print(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
||||
logging.info(f"- Setting Wireless Card's Country Code: {self.computer.wifi.country_code}")
|
||||
if self.computer.wifi.pci_path:
|
||||
arpt_path = self.computer.wifi.pci_path
|
||||
print(f"- Found ARPT device at {arpt_path}")
|
||||
logging.info(f"- Found ARPT device at {arpt_path}")
|
||||
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.country_code}
|
||||
else:
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" brcmfx-country={self.computer.wifi.country_code}"
|
||||
if self.constants.enable_wake_on_wlan is True:
|
||||
print("- Enabling Wake on WLAN support")
|
||||
logging.info("- Enabling Wake on WLAN support")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
||||
elif self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||
self.wifi_fake_id()
|
||||
@@ -63,20 +65,20 @@ class build_wireless:
|
||||
if not "Wireless Model" in smbios_data.smbios_dictionary[self.model]:
|
||||
return
|
||||
if smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4360:
|
||||
print("- Enabling BCM943224 and BCM94331 Networking Support")
|
||||
logging.info("- Enabling BCM943224 and BCM94331 Networking Support")
|
||||
self.wifi_fake_id()
|
||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm4331:
|
||||
print("- Enabling BCM94328 Networking Support")
|
||||
logging.info("- Enabling BCM94328 Networking Support")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True
|
||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Broadcom.Chipsets.AirPortBrcm43224:
|
||||
print("- Enabling BCM94328 Networking Support")
|
||||
logging.info("- Enabling BCM94328 Networking Support")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AppleAirPortBrcm43224.kext")["Enabled"] = True
|
||||
elif smbios_data.smbios_dictionary[self.model]["Wireless Model"] == device_probe.Atheros.Chipsets.AirPortAtheros40:
|
||||
print("- Enabling Atheros Networking Support")
|
||||
logging.info("- Enabling Atheros Networking Support")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("corecaptureElCap.kext", self.constants.corecaptureelcap_version, self.constants.corecaptureelcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("IO80211ElCap.kext", self.constants.io80211elcap_version, self.constants.io80211elcap_path)
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("IO80211ElCap.kext/Contents/PlugIns/AirPortAtheros40.kext")["Enabled"] = True
|
||||
@@ -92,7 +94,7 @@ class build_wireless:
|
||||
if support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext")["Enabled"] is False:
|
||||
return
|
||||
|
||||
print("- Enabling Wake on WLAN support")
|
||||
logging.info("- Enabling Wake on WLAN support")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += f" -brcmfxwowl"
|
||||
|
||||
|
||||
@@ -103,10 +105,10 @@ class build_wireless:
|
||||
support.build_support(self.model, self.constants, self.config).get_kext_by_bundle_path("AirportBrcmFixup.kext/Contents/PlugIns/AirPortBrcmNIC_Injector.kext")["Enabled"] = True
|
||||
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.pci_path:
|
||||
arpt_path = self.computer.wifi.pci_path
|
||||
print(f"- Found ARPT device at {arpt_path}")
|
||||
logging.info(f"- Found ARPT device at {arpt_path}")
|
||||
else:
|
||||
if not self.model in smbios_data.smbios_dictionary:
|
||||
print("No known PCI pathing for this model")
|
||||
logging.info("No known PCI pathing for this model")
|
||||
return
|
||||
if "nForce Chipset" in smbios_data.smbios_dictionary[self.model]:
|
||||
# Nvidia chipsets all have the same path to ARPT
|
||||
@@ -122,8 +124,8 @@ class build_wireless:
|
||||
# Assumes we have a laptop with Intel chipset
|
||||
# iMac11,x-12,x also apply
|
||||
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
|
||||
print(f"- Using known ARPT Path: {arpt_path}")
|
||||
logging.info(f"- Using known ARPT Path: {arpt_path}")
|
||||
|
||||
if not self.constants.custom_model and self.computer.wifi and self.constants.validate is False and self.computer.wifi.country_code:
|
||||
print(f"- Applying fake ID for WiFi, setting Country Code: {self.computer.wifi.country_code}")
|
||||
logging.info(f"- Applying fake ID for WiFi, setting Country Code: {self.computer.wifi.country_code}")
|
||||
self.config["DeviceProperties"]["Add"][arpt_path] = {"brcmfx-country": self.computer.wifi.country_code}
|
||||
@@ -5,6 +5,7 @@ from resources import constants, utilities
|
||||
from resources.build import support
|
||||
|
||||
import binascii
|
||||
import logging
|
||||
|
||||
|
||||
class build_security:
|
||||
@@ -20,45 +21,53 @@ class build_security:
|
||||
if self.constants.sip_status is False or self.constants.custom_sip_value:
|
||||
# Work-around 12.3 bug where Electron apps no longer launch with SIP lowered
|
||||
# Unknown whether this is intended behavior or not, revisit with 12.4
|
||||
print("- Adding ipc_control_port_options=0 to boot-args")
|
||||
logging.info("- Adding ipc_control_port_options=0 to boot-args")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " ipc_control_port_options=0"
|
||||
# Adds AutoPkgInstaller for Automatic OpenCore-Patcher installation
|
||||
# Only install if running the GUI (AutoPkg-Assets.pkg requires the GUI)
|
||||
if self.constants.wxpython_variant is True:
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("AutoPkgInstaller.kext", self.constants.autopkg_version, self.constants.autopkg_path)
|
||||
if self.constants.custom_sip_value:
|
||||
print(f"- Setting SIP value to: {self.constants.custom_sip_value}")
|
||||
logging.info(f"- Setting SIP value to: {self.constants.custom_sip_value}")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = utilities.string_to_hex(self.constants.custom_sip_value.lstrip("0x"))
|
||||
elif self.constants.sip_status is False:
|
||||
print("- Set SIP to allow Root Volume patching")
|
||||
logging.info("- Set SIP to allow Root Volume patching")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["csr-active-config"] = binascii.unhexlify("03080000")
|
||||
|
||||
# apfs.kext has an undocumented boot-arg that allows FileVault usage on broken APFS seals (-arv_allow_fv)
|
||||
# This is however hidden behind kern.development, thus we patch _apfs_filevault_allowed to always return true
|
||||
# Note this function was added in 11.3 (20E232, 20.4), older builds do not support this (ie. 11.2.3)
|
||||
print("- Allowing FileVault on Root Patched systems")
|
||||
logging.info("- Allowing FileVault on Root Patched systems")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Force FileVault on Broken Seal")["Enabled"] = True
|
||||
# Lets us check in sys_patch.py if config supports FileVault
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
|
||||
|
||||
# Patch KC UUID panics due to RSR installation
|
||||
# - Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1019
|
||||
logging.info("- Enabling KC UUID mismatch patch")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -nokcmismatchpanic"
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("RSRHelper.kext", self.constants.rsrhelper_version, self.constants.rsrhelper_path)
|
||||
|
||||
if self.constants.disable_cs_lv is True:
|
||||
print("- Disabling Library Validation")
|
||||
# In Ventura, LV patch broke. For now, add AMFI arg
|
||||
# Before merging into mainline, this needs to be resolved
|
||||
if self.constants.disable_amfi is True:
|
||||
logging.info("- Disabling AMFI")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
|
||||
else:
|
||||
logging.info("- Disabling Library Validation")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable Library Validation Enforcement")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Disable _csr_check() in _vnode_check_signature")["Enabled"] = True
|
||||
if self.constants.disable_amfi is True:
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " amfi=0x80"
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_amfi"
|
||||
# CSLVFixup simply patches out __RESTRICT and __restrict out of the Music.app Binary
|
||||
# Ref: https://pewpewthespells.com/blog/blocking_code_injection_on_ios_and_os_x.html
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("CSLVFixup.kext", self.constants.cslvfixup_version, self.constants.cslvfixup_path)
|
||||
|
||||
if self.constants.secure_status is False:
|
||||
print("- Disabling SecureBootModel")
|
||||
logging.info("- Disabling SecureBootModel")
|
||||
self.config["Misc"]["Security"]["SecureBootModel"] = "Disabled"
|
||||
if self.constants.force_vmm is True:
|
||||
print("- Forcing VMM patchset to support OTA updates")
|
||||
logging.info("- Forcing VMM patchset to support OTA updates")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
||||
|
||||
@@ -5,7 +5,7 @@ from resources import constants, utilities, generate_smbios
|
||||
from resources.build import support
|
||||
from data import smbios_data, cpu_data, model_array
|
||||
|
||||
import subprocess, plistlib, binascii, uuid, ast
|
||||
import subprocess, plistlib, binascii, uuid, ast, logging
|
||||
from pathlib import Path
|
||||
|
||||
class build_smbios:
|
||||
@@ -19,26 +19,26 @@ class build_smbios:
|
||||
if self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True:
|
||||
if self.constants.serial_settings == "None":
|
||||
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
|
||||
print("- Enabling Board ID exemption patch")
|
||||
logging.info("- Enabling Board ID exemption patch")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
|
||||
|
||||
print("- Enabling VMM exemption patch")
|
||||
logging.info("- Enabling VMM exemption patch")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Legacy")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2) Ventura")["Enabled"] = True
|
||||
else:
|
||||
print("- Enabling SMC exemption patch")
|
||||
logging.info("- Enabling SMC exemption patch")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path)
|
||||
|
||||
if self.constants.serial_settings in ["Moderate", "Advanced"]:
|
||||
print("- Enabling USB Rename Patches")
|
||||
logging.info("- Enabling USB Rename Patches")
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "XHC1 to SHC1")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC1 to EH01")["Enabled"] = True
|
||||
support.build_support(self.model, self.constants, self.config).get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC2 to EH02")["Enabled"] = True
|
||||
|
||||
if self.model == self.constants.override_smbios:
|
||||
print("- Adding -no_compat_check")
|
||||
logging.info("- Adding -no_compat_check")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
||||
|
||||
|
||||
@@ -47,20 +47,20 @@ class build_smbios:
|
||||
|
||||
if self.constants.override_smbios == "Default":
|
||||
if self.constants.serial_settings != "None":
|
||||
print("- Setting macOS Monterey Supported SMBIOS")
|
||||
logging.info("- Setting macOS Monterey Supported SMBIOS")
|
||||
if self.constants.allow_native_spoofs is True:
|
||||
spoofed_model = self.model
|
||||
else:
|
||||
spoofed_model = generate_smbios.set_smbios_model_spoof(self.model)
|
||||
else:
|
||||
spoofed_model = self.constants.override_smbios
|
||||
print(f"- Using Model ID: {spoofed_model}")
|
||||
logging.info(f"- Using Model ID: {spoofed_model}")
|
||||
|
||||
spoofed_board = ""
|
||||
if spoofed_model in smbios_data.smbios_dictionary:
|
||||
if "Board ID" in smbios_data.smbios_dictionary[spoofed_model]:
|
||||
spoofed_board = smbios_data.smbios_dictionary[spoofed_model]["Board ID"]
|
||||
print(f"- Using Board ID: {spoofed_board}")
|
||||
logging.info(f"- Using Board ID: {spoofed_board}")
|
||||
|
||||
self.spoofed_model = spoofed_model
|
||||
self.spoofed_board = spoofed_board
|
||||
@@ -69,13 +69,13 @@ class build_smbios:
|
||||
self.config["#Revision"]["Spoofed-Model"] = f"{self.spoofed_model} - {self.constants.serial_settings}"
|
||||
|
||||
if self.constants.serial_settings == "Moderate":
|
||||
print("- Using Moderate SMBIOS patching")
|
||||
logging.info("- Using Moderate SMBIOS patching")
|
||||
self.moderate_serial_patch()
|
||||
elif self.constants.serial_settings == "Advanced":
|
||||
print("- Using Advanced SMBIOS patching")
|
||||
logging.info("- Using Advanced SMBIOS patching")
|
||||
self.advanced_serial_patch()
|
||||
elif self.constants.serial_settings == "Minimal":
|
||||
print("- Using Minimal SMBIOS patching")
|
||||
logging.info("- Using Minimal SMBIOS patching")
|
||||
self.spoofed_model = self.model
|
||||
self.minimal_serial_patch()
|
||||
else:
|
||||
@@ -87,12 +87,12 @@ class build_smbios:
|
||||
# Note 1: Only apply if system is UEFI 1.2, this is generally Ivy Bridge and older
|
||||
# Note 2: Flipping 'UEFI -> ProtocolOverrides -> DataHub' will break hibernation
|
||||
if (smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value and self.model):
|
||||
print("- Detected UEFI 1.2 or older Mac, updating BoardProduct")
|
||||
logging.info("- Detected UEFI 1.2 or older Mac, updating BoardProduct")
|
||||
self.config["PlatformInfo"]["DataHub"]["BoardProduct"] = self.spoofed_board
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
logging.info("- Adding custom serial numbers")
|
||||
self.config["PlatformInfo"]["Automatic"] = True
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
self.config["PlatformInfo"]["UpdateNVRAM"] = True
|
||||
@@ -156,7 +156,7 @@ class build_smbios:
|
||||
if self.model == "MacBookPro6,2":
|
||||
# Force G State to not exceed moderate state
|
||||
# Ref: https://github.com/fabioiop/MBP-2010-GPU-Panic-fix
|
||||
print("- Patching G State for MacBookPro6,2")
|
||||
logging.info("- Patching G State for MacBookPro6,2")
|
||||
for gpu in ["Vendor10deDevice0a34", "Vendor10deDevice0a29"]:
|
||||
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostPState"] = [2, 2, 2, 2]
|
||||
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board][gpu]["BoostTime"] = [2, 2, 2, 2]
|
||||
@@ -183,7 +183,7 @@ class build_smbios:
|
||||
fw_feature = generate_smbios.generate_fw_features(self.model, self.constants.custom_model)
|
||||
# fw_feature = self.patch_firmware_feature()
|
||||
fw_feature = hex(fw_feature).lstrip("0x").rstrip("L").strip()
|
||||
print(f"- Setting Firmware Feature: {fw_feature}")
|
||||
logging.info(f"- Setting Firmware Feature: {fw_feature}")
|
||||
fw_feature = utilities.string_to_hex(fw_feature)
|
||||
|
||||
# FirmwareFeatures
|
||||
@@ -216,7 +216,7 @@ class build_smbios:
|
||||
self.config["PlatformInfo"]["UpdateDataHub"] = True
|
||||
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
logging.info("- Adding custom serial numbers")
|
||||
sn = self.constants.custom_serial_number
|
||||
mlb = self.constants.custom_board_serial_number
|
||||
|
||||
@@ -237,7 +237,7 @@ class build_smbios:
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["PlatformInfo"]["Generic"]["ProcessorType"] = 1537
|
||||
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
|
||||
print("- Adding custom serial numbers")
|
||||
logging.info("- Adding custom serial numbers")
|
||||
self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = self.constants.custom_serial_number
|
||||
self.config["PlatformInfo"]["Generic"]["MLB"] = self.constants.custom_board_serial_number
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-SN"] = self.constants.custom_serial_number
|
||||
|
||||
@@ -5,6 +5,7 @@ from resources import constants, device_probe, utilities
|
||||
from resources.build import support
|
||||
from data import model_array, smbios_data, cpu_data
|
||||
|
||||
import logging
|
||||
|
||||
class build_storage:
|
||||
|
||||
@@ -19,13 +20,23 @@ class build_storage:
|
||||
self.ahci_handling()
|
||||
self.pata_handling()
|
||||
self.misc_handling()
|
||||
self.pcie_handling()
|
||||
self.trim_handling()
|
||||
|
||||
def ahci_handling(self):
|
||||
# MacBookAir6,x ship with an AHCI over PCIe SSD model 'APPLE SSD TS0128F' and 'APPLE SSD TS0256F'
|
||||
# This controller is not supported properly in macOS Ventura, instead populating itself as 'Media' with no partitions
|
||||
# To work-around this, use Monterey's AppleAHCI driver to force
|
||||
if self.model in ["MacBookAir6,1", "MacBookAir6,2"]:
|
||||
print("- Enabling AHCI SSD patch")
|
||||
# To work-around this, use Monterey's AppleAHCI driver to force support
|
||||
if not self.constants.custom_model:
|
||||
sata_devices = [i for i in self.computer.storage if isinstance(i, device_probe.SATAController)]
|
||||
for controller in sata_devices:
|
||||
# https://linux-hardware.org/?id=pci:1179-010b-1b4b-9183
|
||||
if controller.vendor_id == 0x1179 and controller.device_id == 0x010b:
|
||||
logging.info("- Enabling AHCI SSD patch")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
||||
break
|
||||
elif self.model in ["MacBookAir6,1", "MacBookAir6,2"]:
|
||||
logging.info("- Enabling AHCI SSD patch")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("MonteAHCIPort.kext", self.constants.monterey_ahci_version, self.constants.monterey_ahci_path)
|
||||
|
||||
# ThirdPartyDrives Check
|
||||
@@ -38,11 +49,11 @@ class build_storage:
|
||||
if drive in smbios_data.smbios_dictionary[self.model]["Stock Storage"]:
|
||||
if not self.constants.custom_model:
|
||||
if self.computer.third_party_sata_ssd is True:
|
||||
print("- Adding SATA Hibernation Patch")
|
||||
logging.info("- Adding SATA Hibernation Patch")
|
||||
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
|
||||
break
|
||||
else:
|
||||
print("- Adding SATA Hibernation Patch")
|
||||
logging.info("- Adding SATA Hibernation Patch")
|
||||
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
|
||||
break
|
||||
|
||||
@@ -63,29 +74,29 @@ class build_storage:
|
||||
# Use Innie's same logic:
|
||||
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
|
||||
for i, controller in enumerate(self.computer.storage):
|
||||
print(f"- Fixing PCIe Storage Controller ({i + 1}) reporting")
|
||||
logging.info(f"- Fixing PCIe Storage Controller ({i + 1}) reporting")
|
||||
if controller.pci_path:
|
||||
self.config["DeviceProperties"]["Add"][controller.pci_path] = {"built-in": 1}
|
||||
else:
|
||||
print(f"- Failed to find Device path for PCIe Storage Controller {i}, falling back to Innie")
|
||||
logging.info(f"- Failed to find Device path for PCIe Storage Controller {i}, falling back to Innie")
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path)
|
||||
|
||||
if not self.constants.custom_model and self.constants.allow_nvme_fixing is True:
|
||||
nvme_devices = [i for i in self.computer.storage if isinstance(i, device_probe.NVMeController)]
|
||||
for i, controller in enumerate(nvme_devices):
|
||||
print(f"- Found 3rd Party NVMe SSD ({i + 1}): {utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}")
|
||||
logging.info(f"- Found 3rd Party NVMe SSD ({i + 1}): {utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}")
|
||||
self.config["#Revision"][f"Hardware-NVMe-{i}"] = f"{utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}"
|
||||
|
||||
# Disable Bit 0 (L0s), enable Bit 1 (L1)
|
||||
nvme_aspm = (controller.aspm & (~0b11)) | 0b10
|
||||
|
||||
if controller.pci_path:
|
||||
print(f"- Found NVMe ({i}) at {controller.pci_path}")
|
||||
logging.info(f"- Found NVMe ({i}) at {controller.pci_path}")
|
||||
self.config["DeviceProperties"]["Add"].setdefault(controller.pci_path, {})["pci-aspm-default"] = nvme_aspm
|
||||
self.config["DeviceProperties"]["Add"][controller.pci_path.rpartition("/")[0]] = {"pci-aspm-default": nvme_aspm}
|
||||
else:
|
||||
if "-nvmefaspm" not in self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"]:
|
||||
print("- Falling back to -nvmefaspm")
|
||||
logging.info("- Falling back to -nvmefaspm")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -nvmefaspm"
|
||||
|
||||
if (controller.vendor_id != 0x144D and controller.device_id != 0xA804):
|
||||
@@ -117,4 +128,10 @@ class build_storage:
|
||||
# However pre-Ivy Bridge don't support this feature
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:
|
||||
if (self.constants.computer.sdxc_controller and not self.constants.custom_model) or (self.model.startswith("MacBookPro8") or self.model.startswith("Macmini5")):
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path)
|
||||
support.build_support(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path)
|
||||
|
||||
|
||||
def trim_handling(self):
|
||||
if self.constants.apfs_trim_timeout is False:
|
||||
logging.info(f"- Disabling APFS TRIM timeout")
|
||||
self.config["Kernel"]["Quirks"]["SetApfsTrimTimeout"] = 0
|
||||
@@ -5,6 +5,7 @@ from resources import constants, utilities
|
||||
|
||||
from pathlib import Path
|
||||
import shutil, plistlib, subprocess, zipfile
|
||||
import logging
|
||||
|
||||
class build_support:
|
||||
|
||||
@@ -27,7 +28,7 @@ class build_support:
|
||||
def get_kext_by_bundle_path(self, bundle_path):
|
||||
kext = self.get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", bundle_path)
|
||||
if not kext:
|
||||
print(f"- Could not find kext {bundle_path}!")
|
||||
logging.info(f"- Could not find kext {bundle_path}!")
|
||||
raise IndexError
|
||||
return kext
|
||||
|
||||
@@ -35,7 +36,7 @@ class build_support:
|
||||
def get_efi_binary_by_path(self, bundle_path, entry_location, efi_type):
|
||||
efi_binary = self.get_item_by_kv(self.config[entry_location][efi_type], "Path", bundle_path)
|
||||
if not efi_binary:
|
||||
print(f"- Could not find {efi_type}: {bundle_path}!")
|
||||
logging.info(f"- Could not find {efi_type}: {bundle_path}!")
|
||||
raise IndexError
|
||||
return efi_binary
|
||||
|
||||
@@ -50,7 +51,7 @@ class build_support:
|
||||
if kext["Enabled"] is True:
|
||||
return
|
||||
|
||||
print(f"- Adding {kext_name} {kext_version}")
|
||||
logging.info(f"- Adding {kext_name} {kext_version}")
|
||||
shutil.copy(kext_path, self.constants.kexts_path)
|
||||
kext["Enabled"] = True
|
||||
|
||||
@@ -63,27 +64,27 @@ class build_support:
|
||||
# sign.command checks for the existence of '/usr/bin/strings' however does not verify whether it's executable
|
||||
# sign.command will continue to run and create an unbootable OpenCore.efi due to the missing strings binary
|
||||
# macOS has dummy binaries that just reroute to the actual binaries after you install Xcode's Command Line Tools
|
||||
print("- Missing Command Line tools, skipping Vault for saftey reasons")
|
||||
print("- Install via 'xcode-select --install' and rerun OCLP if you wish to vault this config")
|
||||
logging.info("- Missing Command Line tools, skipping Vault for saftey reasons")
|
||||
logging.info("- Install via 'xcode-select --install' and rerun OCLP if you wish to vault this config")
|
||||
return
|
||||
|
||||
print("- Vaulting EFI")
|
||||
logging.info("- Vaulting EFI")
|
||||
subprocess.run([str(self.constants.vault_path), f"{self.constants.oc_folder}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def validate_pathing(self):
|
||||
# Verify whether all files are accounted for on-disk
|
||||
# This ensures that OpenCore won't hit a critical error and fail to boot
|
||||
print("- Validating generated config")
|
||||
logging.info("- Validating generated config")
|
||||
if not Path(self.constants.opencore_release_folder / Path("EFI/OC/config.plist")):
|
||||
print("- OpenCore config file missing!!!")
|
||||
logging.info("- OpenCore config file missing!!!")
|
||||
raise Exception("OpenCore config file missing")
|
||||
|
||||
config_plist = plistlib.load(Path(self.constants.opencore_release_folder / Path("EFI/OC/config.plist")).open("rb"))
|
||||
|
||||
for acpi in config_plist["ACPI"]["Add"]:
|
||||
if not Path(self.constants.opencore_release_folder / Path("EFI/OC/ACPI") / Path(acpi["Path"])).exists():
|
||||
print(f" - Missing ACPI Table: {acpi['Path']}")
|
||||
logging.info(f" - Missing ACPI Table: {acpi['Path']}")
|
||||
raise Exception(f"Missing ACPI Table: {acpi['Path']}")
|
||||
|
||||
for kext in config_plist["Kernel"]["Add"]:
|
||||
@@ -91,40 +92,40 @@ class build_support:
|
||||
kext_binary_path = Path(kext_path / Path(kext["ExecutablePath"]))
|
||||
kext_plist_path = Path(kext_path / Path(kext["PlistPath"]))
|
||||
if not kext_path.exists():
|
||||
print(f"- Missing kext: {kext_path}")
|
||||
logging.info(f"- Missing kext: {kext_path}")
|
||||
raise Exception(f"Missing {kext_path}")
|
||||
if not kext_binary_path.exists():
|
||||
print(f"- Missing {kext['BundlePath']}'s binary: {kext_binary_path}")
|
||||
logging.info(f"- Missing {kext['BundlePath']}'s binary: {kext_binary_path}")
|
||||
raise Exception(f"Missing {kext_binary_path}")
|
||||
if not kext_plist_path.exists():
|
||||
print(f"- Missing {kext['BundlePath']}'s plist: {kext_plist_path}")
|
||||
logging.info(f"- Missing {kext['BundlePath']}'s plist: {kext_plist_path}")
|
||||
raise Exception(f"Missing {kext_plist_path}")
|
||||
|
||||
for tool in config_plist["Misc"]["Tools"]:
|
||||
if not Path(self.constants.opencore_release_folder / Path("EFI/OC/Tools") / Path(tool["Path"])).exists():
|
||||
print(f" - Missing tool: {tool['Path']}")
|
||||
logging.info(f" - Missing tool: {tool['Path']}")
|
||||
raise Exception(f"Missing tool: {tool['Path']}")
|
||||
|
||||
for driver in config_plist["UEFI"]["Drivers"]:
|
||||
if not Path(self.constants.opencore_release_folder / Path("EFI/OC/Drivers") / Path(driver["Path"])).exists():
|
||||
print(f" - Missing driver: {driver['Path']}")
|
||||
logging.info(f" - Missing driver: {driver['Path']}")
|
||||
raise Exception(f"Missing driver: {driver['Path']}")
|
||||
|
||||
# Validating local files
|
||||
# Report if they have no associated config.plist entry (i.e. they're not being used)
|
||||
for tool_files in Path(self.constants.opencore_release_folder / Path("EFI/OC/Tools")).glob("*"):
|
||||
if tool_files.name not in [x["Path"] for x in config_plist["Misc"]["Tools"]]:
|
||||
print(f" - Missing tool from config: {tool_files.name}")
|
||||
logging.info(f" - Missing tool from config: {tool_files.name}")
|
||||
raise Exception(f"Missing tool from config: {tool_files.name}")
|
||||
|
||||
for driver_file in Path(self.constants.opencore_release_folder / Path("EFI/OC/Drivers")).glob("*"):
|
||||
if driver_file.name not in [x["Path"] for x in config_plist["UEFI"]["Drivers"]]:
|
||||
print(f"- Found extra driver: {driver_file.name}")
|
||||
logging.info(f"- Found extra driver: {driver_file.name}")
|
||||
raise Exception(f"Found extra driver: {driver_file.name}")
|
||||
|
||||
|
||||
def cleanup(self):
|
||||
print("- Cleaning up files")
|
||||
logging.info("- Cleaning up files")
|
||||
# Remove unused entries
|
||||
entries_to_clean = {
|
||||
"ACPI": ["Add", "Delete", "Patch"],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +1,41 @@
|
||||
# Parse Commit Info from binary's info.plist
|
||||
# App Structure:
|
||||
# OpenCore-Patcher.app:
|
||||
# Contents:
|
||||
# MacOS:
|
||||
# OpenCore-Patcher
|
||||
# Info.plist
|
||||
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
|
||||
class commit_info:
|
||||
class ParseCommitInfo:
|
||||
|
||||
def __init__(self, binary_path: str) -> None:
|
||||
"""
|
||||
Parameters:
|
||||
binary_path (str): Path to binary
|
||||
"""
|
||||
|
||||
def __init__(self, binary_path):
|
||||
self.binary_path = str(binary_path)
|
||||
self.plist_path = self.convert_binary_path_to_plist_path()
|
||||
self.plist_path = self._convert_binary_path_to_plist_path()
|
||||
|
||||
|
||||
def convert_binary_path_to_plist_path(self):
|
||||
def _convert_binary_path_to_plist_path(self) -> str or None:
|
||||
"""
|
||||
Resolve Info.plist path from binary path
|
||||
"""
|
||||
|
||||
if Path(self.binary_path).exists():
|
||||
plist_path = self.binary_path.replace("MacOS/OpenCore-Patcher", "Info.plist")
|
||||
if Path(plist_path).exists() and plist_path.endswith(".plist"):
|
||||
return plist_path
|
||||
return None
|
||||
|
||||
def generate_commit_info(self):
|
||||
|
||||
def generate_commit_info(self) -> tuple:
|
||||
"""
|
||||
Generate commit info from Info.plist
|
||||
|
||||
Returns:
|
||||
tuple: (Branch, Commit Date, Commit URL)
|
||||
"""
|
||||
|
||||
if self.plist_path:
|
||||
# print(self.plist_path)
|
||||
plist_info = plistlib.load(Path(self.plist_path).open("rb"))
|
||||
if "Github" in plist_info:
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# pylint: disable=multiple-statements
|
||||
# Define Files
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
# Defines versioning, file paths and other settings for the patcher
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
@@ -10,210 +10,220 @@ from data import os_data
|
||||
|
||||
|
||||
class Constants:
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
# Patcher Versioning
|
||||
self.patcher_version = "0.5.3" # OpenCore-Legacy-Patcher
|
||||
self.patcher_support_pkg_version = "0.7.1" # PatcherSupportPkg
|
||||
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
||||
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
|
||||
self.discord_link = "https://discord.gg/rqdPgH8xSN"
|
||||
self.guide_link = "https://dortania.github.io/OpenCore-Legacy-Patcher/"
|
||||
self.repo_link = "https://github.com/dortania/OpenCore-Legacy-Patcher"
|
||||
self.repo_link_latest = f"{self.repo_link}/releases/tag/{self.patcher_version}"
|
||||
self.copyright_date = "Copyright © 2020-2022 Dortania"
|
||||
self.installer_pkg_url = f"{self.repo_link}/releases/download/{self.patcher_version}/AutoPkg-Assets.pkg"
|
||||
self.installer_pkg_url_nightly = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/AutoPkg-Assets.pkg.zip"
|
||||
self.patcher_version: str = "0.6.2" # OpenCore-Legacy-Patcher
|
||||
self.patcher_support_pkg_version: str = "0.8.7" # PatcherSupportPkg
|
||||
self.copyright_date: str = "Copyright © 2020-2023 Dortania"
|
||||
|
||||
# URLs
|
||||
self.url_patcher_support_pkg: str = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
|
||||
self.discord_link: str = "https://discord.gg/rqdPgH8xSN"
|
||||
self.guide_link: str = "https://dortania.github.io/OpenCore-Legacy-Patcher/"
|
||||
self.repo_link: str = "https://github.com/dortania/OpenCore-Legacy-Patcher"
|
||||
self.installer_pkg_url: str = f"{self.repo_link}/releases/download/{self.patcher_version}/AutoPkg-Assets.pkg"
|
||||
self.installer_pkg_url_nightly: str = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/AutoPkg-Assets.pkg.zip"
|
||||
|
||||
# OpenCore Versioning
|
||||
# https://github.com/acidanthera/OpenCorePkg
|
||||
self.opencore_commit = "10fc98f - 12-06-2022"
|
||||
self.opencore_version = "0.8.7"
|
||||
self.opencore_commit: str = "e4f0ba1 - 03-06-2023"
|
||||
self.opencore_version: str = "0.9.0"
|
||||
|
||||
# Kext Versioning
|
||||
## Acidanthera
|
||||
## https://github.com/acidanthera
|
||||
self.lilu_version = "1.6.2" # Lilu
|
||||
self.whatevergreen_version = "1.6.2" # WhateverGreen
|
||||
self.airportbcrmfixup_version = "2.1.6" # AirPortBrcmFixup
|
||||
self.nvmefix_version = "1.0.9" # NVMeFix
|
||||
self.applealc_version = "1.6.3" # AppleALC
|
||||
self.restrictevents_version = "1.0.9" # RestrictEvents
|
||||
self.featureunlock_version = "1.1.2" # FeatureUnlock
|
||||
self.debugenhancer_version = "1.0.7" # DebugEnhancer
|
||||
self.cpufriend_version = "1.2.5" # CPUFriend
|
||||
self.bluetool_version = "2.6.4" # BlueToolFixup (BrcmPatchRAM)
|
||||
self.cslvfixup_version = "2.6.1" # CSLVFixup
|
||||
self.autopkg_version = "1.0.1" # AutoPkgInstaller
|
||||
self.cryptexfixup_version = "1.0.1" # CryptexFixup
|
||||
self.lilu_version: str = "1.6.4" # Lilu
|
||||
self.whatevergreen_version: str = "1.6.4" # WhateverGreen
|
||||
self.whatevergreen_navi_version: str = "1.6.4-Navi" # WhateverGreen (Navi Patch)
|
||||
self.airportbcrmfixup_version: str = "2.1.6" # AirPortBrcmFixup
|
||||
self.nvmefix_version: str = "1.1.0" # NVMeFix
|
||||
self.applealc_version: str = "1.6.3" # AppleALC
|
||||
self.restrictevents_version: str = "1.0.9" # RestrictEvents
|
||||
self.featureunlock_version: str = "1.1.4" # FeatureUnlock
|
||||
self.debugenhancer_version: str = "1.0.7" # DebugEnhancer
|
||||
self.cpufriend_version: str = "1.2.6" # CPUFriend
|
||||
self.bluetool_version: str = "2.6.4" # BlueToolFixup (BrcmPatchRAM)
|
||||
self.cslvfixup_version: str = "2.6.1" # CSLVFixup
|
||||
self.autopkg_version: str = "1.0.2" # AutoPkgInstaller
|
||||
self.cryptexfixup_version: str = "1.0.1" # CryptexFixup
|
||||
|
||||
## Apple
|
||||
## https://www.apple.com
|
||||
self.marvel_version = "1.0.1" # MarvelYukonEthernet
|
||||
self.nforce_version = "1.0.1" # nForceEthernet
|
||||
self.piixata_version = "1.0.1" # AppleIntelPIIXATA
|
||||
self.fw_kext = "1.0.1" # IOFireWireFamily
|
||||
self.apple_trackpad = "1.0.1" # AppleUSBTrackpad
|
||||
self.apple_isight_version = "1.0.0" # AppleiSight
|
||||
self.apple_raid_version = "1.0.0" # AppleRAIDCard
|
||||
self.apfs_zlib_version = "12.3.1" # NoAVXFSCompressionTypeZlib
|
||||
self.apfs_zlib_v2_version = "12.6" # NoAVXFSCompressionTypeZlib (patched with AVXpel)
|
||||
self.multitouch_version = "1.0.0" # AppleUSBMultitouch
|
||||
self.topcase_version = "1.0.0" # AppleUSBTopCase
|
||||
self.intel_82574l_version = "1.0.0" # Intel82574L
|
||||
self.intel_8254x_version = "1.0.0" # AppleIntel8254XEthernet
|
||||
self.apple_usb_11_injector = "1.0.0" # AppleUSBUHCI/OHCI
|
||||
self.aicpupm_version = "1.0.0" # AppleIntelCPUPowerManagement/Client
|
||||
self.marvel_version: str = "1.0.1" # MarvelYukonEthernet
|
||||
self.nforce_version: str = "1.0.1" # nForceEthernet
|
||||
self.piixata_version: str = "1.0.1" # AppleIntelPIIXATA
|
||||
self.fw_kext: str = "1.0.1" # IOFireWireFamily
|
||||
self.apple_trackpad: str = "1.0.1" # AppleUSBTrackpad
|
||||
self.apple_isight_version: str = "1.0.0" # AppleiSight
|
||||
self.apple_raid_version: str = "1.0.0" # AppleRAIDCard
|
||||
self.apfs_zlib_version: str = "12.3.1" # NoAVXFSCompressionTypeZlib
|
||||
self.apfs_zlib_v2_version: str = "12.6" # NoAVXFSCompressionTypeZlib (patched with AVXpel)
|
||||
self.multitouch_version: str = "1.0.0" # AppleUSBMultitouch
|
||||
self.topcase_version: str = "1.0.0" # AppleUSBTopCase
|
||||
self.intel_82574l_version: str = "1.0.0" # Intel82574L
|
||||
self.intel_8254x_version: str = "1.0.0" # AppleIntel8254XEthernet
|
||||
self.apple_usb_11_injector: str = "1.0.0" # AppleUSBUHCI/OHCI
|
||||
self.aicpupm_version: str = "1.0.0" # AppleIntelCPUPowerManagement/Client
|
||||
|
||||
## Apple - Dortania Modified
|
||||
self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet
|
||||
self.i210_version = "1.0.0" # CatalinaIntelI210Ethernet
|
||||
self.corecaptureelcap_version = "1.0.1" # corecaptureElCap
|
||||
self.io80211elcap_version = "2.0.0" # IO80211ElCap
|
||||
self.bigsursdxc_version = "1.0.0" # BigSurSDXC
|
||||
self.monterey_ahci_version = "1.0.0" # CatalinaAHCI
|
||||
self.bcm570_version: str = "1.0.2" # CatalinaBCM5701Ethernet
|
||||
self.i210_version: str = "1.0.0" # CatalinaIntelI210Ethernet
|
||||
self.corecaptureelcap_version: str = "1.0.1" # corecaptureElCap
|
||||
self.io80211elcap_version: str = "2.0.0" # IO80211ElCap
|
||||
self.bigsursdxc_version: str = "1.0.0" # BigSurSDXC
|
||||
self.monterey_ahci_version: str = "1.0.0" # CatalinaAHCI
|
||||
|
||||
## Dortania
|
||||
## https://github.com/dortania
|
||||
self.backlight_injector_version = "1.1.0" # BacklightInjector
|
||||
self.smcspoof_version = "1.0.0" # SMC-Spoof
|
||||
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
|
||||
self.btspoof_version = "1.0.0" # Bluetooth-Spoof
|
||||
self.aspp_override_version = "1.0.1" # ACPI_SMC_PlatformPlugin Override
|
||||
self.backlight_injector_version: str = "1.1.0" # BacklightInjector
|
||||
self.smcspoof_version: str = "1.0.0" # SMC-Spoof
|
||||
self.mce_version: str = "1.0.0" # AppleMCEReporterDisabler
|
||||
self.btspoof_version: str = "1.0.0" # Bluetooth-Spoof
|
||||
self.aspp_override_version: str = "1.0.1" # ACPI_SMC_PlatformPlugin Override
|
||||
self.rsrhelper_version: str = "1.0.0" # RSRHelper
|
||||
|
||||
## Syncretic
|
||||
## https://forums.macrumors.com/members/syncretic.1173816/
|
||||
## https://github.com/reenigneorcim/latebloom
|
||||
self.mousse_version = "0.95-Dortania" # MouSSE
|
||||
self.telemetrap_version = "1.0.0" # telemetrap
|
||||
self.mousse_version: str = "0.95-Dortania" # MouSSE
|
||||
self.telemetrap_version: str = "1.0.0" # telemetrap
|
||||
|
||||
## cdf
|
||||
## https://github.com/cdf/Innie
|
||||
self.innie_version = "1.3.0" # Innie
|
||||
self.innie_version: str = "1.3.1" # Innie
|
||||
|
||||
## arter97
|
||||
## https://github.com/arter97/SimpleMSR/
|
||||
self.simplemsr_version = "1.0.0" # SimpleMSR
|
||||
self.simplemsr_version: str = "1.0.0" # SimpleMSR
|
||||
|
||||
## blackgate
|
||||
## https://github.com/blackgate/AMDGPUWakeHandler
|
||||
self.gpu_wake_version = "1.0.0"
|
||||
self.gpu_wake_version: str = "1.0.0"
|
||||
|
||||
## flagersgit
|
||||
## https://github.com/flagersgit/KDKlessWorkaround
|
||||
self.kdkless_version = "1.0.0"
|
||||
self.kdkless_version: str = "1.0.0"
|
||||
|
||||
# Get resource path
|
||||
self.current_path = Path(__file__).parent.parent.resolve()
|
||||
self.payload_path = self.current_path / Path("payloads")
|
||||
self.current_path: Path = Path(__file__).parent.parent.resolve()
|
||||
self.payload_path: Path = self.current_path / Path("payloads")
|
||||
|
||||
# Patcher Settings
|
||||
self.allow_oc_everywhere = False # Set whether Patcher can be run on unsupported Macs
|
||||
self.gui_mode = False # Determine whether running in a GUI or TUI
|
||||
self.disk = "" # Set installation ESP
|
||||
self.patch_disk = "" # Set Root Volume to patch
|
||||
self.validate = False # Enable validation testing for CI
|
||||
self.recovery_status = False # Detect if booted into RecoveryOS
|
||||
self.launcher_binary = None # Determine launch binary (ie. Python vs PyInstaller)
|
||||
self.launcher_script = None # Determine launch file (if run via Python)
|
||||
self.ignore_updates = False # Ignore OCLP updates
|
||||
self.wxpython_variant = False # Determine if using wxPython variant
|
||||
self.unpack_thread = None # Determine if unpack thread finished
|
||||
self.cli_mode = False # Determine if running in CLI mode
|
||||
self.should_nuke_kdks = True # Determine if KDKs should be nuked if unused in /L*/D*/KDKs
|
||||
self.has_checked_updates = False # Determine if check for updates has been run
|
||||
## Internal settings
|
||||
self.allow_oc_everywhere: bool = False # Set whether Patcher can be run on unsupported Macs
|
||||
self.gui_mode: bool = False # Determine whether running in a GUI or TUI
|
||||
self.cli_mode: bool = False # Determine if running in CLI mode
|
||||
self.validate: bool = False # Enable validation testing for CI
|
||||
self.recovery_status: bool = False # Detect if booted into RecoveryOS
|
||||
self.ignore_updates: bool = False # Ignore OCLP updates
|
||||
self.wxpython_variant: bool = False # Determine if using wxPython variant
|
||||
self.has_checked_updates: bool = False # Determine if check for updates has been run
|
||||
self.root_patcher_succeeded: bool = False # Determine if root patcher succeeded
|
||||
self.start_build_install: bool = False # Determine if build install should be started
|
||||
self.host_is_non_metal: bool = False # Determine if host is non-metal (ie. enable UI hacks)
|
||||
self.needs_to_open_preferences: bool = False # Determine if preferences need to be opened
|
||||
self.host_is_hackintosh: bool = False # Determine if host is Hackintosh
|
||||
self.should_nuke_kdks: bool = True # Determine if KDKs should be nuked if unused in /L*/D*/KDKs
|
||||
self.launcher_binary: str = None # Determine launch binary path (ie. Python vs PyInstaller)
|
||||
self.launcher_script: str = None # Determine launch file path (None if PyInstaller)
|
||||
self.booted_oc_disk: str = None # Determine current disk OCLP booted from
|
||||
self.unpack_thread = None # Determine if unpack thread finished (threading.Thread)
|
||||
|
||||
self.commit_info: tuple = (None, None, None) # Commit info (Branch, Commit Date, Commit URL)
|
||||
|
||||
## Hardware
|
||||
self.computer: device_probe.Computer = None # type: ignore
|
||||
self.custom_model: Optional[str] = None
|
||||
self.custom_model: Optional[str] = None
|
||||
|
||||
## OpenCore Settings
|
||||
self.opencore_debug = False
|
||||
self.opencore_build = "RELEASE"
|
||||
self.showpicker = True # Show or Hide OpenCore's Boot Picker
|
||||
self.boot_efi = False # Use EFI/BOOT/BOOTx64.efi bootstrap
|
||||
self.nvram_write = True # Write to hardware NVRAM
|
||||
self.opencore_debug: bool = False # Enable OpenCore debug
|
||||
self.boot_efi: bool = False # Use EFI/BOOT/BOOTx64.efi vs boot.efi bootstrap
|
||||
self.showpicker: bool = True # Show or Hide OpenCore's Boot Picker
|
||||
self.nvram_write: bool = True # Write to hardware NVRAM
|
||||
self.oc_timeout: int = 5 # Set OpenCore timeout
|
||||
self.opencore_build: str = "RELEASE"
|
||||
|
||||
## Kext Settings
|
||||
self.kext_debug = False # Enables Lilu debug and DebugEnhancer
|
||||
self.kext_variant = "RELEASE"
|
||||
self.kext_debug: bool = False # Enables Lilu debug and DebugEnhancer
|
||||
self.kext_variant: str = "RELEASE"
|
||||
|
||||
## NVRAM Settings
|
||||
self.verbose_debug = False # -v
|
||||
self.verbose_debug: bool = False # -v
|
||||
|
||||
## SMBIOS Settings
|
||||
self.custom_cpu_model = 2 # Patch type value
|
||||
self.custom_cpu_model_value = "" # New CPU name within About This Mac
|
||||
self.serial_settings = "None" # Set SMBIOS level used
|
||||
self.override_smbios = "Default" # Set SMBIOS model used
|
||||
self.allow_native_spoofs = False # Allow native models to recieve spoofs
|
||||
self.custom_serial_number = "" # Set SMBIOS serial number
|
||||
self.custom_board_serial_number = "" # Set SMBIOS board serial number
|
||||
self.serial_settings: str = "None" # Set SMBIOS level used
|
||||
self.override_smbios: str = "Default" # Set SMBIOS model used
|
||||
self.allow_native_spoofs: bool = False # Allow native models to recieve spoofs
|
||||
|
||||
### RestrictEvents CPU renaming
|
||||
self.custom_cpu_model: int = 2 # Patch type value
|
||||
self.custom_cpu_model_value: str = "" # New CPU name within About This Mac
|
||||
|
||||
### Serial Number Overrides
|
||||
self.custom_serial_number: str = "" # Set SMBIOS serial number
|
||||
self.custom_board_serial_number: str = "" # Set SMBIOS board serial number
|
||||
|
||||
## FeatureUnlock Settings
|
||||
self.fu_status = True # Enable FeatureUnlock
|
||||
self.fu_arguments = None # Set FeatureUnlock arguments
|
||||
self.fu_status: bool = True # Enable FeatureUnlock
|
||||
self.fu_arguments: str = None # Set FeatureUnlock arguments
|
||||
|
||||
## Security Settings
|
||||
self.apecid_support = False # ApECID
|
||||
self.sip_status = True # System Integrity Protection
|
||||
self.secure_status = False # Secure Boot Model
|
||||
self.vault = False # EFI Vault
|
||||
self.disable_cs_lv = False # Disable Library validation
|
||||
self.disable_amfi = False # Disable AMFI
|
||||
self.sip_status: bool = True # System Integrity Protection
|
||||
self.secure_status: bool = False # Secure Boot Model
|
||||
self.vault: bool = False # EFI Vault
|
||||
self.disable_cs_lv: bool = False # Disable Library validation
|
||||
self.disable_amfi: bool = False # Disable AMFI
|
||||
|
||||
## OS Settings
|
||||
self.os_support = 12.0
|
||||
self.detected_os = 0 # Major Kernel Version
|
||||
self.detected_os_minor = 0 # Minor Kernel Version
|
||||
self.detected_os_build = "" # OS Build
|
||||
self.detected_os_version = "" # OS Version
|
||||
self.os_support: float = 12.0
|
||||
self.detected_os: int = 0 # Major Kernel Version
|
||||
self.detected_os_minor: int = 0 # Minor Kernel Version
|
||||
self.detected_os_build: str = "" # OS Build
|
||||
self.detected_os_version: str = "" # OS Version
|
||||
|
||||
## Boot Volume Settings
|
||||
self.firewire_boot = False # Allow macOS FireWire Boot
|
||||
self.nvme_boot = False # Allow UEFI NVMe Boot
|
||||
self.xhci_boot = False
|
||||
self.firewire_boot: bool = False # Allow macOS FireWire Boot (kernel)
|
||||
self.nvme_boot: bool = False # Allow UEFI NVMe Boot
|
||||
self.xhci_boot: bool = False # Allow UEFI XHCI Boot
|
||||
|
||||
## Graphics Settings
|
||||
self.metal_build = False # Set MXM Build support
|
||||
self.imac_vendor = "None" # Set MXM GPU vendor
|
||||
self.imac_model = "" # Set MXM GPU model
|
||||
self.drm_support = False # Set iMac14,x DRM support
|
||||
self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support
|
||||
self.force_nv_web = False # Force Nvidia Web Drivers on Tesla and Kepler
|
||||
self.force_output_support = False # Force Output support for Mac Pros with PC VBIOS
|
||||
self.gop_injection = False # Set GOP Injection support
|
||||
self.allow_ts2_accel: bool = True # Set TeraScale 2 Acceleration support
|
||||
self.drm_support: bool = False # Set iMac14,x DRM support
|
||||
self.force_nv_web: bool = False # Force Nvidia Web Drivers on Tesla and Kepler
|
||||
self.force_output_support: bool = False # Force Output support for Mac Pros with PC VBIOS
|
||||
self.amd_gop_injection: bool = False # Set GOP Injection support
|
||||
self.nvidia_kepler_gop_injection: bool = False # Set Kepler GOP Injection support
|
||||
|
||||
## Miscellaneous
|
||||
self.disallow_cpufriend = False # Disable CPUFriend
|
||||
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
|
||||
self.disable_tb = False # Disable Thunderbolt Controller
|
||||
self.set_alc_usage = True # Set AppleALC usage
|
||||
self.dGPU_switch = False # Set Display GPU Switching for Windows
|
||||
self.force_surplus = False # Force SurPlus patch in newer OSes
|
||||
self.force_latest_psp = False # Force latest PatcherSupportPkg
|
||||
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
|
||||
self.software_demux = False # Enable Software Demux patch set
|
||||
self.force_vmm = False # Force VMM patch
|
||||
self.custom_sip_value = None # Set custom SIP value
|
||||
self.walkthrough = False # Enable Walkthrough
|
||||
self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation)
|
||||
self.allow_3rd_party_drives = True # Allow ThridPartyDrives quirk
|
||||
self.set_content_caching = False # Set Content Caching
|
||||
self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches
|
||||
self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext)
|
||||
self.root_patcher_succeeded = False # Determine if root patcher succeeded
|
||||
self.booted_oc_disk = None # Determine current disk OCLP booted from
|
||||
self.start_build_install = False # Determine if build install should be started
|
||||
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)
|
||||
self.needs_to_open_preferences = False # Determine if preferences need to be opened
|
||||
self.host_is_hackintosh = False # Determine if host is Hackintosh
|
||||
self.commit_info = (None, None, None)
|
||||
self.set_vmm_cpuid = False # Set VMM bit inside CPUID
|
||||
self.oc_timeout = 5 # Set OpenCore timeout
|
||||
### MXM GPU Support
|
||||
self.metal_build: bool = False # Set MXM Build support
|
||||
self.imac_vendor: str = "None" # Set MXM GPU vendor
|
||||
self.imac_model: str = "" # Set MXM GPU model
|
||||
|
||||
## Miscellaneous build settings
|
||||
self.disallow_cpufriend: bool = False # Disable CPUFriend
|
||||
self.enable_wake_on_wlan: bool = False # Allow Wake on WLAN for modern Broadcom
|
||||
self.disable_tb: bool = False # Disable Thunderbolt Controller
|
||||
self.dGPU_switch: bool = False # Set Display GPU Switching for Windows
|
||||
self.force_surplus: bool = False # Force SurPlus patch in newer OSes
|
||||
self.force_latest_psp: bool = False # Force latest PatcherSupportPkg
|
||||
self.disable_msr_power_ctl: bool = False # Disable MSR Power Control (missing battery throttling)
|
||||
self.software_demux: bool = False # Enable Software Demux patch set
|
||||
self.force_vmm: bool = False # Force VMM patch
|
||||
self.disable_connectdrivers: bool = False # Disable ConnectDrivers (hibernation)
|
||||
self.set_content_caching: bool = False # Set Content Caching
|
||||
self.disable_xcpm: bool = False # Disable XCPM (X86PlatformPlugin.kext)
|
||||
self.set_vmm_cpuid: bool = False # Set VMM bit inside CPUID
|
||||
self.set_alc_usage: bool = True # Set AppleALC usage
|
||||
self.allow_3rd_party_drives: bool = True # Allow ThridPartyDrives quirk
|
||||
self.allow_nvme_fixing: bool = True # Allow NVMe Kernel Space Patches
|
||||
self.apfs_trim_timeout: bool = True # Set APFS Trim timeout
|
||||
self.custom_sip_value: int = None # Set custom SIP value
|
||||
|
||||
## Non-Metal OS support
|
||||
self.legacy_accel_support = [
|
||||
os_data.os_data.big_sur,
|
||||
os_data.os_data.monterey,
|
||||
os_data.os_data.ventura,
|
||||
]
|
||||
|
||||
# Payload Location
|
||||
@@ -257,6 +267,10 @@ class Constants:
|
||||
def amd_gop_driver_path(self):
|
||||
return self.payload_path / Path("Drivers/AMDGOP.efi")
|
||||
|
||||
@property
|
||||
def nvidia_kepler_gop_driver_path(self):
|
||||
return self.payload_path / Path("Drivers/NVGOP_GK.efi")
|
||||
|
||||
@property
|
||||
def xhci_driver_path(self):
|
||||
return self.payload_path / Path("Drivers/XhciDxe.efi")
|
||||
@@ -273,10 +287,6 @@ class Constants:
|
||||
def link_rate_driver_path(self):
|
||||
return self.payload_path / Path("Drivers/FixPCIeLinkRate.efi")
|
||||
|
||||
@property
|
||||
def list_txt_path(self):
|
||||
return self.payload_path / Path("List.txt")
|
||||
|
||||
@property
|
||||
def installer_sh_path(self):
|
||||
return self.payload_path / Path("Installer.sh")
|
||||
@@ -294,6 +304,10 @@ class Constants:
|
||||
def whatevergreen_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/WhateverGreen-v{self.whatevergreen_version}-{self.kext_variant}.zip")
|
||||
|
||||
@property
|
||||
def whatevergreen_navi_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/WhateverGreen-v{self.whatevergreen_navi_version}-{self.kext_variant}.zip")
|
||||
|
||||
@property
|
||||
def airportbcrmfixup_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/AirportBrcmFixup-v{self.airportbcrmfixup_version}-{self.kext_variant}.zip")
|
||||
@@ -442,9 +456,13 @@ class Constants:
|
||||
def cryptexfixup_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/CryptexFixup-v{self.cryptexfixup_version}-{self.kext_variant}.zip")
|
||||
|
||||
@property
|
||||
def rsrhelper_path(self):
|
||||
return self.payload_kexts_path / Path(f"Acidanthera/RSRHelper-v{self.rsrhelper_version}-{self.kext_variant}.zip")
|
||||
|
||||
@property
|
||||
def innie_path(self):
|
||||
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
|
||||
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}-{self.kext_variant}.zip")
|
||||
|
||||
@property
|
||||
def simplemsr_path(self):
|
||||
@@ -570,11 +588,7 @@ class Constants:
|
||||
# Tools
|
||||
@property
|
||||
def macserial_path(self):
|
||||
return self.payload_path / Path("Tools/macserial")
|
||||
|
||||
@property
|
||||
def gfxutil_path(self):
|
||||
return self.payload_path / Path("Tools/gfxutil")
|
||||
return self.payload_path / Path("OpenCore/macserial")
|
||||
|
||||
@property
|
||||
def vault_path(self):
|
||||
@@ -582,12 +596,16 @@ class Constants:
|
||||
|
||||
@property
|
||||
def ocvalidate_path(self):
|
||||
return self.payload_path / Path(f"Tools/ocvalidate-{self.opencore_version}")
|
||||
return self.payload_path / Path(f"OpenCore/ocvalidate")
|
||||
|
||||
@property
|
||||
def oclp_helper_path(self):
|
||||
return self.payload_path / Path("Tools/OCLP-Helper")
|
||||
|
||||
@property
|
||||
def rsrrepair_userspace_path(self):
|
||||
return self.payload_path / Path("Tools/RSRRepair")
|
||||
|
||||
# Icons
|
||||
@property
|
||||
def app_icon_path(self):
|
||||
|
||||
@@ -1,34 +1,60 @@
|
||||
# Generate Default Data
|
||||
from resources import utilities, device_probe, generate_smbios, global_settings
|
||||
from data import smbios_data, cpu_data, os_data
|
||||
import subprocess
|
||||
|
||||
from resources import (
|
||||
utilities,
|
||||
device_probe,
|
||||
generate_smbios,
|
||||
global_settings,
|
||||
constants
|
||||
)
|
||||
from data import (
|
||||
smbios_data,
|
||||
cpu_data,
|
||||
os_data
|
||||
)
|
||||
|
||||
class generate_defaults:
|
||||
|
||||
def __init__(self, model, host_is_target, settings):
|
||||
self.model = model
|
||||
self.constants = settings
|
||||
self.host_is_target = host_is_target
|
||||
class GenerateDefaults:
|
||||
|
||||
def __init__(self, model: str, host_is_target: bool, global_constants: constants.Constants) -> None:
|
||||
self.constants: constants.Constants = global_constants
|
||||
|
||||
self.model: str = model
|
||||
|
||||
self.host_is_target: bool = host_is_target
|
||||
|
||||
# Reset Variables
|
||||
self.constants.sip_status = True
|
||||
self.constants.secure_status = False
|
||||
self.constants.disable_cs_lv = False
|
||||
self.constants.disable_amfi = False
|
||||
self.constants.sip_status: bool = True
|
||||
self.constants.secure_status: bool = False
|
||||
self.constants.disable_cs_lv: bool = False
|
||||
self.constants.disable_amfi: bool = False
|
||||
self.constants.fu_status: bool = True
|
||||
|
||||
self.constants.custom_serial_number = ""
|
||||
self.constants.custom_board_serial_number = ""
|
||||
self.constants.fu_arguments: str = None
|
||||
|
||||
self.general_probe()
|
||||
self.nvram_probe()
|
||||
self.gpu_probe()
|
||||
self.networking_probe()
|
||||
self.misc_hardwares_probe()
|
||||
self.smbios_probe()
|
||||
self.constants.custom_serial_number: str = ""
|
||||
self.constants.custom_board_serial_number: str = ""
|
||||
|
||||
if self.host_is_target is True:
|
||||
for gpu in self.constants.computer.gpus:
|
||||
if gpu.device_id_unspoofed == -1:
|
||||
gpu.device_id_unspoofed = gpu.device_id
|
||||
if gpu.vendor_id_unspoofed == -1:
|
||||
gpu.vendor_id_unspoofed = gpu.vendor_id
|
||||
|
||||
self._general_probe()
|
||||
self._nvram_probe()
|
||||
self._gpu_probe()
|
||||
self._networking_probe()
|
||||
self._misc_hardwares_probe()
|
||||
self._smbios_probe()
|
||||
|
||||
|
||||
def general_probe(self):
|
||||
def _general_probe(self) -> None:
|
||||
"""
|
||||
General probe for data
|
||||
"""
|
||||
|
||||
if "Book" in self.model:
|
||||
self.constants.set_content_caching = False
|
||||
@@ -38,11 +64,11 @@ class generate_defaults:
|
||||
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||
# Users disabling TS2 most likely have a faulty dGPU
|
||||
# users can override this in settings
|
||||
ts2_status = global_settings.global_settings().read_property("MacBookPro_TeraScale_2_Accel")
|
||||
ts2_status = global_settings.GlobalEnviromentSettings().read_property("MacBookPro_TeraScale_2_Accel")
|
||||
if ts2_status is True:
|
||||
self.constants.allow_ts2_accel = True
|
||||
else:
|
||||
global_settings.global_settings().write_property("MacBookPro_TeraScale_2_Accel", False)
|
||||
global_settings.GlobalEnviromentSettings().write_property("MacBookPro_TeraScale_2_Accel", False)
|
||||
self.constants.allow_ts2_accel = False
|
||||
|
||||
if self.model in smbios_data.smbios_dictionary:
|
||||
@@ -59,14 +85,19 @@ class generate_defaults:
|
||||
# Check if running in RecoveryOS
|
||||
self.constants.recovery_status = utilities.check_recovery()
|
||||
|
||||
if global_settings.global_settings().read_property("Force_Web_Drivers") is True:
|
||||
if global_settings.GlobalEnviromentSettings().read_property("Force_Web_Drivers") is True:
|
||||
self.constants.force_nv_web = True
|
||||
|
||||
result = global_settings.global_settings().read_property("ShouldNukeKDKs")
|
||||
result = global_settings.GlobalEnviromentSettings().read_property("ShouldNukeKDKs")
|
||||
if result is False:
|
||||
self.constants.should_nuke_kdks = False
|
||||
|
||||
def smbios_probe(self):
|
||||
|
||||
def _smbios_probe(self) -> None:
|
||||
"""
|
||||
SMBIOS specific probe
|
||||
"""
|
||||
|
||||
if not self.host_is_target:
|
||||
if self.model in ["MacPro4,1", "MacPro5,1"]:
|
||||
# Allow H.265 on AMD
|
||||
@@ -97,7 +128,11 @@ class generate_defaults:
|
||||
self.constants.force_vmm = False
|
||||
|
||||
|
||||
def nvram_probe(self):
|
||||
def _nvram_probe(self) -> None:
|
||||
"""
|
||||
NVRAM specific probe
|
||||
"""
|
||||
|
||||
if not self.host_is_target:
|
||||
return
|
||||
|
||||
@@ -118,20 +153,52 @@ class generate_defaults:
|
||||
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
|
||||
|
||||
|
||||
def networking_probe(self):
|
||||
if (
|
||||
isinstance(self.constants.computer.wifi, device_probe.Broadcom) and
|
||||
self.constants.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4331, device_probe.Broadcom.Chipsets.AirPortBrcm43224]
|
||||
) or (
|
||||
isinstance(self.constants.computer.wifi, device_probe.Atheros) and
|
||||
self.constants.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40
|
||||
):
|
||||
# 12.0: Legacy Wireless chipsets require root patching
|
||||
self.constants.sip_status = False
|
||||
self.constants.secure_status = False
|
||||
def _networking_probe(self) -> None:
|
||||
"""
|
||||
Networking specific probe
|
||||
"""
|
||||
|
||||
if self.host_is_target:
|
||||
if not (
|
||||
(
|
||||
isinstance(self.constants.computer.wifi, device_probe.Broadcom) and
|
||||
self.constants.computer.wifi.chipset in [
|
||||
device_probe.Broadcom.Chipsets.AirPortBrcm4331,
|
||||
device_probe.Broadcom.Chipsets.AirPortBrcm43224,
|
||||
]
|
||||
) or (
|
||||
isinstance(self.constants.computer.wifi, device_probe.Atheros) and
|
||||
self.constants.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40
|
||||
)
|
||||
):
|
||||
return
|
||||
|
||||
else:
|
||||
if not self.model in smbios_data.smbios_dictionary:
|
||||
return
|
||||
if (
|
||||
smbios_data.smbios_dictionary[self.model]["Wireless Model"] not in [
|
||||
device_probe.Broadcom.Chipsets.AirPortBrcm4331,
|
||||
device_probe.Broadcom.Chipsets.AirPortBrcm43224,
|
||||
device_probe.Atheros.Chipsets.AirPortAtheros40
|
||||
]
|
||||
):
|
||||
return
|
||||
|
||||
# 12.0: Legacy Wireless chipsets require root patching
|
||||
self.constants.sip_status = False
|
||||
self.constants.secure_status = False
|
||||
|
||||
# 13.0: Enabling AirPlay to Mac patches breaks Control Center on legacy chipsets
|
||||
# AirPlay to Mac was unsupported regardless, so we can safely disable it
|
||||
self.constants.fu_status = True
|
||||
self.constants.fu_arguments = " -disable_sidecar_mac"
|
||||
|
||||
|
||||
def misc_hardwares_probe(self):
|
||||
def _misc_hardwares_probe(self) -> None:
|
||||
"""
|
||||
Misc probe
|
||||
"""
|
||||
if self.host_is_target:
|
||||
if self.constants.computer.usb_controllers:
|
||||
if self.model in smbios_data.smbios_dictionary:
|
||||
@@ -144,7 +211,11 @@ class generate_defaults:
|
||||
break
|
||||
|
||||
|
||||
def gpu_probe(self):
|
||||
def _gpu_probe(self) -> None:
|
||||
"""
|
||||
Graphics specific probe
|
||||
"""
|
||||
|
||||
gpu_dict = []
|
||||
if self.host_is_target:
|
||||
gpu_dict = self.constants.computer.gpus
|
||||
@@ -170,14 +241,23 @@ class generate_defaults:
|
||||
device_probe.AMD.Archs.Legacy_GCN_8000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_9000,
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
if gpu in [
|
||||
device_probe.Intel.Archs.Ivy_Bridge,
|
||||
device_probe.Intel.Archs.Haswell,
|
||||
device_probe.NVIDIA.Archs.Kepler,
|
||||
]:
|
||||
self.constants.disable_amfi = True
|
||||
|
||||
if gpu in [
|
||||
device_probe.AMD.Archs.Legacy_GCN_7000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_8000,
|
||||
device_probe.AMD.Archs.Legacy_GCN_9000,
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
@@ -195,6 +275,7 @@ class generate_defaults:
|
||||
# See if system can use the native AMD stack in Ventura
|
||||
if gpu in [
|
||||
device_probe.AMD.Archs.Polaris,
|
||||
device_probe.AMD.Archs.Polaris_Spoof,
|
||||
device_probe.AMD.Archs.Vega,
|
||||
device_probe.AMD.Archs.Navi,
|
||||
]:
|
||||
@@ -228,12 +309,7 @@ class generate_defaults:
|
||||
# Only disable AMFI if we officially support Ventura
|
||||
self.constants.disable_amfi = True
|
||||
|
||||
if self.host_is_target:
|
||||
self.constants.host_is_non_metal = True
|
||||
# If a Mac is non-Metal based, Beta Blur is highly recommended
|
||||
if self.constants.detected_os >= os_data.os_data.big_sur:
|
||||
for arg in ["Moraea_BlurBeta"]:
|
||||
# If user explicitly set the blur, don't override
|
||||
arg_result = subprocess.run(["defaults", "read", "-g", arg], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
|
||||
if arg_result not in ["true", "1", "false", "0"]:
|
||||
subprocess.run(["defaults", "write", "-g", arg, "-bool", "TRUE"])
|
||||
# Enable BetaBlur if user hasn't disabled it
|
||||
is_blur_enabled = subprocess.run(["defaults", "read", "-g", "Moraea_BlurBeta"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
|
||||
if is_blur_enabled in ["false", "0"]:
|
||||
subprocess.run(["defaults", "write", "-g", "Moraea_BlurBeta", "-bool", "true"])
|
||||
@@ -25,25 +25,46 @@ class CPU:
|
||||
class PCIDevice:
|
||||
VENDOR_ID: ClassVar[int] # Default vendor id, for subclasses.
|
||||
|
||||
vendor_id: int # The vendor ID of this PCI device
|
||||
device_id: int # The device ID of this PCI device
|
||||
vendor_id: int # The vendor ID of this PCI device
|
||||
device_id: int # The device ID of this PCI device
|
||||
class_code: int # The class code of this PCI device - https://pci-ids.ucw.cz/read/PD
|
||||
|
||||
name: Optional[str] = None # Name of IORegistryEntry
|
||||
model: Optional[str] = None # model property
|
||||
acpi_path: Optional[str] = None # ACPI Device Path
|
||||
pci_path: Optional[str] = None # PCI Device Path
|
||||
disable_metal: Optional[bool] = False # 'disable-metal' property
|
||||
force_compatible: Optional[bool] = False # 'force-compat' property
|
||||
name: Optional[str] = None # Name of IORegistryEntry
|
||||
model: Optional[str] = None # model property
|
||||
acpi_path: Optional[str] = None # ACPI Device Path
|
||||
pci_path: Optional[str] = None # PCI Device Path
|
||||
disable_metal: Optional[bool] = False # 'disable-metal' property
|
||||
force_compatible: Optional[bool] = False # 'force-compat' property
|
||||
vendor_id_unspoofed: Optional[int] = -1 # Unspoofed vendor ID of this PCI device
|
||||
device_id_unspoofed: Optional[int] = -1 # Unspoofed device ID of this PCI device
|
||||
|
||||
@classmethod
|
||||
def from_ioregistry(cls, entry: ioreg.io_registry_entry_t, anti_spoof=False):
|
||||
properties: dict = ioreg.corefoundation_to_native(ioreg.IORegistryEntryCreateCFProperties(entry, None, ioreg.kCFAllocatorDefault, ioreg.kNilOptions)[1]) # type: ignore
|
||||
if anti_spoof and "IOName" in properties:
|
||||
vendor_id, device_id = (int(i, 16) for i in properties["IOName"][3:].split(","))
|
||||
else:
|
||||
|
||||
vendor_id = None
|
||||
device_id = None
|
||||
vendor_id_unspoofed = None
|
||||
device_id_unspoofed = None
|
||||
|
||||
if "IOName" in properties:
|
||||
ioname = properties["IOName"]
|
||||
if type(ioname) is bytes:
|
||||
ioname = ioname.strip(b"\0").decode()
|
||||
|
||||
if ioname.startswith("pci"):
|
||||
vendor_id_unspoofed, device_id_unspoofed = (int(i, 16) for i in ioname[3:].split(","))
|
||||
if anti_spoof:
|
||||
vendor_id = vendor_id_unspoofed
|
||||
device_id = device_id_unspoofed
|
||||
|
||||
if vendor_id is None and device_id is None:
|
||||
vendor_id, device_id = [int.from_bytes(properties[i][:4], byteorder="little") for i in ["vendor-id", "device-id"]]
|
||||
|
||||
if vendor_id_unspoofed is None and device_id_unspoofed is None:
|
||||
vendor_id_unspoofed = vendor_id
|
||||
device_id_unspoofed = device_id
|
||||
|
||||
device = cls(vendor_id, device_id, int.from_bytes(properties["class-code"][:6], byteorder="little"), name=ioreg.io_name_t_to_str(ioreg.IORegistryEntryGetName(entry, None)[1]))
|
||||
if "model" in properties:
|
||||
model = properties["model"]
|
||||
@@ -56,6 +77,9 @@ class PCIDevice:
|
||||
device.disable_metal = True
|
||||
if "force-compat" in properties:
|
||||
device.force_compatible = True
|
||||
|
||||
device.vendor_id_unspoofed = vendor_id_unspoofed
|
||||
device.device_id_unspoofed = device_id_unspoofed
|
||||
device.populate_pci_path(entry)
|
||||
return device
|
||||
|
||||
@@ -242,6 +266,7 @@ class AMD(GPU):
|
||||
Legacy_GCN_8000 = "Legacy GCN v2"
|
||||
Legacy_GCN_9000 = "Legacy GCN v3"
|
||||
Polaris = "Polaris"
|
||||
Polaris_Spoof = "Polaris (Spoofed)"
|
||||
Vega = "Vega"
|
||||
Navi = "Navi"
|
||||
Unknown = "Unknown"
|
||||
@@ -263,6 +288,8 @@ class AMD(GPU):
|
||||
self.arch = AMD.Archs.TeraScale_2
|
||||
elif self.device_id in pci_data.amd_ids.polaris_ids:
|
||||
self.arch = AMD.Archs.Polaris
|
||||
elif self.device_id in pci_data.amd_ids.polaris_spoof_ids:
|
||||
self.arch = AMD.Archs.Polaris_Spoof
|
||||
elif self.device_id in pci_data.amd_ids.vega_ids:
|
||||
self.arch = AMD.Archs.Vega
|
||||
elif self.device_id in pci_data.amd_ids.navi_ids:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from data import smbios_data, os_data, cpu_data
|
||||
from resources import utilities
|
||||
|
||||
import logging
|
||||
|
||||
def set_smbios_model_spoof(model):
|
||||
try:
|
||||
@@ -60,7 +61,7 @@ def generate_fw_features(model, custom):
|
||||
if not custom:
|
||||
firmwarefeature = utilities.get_rom("firmware-features")
|
||||
if not firmwarefeature:
|
||||
print("- Failed to find FirmwareFeatures, falling back on defaults")
|
||||
logging.info("- Failed to find FirmwareFeatures, falling back on defaults")
|
||||
if smbios_data.smbios_dictionary[model]["FirmwareFeatures"] is None:
|
||||
firmwarefeature = 0
|
||||
else:
|
||||
|
||||
@@ -5,42 +5,66 @@
|
||||
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
class global_settings:
|
||||
|
||||
def __init__(self):
|
||||
self.file_name = ".com.dortania.opencore-legacy-patcher.plist"
|
||||
self.global_settings_folder = "/Users/Shared"
|
||||
self.global_settings_plist = f"{self.global_settings_folder}/{self.file_name}"
|
||||
self.generate_settings_file()
|
||||
self.convert_defaults_to_global_settings()
|
||||
class GlobalEnviromentSettings:
|
||||
"""
|
||||
Library for querying and writing global enviroment settings
|
||||
"""
|
||||
|
||||
def generate_settings_file(self):
|
||||
if Path(self.global_settings_plist).exists():
|
||||
return
|
||||
try:
|
||||
plistlib.dump({"Developed by Dortania": True,}, Path(self.global_settings_plist).open("wb"))
|
||||
except PermissionError:
|
||||
print("- Permission error: Unable to write to global settings file")
|
||||
def __init__(self) -> None:
|
||||
self.file_name: str = ".com.dortania.opencore-legacy-patcher.plist"
|
||||
self.global_settings_folder: str = "/Users/Shared"
|
||||
self.global_settings_plist: str = f"{self.global_settings_folder}/{self.file_name}"
|
||||
|
||||
self._generate_settings_file()
|
||||
self._convert_defaults_to_global_settings()
|
||||
self._fix_file_permission()
|
||||
|
||||
|
||||
def read_property(self, property_name: str) -> str or None:
|
||||
"""
|
||||
Reads a property from the global settings file
|
||||
"""
|
||||
|
||||
def read_property(self, property_name):
|
||||
if Path(self.global_settings_plist).exists():
|
||||
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
||||
if property_name in plist:
|
||||
return plist[property_name]
|
||||
return None
|
||||
|
||||
def write_property(self, property_name, property_value):
|
||||
|
||||
def write_property(self, property_name: str, property_value) -> None:
|
||||
"""
|
||||
Writes a property to the global settings file
|
||||
"""
|
||||
|
||||
if Path(self.global_settings_plist).exists():
|
||||
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
|
||||
plist[property_name] = property_value
|
||||
try:
|
||||
plistlib.dump(plist, Path(self.global_settings_plist).open("wb"))
|
||||
except PermissionError:
|
||||
print("- Failed to write to global settings file")
|
||||
logging.info("- Failed to write to global settings file")
|
||||
|
||||
|
||||
def convert_defaults_to_global_settings(self):
|
||||
def _generate_settings_file(self) -> None:
|
||||
if Path(self.global_settings_plist).exists():
|
||||
return
|
||||
try:
|
||||
plistlib.dump({"Developed by Dortania": True,}, Path(self.global_settings_plist).open("wb"))
|
||||
except PermissionError:
|
||||
logging.info("- Permission error: Unable to write to global settings file")
|
||||
|
||||
|
||||
def _convert_defaults_to_global_settings(self) -> None:
|
||||
"""
|
||||
Converts legacy defaults to global settings
|
||||
"""
|
||||
|
||||
defaults_path = "~/Library/Preferences/com.dortania.opencore-legacy-patcher.plist"
|
||||
defaults_path = Path(defaults_path).expanduser()
|
||||
|
||||
@@ -52,11 +76,30 @@ class global_settings:
|
||||
try:
|
||||
plistlib.dump(global_settings_plist, Path(self.global_settings_plist).open("wb"))
|
||||
except PermissionError:
|
||||
print("- Permission error: Unable to write to global settings file")
|
||||
logging.info("- Permission error: Unable to write to global settings file")
|
||||
return
|
||||
|
||||
# delete defaults plist
|
||||
try:
|
||||
Path(defaults_path).unlink()
|
||||
except PermissionError:
|
||||
print("- Permission error: Unable to delete defaults plist")
|
||||
logging.info("- Permission error: Unable to delete defaults plist")
|
||||
|
||||
|
||||
def _fix_file_permission(self) -> None:
|
||||
"""
|
||||
Fixes file permission for log file
|
||||
|
||||
If OCLP was invoked as root, file permission will only allow root to write to settings file
|
||||
This in turn breaks normal OCLP execution to write to settings file
|
||||
"""
|
||||
|
||||
if os.geteuid() != 0:
|
||||
return
|
||||
|
||||
# Set file permission to allow any user to write to log file
|
||||
result = subprocess.run(["chmod", "777", self.global_settings_plist], capture_output=True)
|
||||
if result.returncode != 0:
|
||||
logging.warning("- Failed to fix settings file permissions:")
|
||||
if result.stderr:
|
||||
logging.warning(result.stderr.decode("utf-8"))
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,12 +23,15 @@ class RedirectLabel(object):
|
||||
self.out=aWxTextCtrl
|
||||
|
||||
def write(self,string):
|
||||
if string.endswith("MB/s"):
|
||||
if "MB/s" in string:
|
||||
self.out.SetLabel(string)
|
||||
self.out.Centre(wx.HORIZONTAL)
|
||||
wx.GetApp().Yield()
|
||||
time.sleep(0.01)
|
||||
|
||||
def fileno(self):
|
||||
return 1
|
||||
|
||||
def flush(self):
|
||||
pass
|
||||
|
||||
@@ -6,8 +6,9 @@ import plistlib
|
||||
import subprocess
|
||||
import shutil
|
||||
import os
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from resources import utilities, constants, tui_helpers
|
||||
from resources import utilities, constants
|
||||
from data import os_data
|
||||
|
||||
class tui_disk_installation:
|
||||
@@ -74,65 +75,6 @@ class tui_disk_installation:
|
||||
return supported_partitions
|
||||
|
||||
|
||||
def copy_efi(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Installing OpenCore to Drive"])
|
||||
|
||||
if not self.constants.opencore_release_folder.exists():
|
||||
tui_helpers.TUIOnlyPrint(
|
||||
["Installing OpenCore to Drive"],
|
||||
"Press [Enter] to go back.\n",
|
||||
[
|
||||
"""OpenCore folder missing!
|
||||
Please build OpenCore first!"""
|
||||
],
|
||||
).start()
|
||||
return
|
||||
|
||||
print("\nDisk picker is loading...")
|
||||
|
||||
all_disks = self.list_disks()
|
||||
menu = tui_helpers.TUIMenu(
|
||||
["Select Disk"],
|
||||
"Please select the disk you would like to install OpenCore to: ",
|
||||
in_between=["Missing disks? Ensure they have an EFI or FAT32 partition."],
|
||||
return_number_instead_of_direct_call=True,
|
||||
loop=True,
|
||||
)
|
||||
for disk in all_disks:
|
||||
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({all_disks[disk]['size']})", key=disk[4:])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
if response == -1:
|
||||
return
|
||||
|
||||
disk_identifier = "disk" + response
|
||||
selected_disk = all_disks[disk_identifier]
|
||||
|
||||
menu = tui_helpers.TUIMenu(
|
||||
["Select Partition"],
|
||||
"Please select the partition you would like to install OpenCore to: ",
|
||||
return_number_instead_of_direct_call=True,
|
||||
loop=True,
|
||||
in_between=["Missing partitions? Ensure they are formatted as an EFI or FAT32.", "", "* denotes likely candidate."],
|
||||
)
|
||||
for partition in selected_disk["partitions"]:
|
||||
if selected_disk["partitions"][partition]["fs"] not in ("msdos", "EFI"):
|
||||
continue
|
||||
text = f"{partition}: {selected_disk['partitions'][partition]['name']} ({utilities.human_fmt(selected_disk['partitions'][partition]['size'])})"
|
||||
if selected_disk["partitions"][partition]["type"] == "EFI" or (
|
||||
selected_disk["partitions"][partition]["type"] == "Microsoft Basic Data" and selected_disk["partitions"][partition]["size"] < 1024 * 1024 * 512
|
||||
): # 512 megabytes:
|
||||
text += " *"
|
||||
menu.add_menu_option(text, key=partition[len(disk_identifier) + 1 :])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
if response == -1:
|
||||
return
|
||||
self.install_opencore(f"{disk_identifier}s{response}")
|
||||
|
||||
def install_opencore(self, full_disk_identifier):
|
||||
def determine_sd_card(media_name):
|
||||
# Array filled with common SD Card names
|
||||
@@ -168,18 +110,13 @@ Please build OpenCore first!"""
|
||||
# cancelled prompt
|
||||
return
|
||||
else:
|
||||
if self.constants.gui_mode is False:
|
||||
tui_helpers.TUIOnlyPrint(
|
||||
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + [""]
|
||||
).start()
|
||||
else:
|
||||
print("An error occurred!")
|
||||
print(result.stderr.decode())
|
||||
logging.info("An error occurred!")
|
||||
logging.info(result.stderr.decode())
|
||||
|
||||
# Check if we're in Safe Mode, and if so, tell user FAT32 is unsupported
|
||||
if utilities.check_boot_mode() == "safe_boot":
|
||||
print("\nSafe Mode detected. FAT32 is unsupported by macOS in this mode.")
|
||||
print("Please disable Safe Mode and try again.")
|
||||
# Check if we're in Safe Mode, and if so, tell user FAT32 is unsupported
|
||||
if utilities.check_boot_mode() == "safe_boot":
|
||||
logging.info("\nSafe Mode detected. FAT32 is unsupported by macOS in this mode.")
|
||||
logging.info("Please disable Safe Mode and try again.")
|
||||
return
|
||||
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {full_disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
parent_disk = partition_info["ParentWholeDisk"]
|
||||
@@ -196,65 +133,62 @@ Please build OpenCore first!"""
|
||||
|
||||
if mount_path.exists():
|
||||
if (mount_path / Path("EFI/Microsoft")).exists() and self.constants.gui_mode is False:
|
||||
print("- Found Windows Boot Loader")
|
||||
print("\nWould you like to continue installing OpenCore?")
|
||||
print("Installing OpenCore onto this drive may make Windows unbootable until OpenCore")
|
||||
print("is removed from the partition")
|
||||
print("We highly recommend users partition 200MB off their drive with Disk Utility")
|
||||
print(" Name:\t\t OPENCORE")
|
||||
print(" Format:\t\t FAT32")
|
||||
print(" Size:\t\t 200MB")
|
||||
logging.info("- Found Windows Boot Loader")
|
||||
logging.info("\nWould you like to continue installing OpenCore?")
|
||||
logging.info("Installing OpenCore onto this drive may make Windows unbootable until OpenCore")
|
||||
logging.info("is removed from the partition")
|
||||
logging.info("We highly recommend users partition 200MB off their drive with Disk Utility")
|
||||
logging.info(" Name:\t\t OPENCORE")
|
||||
logging.info(" Format:\t\t FAT32")
|
||||
logging.info(" Size:\t\t 200MB")
|
||||
choice = input("\nWould you like to still install OpenCore to this drive?(y/n): ")
|
||||
if not choice in ["y", "Y", "Yes", "yes"]:
|
||||
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
return False
|
||||
if (mount_path / Path("EFI/OC")).exists():
|
||||
print("- Removing preexisting EFI/OC folder")
|
||||
logging.info("- Removing preexisting EFI/OC folder")
|
||||
shutil.rmtree(mount_path / Path("EFI/OC"), onerror=rmtree_handler)
|
||||
if (mount_path / Path("System")).exists():
|
||||
print("- Removing preexisting System folder")
|
||||
logging.info("- Removing preexisting System folder")
|
||||
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
|
||||
if (mount_path / Path("boot.efi")).exists():
|
||||
print("- Removing preexisting boot.efi")
|
||||
logging.info("- Removing preexisting boot.efi")
|
||||
os.remove(mount_path / Path("boot.efi"))
|
||||
print("- Copying OpenCore onto EFI partition")
|
||||
logging.info("- Copying 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 Path(self.constants.opencore_release_folder / Path("boot.efi")).exists():
|
||||
shutil.copy(self.constants.opencore_release_folder / Path("boot.efi"), mount_path / Path("boot.efi"))
|
||||
if self.constants.boot_efi is True:
|
||||
print("- Converting Bootstrap to BOOTx64.efi")
|
||||
logging.info("- 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)
|
||||
if determine_sd_card(sd_type) is True:
|
||||
print("- Adding SD Card icon")
|
||||
logging.info("- Adding SD Card icon")
|
||||
shutil.copy(self.constants.icon_path_sd, mount_path)
|
||||
elif ssd_type is True:
|
||||
print("- Adding SSD icon")
|
||||
logging.info("- Adding SSD icon")
|
||||
shutil.copy(self.constants.icon_path_ssd, mount_path)
|
||||
elif disk_type == "USB":
|
||||
print("- Adding External USB Drive icon")
|
||||
logging.info("- Adding External USB Drive icon")
|
||||
shutil.copy(self.constants.icon_path_external, mount_path)
|
||||
else:
|
||||
print("- Adding Internal Drive icon")
|
||||
logging.info("- Adding Internal Drive icon")
|
||||
shutil.copy(self.constants.icon_path_internal, mount_path)
|
||||
|
||||
print("- Cleaning install location")
|
||||
logging.info("- Cleaning install location")
|
||||
if not self.constants.recovery_status:
|
||||
print("- Unmounting EFI partition")
|
||||
logging.info("- Unmounting EFI partition")
|
||||
subprocess.run(["diskutil", "umount", mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
print("- OpenCore transfer complete")
|
||||
logging.info("- OpenCore transfer complete")
|
||||
if self.constants.gui_mode is False:
|
||||
print("\nPress [Enter] to continue.\n")
|
||||
logging.info("\nPress [Enter] to continue.\n")
|
||||
input()
|
||||
else:
|
||||
if self.constants.gui_mode is False:
|
||||
tui_helpers.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!"]).start()
|
||||
else:
|
||||
print("EFI failed to mount!")
|
||||
logging.info("EFI failed to mount!")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -1,483 +0,0 @@
|
||||
# Creates a macOS Installer
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import subprocess
|
||||
import requests
|
||||
import tempfile
|
||||
from resources import utilities, tui_helpers
|
||||
|
||||
def list_local_macOS_installers():
|
||||
# Finds all applicable macOS installers
|
||||
# within a user's /Applications folder
|
||||
# Returns a list of installers
|
||||
application_list = {}
|
||||
|
||||
for application in Path("/Applications").iterdir():
|
||||
# Verify whether application has createinstallmedia
|
||||
try:
|
||||
if (Path("/Applications") / Path(application) / Path("Contents/Resources/createinstallmedia")).exists():
|
||||
plist = plistlib.load((Path("/Applications") / Path(application) / Path("Contents/Info.plist")).open("rb"))
|
||||
try:
|
||||
# Doesn't reflect true OS build, but best to report SDK in the event multiple installers are found with same version
|
||||
app_version = plist["DTPlatformVersion"]
|
||||
clean_name = plist["CFBundleDisplayName"]
|
||||
try:
|
||||
app_sdk = plist["DTSDKBuild"]
|
||||
except KeyError:
|
||||
app_sdk = "Unknown"
|
||||
|
||||
# app_version can sometimes report GM instead of the actual version
|
||||
# This is a workaround to get the actual version
|
||||
if app_version.startswith("GM"):
|
||||
try:
|
||||
app_version = int(app_sdk[:2])
|
||||
if app_version < 20:
|
||||
app_version = f"10.{app_version - 4}"
|
||||
else:
|
||||
app_version = f"{app_version - 9}.0"
|
||||
except ValueError:
|
||||
app_version = "Unknown"
|
||||
# Check if App Version is High Sierra or newer
|
||||
can_add = False
|
||||
if app_version.startswith("10."):
|
||||
app_sub_version = app_version.split(".")[1]
|
||||
if int(app_sub_version) >= 13:
|
||||
can_add = True
|
||||
else:
|
||||
can_add = False
|
||||
else:
|
||||
can_add = True
|
||||
|
||||
# Check SharedSupport.dmg's data
|
||||
results = parse_sharedsupport_version(Path("/Applications") / Path(application)/ Path("Contents/SharedSupport/SharedSupport.dmg"))
|
||||
if results[0] is not None:
|
||||
app_sdk = results[0]
|
||||
if results[1] is not None:
|
||||
app_version = results[1]
|
||||
|
||||
if can_add is True:
|
||||
application_list.update({
|
||||
application: {
|
||||
"Short Name": clean_name,
|
||||
"Version": app_version,
|
||||
"Build": app_sdk,
|
||||
"Path": application,
|
||||
}
|
||||
})
|
||||
except KeyError:
|
||||
pass
|
||||
except PermissionError:
|
||||
pass
|
||||
# Sort Applications by version
|
||||
application_list = {k: v for k, v in sorted(application_list.items(), key=lambda item: item[1]["Version"])}
|
||||
return application_list
|
||||
|
||||
def parse_sharedsupport_version(sharedsupport_path):
|
||||
detected_build = None
|
||||
detected_os = None
|
||||
sharedsupport_path = Path(sharedsupport_path)
|
||||
|
||||
if not sharedsupport_path.exists():
|
||||
return (detected_build, detected_os)
|
||||
|
||||
if not sharedsupport_path.name.endswith(".dmg"):
|
||||
return (detected_build, detected_os)
|
||||
|
||||
|
||||
# Create temporary directory to extract SharedSupport.dmg to
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
output = subprocess.run(
|
||||
[
|
||||
"hdiutil", "attach", "-noverify", sharedsupport_path,
|
||||
"-mountpoint", tmpdir,
|
||||
"-nobrowse",
|
||||
],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
if output.returncode != 0:
|
||||
return (detected_build, detected_os)
|
||||
|
||||
ss_info = Path("SFR/com_apple_MobileAsset_SFRSoftwareUpdate/com_apple_MobileAsset_SFRSoftwareUpdate.xml")
|
||||
|
||||
if Path(tmpdir / ss_info).exists():
|
||||
plist = plistlib.load((tmpdir / ss_info).open("rb"))
|
||||
if "Build" in plist["Assets"][0]:
|
||||
detected_build = plist["Assets"][0]["Build"]
|
||||
if "OSVersion" in plist["Assets"][0]:
|
||||
detected_os = plist["Assets"][0]["OSVersion"]
|
||||
|
||||
# Unmount SharedSupport.dmg
|
||||
output = subprocess.run(["hdiutil", "detach", tmpdir], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
return (detected_build, detected_os)
|
||||
|
||||
|
||||
def create_installer(installer_path, volume_name):
|
||||
# Creates a macOS installer
|
||||
# Takes a path to the installer and the Volume
|
||||
# Returns boolean on success status
|
||||
|
||||
createinstallmedia_path = Path("/Applications") / Path(installer_path) / Path("Contents/Resources/createinstallmedia")
|
||||
|
||||
# Sanity check in the event the user somehow deleted it between the time we found it and now
|
||||
if (createinstallmedia_path).exists():
|
||||
utilities.cls()
|
||||
utilities.header(["Starting createinstallmedia"])
|
||||
print("This will take some time, recommend making some coffee while you wait\n")
|
||||
utilities.elevated([createinstallmedia_path, "--volume", f"/Volumes/{volume_name}", "--nointeraction"])
|
||||
return True
|
||||
else:
|
||||
print("- Failed to find createinstallmedia")
|
||||
return False
|
||||
|
||||
def download_install_assistant(download_path, ia_link):
|
||||
# Downloads InstallAssistant.pkg
|
||||
if utilities.download_file(ia_link, (Path(download_path) / Path("InstallAssistant.pkg"))):
|
||||
return True
|
||||
return False
|
||||
|
||||
def install_macOS_installer(download_path):
|
||||
print("- Extracting macOS installer from InstallAssistant.pkg\n This may take some time")
|
||||
args = [
|
||||
"osascript",
|
||||
"-e",
|
||||
f'''do shell script "installer -pkg {Path(download_path)}/InstallAssistant.pkg -target /"'''
|
||||
' with prompt "OpenCore Legacy Patcher needs administrator privileges to add InstallAssistant."'
|
||||
" with administrator privileges"
|
||||
" without altering line endings",
|
||||
]
|
||||
|
||||
result = subprocess.run(args,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if result.returncode == 0:
|
||||
print("- InstallAssistant installed")
|
||||
return True
|
||||
else:
|
||||
print("- Failed to install InstallAssistant")
|
||||
print(f" Error Code: {result.returncode}")
|
||||
return False
|
||||
|
||||
def list_downloadable_macOS_installers(download_path, catalog):
|
||||
available_apps = {}
|
||||
if catalog == "DeveloperSeed":
|
||||
link = "https://swscan.apple.com/content/catalogs/others/index-13seed-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
|
||||
elif catalog == "PublicSeed":
|
||||
link = "https://swscan.apple.com/content/catalogs/others/index-13beta-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
|
||||
else:
|
||||
link = "https://swscan.apple.com/content/catalogs/others/index-13-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
|
||||
|
||||
if utilities.verify_network_connection(link) is True:
|
||||
try:
|
||||
catalog_plist = plistlib.loads(utilities.SESSION.get(link).content)
|
||||
except plistlib.InvalidFileException:
|
||||
return available_apps
|
||||
|
||||
for item in catalog_plist["Products"]:
|
||||
try:
|
||||
# Check if entry has SharedSupport and BuildManifest
|
||||
# Ensures only Big Sur and newer Installers are listed
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["SharedSupport"]
|
||||
catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["BuildManifest"]
|
||||
|
||||
for bm_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "Info.plist" in bm_package["URL"] and "InstallInfo.plist" not in bm_package["URL"]:
|
||||
try:
|
||||
build_plist = plistlib.loads(utilities.SESSION.get(bm_package["URL"]).content)
|
||||
except plistlib.InvalidFileException:
|
||||
continue
|
||||
# Ensure Apple Silicon specific Installers are not listed
|
||||
if "VMM-x86_64" not in build_plist["MobileAssetProperties"]["SupportedDeviceModels"]:
|
||||
continue
|
||||
version = build_plist["MobileAssetProperties"]["OSVersion"]
|
||||
build = build_plist["MobileAssetProperties"]["Build"]
|
||||
try:
|
||||
catalog_url = build_plist["MobileAssetProperties"]["BridgeVersionInfo"]["CatalogURL"]
|
||||
if "beta" in catalog_url:
|
||||
catalog_url = "PublicSeed"
|
||||
elif "customerseed" in catalog_url:
|
||||
catalog_url = "CustomerSeed"
|
||||
elif "seed" in catalog_url:
|
||||
catalog_url = "DeveloperSeed"
|
||||
else:
|
||||
catalog_url = "Public"
|
||||
except KeyError:
|
||||
# Assume Public if no catalog URL is found
|
||||
catalog_url = "Public"
|
||||
for ia_package in catalog_plist["Products"][item]["Packages"]:
|
||||
if "InstallAssistant.pkg" in ia_package["URL"]:
|
||||
download_link = ia_package["URL"]
|
||||
size = ia_package["Size"]
|
||||
integrity = ia_package["IntegrityDataURL"]
|
||||
|
||||
available_apps.update({
|
||||
item: {
|
||||
"Version": version,
|
||||
"Build": build,
|
||||
"Link": download_link,
|
||||
"Size": size,
|
||||
"integrity": integrity,
|
||||
"Source": "Apple Inc.",
|
||||
"Variant": catalog_url,
|
||||
}
|
||||
})
|
||||
except KeyError:
|
||||
pass
|
||||
available_apps = {k: v for k, v in sorted(available_apps.items(), key=lambda x: x[1]['Version'])}
|
||||
return available_apps
|
||||
|
||||
def only_list_newest_installers(available_apps):
|
||||
# Takes a dictionary of available installers
|
||||
# Returns a dictionary of only the newest installers
|
||||
# This is used to avoid overwhelming the user with installer options
|
||||
|
||||
# Only strip OSes that we know are supported
|
||||
supported_versions = ["10.13", "10.14", "10.15", "11", "12", "13"]
|
||||
|
||||
for version in supported_versions:
|
||||
remote_version_minor = 0
|
||||
remote_version_security = 0
|
||||
os_builds = []
|
||||
|
||||
# First determine the largest version
|
||||
for ia in available_apps:
|
||||
if available_apps[ia]["Version"].startswith(version):
|
||||
if available_apps[ia]["Variant"] not in ["CustomerSeed", "DeveloperSeed", "PublicSeed"]:
|
||||
remote_version = available_apps[ia]["Version"].split(".")
|
||||
if remote_version[0] == "10":
|
||||
remote_version.pop(0)
|
||||
remote_version.pop(0)
|
||||
else:
|
||||
remote_version.pop(0)
|
||||
if int(remote_version[0]) > remote_version_minor:
|
||||
remote_version_minor = int(remote_version[0])
|
||||
remote_version_security = 0 # Reset as new minor version found
|
||||
if len(remote_version) > 1:
|
||||
if int(remote_version[1]) > remote_version_security:
|
||||
remote_version_security = int(remote_version[1])
|
||||
|
||||
# Now remove all versions that are not the largest
|
||||
for ia in list(available_apps):
|
||||
# Don't use Beta builds to determine latest version
|
||||
if available_apps[ia]["Variant"] in ["CustomerSeed", "DeveloperSeed", "PublicSeed"]:
|
||||
continue
|
||||
|
||||
if available_apps[ia]["Version"].startswith(version):
|
||||
remote_version = available_apps[ia]["Version"].split(".")
|
||||
if remote_version[0] == "10":
|
||||
remote_version.pop(0)
|
||||
remote_version.pop(0)
|
||||
else:
|
||||
remote_version.pop(0)
|
||||
if int(remote_version[0]) < remote_version_minor:
|
||||
available_apps.pop(ia)
|
||||
continue
|
||||
if int(remote_version[0]) == remote_version_minor:
|
||||
if len(remote_version) > 1:
|
||||
if int(remote_version[1]) < remote_version_security:
|
||||
available_apps.pop(ia)
|
||||
continue
|
||||
else:
|
||||
if remote_version_security > 0:
|
||||
available_apps.pop(ia)
|
||||
continue
|
||||
|
||||
# Remove duplicate builds
|
||||
# ex. macOS 12.5.1 has 2 builds in the Software Update Catalog
|
||||
# ref: https://twitter.com/classicii_mrmac/status/1560357471654379522
|
||||
if available_apps[ia]["Build"] in os_builds:
|
||||
available_apps.pop(ia)
|
||||
continue
|
||||
|
||||
os_builds.append(available_apps[ia]["Build"])
|
||||
|
||||
# Final passthrough
|
||||
# Remove Betas if there's a non-beta version available
|
||||
for ia in list(available_apps):
|
||||
if available_apps[ia]["Variant"] in ["CustomerSeed", "DeveloperSeed", "PublicSeed"]:
|
||||
for ia2 in available_apps:
|
||||
if available_apps[ia2]["Version"].split(".")[0] == available_apps[ia]["Version"].split(".")[0] and available_apps[ia2]["Variant"] not in ["CustomerSeed", "DeveloperSeed", "PublicSeed"]:
|
||||
available_apps.pop(ia)
|
||||
break
|
||||
|
||||
return available_apps
|
||||
|
||||
def format_drive(disk_id):
|
||||
# Formats a disk for macOS install
|
||||
# Takes a disk ID
|
||||
# Returns boolean on success status
|
||||
header = f"# Formatting disk{disk_id} for macOS installer #"
|
||||
box_length = len(header)
|
||||
utilities.cls()
|
||||
print("#" * box_length)
|
||||
print(header)
|
||||
print("#" * box_length)
|
||||
print("")
|
||||
#print(f"- Formatting disk{disk_id} for macOS installer")
|
||||
format_process = utilities.elevated(["diskutil", "eraseDisk", "HFS+", "OCLP-Installer", f"disk{disk_id}"])
|
||||
if format_process.returncode == 0:
|
||||
print("- Disk formatted")
|
||||
return True
|
||||
else:
|
||||
print("- Failed to format disk")
|
||||
print(f" Error Code: {format_process.returncode}")
|
||||
input("\nPress Enter to exit")
|
||||
return False
|
||||
|
||||
def select_disk_to_format():
|
||||
utilities.cls()
|
||||
utilities.header(["Installing OpenCore to Drive"])
|
||||
|
||||
print("\nDisk picker is loading...")
|
||||
|
||||
all_disks = {}
|
||||
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
|
||||
try:
|
||||
# High Sierra and newer
|
||||
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
except ValueError:
|
||||
# Sierra and older
|
||||
disks = plistlib.loads(subprocess.run("diskutil list -plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
for disk in disks["AllDisksAndPartitions"]:
|
||||
disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
try:
|
||||
all_disks[disk["DeviceIdentifier"]] = {"identifier": disk_info["DeviceNode"], "name": disk_info["MediaName"], "size": disk_info["TotalSize"], "removable": disk_info["Internal"], "partitions": {}}
|
||||
except KeyError:
|
||||
# Avoid crashing with CDs installed
|
||||
continue
|
||||
menu = tui_helpers.TUIMenu(
|
||||
["Select Disk to write the macOS Installer onto"],
|
||||
"Please select the disk you would like to install OpenCore to: ",
|
||||
in_between=["Missing drives? Verify they are 14GB+ and external (ie. USB)", "", "Ensure all data is backed up on selected drive, entire drive will be erased!"],
|
||||
return_number_instead_of_direct_call=True,
|
||||
loop=True,
|
||||
)
|
||||
for disk in all_disks:
|
||||
# Strip disks that are under 14GB (15,032,385,536 bytes)
|
||||
# createinstallmedia isn't great at detecting if a disk has enough space
|
||||
if not any(all_disks[disk]['size'] > 15032385536 for partition in all_disks[disk]):
|
||||
continue
|
||||
# Strip internal disks as well (avoid user formatting their SSD/HDD)
|
||||
# Ensure user doesn't format their boot drive
|
||||
if not any(all_disks[disk]['removable'] is False for partition in all_disks[disk]):
|
||||
continue
|
||||
menu.add_menu_option(f"{disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})", key=disk[4:])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
if response == -1:
|
||||
return None
|
||||
|
||||
return response
|
||||
|
||||
|
||||
|
||||
def list_disk_to_format():
|
||||
all_disks = {}
|
||||
list_disks = {}
|
||||
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
|
||||
try:
|
||||
# High Sierra and newer
|
||||
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
except ValueError:
|
||||
# Sierra and older
|
||||
disks = plistlib.loads(subprocess.run("diskutil list -plist".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
for disk in disks["AllDisksAndPartitions"]:
|
||||
disk_info = plistlib.loads(subprocess.run(f"diskutil info -plist {disk['DeviceIdentifier']}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
try:
|
||||
all_disks[disk["DeviceIdentifier"]] = {"identifier": disk_info["DeviceNode"], "name": disk_info["MediaName"], "size": disk_info["TotalSize"], "removable": disk_info["Internal"], "partitions": {}}
|
||||
except KeyError:
|
||||
# Avoid crashing with CDs installed
|
||||
continue
|
||||
for disk in all_disks:
|
||||
# Strip disks that are under 14GB (15,032,385,536 bytes)
|
||||
# createinstallmedia isn't great at detecting if a disk has enough space
|
||||
if not any(all_disks[disk]['size'] > 15032385536 for partition in all_disks[disk]):
|
||||
continue
|
||||
# Strip internal disks as well (avoid user formatting their SSD/HDD)
|
||||
# Ensure user doesn't format their boot drive
|
||||
if not any(all_disks[disk]['removable'] is False for partition in all_disks[disk]):
|
||||
continue
|
||||
print(f"disk {disk}: {all_disks[disk]['name']} ({utilities.human_fmt(all_disks[disk]['size'])})")
|
||||
list_disks.update({
|
||||
disk: {
|
||||
"identifier": all_disks[disk]["identifier"],
|
||||
"name": all_disks[disk]["name"],
|
||||
"size": all_disks[disk]["size"],
|
||||
}
|
||||
})
|
||||
return list_disks
|
||||
|
||||
# Create global tmp directory
|
||||
tmp_dir = tempfile.TemporaryDirectory()
|
||||
|
||||
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
|
||||
# - Run createinstallmedia on provided disk
|
||||
# Implementing this into a single installer.sh script allows us to only call
|
||||
# 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)
|
||||
args = ["cp", "-cR", installer_path, ia_tmp]
|
||||
if utilities.check_filesystem_type() != "apfs":
|
||||
# HFS+ disks do not support CoW
|
||||
args[1] = "-R"
|
||||
# Ensure we have enough space for the duplication
|
||||
space_available = utilities.get_free_space()
|
||||
space_needed = Path(ia_tmp).stat().st_size
|
||||
if space_available < space_needed:
|
||||
print("Not enough free space to create installer.sh")
|
||||
print(f"{utilities.human_fmt(space_available)} available, {utilities.human_fmt(space_needed)} required")
|
||||
return False
|
||||
subprocess.run(args)
|
||||
|
||||
# Adjust installer_path to point to the copied installer
|
||||
installer_path = Path(ia_tmp) / Path(Path(installer_path).name)
|
||||
if not Path(installer_path).exists():
|
||||
print(f"Failed to copy installer to {ia_tmp}")
|
||||
return False
|
||||
|
||||
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
|
||||
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))
|
||||
if Path(plist_path).exists():
|
||||
plist = plistlib.load(Path(plist_path).open("rb"))
|
||||
if "DTPlatformVersion" in plist:
|
||||
platform_version = plist["DTPlatformVersion"]
|
||||
platform_version = platform_version.split(".")[0]
|
||||
if platform_version[0] == "10":
|
||||
if int(platform_version[1]) < 13:
|
||||
additional_args = f" --applicationpath '{installer_path}'"
|
||||
|
||||
if script_location.exists():
|
||||
script_location.unlink()
|
||||
script_location.touch()
|
||||
|
||||
with script_location.open("w") as script:
|
||||
script.write(f'''#!/bin/bash
|
||||
erase_disk='diskutil eraseDisk HFS+ OCLP-Installer {disk}'
|
||||
if $erase_disk; then
|
||||
"{createinstallmedia_path}" --volume /Volumes/OCLP-Installer --nointeraction{additional_args}
|
||||
fi
|
||||
''')
|
||||
if Path(script_location).exists():
|
||||
return True
|
||||
return False
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user