diff --git a/CHANGELOG.md b/CHANGELOG.md index bf6c9ca7a..12c185fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - Fix CPU Speed reporting - Increment binaries - OpenCore c92bcb7 (0.6.8 rolling - 2021-03-20) -- Add El Capitan and newer .app support +- Add Mavericks and newer .app support - Refactor USB map building, fixes USB 3.0 displaying as USB 2.0 ## 0.0.18 diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 280ea9c02..32803381e 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -19,8 +19,7 @@ class OpenCoreLegacyPatcher(): else: self.current_model = subprocess.run("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.current_model = [line.strip().split(": ", 1)[1] for line in self.current_model.stdout.decode().split("\n") if line.strip().startswith("Model Identifier")][0] - self.constants.detected_os, _, _ = platform.mac_ver() - self.constants.detected_os = float('.'.join(self.constants.detected_os.split('.')[:2])) + self.constants.detected_os = int(platform.uname().release.partition(".")[0]) if self.current_model in ModelArray.NoAPFSsupport: self.constants.serial_settings = "Moderate" diff --git a/README.md b/README.md index b7fbeb749..06eb5589a 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ -A python program for building and booting [OpenCore](https://github.com/acidanthera/OpenCorePkg) on legacy Macs, see [Supported SMBIOS](https://dortania.github.io/OpenCore-Legacy-Patcher/MODELS.html) on whether your model is supported. Designed around Big Sur support. +A python program for building and booting [OpenCore](https://github.com/acidanthera/OpenCorePkg) on legacy Macs, see [Supported SMBIOS](https://dortania.github.io/OpenCore-Legacy-Patcher/MODELS.html) on whether your model is supported. Designed around Big Sur support, however can be used on older OSes. -* Application supports running on macOS El Capitan and newer +* Application supports running on macOS Mavericks (10.9) and newer Supported features: diff --git a/Resources/Constants.py b/Resources/Constants.py index f12dd7b12..0f2e04d3e 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -57,7 +57,7 @@ class Constants: self.vault = False self.sip_status = True self.secure_status = True - self.detected_os = 0.0 + self.detected_os = 0 # Payload Location # OpenCore diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index 0a074f8de..d120fc090 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -233,8 +233,8 @@ class PatchSysVolume: print("Root Patching not required for this machine!") elif self.model not in ModelArray.SupportedSMBIOS: print("Cannot run on this machine, model is unsupported!") - elif self.constants.detected_os < 10.16: - print(f"Cannot run on this OS: {self.constants.detected_os}") + elif self.constants.detected_os < 20: + print(f"Cannot run on this OS! Kernel detected: {self.constants.detected_os}") else: self.check_status() utilities.cls() @@ -262,8 +262,8 @@ class PatchSysVolume: def start_unpatch(self): if self.constants.custom_model is not None: print("Unpatching must be done on target machine!") - elif self.constants.detected_os < 10.16: - print(f"Cannot run on this OS: {self.constants.detected_os}") + elif self.constants.detected_os < 20: + print(f"Cannot run on this OS! Kernel detected: {self.constants.detected_os}") else: self.check_status() utilities.cls() diff --git a/Resources/build.py b/Resources/build.py index cdca49c3e..ddb288f2a 100644 --- a/Resources/build.py +++ b/Resources/build.py @@ -96,8 +96,12 @@ class BuildOpenCore: # WiFi patches # TODO: -a is not supported in Lion and older, need to add proper fix - wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) - wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")] + try: + wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) + wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")] + except ValueError: + wifi_devices = "" + print("- Couldn't run Wifi hardware detection") if self.constants.wifi_build is True: print("- Skipping Wifi patches on request") elif not self.constants.custom_model and wifi_devices and self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4]) in ModelArray.nativeWifi: @@ -132,7 +136,7 @@ class BuildOpenCore: self.get_kext_by_bundle_path("IO80211Mojave.kext/Contents/PlugIns/AirPortBrcm4331.kext")["Enabled"] = True # CPUFriend - pp_map_path = Path(self.constants.current_path) / Path(f"payloads/Kexts/PlatformPlugin/{self.model}/Info.plist") + pp_map_path = Path(self.constants.current_path) / Path(f"payloads/Kexts/Plists/PlatformPlugin/{self.model}/Info.plist") if self.model in ModelArray.X86PP: Path(self.constants.pp_kext_folder).mkdir() Path(self.constants.pp_contents_folder).mkdir() @@ -150,7 +154,7 @@ class BuildOpenCore: self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True # USB Map - usb_map_path = Path(self.constants.current_path) / Path(f"payloads/Kexts/Maps/Universal/Info.plist") + usb_map_path = Path(self.constants.current_path) / Path(f"payloads/Kexts/Plists/AppleUSBMaps/Info.plist") if usb_map_path.exists(): print(f"- Adding USB-Map.kext") Path(self.constants.map_kext_folder).mkdir() @@ -163,6 +167,10 @@ class BuildOpenCore: print("- Adding dual GPU patch") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera" + if self.model == "MacBookPro9,1": + print("- Adding dual GPU patch for MacBookPro9,1") + self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=vit9696" + # HiDPI OpenCanopy and FileVault if self.model in ModelArray.HiDPIpicker: print("- Setting HiDPI picker") @@ -337,7 +345,7 @@ class BuildOpenCore: self.config["PlatformInfo"]["UpdateDataHub"] = True self.config["PlatformInfo"]["UpdateNVRAM"] = True self.config["UEFI"]["ProtocolOverrides"]["DataHub"] = True - self.config["PlatformInfo"]["Generic"]["ROM"] = binascii.unhexlify("112233445566") + self.config["PlatformInfo"]["Generic"]["ROM"] = binascii.unhexlify("0016CB445566") self.config["PlatformInfo"]["Generic"]["SystemProductName"] = self.spoofed_model self.config["PlatformInfo"]["Generic"]["SystemSerialNumber"] = macserial_output[0] self.config["PlatformInfo"]["Generic"]["MLB"] = macserial_output[1] @@ -455,7 +463,7 @@ Please build OpenCore first!""" print("\nDisk picker is loading...") all_disks = {} - # TODO: AllDisksAndPartitions is not supported in Yosemite(?) and older + # TODO: AllDisksAndPartitions is not supported in Mountain Lion(?) and older try: # High Sierra and newer disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) @@ -516,6 +524,7 @@ Please build OpenCore first!""" if response == -1: return + # TODO: Apple Script fails in Yosemite(?) and older args = [ "osascript", "-e", @@ -525,7 +534,10 @@ Please build OpenCore first!""" " without altering line endings", ] - result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if self.constants.detected_os > 14: # Yosemite's kernel + result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + result = subprocess.run(f"diskutil mount {disk_identifier}s{response}".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.returncode != 0: if "execution error" in result.stderr.decode() and result.stderr.decode().strip()[-5:-1] == "-128": diff --git a/payloads/Kexts/Maps/Universal/Info.plist b/payloads/Kexts/Plists/AppleUSBMaps/Info.plist similarity index 100% rename from payloads/Kexts/Maps/Universal/Info.plist rename to payloads/Kexts/Plists/AppleUSBMaps/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookAir5,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookAir5,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookAir5,1/MacBookAir5,1.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,1/MacBookAir5,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookAir5,1/MacBookAir5,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,1/MacBookAir5,1.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookAir5,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookAir5,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookAir5,2/MacBookAir5,2.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,2/MacBookAir5,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookAir5,2/MacBookAir5,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookAir5,2/MacBookAir5,2.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro10,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro10,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro10,1/MacBookPro10,1.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,1/MacBookPro10,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro10,1/MacBookPro10,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,1/MacBookPro10,1.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro10,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro10,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro10,2/MacBookPro10,2.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,2/MacBookPro10,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro10,2/MacBookPro10,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro10,2/MacBookPro10,2.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro9,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro9,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro9,1/MacBookPro9,1.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,1/MacBookPro9,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro9,1/MacBookPro9,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,1/MacBookPro9,1.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro9,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro9,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/MacBookPro9,2/MacBookPro9,2.plist b/payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,2/MacBookPro9,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/MacBookPro9,2/MacBookPro9,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/MacBookPro9,2/MacBookPro9,2.plist diff --git a/payloads/Kexts/PlatformPlugin/Macmini6,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/Macmini6,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/Macmini6,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/Macmini6,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/Macmini6,1/Macmini6,1.plist b/payloads/Kexts/Plists/PlatformPlugin/Macmini6,1/Macmini6,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/Macmini6,1/Macmini6,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/Macmini6,1/Macmini6,1.plist diff --git a/payloads/Kexts/PlatformPlugin/Macmini6,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/Macmini6,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/Macmini6,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/Macmini6,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/Macmini6,2/Macmini6,2.plist b/payloads/Kexts/Plists/PlatformPlugin/Macmini6,2/Macmini6,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/Macmini6,2/Macmini6,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/Macmini6,2/Macmini6,2.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,1/iMac13,1.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,1/iMac13,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,1/iMac13,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,1/iMac13,1.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,2/iMac13,2.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,2/iMac13,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,2/iMac13,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,2/iMac13,2.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,3/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,3/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,3/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,3/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac13,3/iMac13,3.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac13,3/iMac13,3.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac13,3/iMac13,3.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac13,3/iMac13,3.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,1/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,1/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,1/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,1/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,1/iMac14,1.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,1/iMac14,1.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,1/iMac14,1.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,1/iMac14,1.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,2/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,2/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,2/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,2/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,2/iMac14,2.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,2/iMac14,2.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,2/iMac14,2.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,2/iMac14,2.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,3/Info.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,3/Info.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,3/Info.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,3/Info.plist diff --git a/payloads/Kexts/PlatformPlugin/iMac14,3/iMac14,3.plist b/payloads/Kexts/Plists/PlatformPlugin/iMac14,3/iMac14,3.plist similarity index 100% rename from payloads/Kexts/PlatformPlugin/iMac14,3/iMac14,3.plist rename to payloads/Kexts/Plists/PlatformPlugin/iMac14,3/iMac14,3.plist