Raw文件需要添加fdf中参与打包到BIOS Rom中
示例:
\EDK\EmulatorPkg\EmulatorPkg.fdf
FILE FREEFORM = B4E606D1-4D39-41cd-8D7C-46F61DCD7A7C {
SECTION RAW = MdeModulePkg/Application/HelloWorld/HelloWorld.txt
}
GetSectionFromAnyFv (
&gHelloworldFileGuid,
EFI_SECTION_RAW,
0,
&Data,
&DataSize
);
通过匹配File Guid就可以获取Raw Data 。
UEFI Application中 可调用GetSectionFromAnyFv 获取Raw文件解析
Helloword.c中解析Helloword.txt
EFI_STATUS
EFIAPI
GetRawFile(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
UINTN i;
UINT8 *Data = NULL;
UINTN DataSize = 0;
Status = GetSectionFromAnyFv (
&gHelloworldFileGuid,
EFI_SECTION_RAW,
0,
&Data,
&DataSize
);
DEBUG ((DEBUG_ERROR, "BufferSize :%d\n", DataSize));
DEBUG ((DEBUG_ERROR, "GetSectionFromAnyFv:%r\n", Status));
for ( i = 0; i < DataSize - 1; i++) {
if(Data[i] == 0xD && Data[i+1] == 0xA){
i++;
DEBUG((DEBUG_INFO, "\n" ));
}
if(LibIsHexChar(Data[i]))
{
DEBUG((DEBUG_INFO, "%c" , Data[i]));
}
}
return Status;
}
Helloword.txt
解析Raw文件结果: