我通过 Linux efivarfs 接口创建了一个非易失性 UEFI 变量。efivar
我可以使用命令行获取变量的值。但是,当我尝试在引导阶段通过 EDK2 获取该变量的值时,GetVariable2()
出现“未找到”错误。
这是 .dec 文件和 C++ 片段:
[Guids]
gEfiMyTestGuid = {0x11c564cd, 0xb9f2, 0x4eb8, {0x94, 0x62, 0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}}
extern EFI_GUID gEfiMyTestGuid;
....
....
VOID *Data;
UINTN DataSize;
EFI_STATUS Status;
Status = GetVariable2 (L"test", &gEfiMyTestGuid, &Data,
&DataSize);
if (EFI_ERROR (Status)) {
Print (L"Failure error: %r\n", Status);
return Status;
}