EFI_STATUS Status;\r
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;\r
EFI_DEVICE_PATH* BootDevicePath;\r
+ UINT8* OptionalData;\r
+ UINTN OptionalDataSize;\r
ARM_BDS_LOADER_ARGUMENTS* BootArguments;\r
ARM_BDS_LOADER_TYPE BootType;\r
EFI_DEVICE_PATH* InitrdPath;\r
InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));\r
InitrdSize = GetDevicePathSize (InitrdPath);\r
\r
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize);\r
+ OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;\r
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);\r
if (BootArguments == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);\r
CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);\r
+\r
+ OptionalData = (UINT8*)BootArguments;\r
} else {\r
- BootArguments = NULL;\r
+ OptionalData = NULL;\r
+ OptionalDataSize = 0;\r
}\r
\r
BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,\r
(CHAR16*)PcdGetPtr(PcdDefaultBootDescription),\r
BootDevicePath,\r
BootType,\r
- BootArguments,\r
+ OptionalData,\r
+ OptionalDataSize,\r
&BdsLoadOption\r
);\r
FreePool (BdsLoadOption);\r