From 51954d3b6ad2e7b34c98cfa9a61f51fb54a2123d Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 14 Oct 2023 19:15:26 -0600 Subject: [PATCH] firmware.py: Add path check for OpenLegacyBoot.efi --- resources/build/firmware.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/resources/build/firmware.py b/resources/build/firmware.py index 9cace85ce..f944cbe12 100644 --- a/resources/build/firmware.py +++ b/resources/build/firmware.py @@ -215,12 +215,13 @@ class BuildFirmware: # CSM check # For model support, check for GUID in firmware and as well as Bootcamp Assistant's Info.plist ('PreUEFIModels' key) # Ref: https://github.com/acidanthera/OpenCorePkg/blob/0.9.5/Platform/OpenLegacyBoot/OpenLegacyBoot.c#L19 - # if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.CPUGen.ivy_bridge.value and self.model != "MacPro6,1": - # logging.info("- Enabling CSM support") - # support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenLegacyBoot.efi", "UEFI", "Drivers")["Enabled"] = True - # else: - # # Shipped alongside OpenCorePkg, so remove if unused - # (self.constants.drivers_path / Path("OpenLegacyBoot.efi")).unlink() + if Path(self.constants.drivers_path / Path("OpenLegacyBoot.efi")).exists(): + if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.CPUGen.ivy_bridge.value and self.model != "MacPro6,1": + logging.info("- Enabling CSM support") + support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenLegacyBoot.efi", "UEFI", "Drivers")["Enabled"] = True + else: + # Shipped alongside OpenCorePkg, so remove if unused + (self.constants.drivers_path / Path("OpenLegacyBoot.efi")).unlink() def _firmware_compatibility_handling(self) -> None: """