ArmPlatformPkg/Bds: Fix the update of existing boot entries

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
This commit is contained in:
oliviermartin 2011-09-13 09:03:10 +00:00
parent 4223e4f4c9
commit 3e710183d1
1 changed files with 11 additions and 9 deletions

View File

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