]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds: Decoupled OptionalData for the EFI application boot entry from...
[mirror_edk2.git] / ArmPlatformPkg / Bds / Bds.c
index 76dd5465a2cc9cb142f188b6e27c73305ac66c34..2888843058afc4f06765eb82eaa45c615ba9dfcb 100644 (file)
@@ -220,6 +220,8 @@ DefineDefaultBootEntries (
   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
@@ -306,7 +308,8 @@ DefineDefaultBootEntries (
         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
@@ -315,15 +318,19 @@ DefineDefaultBootEntries (
 \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