Add validation checker in CLI

Currently fails due to bootstrap path, will be resolved in future
This commit is contained in:
Mykola Grymalyuk
2021-07-21 19:30:54 -06:00
parent 7fc36ac098
commit 5fefc7185e
5 changed files with 30 additions and 9 deletions
+18 -1
View File
@@ -62,6 +62,8 @@ class OpenCoreLegacyPatcher:
parser.add_argument("--terascale_2", help="Enable TeraScale 2 Acceleration", action="store_true", required=False)
#parser.add_argument("--patch_disk", action="store", help="Specifies disk to root patch", required=False)
parser.add_argument("--validate", help="Validate", action="store_true", required=False)
args = parser.parse_args()
self.constants.gui_mode = True
@@ -76,6 +78,8 @@ class OpenCoreLegacyPatcher:
if args.disk:
print(f"- Install Disk set: {args.disk}")
self.constants.disk = args.disk
if args.validate:
self.validate()
#if args.patch_disk:
# print(f"- Patch Disk set: {args.patch_disk}")
# self.constants.patch_disk = args.patch_disk
@@ -205,7 +209,20 @@ If you plan to create the USB for another machine, please select the "Change Mod
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def validate(self):
# Runs through ocvalidate to check for errors
for model in ModelArray.SupportedSMBIOS:
print(f"Validating 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}")
else:
print(f"Validation succeeded for model: {model}")
OpenCoreLegacyPatcher()
+5 -5
View File
@@ -157,7 +157,7 @@ class BuildOpenCore:
"CPUFriend.kext",
self.constants.cpufriend_version,
self.constants.cpufriend_path,
lambda: self.model not in ["iMac7,1", "Xserve2,1"] and self.constants.allow_oc_everywhere is False and self.constants.disallow_cpufriend is False,
lambda: self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False and self.constants.disallow_cpufriend is False,
),
# Ethernet patches
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: self.model in ModelArray.EthernetNvidia),
@@ -314,7 +314,7 @@ class BuildOpenCore:
# CPUFriend
pp_map_path = Path(self.constants.platform_plugin_plist_path) / Path(f"{self.model}/Info.plist")
if self.model not in ["iMac7,1", "Xserve2,1"] and self.constants.allow_oc_everywhere is False:
if self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.allow_oc_everywhere is False:
Path(self.constants.pp_kext_folder).mkdir()
Path(self.constants.pp_contents_folder).mkdir()
shutil.copy(pp_map_path, self.constants.pp_contents_folder)
@@ -341,7 +341,7 @@ class BuildOpenCore:
# USB Map
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
# iMac7,1 kernel panics with USB map installed, remove for time being until properly debugged
if usb_map_path.exists() and self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1"]:
if usb_map_path.exists() and self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"]:
print("- Adding USB-Map.kext")
Path(self.constants.map_kext_folder).mkdir()
Path(self.constants.map_contents_folder).mkdir()
@@ -749,7 +749,7 @@ class BuildOpenCore:
self.config["PlatformInfo"]["CustomMemory"] = True
# USB Map and CPUFriend Patching
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1"]:
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"]:
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
map_config = plistlib.load(Path(new_map_ls).open("rb"))
# Strip unused USB maps
@@ -769,7 +769,7 @@ class BuildOpenCore:
except KeyError:
continue
plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True)
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1"] and self.constants.disallow_cpufriend is False:
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False:
# Adjust CPU Friend Data to correct SMBIOS
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")
cpu_config = plistlib.load(Path(new_cpu_ls).open("rb"))
+6 -2
View File
@@ -13,8 +13,8 @@ from Resources import device_probe
class Constants:
def __init__(self):
self.patcher_version = "0.2.4"
self.opencore_commit = "4e0ff2d - 05-23-2021"
self.opencore_version = "0.7.0"
self.opencore_commit = "be2d9fe - 07-2-2021"
self.opencore_version = "0.7.1"
self.lilu_version = "1.5.4"
self.whatevergreen_version = "1.5.1"
self.airportbcrmfixup_version = "2.1.3"
@@ -405,6 +405,10 @@ class Constants:
def vault_path(self):
return self.payload_path / Path("Tools/CreateVault/sign.command")
@property
def ocvalidate_path(self):
return self.payload_path / Path("Tools/ocvalidate")
# Icons
@property
def app_icon_path(self):
+1 -1
View File
@@ -953,7 +953,7 @@ windows_audio = [
"iMac13,3",
]
NoAGPMSupport = ["MacBook4,1", "MacBookPro4,1", "iMac7,1", "iMac8,1", "MacPro3,1", "Xserve2,1"]
NoAGPMSupport = ["MacBook4,1", "MacBookPro4,1", "iMac7,1", "iMac8,1", "MacPro3,1", "Xserve2,1", "Dortania1,1"]
AGDPSupport = [
"MacBookPro9,1",
BIN
View File
Binary file not shown.