]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Fix the update of existing boot entries
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Sep 2011 09:03:10 +0000 (09:03 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Sep 2011 09:03:10 +0000 (09:03 +0000)
Variables were not initialized in the right order in the boot entry update function.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12335 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/BootMenu.c

index 3bfe2f6152486adf3021695ce96b807099668dc6..3796f826f39736cfb2cb00f66fe21a0a22d8610e 100644 (file)
@@ -372,14 +372,16 @@ BootMenuUpdateBootOption (
     LinuxArguments = &OptionalData->Arguments.LinuxArguments;\r
 \r
     CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
-    InitrdSize = GetUnalignedDevicePathSize ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize));\r
 \r
-    Print(L"File path of the initrd: ");\r
-    Status = DeviceSupport->UpdateDevicePathNode (\r
-      (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)(LinuxArguments + 1) + CmdLineSize), &InitrdPathList, NULL, NULL);\r
-    if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
+    InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);\r
+    if (InitrdSize > 0) {\r
+      Print(L"File path of the initrd: ");\r
+      Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize), &InitrdPathList, NULL, NULL);\r
+      if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
+        Status = EFI_ABORTED;\r
+        goto EXIT;\r
+      }\r
+      InitrdSize = GetDevicePathSize (InitrdPathList);\r
     }\r
 \r
     Print(L"Arguments to pass to the binary: "); \r
@@ -395,7 +397,6 @@ BootMenuUpdateBootOption (
     }\r
 \r
     CmdLineSize = AsciiStrSize (CmdLine);\r
-    InitrdSize = GetDevicePathSize (InitrdPathList);\r
 \r
     BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);\r
     BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
@@ -407,6 +408,7 @@ BootMenuUpdateBootOption (
   }\r
 \r
   Print(L"Description for this new Entry: ");\r
+  StrnCpy (BootDescription, BootOption->Description, BOOT_DEVICE_DESCRIPTION_MAX);\r
   Status = EditHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);\r
   if (EFI_ERROR(Status)) {\r
     Status = EFI_ABORTED;\r
@@ -536,7 +538,7 @@ BootMenuMain (
         EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
         ARM_BDS_LOADER_OPTIONAL_DATA*     OptionalData;\r
         UINTN                             CmdLineSize;\r
-        ARM_BDS_LOADER_TYPE           LoaderType;\r
+        ARM_BDS_LOADER_TYPE               LoaderType;\r
 \r
         Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);\r
         if (EFI_ERROR(Status)) {\r