diff --git a/Library/OcMainLib/OpenCorePlatform.c b/Library/OcMainLib/OpenCorePlatform.c index 9195587f..c6c64163 100644 --- a/Library/OcMainLib/OpenCorePlatform.c +++ b/Library/OcMainLib/OpenCorePlatform.c @@ -858,6 +858,7 @@ OcGetLegacySecureBootECID ( EFI_STATUS Status; OC_SMBIOS_TABLE SmbiosTable; EFI_GUID Uuid; + UINTN ReadSize; ASSERT (Config != NULL); ASSERT (ApECID != NULL); @@ -897,7 +898,7 @@ OcGetLegacySecureBootECID ( } DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g from auto config - %r\n", &Uuid, Status)); } - } else { + } else if (Config->PlatformInfo.UpdateNvram) { Status = OcAsciiStrToRawGuid (OC_BLOB_GET (&Config->PlatformInfo.Nvram.SystemUuid), &Uuid); if (EFI_ERROR (Status)) { ZeroMem (&Uuid, sizeof (Uuid)); @@ -905,6 +906,21 @@ OcGetLegacySecureBootECID ( DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g from manual config - %r\n", &Uuid, Status)); } + if (IsZeroGuid (&Uuid)) { + ReadSize = sizeof (Uuid); + Status = gRT->GetVariable ( + L"system-id", + &gAppleVendorVariableGuid, + NULL, + &ReadSize, + &Uuid + ); + if (EFI_ERROR (Status)) { + ZeroMem (&Uuid, sizeof (Uuid)); + } + DEBUG ((DEBUG_INFO, "OC: Grabbed SB uuid %g direct from NVRAM - %r\n", &Uuid, Status)); + } + if (IsZeroGuid (&Uuid)) { DEBUG ((DEBUG_ERROR, "OC: Grabbed zero system-id for SB, this is not allowed\n")); CpuDeadLoop ();