mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Allow to update EFI application boot entries
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15457 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5389972a63
commit
3b3b72d62b
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
*
|
||||
* Copyright (c) 2011-2013, ARM Limited. All rights reserved.
|
||||
* Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -261,7 +261,6 @@ EFI_STATUS
|
|||
BootMenuSelectBootOption (
|
||||
IN LIST_ENTRY* BootOptionsList,
|
||||
IN CONST CHAR16* InputStatement,
|
||||
IN BOOLEAN OnlyArmBdsBootEntry,
|
||||
OUT BDS_LOAD_OPTION_ENTRY** BdsLoadOptionEntry
|
||||
)
|
||||
{
|
||||
|
@ -271,6 +270,7 @@ BootMenuSelectBootOption (
|
|||
UINTN BootOptionSelected;
|
||||
UINTN BootOptionCount;
|
||||
UINTN Index;
|
||||
BOOLEAN IsUnicode;
|
||||
|
||||
// Display the list of supported boot devices
|
||||
BootOptionCount = 0;
|
||||
|
@ -281,10 +281,6 @@ BootMenuSelectBootOption (
|
|||
{
|
||||
BdsLoadOption = LOAD_OPTION_FROM_LINK(Entry);
|
||||
|
||||
if (OnlyArmBdsBootEntry && !IS_ARM_BDS_BOOTENTRY (BdsLoadOption)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Print (L"[%d] %s\n", (BootOptionCount + 1), BdsLoadOption->Description);
|
||||
|
||||
DEBUG_CODE_BEGIN();
|
||||
|
@ -299,9 +295,19 @@ BootMenuSelectBootOption (
|
|||
|
||||
Print(L"\t- %s\n",DevicePathTxt);
|
||||
OptionalData = BdsLoadOption->OptionalData;
|
||||
LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
|
||||
if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||
Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);
|
||||
if (IS_ARM_BDS_BOOTENTRY (BdsLoadOption)) {
|
||||
LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
|
||||
if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||
Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);
|
||||
}
|
||||
} else if (OptionalData != NULL) {
|
||||
if (IsPrintableString (OptionalData, &IsUnicode)) {
|
||||
if (IsUnicode) {
|
||||
Print (L"\t- Arguments: %s\n", OptionalData);
|
||||
} else {
|
||||
AsciiPrint ("\t- Arguments: %a\n", OptionalData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePool(DevicePathTxt);
|
||||
|
@ -361,7 +367,7 @@ BootMenuRemoveBootOption (
|
|||
EFI_STATUS Status;
|
||||
BDS_LOAD_OPTION_ENTRY* BootOptionEntry;
|
||||
|
||||
Status = BootMenuSelectBootOption (BootOptionsList, DELETE_BOOT_ENTRY, FALSE, &BootOptionEntry);
|
||||
Status = BootMenuSelectBootOption (BootOptionsList, DELETE_BOOT_ENTRY, &BootOptionEntry);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@ -390,6 +396,7 @@ BootMenuUpdateBootOption (
|
|||
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
|
||||
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
|
||||
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
|
||||
CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
EFI_DEVICE_PATH *TempInitrdPath;
|
||||
ARM_BDS_LOADER_TYPE BootType;
|
||||
|
@ -403,8 +410,10 @@ BootMenuUpdateBootOption (
|
|||
UINT8* OptionalData;
|
||||
UINTN OptionalDataSize;
|
||||
BOOLEAN RequestBootType;
|
||||
BOOLEAN IsPrintable;
|
||||
BOOLEAN IsUnicode;
|
||||
|
||||
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry);
|
||||
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@ -433,7 +442,11 @@ BootMenuUpdateBootOption (
|
|||
}
|
||||
|
||||
LoaderOptionalData = BootOption->OptionalData;
|
||||
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&LoaderOptionalData->Header.LoaderType));
|
||||
if (LoaderOptionalData != NULL) {
|
||||
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&LoaderOptionalData->Header.LoaderType));
|
||||
} else {
|
||||
BootType = BDS_LOADER_EFI_APPLICATION;
|
||||
}
|
||||
|
||||
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||
LinuxArguments = &LoaderOptionalData->Arguments.LinuxArguments;
|
||||
|
@ -514,8 +527,49 @@ BootMenuUpdateBootOption (
|
|||
|
||||
OptionalData = (UINT8*)BootArguments;
|
||||
} else {
|
||||
OptionalData = NULL;
|
||||
OptionalDataSize = 0;
|
||||
Print (L"Arguments to pass to the EFI Application: ");
|
||||
|
||||
if (BootOption->OptionalDataSize > 0) {
|
||||
IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
|
||||
if (IsPrintable) {
|
||||
if (IsUnicode) {
|
||||
StrnCpy (UnicodeCmdLine, BootOption->OptionalData, BootOption->OptionalDataSize / 2);
|
||||
} else {
|
||||
AsciiStrnCpy (CmdLine, BootOption->OptionalData, BootOption->OptionalDataSize);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
UnicodeCmdLine[0] = L'\0';
|
||||
IsPrintable = TRUE;
|
||||
IsUnicode = TRUE;
|
||||
}
|
||||
|
||||
// We do not request arguments for OptionalData that cannot be printed
|
||||
if (IsPrintable) {
|
||||
if (IsUnicode) {
|
||||
Status = EditHIInputStr (UnicodeCmdLine, BOOT_DEVICE_OPTION_MAX);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto FREE_DEVICE_PATH;
|
||||
}
|
||||
|
||||
OptionalData = (UINT8*)UnicodeCmdLine;
|
||||
OptionalDataSize = StrSize (UnicodeCmdLine);
|
||||
} else {
|
||||
Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto FREE_DEVICE_PATH;
|
||||
}
|
||||
|
||||
OptionalData = (UINT8*)CmdLine;
|
||||
OptionalDataSize = AsciiStrSize (CmdLine);
|
||||
}
|
||||
} else {
|
||||
// We keep the former OptionalData
|
||||
OptionalData = BootOption->OptionalData;
|
||||
OptionalDataSize = BootOption->OptionalDataSize;
|
||||
}
|
||||
}
|
||||
|
||||
Print(L"Description for this new Entry: ");
|
||||
|
|
Loading…
Reference in New Issue