Adjust MinKernel

This commit is contained in:
Mykola Grymalyuk
2021-07-28 16:43:17 -06:00
parent 3283cf514b
commit 9bdc5148c4
5 changed files with 233 additions and 75 deletions

View File

@@ -9,7 +9,7 @@ import platform
import argparse
from pathlib import Path
from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities
from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities, ModelExample
class OpenCoreLegacyPatcher:
@@ -212,17 +212,44 @@ If you plan to create the USB for another machine, please select the "Change Mod
def validate(self):
# Runs through ocvalidate to check for errors
valid_dumps = [
ModelExample.MacBookPro.MacBookPro92_Stock,
#ModelExample.MacBookPro.MacBookPro171_Stock,
ModelExample.iMac.iMac81_Stock,
ModelExample.iMac.iMac112_Stock,
ModelExample.MacPro.MacPro31_Stock,
ModelExample.MacPro.MacPro31_Upgrade,
ModelExample.MacPro.MacPro31_Modern_AMD,
]
self.constants.validate = True
for model in ModelArray.SupportedSMBIOS:
print(f"Validating model: {model}")
print(f"Validating predefined model: {model}")
self.constants.custom_model = model
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for model: {model}")
raise Exception(f"Validation failed for predefined model: {model}")
else:
print(f"Validation succeeded for model: {model}")
print(f"Validation succeeded for predefined model: {model}")
for model in valid_dumps:
self.constants.computer = model
self.computer = self.constants.computer
self.constants.custom_model = ""
print(f"Validating dumped model: {self.computer.real_model}")
self.build_opencore()
result = subprocess.run([self.constants.ocvalidate_path, f"{self.constants.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
print("Error on build!")
print(result.stdout.decode())
raise Exception(f"Validation failed for predefined model: {self.computer.real_model}")
else:
print(f"Validation succeeded for predefined model: {self.computer.real_model}")
OpenCoreLegacyPatcher()

View File

@@ -243,7 +243,7 @@ class BuildOpenCore:
arpt_path = "PciRoot(0x0)/Pci(0x1C,0x1)/Pci(0x0,0x0)"
print(f"- Using known DevicePath {arpt_path}")
self.config["DeviceProperties"]["Add"][arpt_path] = {"device-id": binascii.unhexlify("ba430000"), "compatible": "pci14e4,43ba"}
if not self.constants.custom_model and self.computer.wifi and self.computer.wifi.country_code:
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}")
self.config["DeviceProperties"]["Add"][arpt_path].update({"brcmfx-country": self.computer.wifi.country_code})
if self.constants.enable_wake_on_wlan is True:
@@ -264,7 +264,7 @@ class BuildOpenCore:
elif not self.constants.custom_model and self.computer.wifi:
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.computer.wifi.country_code:
if self.computer.wifi.chipset == device_probe.Broadcom.Chipsets.AirportBrcmNIC and self.constants.validate is False and self.computer.wifi.country_code:
self.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}")
if self.computer.wifi.pci_path:
@@ -670,6 +670,9 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
if self.constants.disk != "":
self.disk_type()
if self.constants.validate is False:
print("- Adding bootmgfw.efi BlessOverride")
self.config["Misc"]["BlessOverride"] += ["\\EFI\\Microsoft\\Boot\\bootmgfw.efi"]
def set_smbios(self):
spoofed_model = self.model

View File

@@ -96,6 +96,7 @@ class Constants:
self.latebloom_delay = 0
self.latebloom_range = 0
self.latebloom_debug = 0
self.validate = False
# OS Versions
self.tiger = 8
@@ -575,31 +576,31 @@ class Constants:
]
sbm_values = [
"j137",
"j680",
"j132",
"j174",
"j140k",
"j780",
"j213",
"j140a",
"j152f",
"j160",
"j230k",
"j214k",
"j223",
"j215",
"j185",
"j185f",
"j137", # iMacPro1,1
"j680", # MacBookPro15,1
"j132", # MacBookPro15,2
"j174", # Macmini8,1
"j140k", # MacBookAir8,1
"j780", # MacBookPro15,3
"j213", # MacBookPro15,4
"j140a", # MacBookAir8,2
"j152f", # MacBookPro16,1
"j160", # MacPro7,1
"j230k", # MacBookAir9,1
"j214k", # MacBookPro16,2
"j223", # MacBookPro16,3
"j215", # MacBookPro16,4
"j185", # iMac20,1
"j185f", # iMac20,2
]
sandy_board_id = [
"Mac-E43C1C25D4880AD6", # MacBookPro12,1
"Mac-06F11F11946D27C5", # MacBookPro11,5
"Mac-9F18E312C5C2BF0B", # MacBookAir7,1
"Mac-937CB26E2E02BB01", # MacBookAir7,2
"Mac-35C5E08120C7EEAF", # Macmini7,1
"Mac-7BA5B2D9E42DDD94", # iMacPro1,1
"Mac-E43C1C25D4880AD6", # MacBookPro12,1
"Mac-06F11F11946D27C5", # MacBookPro11,5
"Mac-9F18E312C5C2BF0B", # MacBookAir7,1
"Mac-937CB26E2E02BB01", # MacBookAir7,2
"Mac-35C5E08120C7EEAF", # Macmini7,1
"Mac-7BA5B2D9E42DDD94", # iMacPro1,1
]
board_id = {

164
Resources/ModelExample.py Normal file
View File

@@ -0,0 +1,164 @@
# Example Hardware probe of multiple models
# To be used when running validation tests
from Resources import device_probe
class MacBookPro:
MacBookPro92_Stock = device_probe.Computer(
real_model="MacBookPro9,2",
real_board_id="Mac-6F01561E16C75D06",
reported_model="MacBookPro9,2",
reported_board_id="Mac-6F01561E16C75D06",
gpus=[device_probe.Intel(vendor_id=32902, device_id=358, class_code=196608, name="IGPU", model="Intel HD Graphics 4000", pci_path="PciRoot(0x0)/Pci(0x2,0x0)")],
igpu=device_probe.Intel(vendor_id=32902, device_id=358, class_code=196608, name="IGPU", model="Intel HD Graphics 4000", pci_path="PciRoot(0x0)/Pci(0x2,0x0)"),
dgpu=None,
storage=[device_probe.SATAController(vendor_id=32902, device_id=7683, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17201, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name='Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz',
flags=['FPU', 'VME', 'DE', 'PSE', 'TSC', 'MSR', 'PAE', 'MCE', 'CX8', 'APIC', 'SEP', 'MTRR', 'PGE', 'MCA', 'CMOV', 'PAT', 'PSE36', 'CLFSH', 'DS', 'ACPI', 'MMX', 'FXSR', 'SSE', 'SSE2', 'SS', 'HTT', 'TM', 'PBE', 'SSE3', 'PCLMULQDQ', 'DTES64', 'MON', 'DSCPL', 'VMX', 'EST', 'TM2', 'SSSE3', 'CX16', 'TPR', 'PDCM', 'SSE4.1', 'SSE4.2', 'x2APIC', 'POPCNT', 'AES', 'PCID', 'XSAVE', 'OSXSAVE', 'TSCTMR', 'AVX1.0', 'RDRAND', 'F16C']
),
oclp_version=None,
opencore_version=None,
)
MacBookPro171_Stock = device_probe.Computer(
real_model="MacBookPro17,1",
real_board_id="J293",
reported_model="MacBookPro17,1",
reported_board_id="J293",
gpus=[device_probe.AMD(vendor_id=4098, device_id=26640, class_code=196608, name="display", model="Unknown Unknown", pci_path="")],
igpu=None,
dgpu=None,
storage=[],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17445, class_code=163840, name="wlan", model=None, pci_path=""),
cpu=device_probe.CPU(
name="Apple M1",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "PCLMULQDQ", "DTSE64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "AES", "SEGLIM64"],
),
oclp_version=None,
opencore_version=None,
)
class iMac:
iMac81_Stock = device_probe.Computer(
# Stock Model
real_model="iMac8,1",
real_board_id="Mac-F226BEC8",
reported_model="iMac8,1",
reported_board_id="Mac-F226BEC8",
gpus=[
device_probe.AMD(vendor_id=4098, device_id=38088, class_code=196608, name="GFX0", model="ATI Radeon HD 2400", pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)")
],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=38088, class_code=196608, name="GFX0", model="ATI Radeon HD 2400", pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=10281, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")
],
wifi=device_probe.Broadcom(vendor_id=5348, device_id=17192, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x4)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Core(TM)2 Duo CPU E8135 @ 2.40GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1"]
),
oclp_version=None,
opencore_version=None,
)
iMac112_Stock = device_probe.Computer(
# Stock Model
real_model="iMac11,2",
real_board_id="Mac-F2238AC8",
reported_model="iMac11,2",
reported_board_id="Mac-F2238AC8",
gpus=[
device_probe.AMD(vendor_id=4098, device_id=38024, class_code=196608, name="GFX0", model="ATI Radeon HD 4670", pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)")
],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=38024, class_code=196608, name="GFX0", model="ATI Radeon HD 4670", pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=15138, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")
],
wifi=device_probe.Atheros(vendor_id=5772, device_id=42, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x1)/Pci(0x0,0x0)"),
cpu=device_probe.CPU(
name="Intel(R) Core(TM) i3 CPU 540 @ 3.07GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "POPCNT", "PCID"]
),
oclp_version=None,
opencore_version=None
)
class MacPro:
MacPro31_Stock = device_probe.Computer(
# Stock Model, stock TS1 GPU and no Wifi card
real_model="MacPro3,1",
real_board_id="Mac-F42C88C8",
reported_model="MacPro3,1",
reported_board_id="Mac-F42C88C8",
gpus=[
device_probe.AMD(vendor_id=4098, device_id=38272, class_code=196608, name="GFX0", model="ATI Radeon HD 2600", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)")
],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=38272, class_code=196608, name="GFX0", model="ATI Radeon HD 2600", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=9857, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")
],
wifi=None,
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU X5482 @ 3.20GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1"],
),
oclp_version=None,
opencore_version=None,
)
MacPro31_Upgrade = device_probe.Computer(
# Upgraded Model, TS2 GPU and El-Capitan era Wifi card
real_model="MacPro3,1",
real_board_id="Mac-F42C88C8",
reported_model="MacPro3,1",
reported_board_id="Mac-F42C88C8",
gpus=[
device_probe.AMD(vendor_id=4098, device_id=26808, class_code=196608, name="GFX0", model="ATI Radeon HD 5770", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)")
],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=26808, class_code=196608, name="GFX0", model="ATI Radeon HD 5770", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=9857, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")
],
wifi=device_probe.Broadcom(
vendor_id=5348, device_id=17192, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)"
),
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU X5482 @ 3.20GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1"],
),
oclp_version=None,
opencore_version=None,
)
MacPro31_Modern_AMD = device_probe.Computer(
# Upgraded Model, Polaris GPU and BCM94360CD
real_model="MacPro3,1",
real_board_id="Mac-F42C88C8",
reported_model="MacPro3,1",
reported_board_id="Mac-F42C88C8",
gpus=[
device_probe.AMD(vendor_id=4098, device_id=26591, class_code=196608, name="GFX0", model="Radeon RX 470/570", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)")
],
igpu=None,
dgpu=device_probe.AMD(vendor_id=4098, device_id=26591, class_code=196608, name="GFX0", model="Radeon RX 470/570", pci_path="PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)"),
storage=[
device_probe.SATAController(vendor_id=32902, device_id=9857, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)")
],
wifi=device_probe.Broadcom(
vendor_id=5348, device_id=17312, class_code=163840, name="ARPT", model=None, pci_path="PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)"
),
cpu=device_probe.CPU(
name="Intel(R) Xeon(R) CPU X5482 @ 3.20GHz",
flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "DTES64", "MON", "DSCPL", "VMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1"],
),
oclp_version=None,
opencore_version=None,
)

View File

@@ -242,7 +242,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>10.0.0</string>
<key>BundlePath</key>
<string>Lilu.kext</string>
<key>ExecutablePath</key>
@@ -278,7 +278,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>10.0.0</string>
<key>BundlePath</key>
<string>WhateverGreen.kext</string>
<key>ExecutablePath</key>
@@ -296,7 +296,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>12.0.0</string>
<key>BundlePath</key>
<string>RestrictEvents.kext</string>
<key>ExecutablePath</key>
@@ -314,7 +314,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>16.0.0</string>
<key>BundlePath</key>
<string>AAAMouSSE.kext</string>
<key>ExecutablePath</key>
@@ -592,42 +592,6 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>AppleBacklightFixup - Modded Nvidia GPUs</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>BundlePath</key>
<string>AppleBacklightFixup.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/AppleBacklightFixup</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>Comment</key>
<string>NightShiftEnabler</string>
<key>Enabled</key>
<false/>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>BundlePath</key>
<string>NightShiftEnabler.kext</string>
<key>ExecutablePath</key>
<string>Contents/MacOS/NightShiftEnabler</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
@@ -638,7 +602,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>15.0.0</string>
<key>BundlePath</key>
<string>CPUFriend.kext</string>
<key>ExecutablePath</key>
@@ -656,7 +620,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>15.0.0</string>
<key>BundlePath</key>
<string>CPUFriendDataProvider.kext</string>
<key>ExecutablePath</key>
@@ -764,7 +728,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>12.0.0</string>
<key>BundlePath</key>
<string>CpuTscSync.kext</string>
<key>ExecutablePath</key>
@@ -782,7 +746,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>14.0.0</string>
<key>BundlePath</key>
<string>HibernationFixup.kext</string>
<key>ExecutablePath</key>
@@ -800,7 +764,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>18.0.0</string>
<key>BundlePath</key>
<string>NVMeFix.kext</string>
<key>ExecutablePath</key>
@@ -948,7 +912,7 @@
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<string>12.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
@@ -1110,7 +1074,6 @@
<dict>
<key>BlessOverride</key>
<array>
<string>\EFI\Microsoft\Boot\bootmgfw.efi</string>
</array>
<key>Boot</key>
<dict>