summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Bds/BootMenu.c
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-04-11 10:57:47 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-04-11 10:57:47 +0000
commit55a9f75d149ea53d1c8b3da197ec344c2aedb848 (patch)
tree4f92f10febc30c135440ec262c666274da7faf75 /ArmPlatformPkg/Bds/BootMenu.c
parent06044819bb273fd0db56a988ed307cd70fa34358 (diff)
downloadedk2-platforms-55a9f75d149ea53d1c8b3da197ec344c2aedb848.tar.xz
ArmPlatformPkg/Bds: Added support to detect if the binary is a EFI image
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@15453 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Bds/BootMenu.c')
-rw-r--r--ArmPlatformPkg/Bds/BootMenu.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index 9ca703842f..e00d06e394 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -134,6 +134,7 @@ BootMenuAddBootOption (
UINTN InitrdSize;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN RequestBootType;
Attributes = 0;
SupportedBootDevice = NULL;
@@ -146,7 +147,8 @@ BootMenuAddBootOption (
}
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes, &BootType, &Attributes);
+ RequestBootType = TRUE;
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes, &RequestBootType);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -158,6 +160,16 @@ BootMenuAddBootOption (
goto EXIT;
}
+ if (RequestBootType) {
+ Status = BootDeviceGetType (DevicePath, &BootType, &Attributes);
+ if (EFI_ERROR(Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+ } else {
+ BootType = BDS_LOADER_EFI_APPLICATION;
+ }
+
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
Print(L"Add an initrd: ");
Status = GetHIInputBoolean (&InitrdSupport);
@@ -168,7 +180,7 @@ BootMenuAddBootOption (
if (InitrdSupport) {
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL);
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL);
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 = EFI_ABORTED;
goto EXIT;
@@ -390,6 +402,7 @@ BootMenuUpdateBootOption (
BOOLEAN InitrdSupport;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN RequestBootType;
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry);
if (EFI_ERROR(Status)) {
@@ -404,12 +417,21 @@ BootMenuUpdateBootOption (
return EFI_UNSUPPORTED;
}
- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath, NULL, NULL);
+ RequestBootType = TRUE;
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath, &RequestBootType);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
+ if (RequestBootType) {
+ Status = BootDeviceGetType (DevicePath, &BootType, &BootOption->Attributes);
+ if (EFI_ERROR(Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+ }
+
LoaderOptionalData = BootOption->OptionalData;
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&LoaderOptionalData->Header.LoaderType));
@@ -433,7 +455,7 @@ BootMenuUpdateBootOption (
if (InitrdSupport) {
if (InitrdSize > 0) {
// Case we update the initrd device path
- Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath, NULL, NULL);
+ Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath, NULL);
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 = EFI_ABORTED;
goto EXIT;
@@ -442,7 +464,7 @@ BootMenuUpdateBootOption (
} else {
// Case we create the initrd device path
- Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL);
+ Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL);
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 = EFI_ABORTED;
goto EXIT;
@@ -535,7 +557,7 @@ UpdateFdtPath (
}
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes, NULL, NULL);
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes, NULL);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
goto EXIT;