Move FirmwareFeature generation

This commit is contained in:
Mykola Grymalyuk
2021-10-01 09:58:31 -06:00
parent 0e07273c8e
commit fe359f7ea6
4 changed files with 26 additions and 54 deletions

View File

@@ -1,4 +1,5 @@
from Data import smbios_data, os_data
from Resources import Utilities
def set_smbios_model_spoof(model):
try:
@@ -50,4 +51,25 @@ def set_smbios_model_spoof(model):
return "iMac17,1"
else:
# Unknown Model
raise Exception
raise Exception
def update_firmware_features(firmwarefeature):
# Adjust FirmwareFeature to support everything macOS requires
# APFS Bit (19/20): 10.13+ (OSInstall)
# Large BaseSystem Bit (35): 12.0 B7+ (patchd)
# https://github.com/acidanthera/OpenCorePkg/tree/2f76673546ac3e32d2e2d528095fddcd66ad6a23/Include/Apple/IndustryStandard/AppleFeatures.h
firmwarefeature |= 2 ** 19 # FW_FEATURE_SUPPORTS_APFS
firmwarefeature |= 2 ** 20 # FW_FEATURE_SUPPORTS_APFS_EXTRA
firmwarefeature |= 2 ** 35 # FW_FEATURE_SUPPORTS_LARGE_BASESYSTEM
return firmwarefeature
def generate_fw_features(model, custom):
if not custom:
firmwarefeature = Utilities.get_rom("firmware-features")
if not firmwarefeature:
print("- Failed to find FirmwareFeatures, falling back on defaults")
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
else:
firmwarefeature = int(smbios_data.smbios_dictionary[model]["FirmwareFeatures"], 16)
firmwarefeature = update_firmware_features(firmwarefeature)
return firmwarefeature