diff --git a/README.md b/README.md index 76882f9ba..b059e049b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,19 @@ # OpenCore Legacy Patcher +A python script for building and booting OpenCore on legacy Macs, see [Supported SMBIOS](#supported-smbios) on whether your model is supported. + +Current TO-DO's with this patcher: + +* [x] Create OpenCore EFI +* [ ] Create macOS Installer +* [ ] Install OpenCore to USB +* [ ] Install OpenCore to internal drive +* [ ] USB mapping +* [ ] Legacy GPU patches + * ie. 2011 and older +* [ ] Audio patches + * ie. 2011 and older + ## Supported SMBIOS ``` @@ -65,186 +79,3 @@ Xserve3,1 ``` -## Hardware Patches - -#### MacBook - -``` -MacBook5,1 -MacBook5,2 - Wifi Patch - BCM4322 - AppleHDA Patch - SSE4.1 Patch - Ethernet Patch - Nvidia MCP79 - GPU Patch -MacBook6,1 -MacBook7,1 - Wifi Patch - BCM43224 - AppleHDA Patch - SSE4.1 Patch - Ethernet Patch - Nvidia MCP79 - GPU Patch -``` - -#### MacBook Air - -``` -MacBookAir2,1 -MacBookAir3,1 -MacBookAir3,2 - Wifi Patch - BCM4322 - AppleHDA Patch - SSE4.1 Patch - GPU Patch -MacBookAir4,1 -MacBookAir4,2 - Wifi Patch - BCM4322 - AppleHDA Patch - GPU Patch -MacBookAir5,1 -MacBookAir5,2 - Wifi Patch - BCM4322 -``` - -#### MacBook Pro - -``` -MacBookPro3,1 - Wifi Patch - AR5418 - Ethernet Patch - Marvell - AppleHDA Patch - SSE4.1 Patch - GPU Patch -MacBookPro4,1 - Wifi Patch - BCM4328 - Ethernet Patch - Marvell - AppleHDA Patch - SSE4.1 Patch - GPU Patch -MacBookPro5,1 -MacBookPro5,2 -MacBookPro5,3 -MacBookPro5,4 -MacBookPro5,5 - Wifi Patch - BCM4322 - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -MacBookPro6,1 -MacBookPro6,2 - Wifi Patch - BCM43224 - Ethernet Patch - Broadcom - AppleHDA Patch - GPU Patch -MacBookPro7,1 - Wifi Patch - BCM4322 - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -MacBookPro8,1 -MacBookPro8,2 -MacBookPro8,3 - Wifi Patch - BCM4331 - Ethernet Patch - Broadcom - AppleHDA Patch - GPU Patch -MacBookPro9,1 -MacBookPro9,2 - Wifi Patch - BCM4331 -MacBookPro10,1 -MacBookPro10,2 - Wifi Patch - BCM4331 -``` - -#### Mac Mini - -``` -Macmini3,1 -Macmini4,1 - Wifi Patch - BCM43224 - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -Macmini5,1 -Macmini5,2 -Macmini5,3 - Wifi Patch - BCM4331 - Ethernet Patch - Broadcom - AppleHDA Patch - GPU Patch -Macmini6,1 -Macmini6,2 - Wifi Patch - BCM4331 -``` - -#### iMac - -``` -iMac7,1 -iMac8,1 - Wifi Patch - BCM4328 - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -iMac9,1 - Wifi Patch - BCM4322 - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -iMac10,1 - Wifi Patch - Atheros - Ethernet Patch - Nvidia - AppleHDA Patch - SSE4.1 Patch - GPU Patch -iMac11,1 -iMac11,2 -iMac11,3 - Wifi Patch - Atheros - Ethernet Patch - Broadcom - AppleHDA Patch - GPU Patch - CPBG SSDT -iMac12,1 -iMac12,2 - Wifi Patch - Atheros - Ethernet Patch - Broadcom - AppleHDA Patch - GPU Patch -iMac13,1 -iMac13,2 - Wifi Patch - BCM4331 -iMac14,1 -iMac14,2 -iMac14,3 - None -``` - -#### Mac Pro - -``` -MacPro3,1 - Wifi Patch - Atheros - AppleHDA Patch - SSE4.1 Patch - AppleMCEReporterDisabler for Dual Socket -MacPro4,1 - Wifi Patch - Atheros - AppleMCEReporterDisabler for Dual Socket -MacPro5,1 - Wifi patch - BCM4322 - AppleMCEReporterDisabler for Dual Socket -``` - -#### Xserve - -``` -Xserve3,1 - AppleMCEReporterDisabler for Dual Socket - -``` \ No newline at end of file diff --git a/main.py b/main.py index 663d1bd6c..cf0254d95 100755 --- a/main.py +++ b/main.py @@ -307,12 +307,41 @@ LegacyGPU = [ "iMac12,2" ] +LegacyHID = [ + "MacBook5,1", + "MacBook5,2", + "MacBook6,1", + "MacBook7,1", + "MacBookAir2,1", + "MacBookAir3,1", + "MacBookPro3,1", + "MacBookPro4,1", + "MacBookPro5,1", + "MacBookPro5,2", + "MacBookPro5,3", + "MacBookPro5,4", + "MacBookPro5,5", + "MacBookPro7,1", + "Macmini3,1", + "Macmini4,1", + "iMac7,1", + "iMac8,1", + "iMac9,1", + "iMac10,1", +] + +NVMePatch = [ + "MacPro3,1" + "MacPro4,1" + "Xserve3,1" +] + # List build versions patcher_version = "0.0.1" opencore_version = "0.6.3" lilu_version = "1.4.9" whatevergreen_version = "1.4.4" -airportbcrmfixup_path = "2.1.1" +airportbcrmfixup_version = "2.1.1" bcm570_version = "1.0.0" marvel_version = "1.0.0" nforce_version = "1.0.0" @@ -328,6 +357,13 @@ current_path = os.getcwd() # Payload Location # OpenCore opencore_path = os.path.join(current_path, "payloads/OpenCore/" "OpenCore-v%s.zip" % opencore_version) +plist_path = os.path.join(current_path, "payloads/Config/v%s/" "config.plist" % opencore_version) + +# ACPI +pci_ssdt_path = os.path.join(current_path, "payloads/ACPI/" "SSDT-CPBG.aml") + +# Drivers +nvme_driver_path = os.path.join(current_path, "payloads/Drivers/" "NvmExpressDxe.efi") # Kexts lilu_path = os.path.join(current_path, "payloads/Kexts/Acidanthera/" "Lilu-v%s.zip" % lilu_version) @@ -342,12 +378,12 @@ telemetrap_path = os.path.join(current_path, "payloads/Kexts/SSE/" "telemetrap-v io80211high_sierra_path = os.path.join(current_path, "payloads/Kexts/Wifi/" "IO80211HighSierra-v%s.zip" % io80211high_sierra_version) io80211mojave_path = os.path.join(current_path, "payloads/Kexts/Wifi/" "IO80211Mojave-v%s.zip" % io80211mojave_version) -# ACPI -pci_ssdt_path = os.path.join(current_path, "payloads/ACPI/" "SSDT-CPBG.aml") - # Build Location opencore_path_build = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s.zip" % opencore_version) +plist_path_build = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s/EFI/OC/" % opencore_version) +plist_path_build_full = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s/EFI/OC/config.plist" % opencore_version) acpi_path_build = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s/EFI/OC/ACPI" % opencore_version) +drivers_path_build = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s/EFI/OC/Drivers" % opencore_version) kext_path_build = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s/EFI/OC/Kexts" % opencore_version) opencore_path_done = os.path.join(current_path, "Build-Folder/" "OpenCore-v%s" % opencore_version) @@ -365,22 +401,27 @@ MainMenu=True while MainMenu: os.system('clear') - print("#######################################################") + print("###################################################") print(" OpenCore Legacy patcher v%s" % patcher_version) print(" Current Model: %s" % current_model) - print("#######################################################") + print("###################################################") print("") if current_model not in SupportedSMBIOS: print(" Your model is not supported by this patcher!") print("") - print(" If you plan to create the USB for another machine,") - print(" please select option 5") - print("-------------------------------------------------------") + print(" If you plan to create the USB for another machine,") + print(" please select option 5") + print("---------------------------------------------------") + print("") + elif current_model in ("MacPro3,1", "iMac7,1"): + print(" This model is supported") + print(" However please ensure the CPU have been upgraded") + print(" to support SSE4.1+") + print("---------------------------------------------------") print("") else: - pass print(" This model is supported") - print("-------------------------------------------------------") + print("---------------------------------------------------") print("") print(" 1. Build OpenCore") print(" 2. Create macOS Installer - Not yet implemented") @@ -436,9 +477,16 @@ while MainMenu: print("Deleting old copy of OpenCore folder") rmtree(opencore_path_done) print("") - print("- Adding OpenCore to build folder") + print("- Adding OpenCore v%s" % opencore_version) copy(opencore_path, build_path) zipfile.ZipFile(opencore_path_build).extractall(build_path) + + print("- Adding config.plist v%s" % opencore_version) + # Setup config.plist for editing + copy(plist_path, plist_path_build) + with open(plist_path_build_full, 'r') as file : + plist_data = file.read() + print("- Adding Lilu %s" % lilu_version) copy(lilu_path, kext_path_build) print("- Adding WhateverGreen %s" % whatevergreen_version) @@ -449,50 +497,141 @@ while MainMenu: if current_model in DualSocket: print("- Adding AppleMCEReporterDisabler v%s" % mce_version) copy(mce_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) + if current_model in SSEEmulator: print("- Adding AAAMouSSE v%s" % mousse_version) copy(mousse_version, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) if current_model in MissingSSE42: - print("- Adding Teletrap %s" % telemetrap_version) + print("- Adding telemetrap %s" % telemetrap_version) copy(telemetrap_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) # Ethernet Patches if current_model in EthernetNvidia: print("- Adding nForceEthernet v%s" % nforce_version) copy(nforce_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) if current_model in EthernetMarvell: print("- Adding MarvelYukonEthernet v%s" % marvel_version) copy(marvel_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) if current_model in EthernetBroadcom: print("- Adding CatalinaBCM5701Ethernet %s" % bcm570_version) copy(bcm570_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) # Wifi Patches if current_model in WifiAtheros: print("- Adding IO80211HighSierra v%s" % io80211high_sierra_version) copy(io80211high_sierra_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) + plist_data = plist_data.replace( + "", + "" + ) if current_model in WifiBCM94328: print("- Wifi patches currently unsupported") # TO-DO: Add El Capitan's IO80211 if current_model in WifiBCM94322: print("- Adding IO80211Mojave %s" % io80211mojave_version) copy(io80211mojave_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) + plist_data = plist_data.replace( + "", + "" + ) if current_model in WifiBCM943224: print("- Adding IO80211Mojave %s" % io80211mojave_version) copy(io80211mojave_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) + plist_data = plist_data.replace( + "", + "" + ) if current_model in WifiBCM94331: - print("- Wifi patches currently unsupported") - # TO-DO: Add Fake ID and AirportBrcmFixup for native support + print("- Adding AirportBrcmFixup and appling fake ID") + copy(airportbcrmfixup_path, kext_path_build) + plist_data = plist_data.replace( + "", + "" + ) + plist_data = plist_data.replace( + "", + "" + ) + if current_model in ("iMac13,1", "iMac13,2"): + plist_data = plist_data.replace( + "#PciRoot(0x0)/Pci(0x1C,0x1)Pci(0x0,0x0)", + "PciRoot(0x0)/Pci(0x1C,0x3)Pci(0x0,0x0)" + ) + else: + plist_data = plist_data.replace( + "#PciRoot(0x0)/Pci(0x1C,0x1)Pci(0x0,0x0)", + "PciRoot(0x0)/Pci(0x1C,0x1)Pci(0x0,0x0)" + ) # Checks for ACPI # Add SSDTs if current_model in pciSSDT: - print("- SSDT-CPBG.aml") + print("- Adding SSDT-CPBG.aml") copy(pci_ssdt_path, acpi_path_build) + plist_data = plist_data.replace( + "", + "" + ) - # Add Config.plist + # Check for Kernel Patches + if current_model in LegacyHID: + print("- Adding IOHIDFamily Patch") + copy(pci_ssdt_path, acpi_path_build) + plist_data = plist_data.replace( + "", + "" + ) + + # Check for EFI Drivers + if current_model in NVMePatch: + print("- Adding NVMe support") + copy(nvme_driver_path, drivers_path_build) + plist_data = plist_data.replace( + "#NvmExpressDxe.efi", + "NvmExpressDxe.efi" + ) + + # Save config.plist changes in memory + with open(plist_path_build_full, 'w') as file: + file.write(plist_data) # Clean up Build Folder print("") @@ -514,6 +653,7 @@ while MainMenu: print("") print("Your OpenCore EFI has been built at:") print(" %s" % opencore_path_done) + print("") AutoBuilderMenu = raw_input("Press any key to return to previous menu: ") if AutoBuilderMenu=="1": print("Returning to previous menu...") diff --git a/payloads/config/config-v0.6.3.plist b/payloads/Config/v0.6.3/config.plist similarity index 96% rename from payloads/config/config-v0.6.3.plist rename to payloads/Config/v0.6.3/config.plist index 31f171783..391a0d24a 100644 --- a/payloads/config/config-v0.6.3.plist +++ b/payloads/Config/v0.6.3/config.plist @@ -8,7 +8,7 @@ Enabled - + Comment Patch CPBG for Arrendale, Lynnfield and Clarkdale Path @@ -21,11 +21,11 @@ Comment - XHC1 to SHCI + XHC1 to SHC1 Count 0 Enabled - + Find WEhDMQ== Limit @@ -35,7 +35,7 @@ OemTableId Replace - U0hDSQ== + U0hDMQ== ReplaceMask Skip @@ -51,7 +51,7 @@ Count 0 Enabled - + Find RUhDMQ== Limit @@ -77,7 +77,7 @@ Count 0 Enabled - + Find RUhDMg== Limit @@ -158,10 +158,12 @@ Add - PciRoot(0x0)/Pci(0x1b,0x0) + #PciRoot(0x0)/Pci(0x1C,0x1)Pci(0x0,0x0) - layout-id - AQAAAA== + device-id + ukMAAA== + compatible + pci14e4,43ba Delete @@ -175,7 +177,7 @@ Comment Patching Engine Enabled - + MaxKernel MinKernel @@ -191,7 +193,7 @@ Comment GPU Patching Enabled - + MaxKernel MinKernel @@ -207,7 +209,7 @@ Comment SSE Emulator Enabled - + MaxKernel MinKernel @@ -223,7 +225,7 @@ Comment SSE Patcher Enabled - + MaxKernel MinKernel @@ -239,7 +241,7 @@ Comment 4331 Wifi Patch Enabled - + MaxKernel MinKernel @@ -255,7 +257,7 @@ Comment 4331 Wifi Patch Enabled - + MaxKernel MinKernel @@ -271,7 +273,7 @@ Comment Dual Socket Patch Enabled - + MaxKernel MinKernel @@ -287,7 +289,7 @@ Comment BCM Ethernet patch Enabled - + MaxKernel MinKernel @@ -303,7 +305,7 @@ Comment Atheros Wifi Patch Enabled - + MaxKernel MinKernel @@ -319,7 +321,7 @@ Comment Atheros Wifi Patch Enabled - + MaxKernel MinKernel @@ -335,7 +337,7 @@ Comment Broadcom Wifi Patch Enabled - + MaxKernel MinKernel @@ -351,7 +353,7 @@ Comment Broadcom Wifi Patch Enabled - + MaxKernel MinKernel @@ -367,7 +369,7 @@ Comment Marvel Ethernet Patch Enabled - + MaxKernel MinKernel @@ -383,7 +385,7 @@ Comment Nvidia Ethernet Patch Enabled - + MaxKernel MinKernel @@ -425,7 +427,7 @@ Count 1 Enabled - + Find Identifier @@ -757,7 +759,7 @@ Drivers - NvmExpressDxe.efi + #NvmExpressDxe.efi OpenCanopy.efi OpenRuntime.efi diff --git a/payloads/Tools/gfxutil b/payloads/Tools/gfxutil deleted file mode 100755 index 48f4fff9b..000000000 Binary files a/payloads/Tools/gfxutil and /dev/null differ