From b25fa91962d4ca89a3f7ec2530073b198761bb39 Mon Sep 17 00:00:00 2001
From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com>
Date: Thu, 3 Dec 2020 13:42:54 -0700
Subject: [PATCH] Fix misc issues
---
CHANGELOG.md | 3 +++
README.md | 12 +++++++++++-
Resources/BuildOpenCore.py | 19 ++++++++++++++++---
payloads/Config/v0.6.3/config.plist | 4 ++--
payloads/Config/v0.6.4/config.plist | 4 ++--
5 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9fc3c881..8855e0af3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## 0.0.5
- Enable hibernation support
+- Work around USB Map failing
+- Add checks whether booting with OpenCore
+- Fix MouSSE injection
## 0.0.4
- Add basic audio support for legacy chipsets
diff --git a/README.md b/README.md
index c23f9a1e9..69dfed4ba 100644
--- a/README.md
+++ b/README.md
@@ -126,4 +126,14 @@ Once you've booted OpenCore at least once, your hardware should now auto boot it
At this time, the OpenCore Patcher won't install macOS onto the internal drive itself during installs. Instead, you'll need to either [manually transfer](https://dortania.github.io/OpenCore-Post-Install/universal/oc2hdd.html) OpenCore to the internal drive's EFI or run this patcher's Option 2 again but select your internal drive.
-Reminder that once this is done, you'll need to select OpenCore in the boot picker again for your hardware to remenber this entry and auto boot from then on.
\ No newline at end of file
+Reminder that once this is done, you'll need to select OpenCore in the boot picker again for your hardware to remenber this entry and auto boot from then on.
+
+### OpenCore won't show up in the boot picker
+
+If OpenCore refuses to show up in the boot picker even with the above troubleshooting step, you can try to disable SIP and run this command(With your EFI drive mounted):
+
+```sh
+sudo bless --verbose --file /Volumes/EFI/EFI/OC/Bootstrap/Bootstrap.efi --folder /Volumes/EFI/EFI/OC/Bootstrap --setBoot
+```
+
+* Note: NVRAM write is disabled with SIP, so disables SIP first before running
\ No newline at end of file
diff --git a/Resources/BuildOpenCore.py b/Resources/BuildOpenCore.py
index 434c4d3bd..ba9219efd 100644
--- a/Resources/BuildOpenCore.py
+++ b/Resources/BuildOpenCore.py
@@ -22,8 +22,17 @@ except NameError:
pass
# Find SMBIOS of machine
-current_model = subprocess.Popen("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE)
-current_model = [line.strip().split(": ", 1)[1] for line in current_model.stdout.read().split("\n") if line.strip().startswith("Model Identifier")][0]
+opencore_model = subprocess.Popen(["NVRAM", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product"], stdout=subprocess.PIPE).communicate()[0]
+if opencore_model not in ("NVRAM: Error getting variable - '4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product': (iokit/common) data was not found"):
+ print("Detected OpenCore machine")
+ opencore_model = subprocess.Popen("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE)
+ opencore_model = [line.strip().split(":oem-product ", 1)[1] for line in opencore_model.stdout.read().split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
+ current_model = opencore_model
+else:
+ print("No OpenCore detected")
+ current_model = subprocess.Popen("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE)
+ current_model = [line.strip().split(": ", 1)[1] for line in current_model.stdout.read().split("\n") if line.strip().startswith("Model Identifier")][0]
+ print("Current Model: %s" % current_model)
OCExist = False
@@ -71,7 +80,7 @@ def BuildEFI():
if current_model in ModelArray.SSEEmulator:
print("- Adding AAAMouSSE v%s" % Versions.mousse_version)
- copy(Versions.mousse_version, Versions.kext_path_build)
+ copy(Versions.mousse_path, Versions.kext_path_build)
Versions.plist_data = Versions.plist_data.replace(
"",
""
@@ -208,6 +217,10 @@ def BuildEFI():
print("- Adding USB Map for %s" % current_model)
copy(usb_map_path, Versions.kext_path_build)
map_name = ("USB-Map-%s.kext" % current_model)
+ Versions.plist_data = Versions.plist_data.replace(
+ "<",
+ ""
+ )
Versions.plist_data = Versions.plist_data.replace(
"USB-Map-SMBIOS.kext",
map_name
diff --git a/payloads/Config/v0.6.3/config.plist b/payloads/Config/v0.6.3/config.plist
index c31ed3da6..64c42a23b 100644
--- a/payloads/Config/v0.6.3/config.plist
+++ b/payloads/Config/v0.6.3/config.plist
@@ -448,7 +448,7 @@
Comment
USB Map
Enabled
-
+
MaxKernel
MinKernel
@@ -625,7 +625,7 @@
EnablePassword
ExposeSensitiveData
- 6
+ 15
HaltLevel
2147483648
PasswordHash
diff --git a/payloads/Config/v0.6.4/config.plist b/payloads/Config/v0.6.4/config.plist
index a5ea4e771..d4fa5775e 100644
--- a/payloads/Config/v0.6.4/config.plist
+++ b/payloads/Config/v0.6.4/config.plist
@@ -450,7 +450,7 @@
Comment
USB Map
Enabled
-
+
MaxKernel
MinKernel
@@ -629,7 +629,7 @@
EnablePassword
ExposeSensitiveData
- 6
+ 15
HaltLevel
2147483648
PasswordHash