Discussion:
[edk2] [PATCH 1/8] ArmPkg/BdsLib: Replaced BdsLoadApplication() by LocateEfiApplicationInFv(Name|Guid)()
Olivier Martin
2015-07-13 16:36:41 UTC
Permalink
Replaced the function BdsLoadApplication() by two explicit
functions that load the EFI application either by its GUID
or its Name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmPkg/Include/Library/BdsLib.h | 52 ++++---
ArmPkg/Library/BdsLib/BdsAppLoader.c | 283 ++++++++++++++++++++++++-----------
ArmPlatformPkg/Bds/Bds.inf | 3 +
ArmPlatformPkg/Bds/BootMenu.c | 24 ++-
4 files changed, 250 insertions(+), 112 deletions(-)

diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h
index c6416db..3d9e195 100644
--- a/ArmPkg/Include/Library/BdsLib.h
+++ b/ArmPkg/Include/Library/BdsLib.h
@@ -193,24 +193,6 @@ BdsStartEfiApplication (
IN VOID* LoadOptions
);

-/**
- Start an EFI Application from any Firmware Volume
-
- @param EfiApp EFI Application Name
-
- @retval EFI_SUCCESS All drivers have been connected
- @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
- @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
-
-**/
-EFI_STATUS
-BdsLoadApplication (
- IN EFI_HANDLE ParentImageHandle,
- IN CHAR16* EfiApp,
- IN UINTN LoadOptionsSize,
- IN VOID* LoadOptions
- );
-
EFI_STATUS
BdsLoadImage (
IN EFI_DEVICE_PATH *DevicePath,
@@ -227,4 +209,38 @@ ShutdownUefiBootServices (
VOID
);

+/**
+ Locate an EFI application in a the Firmware Volumes by its name
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateEfiApplicationInFvByName (
+ IN CONST CHAR16* EfiAppName,
+ OUT EFI_DEVICE_PATH **DevicePath
+ );
+
+/**
+ Locate an EFI application in a the Firmware Volumes by its GUID
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateEfiApplicationInFvByGuid (
+ IN CONST EFI_GUID *EfiAppGuid,
+ OUT EFI_DEVICE_PATH **DevicePath
+ );
+
#endif
diff --git a/ArmPkg/Library/BdsLib/BdsAppLoader.c b/ArmPkg/Library/BdsLib/BdsAppLoader.c
index 2b88bf1..1f208f8 100644
--- a/ArmPkg/Library/BdsLib/BdsAppLoader.c
+++ b/ArmPkg/Library/BdsLib/BdsAppLoader.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -14,18 +14,23 @@

#include "BdsInternal.h"

-//#include <Library/DxeServicesLib.h>
+/**
+ Locate an EFI application in a the Firmware Volumes by its Name
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.

-STATIC
+**/
EFI_STATUS
-BdsLoadFileFromFirmwareVolume (
- IN EFI_HANDLE FvHandle,
- IN CHAR16 *FilePath,
- IN EFI_FV_FILETYPE FileTypeFilter,
- OUT EFI_DEVICE_PATH **EfiAppDevicePath
+LocateEfiApplicationInFvByName (
+ IN CONST CHAR16* EfiAppName,
+ OUT EFI_DEVICE_PATH **DevicePath
)
{
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;
VOID *Key;
EFI_STATUS Status, FileStatus;
EFI_GUID NameGuid;
@@ -37,108 +42,212 @@ BdsLoadFileFromFirmwareVolume (
UINT32 Authentication;
EFI_DEVICE_PATH *FvDevicePath;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileDevicePath;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;

- Status = gBS->HandleProtocol (FvHandle,&gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FvProtocol);
- if (EFI_ERROR(Status)) {
- return Status;
- }
+ ASSERT (DevicePath != NULL);

// Length of FilePath
- UiStringLen = StrLen (FilePath);
-
- // Allocate Key
- Key = AllocatePool (FvProtocol->KeySize);
- ASSERT (Key != NULL);
- ZeroMem (Key, FvProtocol->KeySize);
+ UiStringLen = StrLen (EfiAppName);
+
+ // Locate all the Firmware Volume protocols.
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }

- do {
- // Search in all files
- FileType = FileTypeFilter;
+ *DevicePath = NULL;
+
+ // Looking for FV with ACPI storage file
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ //
+ // Get the protocol on this handle
+ // This should not fail because of LocateHandleBuffer
+ //
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (VOID**) &FvInstance
+ );
+ if (EFI_ERROR (Status)) {
+ goto FREE_HANDLE_BUFFER;
+ }

- Status = FvProtocol->GetNextFile (FvProtocol, Key, &FileType, &NameGuid, &Attributes, &Size);
- if (!EFI_ERROR (Status)) {
- UiSection = NULL;
- FileStatus = FvProtocol->ReadSection (
- FvProtocol,
- &NameGuid,
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **)&UiSection,
- &Size,
- &Authentication
- );
- if (!EFI_ERROR (FileStatus)) {
- if (StrnCmp (FilePath, UiSection, UiStringLen) == 0) {
- //
- // We found a UiString match.
- //
- Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
-
- // Generate the Device Path for the file
- //DevicePath = DuplicateDevicePath(FvDevicePath);
- EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);
- *EfiAppDevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);
-
- FreePool (Key);
+ // Allocate Key
+ Key = AllocatePool (FvInstance->KeySize);
+ ASSERT (Key != NULL);
+ ZeroMem (Key, FvInstance->KeySize);
+
+ do {
+ // Search in all files
+ FileType = EFI_FV_FILETYPE_ALL;
+
+ Status = FvInstance->GetNextFile (FvInstance, Key, &FileType, &NameGuid, &Attributes, &Size);
+ if (!EFI_ERROR (Status)) {
+ UiSection = NULL;
+ FileStatus = FvInstance->ReadSection (
+ FvInstance,
+ &NameGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&UiSection,
+ &Size,
+ &Authentication
+ );
+ if (!EFI_ERROR (FileStatus)) {
+ if (StrnCmp (EfiAppName, UiSection, UiStringLen) == 0) {
+ //
+ // We found a UiString match.
+ //
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
+
+ // Generate the Device Path for the file
+ EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);
+ *DevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);
+ ASSERT (*DevicePath != NULL);
+
+ FreePool (Key);
+ FreePool (UiSection);
+ FreePool (HandleBuffer);
+ return FileStatus;
+ }
FreePool (UiSection);
- return FileStatus;
}
- FreePool (UiSection);
}
- }
- } while (!EFI_ERROR (Status));
+ } while (!EFI_ERROR (Status));

- FreePool(Key);
- return Status;
+ FreePool (Key);
+ }
+
+FREE_HANDLE_BUFFER:
+ FreePool (HandleBuffer);
+ return EFI_NOT_FOUND;
}

/**
- Start an EFI Application from any Firmware Volume
+ Locate an EFI application in a the Firmware Volumes by its GUID

- @param EfiApp EFI Application Name
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application

- @retval EFI_SUCCESS All drivers have been connected
- @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
- @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.

**/
EFI_STATUS
-BdsLoadApplication (
- IN EFI_HANDLE ParentImageHandle,
- IN CHAR16* EfiApp,
- IN UINTN LoadOptionsSize,
- IN VOID* LoadOptions
+LocateEfiApplicationInFvByGuid (
+ IN CONST EFI_GUID *EfiAppGuid,
+ OUT EFI_DEVICE_PATH **DevicePath
)
{
- EFI_STATUS Status;
- UINTN NoHandles, HandleIndex;
- EFI_HANDLE *Handles;
- EFI_DEVICE_PATH *EfiAppDevicePath;
-
- // Need to connect every drivers to ensure no dependencies are missing for the application
- Status = BdsConnectAllDrivers();
- if (EFI_ERROR(Status)) {
- DEBUG ((EFI_D_ERROR, "FAIL to connect all drivers\n"));
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH *FvDevicePath;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 AuthenticationStatus;
+ EFI_FV_FILETYPE Type;
+ UINTN Size;
+ CHAR16 *UiSection;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FvFileDevicePath;
+
+ ASSERT (DevicePath != NULL);
+
+ // Locate all the Firmware Volume protocols.
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
return Status;
}

- // Search the application in any Firmware Volume
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Handles);
- if (EFI_ERROR (Status) || (NoHandles == 0)) {
- DEBUG ((EFI_D_ERROR, "FAIL to find Firmware Volume\n"));
- return Status;
- }
+ *DevicePath = NULL;
+
+ // Looking for FV with ACPI storage file
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ //
+ // Get the protocol on this handle
+ // This should not fail because of LocateHandleBuffer
+ //
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (VOID**) &FvInstance
+ );
+ if (EFI_ERROR (Status)) {
+ goto FREE_HANDLE_BUFFER;
+ }

- // Search in all Firmware Volume for the EFI Application
- for (HandleIndex = 0; HandleIndex < NoHandles; HandleIndex++) {
- EfiAppDevicePath = NULL;
- Status = BdsLoadFileFromFirmwareVolume (Handles[HandleIndex], EfiApp, EFI_FV_FILETYPE_APPLICATION, &EfiAppDevicePath);
- if (!EFI_ERROR (Status)) {
- // Start the application
- Status = BdsStartEfiApplication (ParentImageHandle, EfiAppDevicePath, LoadOptionsSize, LoadOptions);
- return Status;
+ Status = FvInstance->ReadFile (
+ FvInstance,
+ EfiAppGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Skip if no EFI application file in the FV
+ //
+ continue;
+ } else {
+ UiSection = NULL;
+ Status = FvInstance->ReadSection (
+ FvInstance,
+ EfiAppGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&UiSection,
+ &Size,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Create the EFI Device Path for the application using the Filename of the application
+ //
+ *DevicePath = FileDevicePath (HandleBuffer[Index], UiSection);
+ } else {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID**)&FvDevicePath);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Create the EFI Device Path for the application using the EFI GUID of the application
+ //
+ EfiInitializeFwVolDevicepathNode (&FvFileDevicePath, EfiAppGuid);
+
+ *DevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FvFileDevicePath);
+ ASSERT (*DevicePath != NULL);
+ }
+ break;
}
}

- return Status;
+FREE_HANDLE_BUFFER:
+ //
+ // Free any allocated buffers
+ //
+ FreePool (HandleBuffer);
+
+ if (*DevicePath == NULL) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_SUCCESS;
+ }
}
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index f4c0f1c..76a45e0 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -37,6 +37,7 @@
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
+ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec

[LibraryClasses]
BdsLib
@@ -79,5 +80,7 @@
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths

+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
+
[Depex]
TRUE
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index d2dccbc..a304cc4 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -1069,17 +1069,27 @@ BootShell (
IN LIST_ENTRY *BootOptionsList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH* EfiShellDevicePath;

- // Start EFI Shell
- Status = BdsLoadApplication (gImageHandle, L"Shell", 0, NULL);
+ // Find the EFI Shell
+ Status = LocateEfiApplicationInFvByName (L"Shell", &EfiShellDevicePath);
if (Status == EFI_NOT_FOUND) {
Print (L"Error: EFI Application not found.\n");
- } else if (EFI_ERROR(Status)) {
- Print (L"Error: Status Code: 0x%X\n",(UINT32)Status);
- }
+ return Status;
+ } else if (EFI_ERROR (Status)) {
+ Print (L"Error: Status Code: 0x%X\n", (UINT32)Status);
+ return Status;
+ } else {
+ // Need to connect every drivers to ensure no dependencies are missing for the application
+ Status = BdsConnectAllDrivers ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FAIL to connect all drivers\n"));
+ return Status;
+ }

- return Status;
+ return BdsStartEfiApplication (gImageHandle, EfiShellDevicePath, 0, NULL);
+ }
}

struct BOOT_MAIN_ENTRY {
--
2.1.1
Olivier Martin
2015-07-13 16:36:43 UTC
Permalink
Android FastBoot EFI application was using the Linux Loader
from BdsLib. This change makes use of the EFI Linux Loader
application.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
.../AndroidFastboot/AndroidFastbootApp.inf | 3 +-
.../AndroidFastboot/Arm/BootAndroidBootImg.c | 48 +++++++++++++++++++---
2 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
index ab9354c..ca17af8 100644
--- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
+++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -39,6 +39,7 @@
PrintLib
UefiApplicationEntryPoint
UefiBootServicesTableLib
+ UefiLib
UefiRuntimeServicesTableLib

[Protocols]
diff --git a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
index 7e9ad88..3053cf0 100644
--- a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
+++ b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -18,9 +18,16 @@

#include <Library/BdsLib.h>
#include <Library/DevicePathLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>

#include <Guid/ArmGlobalVariableHob.h>

+#define LINUX_LOADER_COMMAND_LINE L"%s -f %s -c %s"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
// Device Path representing an image in memory
#pragma pack(1)
typedef struct {
@@ -64,6 +71,10 @@ BootAndroidBootImg (
UINTN RamdiskSize;
MEMORY_DEVICE_PATH KernelDevicePath;
MEMORY_DEVICE_PATH* RamdiskDevicePath;
+ CHAR16* KernelDevicePathTxt;
+ CHAR16* RamdiskDevicePathTxt;
+ EFI_DEVICE_PATH* LinuxLoaderDevicePath;
+ CHAR16* LoadOptions;

Status = ParseAndroidBootImg (
Buffer,
@@ -92,20 +103,45 @@ BootAndroidBootImg (
RamdiskDevicePath->Node1.EndingAddress = ((EFI_PHYSICAL_ADDRESS)(UINTN) Ramdisk) + RamdiskSize;
}

- Status = BdsBootLinuxFdt (
- (EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) RamdiskDevicePath,
- KernelArgs
- );
+ //
+ // Boot Linux using the Legacy Linux Loader
+ //
+
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &LinuxLoaderDevicePath);
+ if (EFI_ERROR (Status)) {
+ Print (L"Couldn't Boot Linux: %d\n", Status);
+ return EFI_DEVICE_ERROR;
+ }
+
+ KernelDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath, FALSE, FALSE);
+ if (KernelDevicePathTxt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ RamdiskDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) RamdiskDevicePath, FALSE, FALSE);
+ if (RamdiskDevicePathTxt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ // Initialize Legacy Linux loader command line
+ LoadOptions = CatSPrint (NULL, LINUX_LOADER_COMMAND_LINE, KernelDevicePathTxt, RamdiskDevicePathTxt, KernelArgs);
+ if (LoadOptions == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = BdsStartEfiApplication (gImageHandle, LinuxLoaderDevicePath, StrSize (LoadOptions), LoadOptions);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Couldn't Boot Linux: %d\n", Status));
return EFI_DEVICE_ERROR;
}

if (RamdiskDevicePath) {
+ FreePool (RamdiskDevicePathTxt);
FreePool (RamdiskDevicePath);
}

+ FreePool (KernelDevicePathTxt);
+
// If we got here we do a confused face because BootLinuxFdt returned,
// reporting success.
DEBUG ((EFI_D_ERROR, "WARNING: BdsBootLinuxFdt returned EFI_SUCCESS.\n"));
--
2.1.1
Olivier Martin
2015-07-13 16:36:52 UTC
Permalink
When PcdBdsLinuxSupport is enabled, users can create boot
entries for the legacy EFI Linux loader.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmPlatformPkg/ArmPlatformPkg.dec | 3 +
ArmPlatformPkg/Bds/Bds.inf | 4 +
ArmPlatformPkg/Bds/BdsHelper.c | 9 ---
ArmPlatformPkg/Bds/BdsInternal.h | 26 ++++--
ArmPlatformPkg/Bds/BootLinux.c | 124 +++++++++++++++++++++++++++++
ArmPlatformPkg/Bds/BootMenu.c | 161 +++++++++++++++++++++++++++++---------
6 files changed, 274 insertions(+), 53 deletions(-)
create mode 100644 ArmPlatformPkg/Bds/BootLinux.c

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index be0919b..45aeaee 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -61,6 +61,9 @@
# we assume the OS will handle the FrameBuffer from the UEFI GOP information.
gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D

+ # Enable Legacy Linux support in the BDS
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport|TRUE|BOOLEAN|0x0000002E
+
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039
gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 3b6ffc3..06e8d91 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -27,6 +27,7 @@
[Sources]
Bds.c
BdsHelper.c
+ BootLinux.c
BootMenu.c
BootOption.c
BootOptionSupport.c
@@ -72,6 +73,9 @@
gEfiDhcp4ServiceBindingProtocolGuid
gEfiMtftp4ServiceBindingProtocolGuid

+[FeaturePcd]
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport
+
[Pcd]
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c
index b3003e9..732292c 100644
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ b/ArmPlatformPkg/Bds/BdsHelper.c
@@ -256,15 +256,6 @@ GetHIInputBoolean (
}
}

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- )
-{
- return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
- (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
-}
-
// Return the last non end-type Device Path Node from a Device Path
EFI_DEVICE_PATH*
GetLastDevicePathNode (
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index fe4fd79..ddf5308 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -79,6 +79,12 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption

+// GUID of the EFI Linux Loader
+extern CONST EFI_GUID mLinuxLoaderAppGuid;
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;
+
EFI_STATUS
BootDeviceListSupportedInit (
IN OUT LIST_ENTRY *SupportedDeviceList
@@ -141,11 +147,6 @@ GetHIInputBoolean (
OUT BOOLEAN *Value
);

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- );
-
EFI_DEVICE_PATH*
GetLastDevicePathNode (
IN EFI_DEVICE_PATH* DevicePath
@@ -260,4 +261,17 @@ EmptyCallbackFunction (
IN VOID *Context
);

+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ );
+
#endif /* _BDSINTERNAL_H_ */
diff --git a/ArmPlatformPkg/Bds/BootLinux.c b/ArmPlatformPkg/Bds/BootLinux.c
new file mode 100644
index 0000000..0445e89
--- /dev/null
+++ b/ArmPlatformPkg/Bds/BootLinux.c
@@ -0,0 +1,124 @@
+/** @file
+*
+* Copyright (c) 2011 - 2015, 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
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include "BdsInternal.h"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+EFI_DEVICE_PATH* mLinuxLoaderDevicePath = NULL;
+
+STATIC
+BOOLEAN
+HasFilePathEfiExtension (
+ IN CHAR16* FilePath
+ )
+{
+ return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
+ (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
+}
+
+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ )
+{
+ EFI_STATUS Status;
+ CHAR16* FileName;
+ EFI_DEVICE_PATH* PrevDevicePathNode;
+ EFI_DEVICE_PATH* DevicePathNode;
+ EFI_PHYSICAL_ADDRESS Image;
+ UINTN FileSize;
+ EFI_IMAGE_DOS_HEADER* DosHeader;
+ UINTN PeCoffHeaderOffset;
+ EFI_IMAGE_NT_HEADERS32* NtHeader;
+
+ ASSERT (EfiBinary != NULL);
+
+ //
+ // Check if the last node of the device path is a FilePath node
+ //
+ PrevDevicePathNode = NULL;
+ DevicePathNode = DevicePath;
+ while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
+ PrevDevicePathNode = DevicePathNode;
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ if ((PrevDevicePathNode != NULL) &&
+ (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
+ (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
+ {
+ FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
+ } else {
+ FileName = NULL;
+ }
+
+ if (FileName == NULL) {
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ } else if (HasFilePathEfiExtension (FileName)) {
+ *EfiBinary = TRUE;
+ } else {
+ // Check if the file exist
+ Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
+ if (!EFI_ERROR (Status)) {
+
+ DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
+ if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present,
+ // so read the PE header after the DOS image header.
+ //
+ PeCoffHeaderOffset = DosHeader->e_lfanew;
+ } else {
+ PeCoffHeaderOffset = 0;
+ }
+
+ //
+ // Check PE/COFF image.
+ //
+ NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
+ if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
+ *EfiBinary = FALSE;
+ } else {
+ *EfiBinary = TRUE;
+ }
+
+ // Free memory
+ gBS->FreePages (Image, EFI_SIZE_TO_PAGES (FileSize));
+ } else {
+ // If we did not manage to open it then ask for the type
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index af7f1f1..8caa3ce 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -269,6 +269,8 @@ BootMenuAddBootOption (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN EfiBinary;
+ CHAR16 *LinuxDevicePath;

Attributes = 0;
SupportedBootDevice = NULL;
@@ -281,8 +283,12 @@ BootMenuAddBootOption (
}

// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
- if (EFI_ERROR(Status)) {
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
+ } else {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application", &DevicePathNodes);
+ }
+ if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
@@ -293,8 +299,39 @@ BootMenuAddBootOption (
goto EXIT;
}

+ // Is it an EFI application?
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (CmdLine, LinuxDevicePath, MAX (sizeof (CmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+ } else {
+ CmdLine[0] = L'\0';
+ }
+ } else {
+ CmdLine[0] = L'\0';
+ }
+
Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ Status = EditHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -366,11 +403,13 @@ BootMenuUpdateBootOption (
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
+ CHAR16 *LinuxDevicePath;
EFI_DEVICE_PATH *DevicePath;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
BOOLEAN IsUnicode;
+ BOOLEAN EfiBinary;

DisplayBootOptions (BootOptionsList);
Status = SelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
@@ -386,46 +425,87 @@ BootMenuUpdateBootOption (
return EFI_UNSUPPORTED;
}

- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
+ EfiBinary = TRUE;
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ // Is it an EFI application?
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (UnicodeCmdLine, LinuxDevicePath, MAX (sizeof (UnicodeCmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+
+ // The command line is a unicode printable string
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }
+ } else {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
}

Print (L"Arguments to pass to the EFI Application: ");

- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
+ // When the command line has not been initialized by the embedded Linux loader earlier
+ if (EfiBinary) {
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than "BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by "BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
+ } else {
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
+ }
}
+ } else {
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
}
- } else {
- UnicodeCmdLine[0] = L'\0';
- IsPrintable = TRUE;
- IsUnicode = TRUE;
}

// We do not request arguments for OptionalData that cannot be printed
@@ -909,7 +989,6 @@ struct BOOT_MAIN_ENTRY {
{ L"Boot Manager", BootMenuManager },
};

-
EFI_STATUS
BootMenuMain (
VOID
@@ -929,6 +1008,12 @@ BootMenuMain (
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);

+ if (FeaturePcdGet (PcdBdsLinuxSupport)) {
+ // Check Linux Loader is present
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &mLinuxLoaderDevicePath);
+ ASSERT_EFI_ERROR (Status);
+ }
+
while (TRUE) {
// Get Boot#### list
BootOptionList (&BootOptionsList);
--
2.1.1
Olivier Martin
2015-07-13 16:36:46 UTC
Permalink
From: Ronald Cron <***@arm.com>

Add the legacy Linux Loader EFI application to the ARM
development platforms.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <***@arm.com>
Reviewed-by: Olivier Martin <***@arm.com>
---
ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf | 1 +
ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc | 12 ++++++++++++
ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf | 4 +++-
ArmPlatformPkg/ArmPlatformPkg.dsc | 13 +++++++++++++
ArmPlatformPkg/ArmPlatformPkg.fdf | 4 +++-
.../ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf | 4 +++-
.../ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf | 5 ++++-
ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 17 +++++++++++++++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 2 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 3 ++-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf | 3 +++
.../ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 5 ++++-
BeagleBoardPkg/BeagleBoardPkg.dsc | 14 +++++++++++++-
BeagleBoardPkg/BeagleBoardPkg.fdf | 3 +++
24 files changed, 104 insertions(+), 13 deletions(-)

diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
index 2dbf0e6..db70609 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
@@ -191,6 +191,7 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092
# UEFI applications
#
INF ShellBinPkg/UefiShell/UefiShell.inf
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

#
# Juno platform driver
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
index 4cfb913..76415fe 100644
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
@@ -89,6 +89,11 @@
# Networking Requirements for ArmPlatformPkg/Bds
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
@@ -298,6 +303,11 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
@@ -369,3 +379,5 @@
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
index 86a94c1..9c35ebb 100644
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
+++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -129,6 +129,8 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index f9f217c..0147146 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -88,6 +88,11 @@
# Networking Requirements for ArmPlatformPkg/Bds
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
@@ -331,6 +336,11 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
@@ -434,3 +444,6 @@
#
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
ArmPlatformPkg/Bds/Bds.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg.fdf b/ArmPlatformPkg/ArmPlatformPkg.fdf
index 36ca8b0..0dd9849 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.fdf
+++ b/ArmPlatformPkg/ArmPlatformPkg.fdf
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -178,6 +178,8 @@ FvNameGuid = 8fa66cd0-f773-4f26-8f9f-5e54d0804c68
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
index bedcf77..85c74df 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
@@ -1,6 +1,6 @@
# FLASH layout file for ARM RealView EB.
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -177,6 +177,8 @@ FvNameGuid = 14801114-da6a-4113-985b-dc876337a15e
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
index c6acf9e..55257c2 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
@@ -1,7 +1,7 @@
# FLASH layout file for ARM RealView EB.
#
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011 - 2015, 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
@@ -178,6 +178,9 @@ FvNameGuid = 14801114-da6a-4113-985b-dc876337a15e
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
index d0889f5..6232791 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
@@ -105,6 +105,11 @@

GdbSerialLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/GdbSerialLib/GdbSerialLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# BDS Libraries
BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@@ -303,13 +308,18 @@
gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x10000048
gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x10005000

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM OS Loader
#
gArmTokenSpaceGuid.PcdArmMachineType|827
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(14801114-DA6A-4113-985B-DC876337A15E)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM -a 827 -c \"console=ttyAMA0,38400n8\""

# Use the Serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
@@ -325,3 +335,6 @@

# FV Filesystem
MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 318c2cf..3b693c2 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -184,7 +184,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0xE000000,0xE800000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
index 3cb634a..3b4b1fc 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
@@ -172,6 +172,9 @@ FvNameGuid = 73dcb643-3862-4904-9076-a94af1890243
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index ad4e7bf..baa5478 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -183,7 +183,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0x46000000,0x46400000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
index c8f425f..7a26f3c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
@@ -241,6 +241,9 @@ FvNameGuid = 1a9b3625-5286-4fa6-af5f-8eabc481f3cc
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
index 95d5b1d..53e2ca8 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
@@ -203,6 +203,9 @@ FvNameGuid = 87940482-fc81-41c3-87e6-399cf85ac8a0
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index bee8f95..fb42f34 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -160,7 +160,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
index 0f20a04..b71eb5c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
@@ -219,6 +219,9 @@ FvNameGuid = 9ca4f58c-341e-4f42-b37d-6042fcddb5bf
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x1.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index 5f85b28..09dc1db 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -162,7 +162,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
index 507afac..1758a5f 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
@@ -219,6 +219,9 @@ FvNameGuid = 12c68be9-0996-49d3-8c5b-4957379027ee
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x4.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
index 14d0cf5..2fe9e58 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
@@ -163,7 +163,8 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(272E583C-B951-433F-AF42-A9C6862AF002)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage -c \"console=ttyAMA0,38400n8\""
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
index d671489..029b608 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
@@ -205,6 +205,9 @@ FvNameGuid = 272e583c-b951-433f-af42-a9c6862af002
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca9x4.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
index 5015266..402ee96 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
@@ -187,6 +187,9 @@ FvNameGuid = 6685e0b5-d6bb-4c12-97ef-58bd87112dee
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 16
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
index ee862d4..6cd125b 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
@@ -197,6 +197,9 @@ FvNameGuid = a2fc72eb-4157-40a3-8110-14c010e810b4
# after the device drivers (eg: Ethernet) to ensure we have support for them.
INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 16
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
index c6b2598..3d6537a 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
@@ -383,7 +383,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/MemoryMapped(0x0,0xED000000,0xED400000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
@@ -436,3 +436,6 @@
# FDT installation
#
EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 9eb364e..7aa6ce2 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -63,6 +63,10 @@

EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf

PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf

@@ -345,13 +349,18 @@
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|13000000

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000

gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SD"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=tty0 console=ttyS2,115200n8 root=UUID=a4af765b-c2b5-48f4-9564-7a4e9104c4f6 rootwait ro earlyprintk"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
@@ -473,6 +482,9 @@
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
#
# Example Application
#
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf b/BeagleBoardPkg/BeagleBoardPkg.fdf
index 9bc5b13..a639244 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -174,6 +174,9 @@ FvNameGuid = d0dd3e90-343d-4cb3-8f69-772214989282
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+

[FV.FVMAIN_COMPACT]
FvAlignment = 8
--
2.1.1
Olivier Martin
2015-07-13 16:36:54 UTC
Permalink
There are still ARM/AArch64 Linux kernels that do not
support EFI Stub.
By using the EFI Linux loader as the default option
we can boot any Linux kernel from UEFI as Linux
kernel with EFI stub can also be booted with the
legacy way.

Change-Id: I23aa84ae46c3fbad72380c4bab92ec86fbca0c24
---
ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc | 5 ++---
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 4 ++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 5 +++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 5 ++---
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 3 ++-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 5 +++--
6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
index 9860cf0..09ec5b3 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
@@ -146,10 +146,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NOR Flash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
-
# Support the Linux EFI stub by default
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"EFI Linux from NOR Flash"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug"

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 50bb556..c1e3513 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -182,8 +182,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(73DCB643-3862-4904-9076-A94AF1890243)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/kernel -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
# PL111 - CLCD
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index 18cc978..b7a43fc 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -180,8 +180,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(1A9B3625-5286-4FA6-AF5F-8EABC481F3CC)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/kernel -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
index 1b6134f..119ba3a 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -174,9 +174,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -f VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz -c \"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index 3896166..b34d9d1 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -158,7 +158,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(9CA4F58C-341E-4F42-B37D-6042FCDDB5BF)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index acfe164..37f3648 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -159,8 +159,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(12C68BE9-0996-49D3-8C5B-4957379027EE)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
--
2.1.1
Olivier Martin
2015-07-13 16:36:44 UTC
Permalink
Change-Id: I8b8596c9457e079227cc00d3f7eff8cc0319cedd
---
.../AndroidFastboot/AndroidFastbootApp.inf | 3 +-
.../AndroidFastboot/Arm/BootAndroidBootImg.c | 48 +++++++++++++++++++---
2 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
index ab9354c..ca17af8 100644
--- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
+++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -39,6 +39,7 @@
PrintLib
UefiApplicationEntryPoint
UefiBootServicesTableLib
+ UefiLib
UefiRuntimeServicesTableLib

[Protocols]
diff --git a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
index 7e9ad88..3053cf0 100644
--- a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
+++ b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2013-2015, ARM Ltd. All rights reserved.<BR>

This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -18,9 +18,16 @@

#include <Library/BdsLib.h>
#include <Library/DevicePathLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>

#include <Guid/ArmGlobalVariableHob.h>

+#define LINUX_LOADER_COMMAND_LINE L"%s -f %s -c %s"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
// Device Path representing an image in memory
#pragma pack(1)
typedef struct {
@@ -64,6 +71,10 @@ BootAndroidBootImg (
UINTN RamdiskSize;
MEMORY_DEVICE_PATH KernelDevicePath;
MEMORY_DEVICE_PATH* RamdiskDevicePath;
+ CHAR16* KernelDevicePathTxt;
+ CHAR16* RamdiskDevicePathTxt;
+ EFI_DEVICE_PATH* LinuxLoaderDevicePath;
+ CHAR16* LoadOptions;

Status = ParseAndroidBootImg (
Buffer,
@@ -92,20 +103,45 @@ BootAndroidBootImg (
RamdiskDevicePath->Node1.EndingAddress = ((EFI_PHYSICAL_ADDRESS)(UINTN) Ramdisk) + RamdiskSize;
}

- Status = BdsBootLinuxFdt (
- (EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) RamdiskDevicePath,
- KernelArgs
- );
+ //
+ // Boot Linux using the Legacy Linux Loader
+ //
+
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &LinuxLoaderDevicePath);
+ if (EFI_ERROR (Status)) {
+ Print (L"Couldn't Boot Linux: %d\n", Status);
+ return EFI_DEVICE_ERROR;
+ }
+
+ KernelDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath, FALSE, FALSE);
+ if (KernelDevicePathTxt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ RamdiskDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) RamdiskDevicePath, FALSE, FALSE);
+ if (RamdiskDevicePathTxt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ // Initialize Legacy Linux loader command line
+ LoadOptions = CatSPrint (NULL, LINUX_LOADER_COMMAND_LINE, KernelDevicePathTxt, RamdiskDevicePathTxt, KernelArgs);
+ if (LoadOptions == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = BdsStartEfiApplication (gImageHandle, LinuxLoaderDevicePath, StrSize (LoadOptions), LoadOptions);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Couldn't Boot Linux: %d\n", Status));
return EFI_DEVICE_ERROR;
}

if (RamdiskDevicePath) {
+ FreePool (RamdiskDevicePathTxt);
FreePool (RamdiskDevicePath);
}

+ FreePool (KernelDevicePathTxt);
+
// If we got here we do a confused face because BootLinuxFdt returned,
// reporting success.
DEBUG ((EFI_D_ERROR, "WARNING: BdsBootLinuxFdt returned EFI_SUCCESS.\n"));
--
2.1.1
Olivier Martin
2015-07-13 16:36:56 UTC
Permalink
PcdDefaultBootType has been removed when the embedded
Linux Loader has been removed from BdsLib.
The boot arguments (defined by PcdDefaultBootArgument) are
now always targetting EFI applications.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmVirtPkg/ArmVirtQemu.dsc | 1 -
1 file changed, 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index fbc2b12..0d4f4b0 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -133,7 +133,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux (EFI stub) on virtio31:hd0:part0"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A00000000)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/vda2 console=ttyAMA0 earlycon uefi_debug"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

#
# Settings for ARM BDS -- use the serial console (ConIn & ConOut).
--
2.1.1
Laszlo Ersek
2015-07-13 17:30:04 UTC
Permalink
Post by Olivier Martin
PcdDefaultBootType has been removed when the embedded
Linux Loader has been removed from BdsLib.
The boot arguments (defined by PcdDefaultBootArgument) are
now always targetting EFI applications.
Contributed-under: TianoCore Contribution Agreement 1.0
---
ArmVirtPkg/ArmVirtQemu.dsc | 1 -
1 file changed, 1 deletion(-)
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index fbc2b12..0d4f4b0 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -133,7 +133,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux (EFI stub) on virtio31:hd0:part0"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A00000000)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/vda2 console=ttyAMA0 earlycon uefi_debug"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0
#
# Settings for ARM BDS -- use the serial console (ConIn & ConOut).
The declaration of "gArmPlatformTokenSpaceGuid.PcdDefaultBootType" is
removed from "ArmPlatformPkg/ArmPlatformPkg.dec" in patch #5. Therefore,
if someone were to build the ArmVirtQemu.dsc platform right at patch #5,
it would break.

I'd like to request the following:
- First, please remove the code (driver, library, etc) that consumes
PcdDefaultBootType. At this point the PCD becomes unused, code-wise,
but the tree should build.
- Second, please remove the PCD assignments from the DSC files across
the tree.
- Third, please drop the PCD declaration as last step.

Thank you
Laszlo
Olivier Martin
2015-07-13 16:36:55 UTC
Permalink
PcdDefaultBootType has been removed when the embedded
Linux Loader has been removed from BdsLib.
The boot arguments (defined by PcdDefaultBootArgument) are
now always targetting EFI applications.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
Cc: Laszlo Ersek <***@redhat.com>
Cc: Ard Biesheuvel <***@linaro.org>
---
ArmVirtPkg/ArmVirtQemu.dsc | 1 -
1 file changed, 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index fbc2b12..0d4f4b0 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -133,7 +133,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux (EFI stub) on virtio31:hd0:part0"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A00000000)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/vda2 console=ttyAMA0 earlycon uefi_debug"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

#
# Settings for ARM BDS -- use the serial console (ConIn & ConOut).
--
2.1.1
Olivier Martin
2015-07-13 16:36:42 UTC
Permalink
Change-Id: I34777219b14393759f57dc660bd386da0542376a
---
ArmPkg/Include/Library/BdsLib.h | 52 ++++---
ArmPkg/Library/BdsLib/BdsAppLoader.c | 283 ++++++++++++++++++++++++-----------
ArmPlatformPkg/Bds/Bds.inf | 3 +
ArmPlatformPkg/Bds/BootMenu.c | 24 ++-
4 files changed, 250 insertions(+), 112 deletions(-)

diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h
index c6416db..3d9e195 100644
--- a/ArmPkg/Include/Library/BdsLib.h
+++ b/ArmPkg/Include/Library/BdsLib.h
@@ -193,24 +193,6 @@ BdsStartEfiApplication (
IN VOID* LoadOptions
);

-/**
- Start an EFI Application from any Firmware Volume
-
- @param EfiApp EFI Application Name
-
- @retval EFI_SUCCESS All drivers have been connected
- @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
- @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
-
-**/
-EFI_STATUS
-BdsLoadApplication (
- IN EFI_HANDLE ParentImageHandle,
- IN CHAR16* EfiApp,
- IN UINTN LoadOptionsSize,
- IN VOID* LoadOptions
- );
-
EFI_STATUS
BdsLoadImage (
IN EFI_DEVICE_PATH *DevicePath,
@@ -227,4 +209,38 @@ ShutdownUefiBootServices (
VOID
);

+/**
+ Locate an EFI application in a the Firmware Volumes by its name
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateEfiApplicationInFvByName (
+ IN CONST CHAR16* EfiAppName,
+ OUT EFI_DEVICE_PATH **DevicePath
+ );
+
+/**
+ Locate an EFI application in a the Firmware Volumes by its GUID
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateEfiApplicationInFvByGuid (
+ IN CONST EFI_GUID *EfiAppGuid,
+ OUT EFI_DEVICE_PATH **DevicePath
+ );
+
#endif
diff --git a/ArmPkg/Library/BdsLib/BdsAppLoader.c b/ArmPkg/Library/BdsLib/BdsAppLoader.c
index 2b88bf1..1f208f8 100644
--- a/ArmPkg/Library/BdsLib/BdsAppLoader.c
+++ b/ArmPkg/Library/BdsLib/BdsAppLoader.c
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -14,18 +14,23 @@

#include "BdsInternal.h"

-//#include <Library/DxeServicesLib.h>
+/**
+ Locate an EFI application in a the Firmware Volumes by its Name
+
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.

-STATIC
+**/
EFI_STATUS
-BdsLoadFileFromFirmwareVolume (
- IN EFI_HANDLE FvHandle,
- IN CHAR16 *FilePath,
- IN EFI_FV_FILETYPE FileTypeFilter,
- OUT EFI_DEVICE_PATH **EfiAppDevicePath
+LocateEfiApplicationInFvByName (
+ IN CONST CHAR16* EfiAppName,
+ OUT EFI_DEVICE_PATH **DevicePath
)
{
- EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;
VOID *Key;
EFI_STATUS Status, FileStatus;
EFI_GUID NameGuid;
@@ -37,108 +42,212 @@ BdsLoadFileFromFirmwareVolume (
UINT32 Authentication;
EFI_DEVICE_PATH *FvDevicePath;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileDevicePath;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;

- Status = gBS->HandleProtocol (FvHandle,&gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FvProtocol);
- if (EFI_ERROR(Status)) {
- return Status;
- }
+ ASSERT (DevicePath != NULL);

// Length of FilePath
- UiStringLen = StrLen (FilePath);
-
- // Allocate Key
- Key = AllocatePool (FvProtocol->KeySize);
- ASSERT (Key != NULL);
- ZeroMem (Key, FvProtocol->KeySize);
+ UiStringLen = StrLen (EfiAppName);
+
+ // Locate all the Firmware Volume protocols.
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }

- do {
- // Search in all files
- FileType = FileTypeFilter;
+ *DevicePath = NULL;
+
+ // Looking for FV with ACPI storage file
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ //
+ // Get the protocol on this handle
+ // This should not fail because of LocateHandleBuffer
+ //
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (VOID**) &FvInstance
+ );
+ if (EFI_ERROR (Status)) {
+ goto FREE_HANDLE_BUFFER;
+ }

- Status = FvProtocol->GetNextFile (FvProtocol, Key, &FileType, &NameGuid, &Attributes, &Size);
- if (!EFI_ERROR (Status)) {
- UiSection = NULL;
- FileStatus = FvProtocol->ReadSection (
- FvProtocol,
- &NameGuid,
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **)&UiSection,
- &Size,
- &Authentication
- );
- if (!EFI_ERROR (FileStatus)) {
- if (StrnCmp (FilePath, UiSection, UiStringLen) == 0) {
- //
- // We found a UiString match.
- //
- Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
-
- // Generate the Device Path for the file
- //DevicePath = DuplicateDevicePath(FvDevicePath);
- EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);
- *EfiAppDevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);
-
- FreePool (Key);
+ // Allocate Key
+ Key = AllocatePool (FvInstance->KeySize);
+ ASSERT (Key != NULL);
+ ZeroMem (Key, FvInstance->KeySize);
+
+ do {
+ // Search in all files
+ FileType = EFI_FV_FILETYPE_ALL;
+
+ Status = FvInstance->GetNextFile (FvInstance, Key, &FileType, &NameGuid, &Attributes, &Size);
+ if (!EFI_ERROR (Status)) {
+ UiSection = NULL;
+ FileStatus = FvInstance->ReadSection (
+ FvInstance,
+ &NameGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&UiSection,
+ &Size,
+ &Authentication
+ );
+ if (!EFI_ERROR (FileStatus)) {
+ if (StrnCmp (EfiAppName, UiSection, UiStringLen) == 0) {
+ //
+ // We found a UiString match.
+ //
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
+
+ // Generate the Device Path for the file
+ EfiInitializeFwVolDevicepathNode (&FileDevicePath, &NameGuid);
+ *DevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FileDevicePath);
+ ASSERT (*DevicePath != NULL);
+
+ FreePool (Key);
+ FreePool (UiSection);
+ FreePool (HandleBuffer);
+ return FileStatus;
+ }
FreePool (UiSection);
- return FileStatus;
}
- FreePool (UiSection);
}
- }
- } while (!EFI_ERROR (Status));
+ } while (!EFI_ERROR (Status));

- FreePool(Key);
- return Status;
+ FreePool (Key);
+ }
+
+FREE_HANDLE_BUFFER:
+ FreePool (HandleBuffer);
+ return EFI_NOT_FOUND;
}

/**
- Start an EFI Application from any Firmware Volume
+ Locate an EFI application in a the Firmware Volumes by its GUID

- @param EfiApp EFI Application Name
+ @param EfiAppGuid Guid of the EFI Application into the Firmware Volume
+ @param DevicePath EFI Device Path of the EFI application

- @retval EFI_SUCCESS All drivers have been connected
- @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found
- @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results.
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.

**/
EFI_STATUS
-BdsLoadApplication (
- IN EFI_HANDLE ParentImageHandle,
- IN CHAR16* EfiApp,
- IN UINTN LoadOptionsSize,
- IN VOID* LoadOptions
+LocateEfiApplicationInFvByGuid (
+ IN CONST EFI_GUID *EfiAppGuid,
+ OUT EFI_DEVICE_PATH **DevicePath
)
{
- EFI_STATUS Status;
- UINTN NoHandles, HandleIndex;
- EFI_HANDLE *Handles;
- EFI_DEVICE_PATH *EfiAppDevicePath;
-
- // Need to connect every drivers to ensure no dependencies are missing for the application
- Status = BdsConnectAllDrivers();
- if (EFI_ERROR(Status)) {
- DEBUG ((EFI_D_ERROR, "FAIL to connect all drivers\n"));
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH *FvDevicePath;
+ EFI_HANDLE *HandleBuffer;
+ UINTN NumberOfHandles;
+ UINTN Index;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
+ EFI_FV_FILE_ATTRIBUTES Attributes;
+ UINT32 AuthenticationStatus;
+ EFI_FV_FILETYPE Type;
+ UINTN Size;
+ CHAR16 *UiSection;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FvFileDevicePath;
+
+ ASSERT (DevicePath != NULL);
+
+ // Locate all the Firmware Volume protocols.
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ NULL,
+ &NumberOfHandles,
+ &HandleBuffer
+ );
+ if (EFI_ERROR (Status)) {
return Status;
}

- // Search the application in any Firmware Volume
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &NoHandles, &Handles);
- if (EFI_ERROR (Status) || (NoHandles == 0)) {
- DEBUG ((EFI_D_ERROR, "FAIL to find Firmware Volume\n"));
- return Status;
- }
+ *DevicePath = NULL;
+
+ // Looking for FV with ACPI storage file
+ for (Index = 0; Index < NumberOfHandles; Index++) {
+ //
+ // Get the protocol on this handle
+ // This should not fail because of LocateHandleBuffer
+ //
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiFirmwareVolume2ProtocolGuid,
+ (VOID**) &FvInstance
+ );
+ if (EFI_ERROR (Status)) {
+ goto FREE_HANDLE_BUFFER;
+ }

- // Search in all Firmware Volume for the EFI Application
- for (HandleIndex = 0; HandleIndex < NoHandles; HandleIndex++) {
- EfiAppDevicePath = NULL;
- Status = BdsLoadFileFromFirmwareVolume (Handles[HandleIndex], EfiApp, EFI_FV_FILETYPE_APPLICATION, &EfiAppDevicePath);
- if (!EFI_ERROR (Status)) {
- // Start the application
- Status = BdsStartEfiApplication (ParentImageHandle, EfiAppDevicePath, LoadOptionsSize, LoadOptions);
- return Status;
+ Status = FvInstance->ReadFile (
+ FvInstance,
+ EfiAppGuid,
+ NULL,
+ &Size,
+ &Type,
+ &Attributes,
+ &AuthenticationStatus
+ );
+ if (EFI_ERROR (Status)) {
+ //
+ // Skip if no EFI application file in the FV
+ //
+ continue;
+ } else {
+ UiSection = NULL;
+ Status = FvInstance->ReadSection (
+ FvInstance,
+ EfiAppGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&UiSection,
+ &Size,
+ &AuthenticationStatus
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Create the EFI Device Path for the application using the Filename of the application
+ //
+ *DevicePath = FileDevicePath (HandleBuffer[Index], UiSection);
+ } else {
+ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID**)&FvDevicePath);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Create the EFI Device Path for the application using the EFI GUID of the application
+ //
+ EfiInitializeFwVolDevicepathNode (&FvFileDevicePath, EfiAppGuid);
+
+ *DevicePath = AppendDevicePathNode (FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&FvFileDevicePath);
+ ASSERT (*DevicePath != NULL);
+ }
+ break;
}
}

- return Status;
+FREE_HANDLE_BUFFER:
+ //
+ // Free any allocated buffers
+ //
+ FreePool (HandleBuffer);
+
+ if (*DevicePath == NULL) {
+ return EFI_NOT_FOUND;
+ } else {
+ return EFI_SUCCESS;
+ }
}
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index f4c0f1c..76a45e0 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -37,6 +37,7 @@
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
+ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec

[LibraryClasses]
BdsLib
@@ -79,5 +80,7 @@
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths

+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
+
[Depex]
TRUE
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index d2dccbc..a304cc4 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -1069,17 +1069,27 @@ BootShell (
IN LIST_ENTRY *BootOptionsList
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH* EfiShellDevicePath;

- // Start EFI Shell
- Status = BdsLoadApplication (gImageHandle, L"Shell", 0, NULL);
+ // Find the EFI Shell
+ Status = LocateEfiApplicationInFvByName (L"Shell", &EfiShellDevicePath);
if (Status == EFI_NOT_FOUND) {
Print (L"Error: EFI Application not found.\n");
- } else if (EFI_ERROR(Status)) {
- Print (L"Error: Status Code: 0x%X\n",(UINT32)Status);
- }
+ return Status;
+ } else if (EFI_ERROR (Status)) {
+ Print (L"Error: Status Code: 0x%X\n", (UINT32)Status);
+ return Status;
+ } else {
+ // Need to connect every drivers to ensure no dependencies are missing for the application
+ Status = BdsConnectAllDrivers ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "FAIL to connect all drivers\n"));
+ return Status;
+ }

- return Status;
+ return BdsStartEfiApplication (gImageHandle, EfiShellDevicePath, 0, NULL);
+ }
}

struct BOOT_MAIN_ENTRY {
--
2.1.1
Olivier Martin
2015-07-13 16:36:45 UTC
Permalink
From: Ronald Cron <***@arm.com>

Add the legacy Linux Loader EFI application to the ARM
development platform firmware.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <***@arm.com>
Reviewed-by: Olivier Martin <***@arm.com>
---
ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf | 1 +
ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc | 12 ++++++++++++
ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf | 4 +++-
ArmPlatformPkg/ArmPlatformPkg.dsc | 13 +++++++++++++
ArmPlatformPkg/ArmPlatformPkg.fdf | 4 +++-
.../ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf | 4 +++-
.../ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf | 5 ++++-
ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 17 +++++++++++++++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 2 +-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 2 +-
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 3 ++-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf | 3 +++
.../ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf | 3 +++
.../ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf | 3 +++
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 5 ++++-
BeagleBoardPkg/BeagleBoardPkg.dsc | 14 +++++++++++++-
BeagleBoardPkg/BeagleBoardPkg.fdf | 3 +++
24 files changed, 104 insertions(+), 13 deletions(-)

diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
index 2dbf0e6..db70609 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.fdf
@@ -191,6 +191,7 @@ FvNameGuid = B73FE497-B92E-416e-8326-45AD0D270092
# UEFI applications
#
INF ShellBinPkg/UefiShell/UefiShell.inf
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

#
# Juno platform driver
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
index 4cfb913..76415fe 100644
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc
@@ -89,6 +89,11 @@
# Networking Requirements for ArmPlatformPkg/Bds
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
@@ -298,6 +303,11 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
@@ -369,3 +379,5 @@
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
index 86a94c1..9c35ebb 100644
--- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
+++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.fdf
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -129,6 +129,8 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index f9f217c..0147146 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -88,6 +88,11 @@
# Networking Requirements for ArmPlatformPkg/Bds
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# EBL Related Libraries
EblCmdLib|ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
@@ -331,6 +336,11 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
@@ -434,3 +444,6 @@
#
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
ArmPlatformPkg/Bds/Bds.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmPlatformPkg.fdf b/ArmPlatformPkg/ArmPlatformPkg.fdf
index 36ca8b0..0dd9849 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.fdf
+++ b/ArmPlatformPkg/ArmPlatformPkg.fdf
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -178,6 +178,8 @@ FvNameGuid = 8fa66cd0-f773-4f26-8f9f-5e54d0804c68
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
index bedcf77..85c74df 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-MPCore.fdf
@@ -1,6 +1,6 @@
# FLASH layout file for ARM RealView EB.
#
-# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2015, 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
@@ -177,6 +177,8 @@ FvNameGuid = 14801114-da6a-4113-985b-dc876337a15e
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
index c6acf9e..55257c2 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-UniCore.fdf
@@ -1,7 +1,7 @@
# FLASH layout file for ARM RealView EB.
#
# Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
+# Copyright (c) 2011 - 2015, 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
@@ -178,6 +178,9 @@ FvNameGuid = 14801114-da6a-4113-985b-dc876337a15e
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+

[FV.FVMAIN_COMPACT]
FvAlignment = 8
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
index d0889f5..6232791 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
@@ -105,6 +105,11 @@

GdbSerialLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/GdbSerialLib/GdbSerialLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
# BDS Libraries
BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@@ -303,13 +308,18 @@
gArmPlatformTokenSpaceGuid.PcdPL180SysMciRegAddress|0x10000048
gArmPlatformTokenSpaceGuid.PcdPL180MciBaseAddress|0x10005000

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM OS Loader
#
gArmTokenSpaceGuid.PcdArmMachineType|827
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(14801114-DA6A-4113-985B-DC876337A15E)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM -a 827 -c \"console=ttyAMA0,38400n8\""

# Use the Serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
@@ -325,3 +335,6 @@

# FV Filesystem
MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 318c2cf..3b693c2 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -184,7 +184,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0xE000000,0xE800000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
index 3cb634a..3b4b1fc 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf
@@ -172,6 +172,9 @@ FvNameGuid = 73dcb643-3862-4904-9076-a94af1890243
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index ad4e7bf..baa5478 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -183,7 +183,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0x46000000,0x46400000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
index c8f425f..7a26f3c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf
@@ -241,6 +241,9 @@ FvNameGuid = 1a9b3625-5286-4fa6-af5f-8eabc481f3cc
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
index 95d5b1d..53e2ca8 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf
@@ -203,6 +203,9 @@ FvNameGuid = 87940482-fc81-41c3-87e6-399cf85ac8a0
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index bee8f95..fb42f34 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -160,7 +160,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
index 0f20a04..b71eb5c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf
@@ -219,6 +219,9 @@ FvNameGuid = 9ca4f58c-341e-4f42-b37d-6042fcddb5bf
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x1.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index 5f85b28..09dc1db 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -162,7 +162,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
index 507afac..1758a5f 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf
@@ -219,6 +219,9 @@ FvNameGuid = 12c68be9-0996-49d3-8c5b-4957379027ee
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x4.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
index 14d0cf5..2fe9e58 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
@@ -163,7 +163,8 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(272E583C-B951-433F-AF42-A9C6862AF002)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage -c \"console=ttyAMA0,38400n8\""
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
index d671489..029b608 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf
@@ -205,6 +205,9 @@ FvNameGuid = 272e583c-b951-433f-af42-a9c6862af002
# SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca9x4.dtb
#}

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 8
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
index 5015266..402ee96 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf
@@ -187,6 +187,9 @@ FvNameGuid = 6685e0b5-d6bb-4c12-97ef-58bd87112dee
# FV Filesystem
INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 16
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
index ee862d4..6cd125b 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf
@@ -197,6 +197,9 @@ FvNameGuid = a2fc72eb-4157-40a3-8110-14c010e810b4
# after the device drivers (eg: Ethernet) to ensure we have support for them.
INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
[FV.FVMAIN_COMPACT]
FvAlignment = 16
ERASE_POLARITY = 1
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
index c6b2598..3d6537a 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
@@ -383,7 +383,7 @@
# Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/MemoryMapped(0x0,0xED000000,0xED400000)"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
@@ -436,3 +436,6 @@
# FDT installation
#
EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
+
+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 9eb364e..7aa6ce2 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -63,6 +63,10 @@

EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf

+ # These libraries are used by the dynamic EFI Shell commands
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf

PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf

@@ -345,13 +349,18 @@
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|13000000

+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
#
# ARM Pcds
#
gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x0000000040000000

gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SD"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/zImage"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=tty0 console=ttyS2,115200n8 root=UUID=a4af765b-c2b5-48f4-9564-7a4e9104c4f6 rootwait ro earlyprintk"
gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
@@ -473,6 +482,9 @@
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+
#
# Example Application
#
diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf b/BeagleBoardPkg/BeagleBoardPkg.fdf
index 9bc5b13..a639244 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.fdf
+++ b/BeagleBoardPkg/BeagleBoardPkg.fdf
@@ -174,6 +174,9 @@ FvNameGuid = d0dd3e90-343d-4cb3-8f69-772214989282
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF ArmPlatformPkg/Bds/Bds.inf

+ # Legacy Linux Loader
+ INF ArmPkg/Application/LinuxLoader/LinuxLoader.inf
+

[FV.FVMAIN_COMPACT]
FvAlignment = 8
--
2.1.1
Olivier Martin
2015-07-13 16:36:53 UTC
Permalink
There are still ARM/AArch64 Linux kernels that do not
support EFI Stub.
By using the EFI Linux loader as the default option
we can boot any Linux kernel from UEFI as Linux
kernel with EFI stub can also be booted with the
legacy way.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc | 5 ++---
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 4 ++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 5 +++--
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 5 ++---
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 3 ++-
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 5 +++--
6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
index 9860cf0..09ec5b3 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
@@ -146,10 +146,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NOR Flash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
-
# Support the Linux EFI stub by default
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"EFI Linux from NOR Flash"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug"

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 50bb556..c1e3513 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -182,8 +182,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(73DCB643-3862-4904-9076-A94AF1890243)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/kernel -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
# PL111 - CLCD
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index 18cc978..b7a43fc 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -180,8 +180,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(1A9B3625-5286-4FA6-AF5F-8EABC481F3CC)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/kernel -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
index 1b6134f..119ba3a 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -174,9 +174,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(87940482-FC81-41C3-87E6-399CF85AC8A0)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -f VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz -c \"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index 3896166..b34d9d1 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -158,7 +158,8 @@
# ARM OS Loader
#
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(9CA4F58C-341E-4F42-B37D-6042FCDDB5BF)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index acfe164..37f3648 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -159,8 +159,9 @@
#
# ARM OS Loader
#
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(12C68BE9-0996-49D3-8C5B-4957379027EE)/LinuxLoader.efi"
+ gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image -c \"console=ttyAMA0,38400 earlyprintk debug verbose\""

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
--
2.1.1
Olivier Martin
2015-07-13 16:36:51 UTC
Permalink
When PcdBdsLinuxSupport is enabled, users can create boot
entries for the legacy EFI Linux loader if it exists into
the firmware.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmPlatformPkg/ArmPlatformPkg.dec | 3 +
ArmPlatformPkg/Bds/Bds.inf | 4 +
ArmPlatformPkg/Bds/BdsHelper.c | 9 ---
ArmPlatformPkg/Bds/BdsInternal.h | 26 ++++--
ArmPlatformPkg/Bds/BootLinux.c | 124 +++++++++++++++++++++++++++++
ArmPlatformPkg/Bds/BootMenu.c | 161 +++++++++++++++++++++++++++++---------
6 files changed, 274 insertions(+), 53 deletions(-)
create mode 100644 ArmPlatformPkg/Bds/BootLinux.c

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index be0919b..45aeaee 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -61,6 +61,9 @@
# we assume the OS will handle the FrameBuffer from the UEFI GOP information.
gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D

+ # Enable Legacy Linux support in the BDS
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport|TRUE|BOOLEAN|0x0000002E
+
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039
gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 3b6ffc3..06e8d91 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -27,6 +27,7 @@
[Sources]
Bds.c
BdsHelper.c
+ BootLinux.c
BootMenu.c
BootOption.c
BootOptionSupport.c
@@ -72,6 +73,9 @@
gEfiDhcp4ServiceBindingProtocolGuid
gEfiMtftp4ServiceBindingProtocolGuid

+[FeaturePcd]
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport
+
[Pcd]
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c
index b3003e9..732292c 100644
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ b/ArmPlatformPkg/Bds/BdsHelper.c
@@ -256,15 +256,6 @@ GetHIInputBoolean (
}
}

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- )
-{
- return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
- (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
-}
-
// Return the last non end-type Device Path Node from a Device Path
EFI_DEVICE_PATH*
GetLastDevicePathNode (
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index fe4fd79..ddf5308 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -79,6 +79,12 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption

+// GUID of the EFI Linux Loader
+extern CONST EFI_GUID mLinuxLoaderAppGuid;
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;
+
EFI_STATUS
BootDeviceListSupportedInit (
IN OUT LIST_ENTRY *SupportedDeviceList
@@ -141,11 +147,6 @@ GetHIInputBoolean (
OUT BOOLEAN *Value
);

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- );
-
EFI_DEVICE_PATH*
GetLastDevicePathNode (
IN EFI_DEVICE_PATH* DevicePath
@@ -260,4 +261,17 @@ EmptyCallbackFunction (
IN VOID *Context
);

+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ );
+
#endif /* _BDSINTERNAL_H_ */
diff --git a/ArmPlatformPkg/Bds/BootLinux.c b/ArmPlatformPkg/Bds/BootLinux.c
new file mode 100644
index 0000000..0445e89
--- /dev/null
+++ b/ArmPlatformPkg/Bds/BootLinux.c
@@ -0,0 +1,124 @@
+/** @file
+*
+* Copyright (c) 2011 - 2015, 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
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include "BdsInternal.h"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+EFI_DEVICE_PATH* mLinuxLoaderDevicePath = NULL;
+
+STATIC
+BOOLEAN
+HasFilePathEfiExtension (
+ IN CHAR16* FilePath
+ )
+{
+ return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
+ (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
+}
+
+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ )
+{
+ EFI_STATUS Status;
+ CHAR16* FileName;
+ EFI_DEVICE_PATH* PrevDevicePathNode;
+ EFI_DEVICE_PATH* DevicePathNode;
+ EFI_PHYSICAL_ADDRESS Image;
+ UINTN FileSize;
+ EFI_IMAGE_DOS_HEADER* DosHeader;
+ UINTN PeCoffHeaderOffset;
+ EFI_IMAGE_NT_HEADERS32* NtHeader;
+
+ ASSERT (EfiBinary != NULL);
+
+ //
+ // Check if the last node of the device path is a FilePath node
+ //
+ PrevDevicePathNode = NULL;
+ DevicePathNode = DevicePath;
+ while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
+ PrevDevicePathNode = DevicePathNode;
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ if ((PrevDevicePathNode != NULL) &&
+ (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
+ (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
+ {
+ FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
+ } else {
+ FileName = NULL;
+ }
+
+ if (FileName == NULL) {
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ } else if (HasFilePathEfiExtension (FileName)) {
+ *EfiBinary = TRUE;
+ } else {
+ // Check if the file exist
+ Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
+ if (!EFI_ERROR (Status)) {
+
+ DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
+ if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present,
+ // so read the PE header after the DOS image header.
+ //
+ PeCoffHeaderOffset = DosHeader->e_lfanew;
+ } else {
+ PeCoffHeaderOffset = 0;
+ }
+
+ //
+ // Check PE/COFF image.
+ //
+ NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
+ if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
+ *EfiBinary = FALSE;
+ } else {
+ *EfiBinary = TRUE;
+ }
+
+ // Free memory
+ gBS->FreePages (Image, EFI_SIZE_TO_PAGES (FileSize));
+ } else {
+ // If we did not manage to open it then ask for the type
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index af7f1f1..8caa3ce 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -269,6 +269,8 @@ BootMenuAddBootOption (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN EfiBinary;
+ CHAR16 *LinuxDevicePath;

Attributes = 0;
SupportedBootDevice = NULL;
@@ -281,8 +283,12 @@ BootMenuAddBootOption (
}

// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
- if (EFI_ERROR(Status)) {
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
+ } else {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application", &DevicePathNodes);
+ }
+ if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
@@ -293,8 +299,39 @@ BootMenuAddBootOption (
goto EXIT;
}

+ // Is it an EFI application?
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (CmdLine, LinuxDevicePath, MAX (sizeof (CmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+ } else {
+ CmdLine[0] = L'\0';
+ }
+ } else {
+ CmdLine[0] = L'\0';
+ }
+
Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ Status = EditHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -366,11 +403,13 @@ BootMenuUpdateBootOption (
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
+ CHAR16 *LinuxDevicePath;
EFI_DEVICE_PATH *DevicePath;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
BOOLEAN IsUnicode;
+ BOOLEAN EfiBinary;

DisplayBootOptions (BootOptionsList);
Status = SelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
@@ -386,46 +425,87 @@ BootMenuUpdateBootOption (
return EFI_UNSUPPORTED;
}

- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
+ EfiBinary = TRUE;
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ // Is it an EFI application?
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (UnicodeCmdLine, LinuxDevicePath, MAX (sizeof (UnicodeCmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+
+ // The command line is a unicode printable string
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }
+ } else {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
}

Print (L"Arguments to pass to the EFI Application: ");

- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
+ // When the command line has not been initialized by the embedded Linux loader earlier
+ if (EfiBinary) {
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than "BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by "BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
+ } else {
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
+ }
}
+ } else {
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
}
- } else {
- UnicodeCmdLine[0] = L'\0';
- IsPrintable = TRUE;
- IsUnicode = TRUE;
}

// We do not request arguments for OptionalData that cannot be printed
@@ -909,7 +989,6 @@ struct BOOT_MAIN_ENTRY {
{ L"Boot Manager", BootMenuManager },
};

-
EFI_STATUS
BootMenuMain (
VOID
@@ -929,6 +1008,12 @@ BootMenuMain (
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);

+ if (FeaturePcdGet (PcdBdsLinuxSupport)) {
+ // Check Linux Loader is present
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &mLinuxLoaderDevicePath);
+ ASSERT_EFI_ERROR (Status);
+ }
+
while (TRUE) {
// Get Boot#### list
BootOptionList (&BootOptionsList);
--
2.1.1
Ryan Harkin
2015-07-13 17:17:06 UTC
Permalink
Post by Olivier Martin
When PcdBdsLinuxSupport is enabled, users can create boot
entries for the legacy EFI Linux loader if it exists into
the firmware.
Surely this is only true if the kernel doesn't have an EFI header? If it
has an EFI header, it will be forced to use the EFI loader.
Post by Olivier Martin
Contributed-under: TianoCore Contribution Agreement 1.0
---
ArmPlatformPkg/ArmPlatformPkg.dec | 3 +
ArmPlatformPkg/Bds/Bds.inf | 4 +
ArmPlatformPkg/Bds/BdsHelper.c | 9 ---
ArmPlatformPkg/Bds/BdsInternal.h | 26 ++++--
ArmPlatformPkg/Bds/BootLinux.c | 124 +++++++++++++++++++++++++++++
ArmPlatformPkg/Bds/BootMenu.c | 161
+++++++++++++++++++++++++++++---------
6 files changed, 274 insertions(+), 53 deletions(-)
create mode 100644 ArmPlatformPkg/Bds/BootLinux.c
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec
b/ArmPlatformPkg/ArmPlatformPkg.dec
index be0919b..45aeaee 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -61,6 +61,9 @@
# we assume the OS will handle the FrameBuffer from the UEFI GOP information.
gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D
+ # Enable Legacy Linux support in the BDS
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport|TRUE|BOOLEAN|0x0000002E
+
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039
gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 3b6ffc3..06e8d91 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -27,6 +27,7 @@
[Sources]
Bds.c
BdsHelper.c
+ BootLinux.c
BootMenu.c
BootOption.c
BootOptionSupport.c
@@ -72,6 +73,9 @@
gEfiDhcp4ServiceBindingProtocolGuid
gEfiMtftp4ServiceBindingProtocolGuid
+[FeaturePcd]
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport
+
[Pcd]
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c
b/ArmPlatformPkg/Bds/BdsHelper.c
index b3003e9..732292c 100644
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ b/ArmPlatformPkg/Bds/BdsHelper.c
@@ -256,15 +256,6 @@ GetHIInputBoolean (
}
}
-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- )
-{
- return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
- (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
-}
-
// Return the last non end-type Device Path Node from a Device Path
EFI_DEVICE_PATH*
GetLastDevicePathNode (
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h
b/ArmPlatformPkg/Bds/BdsInternal.h
index fe4fd79..ddf5308 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -1,6 +1,6 @@
*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -79,6 +79,12 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
#define LOAD_OPTION_FROM_LINK(a)
((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY,
Link))->BdsLoadOption
+// GUID of the EFI Linux Loader
+extern CONST EFI_GUID mLinuxLoaderAppGuid;
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;
+
EFI_STATUS
BootDeviceListSupportedInit (
IN OUT LIST_ENTRY *SupportedDeviceList
@@ -141,11 +147,6 @@ GetHIInputBoolean (
OUT BOOLEAN *Value
);
-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- );
-
EFI_DEVICE_PATH*
GetLastDevicePathNode (
IN EFI_DEVICE_PATH* DevicePath
@@ -260,4 +261,17 @@ EmptyCallbackFunction (
IN VOID *Context
);
+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ );
+
#endif /* _BDSINTERNAL_H_ */
diff --git a/ArmPlatformPkg/Bds/BootLinux.c
b/ArmPlatformPkg/Bds/BootLinux.c
new file mode 100644
index 0000000..0445e89
--- /dev/null
+++ b/ArmPlatformPkg/Bds/BootLinux.c
@@ -0,0 +1,124 @@
+*
+* Copyright (c) 2011 - 2015, 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
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include "BdsInternal.h"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, {
0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+EFI_DEVICE_PATH* mLinuxLoaderDevicePath = NULL;
+
+STATIC
+BOOLEAN
+HasFilePathEfiExtension (
+ IN CHAR16* FilePath
+ )
+{
+ return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
+ (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
+}
+
+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ )
+{
+ EFI_STATUS Status;
+ CHAR16* FileName;
+ EFI_DEVICE_PATH* PrevDevicePathNode;
+ EFI_DEVICE_PATH* DevicePathNode;
+ EFI_PHYSICAL_ADDRESS Image;
+ UINTN FileSize;
+ EFI_IMAGE_DOS_HEADER* DosHeader;
+ UINTN PeCoffHeaderOffset;
+ EFI_IMAGE_NT_HEADERS32* NtHeader;
+
+ ASSERT (EfiBinary != NULL);
+
+ //
+ // Check if the last node of the device path is a FilePath node
+ //
+ PrevDevicePathNode = NULL;
+ DevicePathNode = DevicePath;
+ while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
+ PrevDevicePathNode = DevicePathNode;
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ if ((PrevDevicePathNode != NULL) &&
+ (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
+ (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
+ {
+ FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
+ } else {
+ FileName = NULL;
+ }
+
+ if (FileName == NULL) {
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ } else if (HasFilePathEfiExtension (FileName)) {
+ *EfiBinary = TRUE;
+ } else {
+ // Check if the file exist
+ Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
+ if (!EFI_ERROR (Status)) {
+
+ DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
+ if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present,
+ // so read the PE header after the DOS image header.
+ //
+ PeCoffHeaderOffset = DosHeader->e_lfanew;
+ } else {
+ PeCoffHeaderOffset = 0;
+ }
+
+ //
+ // Check PE/COFF image.
+ //
+ NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image +
PeCoffHeaderOffset);
+ if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
+ *EfiBinary = FALSE;
+ } else {
+ *EfiBinary = TRUE;
+ }
+
+ // Free memory
+ gBS->FreePages (Image, EFI_SIZE_TO_PAGES (FileSize));
+ } else {
+ // If we did not manage to open it then ask for the type
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index af7f1f1..8caa3ce 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -269,6 +269,8 @@ BootMenuAddBootOption (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN EfiBinary;
+ CHAR16 *LinuxDevicePath;
Attributes = 0;
SupportedBootDevice = NULL;
@@ -281,8 +283,12 @@ BootMenuAddBootOption (
}
// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI
Application or the kernel", &DevicePathNodes);
- if (EFI_ERROR(Status)) {
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI
Application or the kernel", &DevicePathNodes);
+ } else {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI
Application", &DevicePathNodes);
+ }
+ if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
@@ -293,8 +299,39 @@ BootMenuAddBootOption (
goto EXIT;
}
+ // Is it an EFI application?
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the
embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (CmdLine, LinuxDevicePath, MAX (sizeof (CmdLine), StrSize
(LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+ } else {
+ CmdLine[0] = L'\0';
+ }
+ } else {
+ CmdLine[0] = L'\0';
+ }
+
Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ Status = EditHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -366,11 +403,13 @@ BootMenuUpdateBootOption (
CHAR16
BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
+ CHAR16 *LinuxDevicePath;
EFI_DEVICE_PATH *DevicePath;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
BOOLEAN IsUnicode;
+ BOOLEAN EfiBinary;
DisplayBootOptions (BootOptionsList);
Status = SelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
@@ -386,46 +425,87 @@ BootMenuUpdateBootOption (
return EFI_UNSUPPORTED;
}
- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList,
L"EFI Application or the kernel", &DevicePath);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
+ EfiBinary = TRUE;
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = DeviceSupport->UpdateDevicePathNode
(BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ // Is it an EFI application?
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the
embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel
command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (UnicodeCmdLine, LinuxDevicePath, MAX (sizeof
(UnicodeCmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+
+ // The command line is a unicode printable string
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }
+ } else {
+ Status = DeviceSupport->UpdateDevicePathNode
(BootOption->FilePathList, L"EFI Application", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
}
Print (L"Arguments to pass to the EFI Application: ");
- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than
"BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by
"BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
+ // When the command line has not been initialized by the embedded Linux loader earlier
+ if (EfiBinary) {
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than
"BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than
BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by
"BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
+ } else {
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
+ }
}
+ } else {
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
}
- } else {
- UnicodeCmdLine[0] = L'\0';
- IsPrintable = TRUE;
- IsUnicode = TRUE;
}
// We do not request arguments for OptionalData that cannot be printed
@@ -909,7 +989,6 @@ struct BOOT_MAIN_ENTRY {
{ L"Boot Manager", BootMenuManager },
};
-
EFI_STATUS
BootMenuMain (
VOID
@@ -929,6 +1008,12 @@ BootMenuMain (
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
+ if (FeaturePcdGet (PcdBdsLinuxSupport)) {
+ // Check Linux Loader is present
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid,
&mLinuxLoaderDevicePath);
+ ASSERT_EFI_ERROR (Status);
+ }
+
while (TRUE) {
// Get Boot#### list
BootOptionList (&BootOptionsList);
--
2.1.1
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Olivier Martin
2015-07-14 09:33:12 UTC
Permalink
Yes, that’s correct that was the patch is doing. I will update the comment and send a V2 as per Laszlo’s comments.

From: Ryan Harkin [mailto:***@linaro.org]
Sent: 13 July 2015 18:17
To: Olivier Martin
Cc: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] [PATCH 6/8] ArmPlatformPkg/Bds: Added support for booting legacy kernel from BDS



On 13 July 2015 at 17:36, Olivier Martin <***@arm.com<mailto:***@arm.com>> wrote:
When PcdBdsLinuxSupport is enabled, users can create boot
entries for the legacy EFI Linux loader if it exists into
the firmware.

Surely this is only true if the kernel doesn't have an EFI header? If it has an EFI header, it will be forced to use the EFI loader.


Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com<mailto:***@arm.com>>
Reviewed-by: Ronald Cron <***@arm.com<mailto:***@arm.com>>
---
ArmPlatformPkg/ArmPlatformPkg.dec | 3 +
ArmPlatformPkg/Bds/Bds.inf | 4 +
ArmPlatformPkg/Bds/BdsHelper.c | 9 ---
ArmPlatformPkg/Bds/BdsInternal.h | 26 ++++--
ArmPlatformPkg/Bds/BootLinux.c | 124 +++++++++++++++++++++++++++++
ArmPlatformPkg/Bds/BootMenu.c | 161 +++++++++++++++++++++++++++++---------
6 files changed, 274 insertions(+), 53 deletions(-)
create mode 100644 ArmPlatformPkg/Bds/BootLinux.c

diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index be0919b..45aeaee 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -61,6 +61,9 @@
# we assume the OS will handle the FrameBuffer from the UEFI GOP information.
gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D

+ # Enable Legacy Linux support in the BDS
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport|TRUE|BOOLEAN|0x0000002E
+
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039
gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 3b6ffc3..06e8d91 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -27,6 +27,7 @@
[Sources]
Bds.c
BdsHelper.c
+ BootLinux.c
BootMenu.c
BootOption.c
BootOptionSupport.c
@@ -72,6 +73,9 @@
gEfiDhcp4ServiceBindingProtocolGuid
gEfiMtftp4ServiceBindingProtocolGuid

+[FeaturePcd]
+ gArmPlatformTokenSpaceGuid.PcdBdsLinuxSupport
+
[Pcd]
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
diff --git a/ArmPlatformPkg/Bds/BdsHelper.c b/ArmPlatformPkg/Bds/BdsHelper.c
index b3003e9..732292c 100644
--- a/ArmPlatformPkg/Bds/BdsHelper.c
+++ b/ArmPlatformPkg/Bds/BdsHelper.c
@@ -256,15 +256,6 @@ GetHIInputBoolean (
}
}

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- )
-{
- return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
- (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
-}
-
// Return the last non end-type Device Path Node from a Device Path
EFI_DEVICE_PATH*
GetLastDevicePathNode (
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index fe4fd79..ddf5308 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -1,6 +1,6 @@
/** @file
*
-* Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+* Copyright (c) 2011-2015, 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
@@ -79,6 +79,12 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption

+// GUID of the EFI Linux Loader
+extern CONST EFI_GUID mLinuxLoaderAppGuid;
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;
+
EFI_STATUS
BootDeviceListSupportedInit (
IN OUT LIST_ENTRY *SupportedDeviceList
@@ -141,11 +147,6 @@ GetHIInputBoolean (
OUT BOOLEAN *Value
);

-BOOLEAN
-HasFilePathEfiExtension (
- IN CHAR16* FilePath
- );
-
EFI_DEVICE_PATH*
GetLastDevicePathNode (
IN EFI_DEVICE_PATH* DevicePath
@@ -260,4 +261,17 @@ EmptyCallbackFunction (
IN VOID *Context
);

+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ );
+
#endif /* _BDSINTERNAL_H_ */
diff --git a/ArmPlatformPkg/Bds/BootLinux.c b/ArmPlatformPkg/Bds/BootLinux.c
new file mode 100644
index 0000000..0445e89
--- /dev/null
+++ b/ArmPlatformPkg/Bds/BootLinux.c
@@ -0,0 +1,124 @@
+/** @file
+*
+* Copyright (c) 2011 - 2015, 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
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include "BdsInternal.h"
+
+// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
+CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
+
+// Device path of the EFI Linux Loader in the Firmware Volume
+EFI_DEVICE_PATH* mLinuxLoaderDevicePath = NULL;
+
+STATIC
+BOOLEAN
+HasFilePathEfiExtension (
+ IN CHAR16* FilePath
+ )
+{
+ return (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".EFI") == 0) ||
+ (StrCmp (FilePath + (StrSize (FilePath) / sizeof (CHAR16)) - 5, L".efi") == 0);
+}
+
+/**
+ * This function check if the DevicePath defines an EFI binary
+ *
+ * This function is used when the BDS support Linux loader to
+ * detect if the binary is an EFI application or potentially a
+ * Linux kernel.
+ */
+EFI_STATUS
+IsEfiBinary (
+ IN EFI_DEVICE_PATH* DevicePath,
+ OUT BOOLEAN *EfiBinary
+ )
+{
+ EFI_STATUS Status;
+ CHAR16* FileName;
+ EFI_DEVICE_PATH* PrevDevicePathNode;
+ EFI_DEVICE_PATH* DevicePathNode;
+ EFI_PHYSICAL_ADDRESS Image;
+ UINTN FileSize;
+ EFI_IMAGE_DOS_HEADER* DosHeader;
+ UINTN PeCoffHeaderOffset;
+ EFI_IMAGE_NT_HEADERS32* NtHeader;
+
+ ASSERT (EfiBinary != NULL);
+
+ //
+ // Check if the last node of the device path is a FilePath node
+ //
+ PrevDevicePathNode = NULL;
+ DevicePathNode = DevicePath;
+ while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
+ PrevDevicePathNode = DevicePathNode;
+ DevicePathNode = NextDevicePathNode (DevicePathNode);
+ }
+
+ if ((PrevDevicePathNode != NULL) &&
+ (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
+ (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
+ {
+ FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
+ } else {
+ FileName = NULL;
+ }
+
+ if (FileName == NULL) {
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ } else if (HasFilePathEfiExtension (FileName)) {
+ *EfiBinary = TRUE;
+ } else {
+ // Check if the file exist
+ Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
+ if (!EFI_ERROR (Status)) {
+
+ DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
+ if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ //
+ // DOS image header is present,
+ // so read the PE header after the DOS image header.
+ //
+ PeCoffHeaderOffset = DosHeader->e_lfanew;
+ } else {
+ PeCoffHeaderOffset = 0;
+ }
+
+ //
+ // Check PE/COFF image.
+ //
+ NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
+ if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
+ *EfiBinary = FALSE;
+ } else {
+ *EfiBinary = TRUE;
+ }
+
+ // Free memory
+ gBS->FreePages (Image, EFI_SIZE_TO_PAGES (FileSize));
+ } else {
+ // If we did not manage to open it then ask for the type
+ Print (L"Is an EFI Application? ");
+ Status = GetHIInputBoolean (EfiBinary);
+ if (EFI_ERROR (Status)) {
+ return EFI_ABORTED;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index af7f1f1..8caa3ce 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -269,6 +269,8 @@ BootMenuAddBootOption (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
UINT8* OptionalData;
UINTN OptionalDataSize;
+ BOOLEAN EfiBinary;
+ CHAR16 *LinuxDevicePath;

Attributes = 0;
SupportedBootDevice = NULL;
@@ -281,8 +283,12 @@ BootMenuAddBootOption (
}

// Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
- if (EFI_ERROR(Status)) {
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes);
+ } else {
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application", &DevicePathNodes);
+ }
+ if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
}
@@ -293,8 +299,39 @@ BootMenuAddBootOption (
goto EXIT;
}

+ // Is it an EFI application?
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (CmdLine, LinuxDevicePath, MAX (sizeof (CmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+ } else {
+ CmdLine[0] = L'\0';
+ }
+ } else {
+ CmdLine[0] = L'\0';
+ }
+
Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ Status = EditHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
if (EFI_ERROR (Status)) {
Status = EFI_ABORTED;
goto EXIT;
@@ -366,11 +403,13 @@ BootMenuUpdateBootOption (
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];
+ CHAR16 *LinuxDevicePath;
EFI_DEVICE_PATH *DevicePath;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
BOOLEAN IsUnicode;
+ BOOLEAN EfiBinary;

DisplayBootOptions (BootOptionsList);
Status = SelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, &BootOptionEntry);
@@ -386,46 +425,87 @@ BootMenuUpdateBootOption (
return EFI_UNSUPPORTED;
}

- Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
+ EfiBinary = TRUE;
+ if (FeaturePcdGet (PcdBdsLinuxSupport) && mLinuxLoaderDevicePath) {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ // Is it an EFI application?
+ Status = IsEfiBinary (DevicePath, &EfiBinary);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
+
+ if (EfiBinary == FALSE) {
+ Print (L"It is assumed the binary is a Linux kernel and the embedded Linux Loader is going to be used.\n");
+ Print (L"Supported command line formats by the embedded Linux Loader:\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\"\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -f <EFI Device Path of the Linux initrd>\n");
+ Print (L"- <EFI device path of the Linux kernel> -c \"<Linux kernel command line>\" -a <Machine Type for ATAG Linux kernel>\n");
+
+ // Copy the Linux path into the command line
+ LinuxDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
+ CopyMem (UnicodeCmdLine, LinuxDevicePath, MAX (sizeof (UnicodeCmdLine), StrSize (LinuxDevicePath)));
+ FreePool (LinuxDevicePath);
+
+ // Free the generated Device Path
+ FreePool (DevicePath);
+ // and use the embedded Linux Loader as the EFI application
+ DevicePath = mLinuxLoaderDevicePath;
+
+ // The command line is a unicode printable string
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }
+ } else {
+ Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application", &DevicePath);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
+ }
}

Print (L"Arguments to pass to the EFI Application: ");

- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
+ // When the command line has not been initialized by the embedded Linux loader earlier
+ if (EfiBinary) {
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than "BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by "BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
+ } else {
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
+ }
}
+ } else {
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
}
- } else {
- UnicodeCmdLine[0] = L'\0';
- IsPrintable = TRUE;
- IsUnicode = TRUE;
}

// We do not request arguments for OptionalData that cannot be printed
@@ -909,7 +989,6 @@ struct BOOT_MAIN_ENTRY {
{ L"Boot Manager", BootMenuManager },
};

-
EFI_STATUS
BootMenuMain (
VOID
@@ -929,6 +1008,12 @@ BootMenuMain (
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);

+ if (FeaturePcdGet (PcdBdsLinuxSupport)) {
+ // Check Linux Loader is present
+ Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &mLinuxLoaderDevicePath);
+ ASSERT_EFI_ERROR (Status);
+ }
+
while (TRUE) {
// Get Boot#### list
BootOptionList (&BootOptionsList);
--
2.1.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No: 2548782
Olivier Martin
2015-07-13 16:36:50 UTC
Permalink
Change-Id: Id055d77ee78729dcfd692d956e9b5ebc7b930611
---
ArmPkg/ArmPkg.dec | 1 -
ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc | 1 -
ArmPlatformPkg/ArmPlatformPkg.dec | 6 -
.../ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 1 -
.../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 2 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 3 -
.../ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc | 1 -
.../ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc | 1 -
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 3 -
ArmPlatformPkg/Bds/Bds.c | 36 +--
ArmPlatformPkg/Bds/Bds.inf | 7 +-
ArmPlatformPkg/Bds/BdsInternal.h | 45 ---
ArmPlatformPkg/Bds/BootMenu.c | 358 ++++-----------------
ArmPlatformPkg/Bds/BootOption.c | 100 ++----
ArmPlatformPkg/Bds/BootOptionSupport.c | 111 -------
BeagleBoardPkg/BeagleBoardPkg.dsc | 7 -
20 files changed, 93 insertions(+), 602 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index b30de91..da0c8a9 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -115,7 +115,6 @@
#
# BdsLib
#
- gArmTokenSpaceGuid.PcdArmMachineType|0|UINT32|0x0000001E
# The compressed Linux kernel is expected to be under 128MB from the beginning of the System Memory
gArmTokenSpaceGuid.PcdArmLinuxKernelMaxOffset|0x08000000|UINT32|0x0000001F
# Maximum file size for TFTP servers that do not support 'tsize' extension
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
index b5b959a..9860cf0 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
@@ -151,7 +151,6 @@

# Support the Linux EFI stub by default
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index cd67aee..be0919b 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -129,13 +129,7 @@
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Platform"|VOID*|0x00000019
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Default Boot Device"|VOID*|0x0000000C
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L""|VOID*|0x0000000D
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L""|VOID*|0x0000000E
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L""|VOID*|0x000000F
- # PcdDefaultBootType define the type of the binary pointed by PcdDefaultBootDevicePath:
- # - 0 = an EFI application
- # - 1 = a Linux kernel with ATAG support
- # - 2 = a Linux kernel with FDT support
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0|UINT32|0x00000010

gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L""|VOID*|0x0000001B
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L""|VOID*|0x0000001C
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
index 6232791..9445ce2 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
@@ -316,7 +316,6 @@
#
# ARM OS Loader
#
- gArmTokenSpaceGuid.PcdArmMachineType|827
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(14801114-DA6A-4113-985B-DC876337A15E)/LinuxLoader.efi"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM -a 827 -c \"console=ttyAMA0,38400n8\""
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 3b693c2..50bb556 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -181,12 +181,9 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
# PL111 - CLCD
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index baa5478..18cc978 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -180,11 +180,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
index bfdc96b..1b6134f 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -177,8 +177,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9"
- # Use EFI Stub
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index fb42f34..3896166 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -157,11 +157,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index 09dc1db..acfe164 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -159,11 +159,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
index 2fe9e58..4bcdc8c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
@@ -160,12 +160,9 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(272E583C-B951-433F-AF42-A9C6862AF002)/LinuxLoader.efi"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage -c \"console=ttyAMA0,38400n8\""
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
index 9129288..c956897 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
@@ -126,7 +126,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/vda2 rw console=ttyAMA0 earlyprintk=pl011,0x1c090000 maxcpus=4 debug user_debug=31 loglevel=9"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
index 280fb72..4880591 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
@@ -155,7 +155,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/mmcblk0p2 console=ttyAMA0 earlyprintk=pl011,0x1c090000 debug user_debug=31 loglevel=9"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
index 3d6537a..ad804ab 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
@@ -380,11 +380,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index 1fab439..3ee866c 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -220,12 +220,6 @@ DefineDefaultBootEntries (
EFI_STATUS Status;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
EFI_DEVICE_PATH* BootDevicePath;
- UINT8* OptionalData;
- UINTN OptionalDataSize;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;
- ARM_BDS_LOADER_TYPE BootType;
- EFI_DEVICE_PATH* InitrdPath;
- UINTN InitrdSize;
UINTN CmdLineSize;
UINTN CmdLineAsciiSize;
CHAR16* DefaultBootArgument;
@@ -269,8 +263,6 @@ DefineDefaultBootEntries (

// Create the entry is the Default values are correct
if (BootDevicePath != NULL) {
- BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
-
// We do not support NULL pointer
ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);

@@ -308,33 +300,11 @@ DefineDefaultBootEntries (
AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);
}

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
- InitrdSize = GetDevicePathSize (InitrdPath);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
- if (BootArguments == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- BootArguments->LinuxArguments.CmdLineSize = CmdLineAsciiSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
-
- CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);
- CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
- } else {
- OptionalData = (UINT8*)DefaultBootArgument;
- OptionalDataSize = CmdLineSize;
- }
-
BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
- (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),
+ (CHAR16*)PcdGetPtr (PcdDefaultBootDescription),
BootDevicePath,
- BootType,
- OptionalData,
- OptionalDataSize,
+ (UINT8 *)DefaultBootArgument, // OptionalData
+ CmdLineSize, // OptionalDataSize
&BdsLoadOption
);
FreePool (BdsLoadOption);
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 9639f14..3b6ffc3 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -24,7 +24,7 @@

ENTRY_POINT = BdsInitialize

-[Sources.common]
+[Sources]
Bds.c
BdsHelper.c
BootMenu.c
@@ -44,12 +44,11 @@

[LibraryClasses]
BdsLib
- TimerLib
- PerformanceLib
UefiBootServicesTableLib
DxeServicesTableLib
UefiDriverEntryPoint
DebugLib
+ PerformanceLib
PrintLib
BaseLib
FdtLib
@@ -77,9 +76,7 @@
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index 1cb154e..fe4fd79 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -38,46 +38,10 @@
#define BOOT_DEVICE_OPTION_MAX 300
#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))

-#define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd')
-
-#define IS_ARM_BDS_BOOTENTRY(ptr) \
- (((ptr)->OptionalData != NULL) && \
- (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) \
- == ARM_BDS_OPTIONAL_DATA_SIGNATURE))
-
#define UPDATE_BOOT_ENTRY L"Update entry: "
#define DELETE_BOOT_ENTRY L"Delete entry: "
#define MOVE_BOOT_ENTRY L"Move entry: "

-typedef enum {
- BDS_LOADER_EFI_APPLICATION = 0,
- BDS_LOADER_KERNEL_LINUX_ATAG,
- BDS_LOADER_KERNEL_LINUX_FDT,
-} ARM_BDS_LOADER_TYPE;
-
-typedef struct {
- UINT16 CmdLineSize;
- UINT16 InitrdSize;
-
- // These following fields have variable length and are packed:
- //CHAR8 *CmdLine;
- //EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
-} ARM_BDS_LINUX_ARGUMENTS;
-
-typedef union {
- ARM_BDS_LINUX_ARGUMENTS LinuxArguments;
-} ARM_BDS_LOADER_ARGUMENTS;
-
-typedef struct {
- UINT32 Signature;
- ARM_BDS_LOADER_TYPE LoaderType;
-} ARM_BDS_LOADER_OPTIONAL_DATA_HEADER;
-
-typedef struct {
- ARM_BDS_LOADER_OPTIONAL_DATA_HEADER Header;
- ARM_BDS_LOADER_ARGUMENTS Arguments;
-} ARM_BDS_LOADER_OPTIONAL_DATA;
-
typedef struct {
LIST_ENTRY Link;
BDS_LOAD_OPTION* BdsLoadOption;
@@ -230,7 +194,6 @@ BootOptionCreate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize,
OUT BDS_LOAD_OPTION** BdsLoadOption
@@ -242,7 +205,6 @@ BootOptionUpdate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
);
@@ -253,13 +215,6 @@ BootOptionDelete (
);

EFI_STATUS
-BootDeviceGetType (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT ARM_BDS_LOADER_TYPE *BootType,
- OUT UINT32 *Attributes
- );
-
-EFI_STATUS
BootMenuMain (
VOID
);
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index a304cc4..af7f1f1 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -54,8 +54,6 @@ DisplayBootOptions (
DEBUG_CODE_BEGIN ();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- ARM_BDS_LOADER_TYPE LoaderType;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;

Status = gBS->LocateProtocol (
&gEfiDevicePathToTextProtocolGuid,
@@ -70,20 +68,11 @@ DisplayBootOptions (
);
Print (L"\t- %s\n", DevicePathTxt);

- OptionalData = BdsLoadOption->OptionalData;
- 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);
- }
+ if (IsPrintableString (BdsLoadOption->OptionalData, &IsUnicode)) {
+ if (IsUnicode) {
+ Print (L"\t- Arguments: %s\n", BdsLoadOption->OptionalData);
+ } else {
+ AsciiPrint ("\t- Arguments: %a\n", BdsLoadOption->OptionalData);
}
}

@@ -272,20 +261,12 @@ BootMenuAddBootOption (
{
EFI_STATUS Status;
BDS_SUPPORTED_DEVICE* SupportedBootDevice;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- CHAR8 AsciiCmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 CmdLine[BOOT_DEVICE_OPTION_MAX];
UINT32 Attributes;
- ARM_BDS_LOADER_TYPE BootType;
BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
EFI_DEVICE_PATH *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
- UINTN CmdLineSize;
- BOOLEAN InitrdSupport;
- UINTN InitrdSize;
UINT8* OptionalData;
UINTN OptionalDataSize;

@@ -312,79 +293,15 @@ BootMenuAddBootOption (
goto EXIT;
}

- if (SupportedBootDevice->Support->RequestBootType) {
- Status = BootDeviceGetType (DevicePath, &BootType, &Attributes);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- } else {
- BootType = BDS_LOADER_EFI_APPLICATION;
+ Print (L"Arguments to pass to the EFI Application: ");
+ Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
}

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- Print(L"Add an initrd: ");
- Status = GetHIInputBoolean (&InitrdSupport);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (InitrdSupport) {
- // Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes);
- 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;
- }
-
- if (InitrdPathNodes != NULL) {
- // Append the Device Path to the selected device path
- InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
- // Free the InitrdPathNodes created by Support->CreateDevicePathNode()
- FreePool (InitrdPathNodes);
-
- if (InitrdPath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
- } else {
- InitrdPath = NULL;
- }
- } else {
- InitrdPath = NULL;
- }
-
- Print(L"Arguments to pass to the binary: ");
- Status = GetHIInputAscii (AsciiCmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- CmdLineSize = AsciiStrSize (AsciiCmdLine);
- InitrdSize = GetDevicePathSize (InitrdPath);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
-
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), AsciiCmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
- } else {
- Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- OptionalData = (UINT8*)CmdLine;
- OptionalDataSize = StrSize (CmdLine);
- }
+ OptionalData = (UINT8*)CmdLine;
+ OptionalDataSize = StrSize (CmdLine);

Print(L"Description for this new Entry: ");
Status = GetHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
@@ -395,7 +312,7 @@ BootMenuAddBootOption (

// Create new entry
BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY));
- Status = BootOptionCreate (Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);
+ Status = BootOptionCreate (Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);
if (!EFI_ERROR(Status)) {
InsertTailList (BootOptionsList, &BdsLoadOptionEntry->Link);
}
@@ -446,20 +363,10 @@ BootMenuUpdateBootOption (
BDS_LOAD_OPTION_ENTRY *BootOptionEntry;
BDS_LOAD_OPTION *BootOption;
BDS_LOAD_OPTION_SUPPORT* DeviceSupport;
- 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;
- ARM_BDS_LOADER_OPTIONAL_DATA* LoaderOptionalData;
- ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
- EFI_DEVICE_PATH *InitrdPathNodes;
- EFI_DEVICE_PATH *InitrdPath;
- UINTN InitrdSize;
- UINTN CmdLineSize;
- BOOLEAN InitrdSupport;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
@@ -485,165 +392,67 @@ BootMenuUpdateBootOption (
goto EXIT;
}

- if (DeviceSupport->RequestBootType) {
- Status = BootDeviceGetType (DevicePath, &BootType, &BootOption->Attributes);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- }
-
- LoaderOptionalData = BootOption->OptionalData;
- 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;
-
- CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
-
- InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
- if (InitrdSize > 0) {
- Print(L"Keep the initrd: ");
- } else {
- Print(L"Add an initrd: ");
- }
- Status = GetHIInputBoolean (&InitrdSupport);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
+ Print (L"Arguments to pass to the EFI Application: ");

- 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);
- 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;
- }
- InitrdSize = GetDevicePathSize (InitrdPath);
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than "BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by "BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
} else {
- // Case we create the initrd device path
-
- Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes);
- 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;
- }
-
- if (InitrdPathNodes != NULL) {
- // Duplicate Linux kernel Device Path
- TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
- // Replace Linux kernel Node by EndNode
- SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
- // Append the Device Path to the selected device path
- InitrdPath = AppendDevicePath (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
- FreePool (TempInitrdPath);
- // Free the InitrdPathNodes created by Support->CreateDevicePathNode()
- FreePool (InitrdPathNodes);
- if (InitrdPath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
- InitrdSize = GetDevicePathSize (InitrdPath);
- } else {
- InitrdPath = NULL;
- }
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
}
- } else {
- InitrdSize = 0;
- }
-
- Print(L"Arguments to pass to the binary: ");
- if (CmdLineSize > 0) {
- AsciiStrnCpy (CmdLine, (CONST CHAR8*)(LinuxArguments + 1), sizeof (CmdLine));
- CmdLine[sizeof (CmdLine) - 1] = '\0';
- } else {
- CmdLine[0] = '\0';
}
- Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- CmdLineSize = AsciiStrSize (CmdLine);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
} else {
- Print (L"Arguments to pass to the EFI Application: ");
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }

- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
- }
+ // 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;
}
- } 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);
- }
+ OptionalData = (UINT8*)UnicodeCmdLine;
+ OptionalDataSize = StrSize (UnicodeCmdLine);
} else {
- // We keep the former OptionalData
- OptionalData = BootOption->OptionalData;
- OptionalDataSize = BootOption->OptionalDataSize;
+ 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: ");
@@ -655,7 +464,7 @@ BootMenuUpdateBootOption (
}

// Update the entry
- Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

FREE_DEVICE_PATH:
FreePool (DevicePath);
@@ -1139,9 +948,6 @@ BootMenuMain (
DEBUG_CODE_BEGIN();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
- UINTN CmdLineSize;
- ARM_BDS_LOADER_TYPE LoaderType;

Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
if (EFI_ERROR(Status)) {
@@ -1153,39 +959,7 @@ BootMenuMain (

Print(L"\t- %s\n",DevicePathTxt);

- // If it is a supported BootEntry then print its details
- if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
- OptionalData = BootOption->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)) {
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
- CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);
- Print(L"\t- Initrd: %s\n", DevicePathTxt);
- }
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize) > 0) {
- Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));
- }
- }
-
- switch (LoaderType) {
- case BDS_LOADER_EFI_APPLICATION:
- Print(L"\t- LoaderType: EFI Application\n");
- break;
-
- case BDS_LOADER_KERNEL_LINUX_ATAG:
- Print(L"\t- LoaderType: Linux kernel with ATAG support\n");
- break;
-
- case BDS_LOADER_KERNEL_LINUX_FDT:
- Print(L"\t- LoaderType: Linux kernel with FDT support\n");
- break;
-
- default:
- Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType);
- }
- } else if (BootOption->OptionalData != NULL) {
+ if (BootOption->OptionalData != NULL) {
if (IsPrintableString (BootOption->OptionalData, &IsUnicode)) {
if (IsUnicode) {
Print (L"\t- Arguments: %s\n", BootOption->OptionalData);
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
index 342d441..bdd02b4 100644
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ b/ArmPlatformPkg/Bds/BootOption.c
@@ -20,48 +20,27 @@ BootOptionStart (
IN BDS_LOAD_OPTION *BootOption
)
{
- EFI_STATUS Status;
- UINT32 LoaderType;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
- UINT16 LoadOptionIndexSize;
-
- if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
- Status = EFI_UNSUPPORTED;
- OptionalData = BootOption->OptionalData;
- LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
-
- if (LoaderType == BDS_LOADER_EFI_APPLICATION) {
- if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
- // Need to connect every drivers to ensure no dependencies are missing for the application
- BdsConnectAllDrivers ();
- }
+ EFI_STATUS Status;
+ UINT16 LoadOptionIndexSize;

- Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, 0, NULL);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
- ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
- ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
- }
- } else {
- // Connect all the drivers if the EFI Application is not a EFI OS Loader
- if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
- BdsConnectAllDrivers ();
- }
+ // Connect all the drivers if the EFI Application is not a EFI OS Loader
+ if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
+ BdsConnectAllDrivers ();
+ }

- // Set BootCurrent variable
- LoadOptionIndexSize = sizeof(UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- LoadOptionIndexSize, &(BootOption->LoadOptionIndex));
+ // Set BootCurrent variable
+ LoadOptionIndexSize = sizeof (UINT16);
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ LoadOptionIndexSize, &(BootOption->LoadOptionIndex));

- Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);
+ Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);

- // Clear BootCurrent variable
- LoadOptionIndexSize = sizeof(UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0, NULL);
- }
+ // Clear BootCurrent variable
+ LoadOptionIndexSize = sizeof (UINT16);
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ 0, NULL);

return Status;
}
@@ -107,7 +86,6 @@ BootOptionSetFields (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
)
@@ -117,10 +95,6 @@ BootOptionSetFields (
UINTN BootDescriptionSize;
UINT16 FilePathListLength;
UINT8* EfiLoadOptionPtr;
- UINT8* InitrdPathListPtr;
- ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments;
- ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;

// If we are overwriting an existent Boot Option then we have to free previously allocated memory
if (BootOption->LoadOption) {
@@ -129,11 +103,6 @@ BootOptionSetFields (

BootDescriptionSize = StrSize (BootDescription);

- // Fixup the size in case of entry specific to ArmPlatformPkg/Bds
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- OptionalDataSize += sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- }
-
// Compute the size of the FilePath list
FilePathListLength = GetUnalignedDevicePathSize (DevicePath);

@@ -169,33 +138,10 @@ BootOptionSetFields (
// Optional Data fields, Do unaligned writes
BootOption->OptionalData = EfiLoadOptionPtr;

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- // Write the header
- WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);
- WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
-
- // OptionalData should have been initialized by the caller of this function
- ASSERT (OptionalData != NULL);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;
- SrcLinuxArguments = &(BootArguments->LinuxArguments);
- DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
-
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);
-
- if (SrcLinuxArguments->CmdLineSize > 0) {
- CopyMem ((VOID*)(DestLinuxArguments + 1), (VOID*)(SrcLinuxArguments + 1), SrcLinuxArguments->CmdLineSize);
- }
-
- if (SrcLinuxArguments->InitrdSize > 0) {
- InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);
- CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
- }
- } else {
- if (OptionalData != NULL) {
- CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
- }
+ if (OptionalData != NULL) {
+ CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
}
+
BootOption->OptionalDataSize = OptionalDataSize;

// If this function is called at the creation of the Boot Device entry (not at the update) the
@@ -216,7 +162,6 @@ BootOptionCreate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize,
OUT BDS_LOAD_OPTION** BdsLoadOption
@@ -237,7 +182,7 @@ BootOptionCreate (
BootOptionEntry->BdsLoadOption = (BDS_LOAD_OPTION*)AllocateZeroPool (sizeof(BDS_LOAD_OPTION));

BootOption = BootOptionEntry->BdsLoadOption;
- BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

//
// Set the related environment variables
@@ -290,7 +235,6 @@ BootOptionUpdate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
)
@@ -299,7 +243,7 @@ BootOptionUpdate (
CHAR16 BootVariableName[9];

// Update the BDS Load Option structure
- BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

// Update the related environment variables
UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BdsLoadOption->LoadOptionIndex);
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c
index 974f220..f50f13f 100644
--- a/ArmPlatformPkg/Bds/BootOptionSupport.c
+++ b/ArmPlatformPkg/Bds/BootOptionSupport.c
@@ -214,117 +214,6 @@ BootDeviceGetDeviceSupport (
}

EFI_STATUS
-BootDeviceGetType (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT ARM_BDS_LOADER_TYPE *BootType,
- OUT UINT32 *Attributes
- )
-{
- EFI_STATUS Status;
- BOOLEAN IsEfiApp;
- BOOLEAN IsBootLoader;
- BOOLEAN HasFDTSupport;
- CHAR16* FileName;
- EFI_DEVICE_PATH* PrevDevicePathNode;
- EFI_DEVICE_PATH* DevicePathNode;
- EFI_PHYSICAL_ADDRESS Image;
- UINTN FileSize;
- EFI_IMAGE_DOS_HEADER* DosHeader;
- UINTN PeCoffHeaderOffset;
- EFI_IMAGE_NT_HEADERS32* NtHeader;
-
- //
- // Check if the last node of the device path is a FilePath node
- //
- PrevDevicePathNode = NULL;
- DevicePathNode = DevicePath;
- while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
- PrevDevicePathNode = DevicePathNode;
- DevicePathNode = NextDevicePathNode (DevicePathNode);
- }
-
- if ((PrevDevicePathNode != NULL) &&
- (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
- (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
- {
- FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
- } else {
- FileName = NULL;
- }
-
- if (FileName == NULL) {
- Print(L"Is an EFI Application? ");
- Status = GetHIInputBoolean (&IsEfiApp);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- } else if (HasFilePathEfiExtension(FileName)) {
- IsEfiApp = TRUE;
- } else {
- // Check if the file exist
- Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
- if (!EFI_ERROR (Status)) {
-
- DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
- if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present,
- // so read the PE header after the DOS image header.
- //
- PeCoffHeaderOffset = DosHeader->e_lfanew;
- } else {
- PeCoffHeaderOffset = 0;
- }
-
- //
- // Check PE/COFF image.
- //
- NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
- if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
- IsEfiApp = FALSE;
- } else {
- IsEfiApp = TRUE;
- }
-
- // Free memory
- gBS->FreePages (Image, EFI_SIZE_TO_PAGES(FileSize));
- } else {
- // If we did not manage to open it then ask for the type
- Print(L"Is an EFI Application? ");
- Status = GetHIInputBoolean (&IsEfiApp);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- }
- }
-
- if (IsEfiApp) {
- Print(L"Is your application an OS loader? ");
- Status = GetHIInputBoolean (&IsBootLoader);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- if (!IsBootLoader) {
- *Attributes |= LOAD_OPTION_CATEGORY_APP;
- }
- *BootType = BDS_LOADER_EFI_APPLICATION;
- } else {
- Print(L"Has FDT support? ");
- Status = GetHIInputBoolean (&HasFDTSupport);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- if (HasFDTSupport) {
- *BootType = BDS_LOADER_KERNEL_LINUX_FDT;
- } else {
- *BootType = BDS_LOADER_KERNEL_LINUX_ATAG;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
BdsLoadOptionFileSystemList (
IN OUT LIST_ENTRY* BdsLoadOptionList
)
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 7aa6ce2..5338492 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -362,18 +362,11 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SD"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=tty0 console=ttyS2,115200n8 root=UUID=a4af765b-c2b5-48f4-9564-7a4e9104c4f6 rootwait ro earlyprintk"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10

gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(E68088EF-D1A4-4336-C1DB-4D3A204730A6)"
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()"

- #
- # ARM OS Loader
- #
- # BeagleBoard machine type (OMAP3_BEAGLE = 1546) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|1546
-
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
--
2.1.1
Olivier Martin
2015-07-13 16:36:48 UTC
Permalink
This post might be inappropriate. Click to display it.
Olivier Martin
2015-07-13 16:36:47 UTC
Permalink
This post might be inappropriate. Click to display it.
Olivier Martin
2015-07-13 16:36:49 UTC
Permalink
Since the embedded Linux Loader has been removed from BdsLib
there is no more Linux specific boot option.
All the boot options are now expected to be arguments for
EFI applications.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
ArmPkg/ArmPkg.dec | 1 -
ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc | 1 -
ArmPlatformPkg/ArmPlatformPkg.dec | 6 -
.../ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 1 -
.../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc | 2 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc | 3 -
.../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 3 -
.../ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc | 1 -
.../ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc | 1 -
ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 3 -
ArmPlatformPkg/Bds/Bds.c | 36 +--
ArmPlatformPkg/Bds/Bds.inf | 7 +-
ArmPlatformPkg/Bds/BdsInternal.h | 45 ---
ArmPlatformPkg/Bds/BootMenu.c | 358 ++++-----------------
ArmPlatformPkg/Bds/BootOption.c | 100 ++----
ArmPlatformPkg/Bds/BootOptionSupport.c | 111 -------
BeagleBoardPkg/BeagleBoardPkg.dsc | 7 -
20 files changed, 93 insertions(+), 602 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index b30de91..da0c8a9 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -115,7 +115,6 @@
#
# BdsLib
#
- gArmTokenSpaceGuid.PcdArmMachineType|0|UINT32|0x0000001E
# The compressed Linux kernel is expected to be under 128MB from the beginning of the System Memory
gArmTokenSpaceGuid.PcdArmLinuxKernelMaxOffset|0x08000000|UINT32|0x0000001F
# Maximum file size for TFTP servers that do not support 'tsize' extension
diff --git a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
index b5b959a..9860cf0 100644
--- a/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
+++ b/ArmPlatformPkg/ArmJunoPkg/ArmJuno.dsc
@@ -151,7 +151,6 @@

# Support the Linux EFI stub by default
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0,115200 earlycon=pl011,0x7ff80000 root=/dev/sda1 rootwait verbose debug"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec
index cd67aee..be0919b 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dec
+++ b/ArmPlatformPkg/ArmPlatformPkg.dec
@@ -129,13 +129,7 @@
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Platform"|VOID*|0x00000019
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Default Boot Device"|VOID*|0x0000000C
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L""|VOID*|0x0000000D
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L""|VOID*|0x0000000E
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L""|VOID*|0x000000F
- # PcdDefaultBootType define the type of the binary pointed by PcdDefaultBootDevicePath:
- # - 0 = an EFI application
- # - 1 = a Linux kernel with ATAG support
- # - 2 = a Linux kernel with FDT support
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0|UINT32|0x00000010

gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L""|VOID*|0x0000001B
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L""|VOID*|0x0000001C
diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
index 6232791..9445ce2 100644
--- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
+++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc
@@ -316,7 +316,6 @@
#
# ARM OS Loader
#
- gArmTokenSpaceGuid.PcdArmMachineType|827
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(14801114-DA6A-4113-985B-DC876337A15E)/LinuxLoader.efi"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage-RTSM -a 827 -c \"console=ttyAMA0,38400n8\""
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
index 3b693c2..50bb556 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc
@@ -181,12 +181,9 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=ttyAMA0,38400 earlyprintk debug verbose"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
# PL111 - CLCD
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
index baa5478..18cc978 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
@@ -180,11 +180,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
index bfdc96b..1b6134f 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -177,8 +177,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/filesystem.cpio.gz"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 loglevel=9"
- # Use EFI Stub
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|0

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
index fb42f34..3896166 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
@@ -157,11 +157,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
index 09dc1db..acfe164 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
@@ -159,11 +159,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
index 2fe9e58..4bcdc8c 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
@@ -160,12 +160,9 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"Fv(272E583C-B951-433F-AF42-A9C6862AF002)/LinuxLoader.efi"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/zImage -c \"console=ttyAMA0,38400n8\""
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
index 9129288..c956897 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc
@@ -126,7 +126,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/vda2 rw console=ttyAMA0 earlyprintk=pl011,0x1c090000 maxcpus=4 debug user_debug=31 loglevel=9"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
index 280fb72..4880591 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc
@@ -155,7 +155,6 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SemiHosting"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/mmcblk0p2 console=ttyAMA0 earlyprintk=pl011,0x1c090000 debug user_debug=31 loglevel=9"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|2

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(407B4008-BF5B-11DF-9547-CF16E0D72085)"
diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
index 3d6537a..ad804ab 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
+++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc
@@ -380,11 +380,8 @@
#
# ARM OS Loader
#
- # Versatile Express machine type (ARM VERSATILE EXPRESS = 2272) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|2272
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from NorFlash"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/Image"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

# Use the serial console (ConIn & ConOut) and the Graphic driver (ConOut)
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(38400,8,N,1)/VenPcAnsi();VenHw(CE660500-824D-11E0-AC72-0002A5D5C51B)"
diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c
index 1fab439..3ee866c 100644
--- a/ArmPlatformPkg/Bds/Bds.c
+++ b/ArmPlatformPkg/Bds/Bds.c
@@ -220,12 +220,6 @@ DefineDefaultBootEntries (
EFI_STATUS Status;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
EFI_DEVICE_PATH* BootDevicePath;
- UINT8* OptionalData;
- UINTN OptionalDataSize;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;
- ARM_BDS_LOADER_TYPE BootType;
- EFI_DEVICE_PATH* InitrdPath;
- UINTN InitrdSize;
UINTN CmdLineSize;
UINTN CmdLineAsciiSize;
CHAR16* DefaultBootArgument;
@@ -269,8 +263,6 @@ DefineDefaultBootEntries (

// Create the entry is the Default values are correct
if (BootDevicePath != NULL) {
- BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
-
// We do not support NULL pointer
ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);

@@ -308,33 +300,11 @@ DefineDefaultBootEntries (
AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);
}

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
- InitrdSize = GetDevicePathSize (InitrdPath);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
- if (BootArguments == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- BootArguments->LinuxArguments.CmdLineSize = CmdLineAsciiSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
-
- CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);
- CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
- } else {
- OptionalData = (UINT8*)DefaultBootArgument;
- OptionalDataSize = CmdLineSize;
- }
-
BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
- (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),
+ (CHAR16*)PcdGetPtr (PcdDefaultBootDescription),
BootDevicePath,
- BootType,
- OptionalData,
- OptionalDataSize,
+ (UINT8 *)DefaultBootArgument, // OptionalData
+ CmdLineSize, // OptionalDataSize
&BdsLoadOption
);
FreePool (BdsLoadOption);
diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf
index 9639f14..3b6ffc3 100644
--- a/ArmPlatformPkg/Bds/Bds.inf
+++ b/ArmPlatformPkg/Bds/Bds.inf
@@ -24,7 +24,7 @@

ENTRY_POINT = BdsInitialize

-[Sources.common]
+[Sources]
Bds.c
BdsHelper.c
BootMenu.c
@@ -44,12 +44,11 @@

[LibraryClasses]
BdsLib
- TimerLib
- PerformanceLib
UefiBootServicesTableLib
DxeServicesTableLib
UefiDriverEntryPoint
DebugLib
+ PerformanceLib
PrintLib
BaseLib
FdtLib
@@ -77,9 +76,7 @@
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath
- gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths
gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths
diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h
index 1cb154e..fe4fd79 100644
--- a/ArmPlatformPkg/Bds/BdsInternal.h
+++ b/ArmPlatformPkg/Bds/BdsInternal.h
@@ -38,46 +38,10 @@
#define BOOT_DEVICE_OPTION_MAX 300
#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))

-#define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd')
-
-#define IS_ARM_BDS_BOOTENTRY(ptr) \
- (((ptr)->OptionalData != NULL) && \
- (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) \
- == ARM_BDS_OPTIONAL_DATA_SIGNATURE))
-
#define UPDATE_BOOT_ENTRY L"Update entry: "
#define DELETE_BOOT_ENTRY L"Delete entry: "
#define MOVE_BOOT_ENTRY L"Move entry: "

-typedef enum {
- BDS_LOADER_EFI_APPLICATION = 0,
- BDS_LOADER_KERNEL_LINUX_ATAG,
- BDS_LOADER_KERNEL_LINUX_FDT,
-} ARM_BDS_LOADER_TYPE;
-
-typedef struct {
- UINT16 CmdLineSize;
- UINT16 InitrdSize;
-
- // These following fields have variable length and are packed:
- //CHAR8 *CmdLine;
- //EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
-} ARM_BDS_LINUX_ARGUMENTS;
-
-typedef union {
- ARM_BDS_LINUX_ARGUMENTS LinuxArguments;
-} ARM_BDS_LOADER_ARGUMENTS;
-
-typedef struct {
- UINT32 Signature;
- ARM_BDS_LOADER_TYPE LoaderType;
-} ARM_BDS_LOADER_OPTIONAL_DATA_HEADER;
-
-typedef struct {
- ARM_BDS_LOADER_OPTIONAL_DATA_HEADER Header;
- ARM_BDS_LOADER_ARGUMENTS Arguments;
-} ARM_BDS_LOADER_OPTIONAL_DATA;
-
typedef struct {
LIST_ENTRY Link;
BDS_LOAD_OPTION* BdsLoadOption;
@@ -230,7 +194,6 @@ BootOptionCreate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize,
OUT BDS_LOAD_OPTION** BdsLoadOption
@@ -242,7 +205,6 @@ BootOptionUpdate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
);
@@ -253,13 +215,6 @@ BootOptionDelete (
);

EFI_STATUS
-BootDeviceGetType (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT ARM_BDS_LOADER_TYPE *BootType,
- OUT UINT32 *Attributes
- );
-
-EFI_STATUS
BootMenuMain (
VOID
);
diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index a304cc4..af7f1f1 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -54,8 +54,6 @@ DisplayBootOptions (
DEBUG_CODE_BEGIN ();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- ARM_BDS_LOADER_TYPE LoaderType;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;

Status = gBS->LocateProtocol (
&gEfiDevicePathToTextProtocolGuid,
@@ -70,20 +68,11 @@ DisplayBootOptions (
);
Print (L"\t- %s\n", DevicePathTxt);

- OptionalData = BdsLoadOption->OptionalData;
- 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);
- }
+ if (IsPrintableString (BdsLoadOption->OptionalData, &IsUnicode)) {
+ if (IsUnicode) {
+ Print (L"\t- Arguments: %s\n", BdsLoadOption->OptionalData);
+ } else {
+ AsciiPrint ("\t- Arguments: %a\n", BdsLoadOption->OptionalData);
}
}

@@ -272,20 +261,12 @@ BootMenuAddBootOption (
{
EFI_STATUS Status;
BDS_SUPPORTED_DEVICE* SupportedBootDevice;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];
- CHAR8 AsciiCmdLine[BOOT_DEVICE_OPTION_MAX];
CHAR16 CmdLine[BOOT_DEVICE_OPTION_MAX];
UINT32 Attributes;
- ARM_BDS_LOADER_TYPE BootType;
BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
EFI_DEVICE_PATH *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes;
- EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
- UINTN CmdLineSize;
- BOOLEAN InitrdSupport;
- UINTN InitrdSize;
UINT8* OptionalData;
UINTN OptionalDataSize;

@@ -312,79 +293,15 @@ BootMenuAddBootOption (
goto EXIT;
}

- if (SupportedBootDevice->Support->RequestBootType) {
- Status = BootDeviceGetType (DevicePath, &BootType, &Attributes);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- } else {
- BootType = BDS_LOADER_EFI_APPLICATION;
+ Print (L"Arguments to pass to the EFI Application: ");
+ Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ABORTED;
+ goto EXIT;
}

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- Print(L"Add an initrd: ");
- Status = GetHIInputBoolean (&InitrdSupport);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- if (InitrdSupport) {
- // Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes);
- 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;
- }
-
- if (InitrdPathNodes != NULL) {
- // Append the Device Path to the selected device path
- InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
- // Free the InitrdPathNodes created by Support->CreateDevicePathNode()
- FreePool (InitrdPathNodes);
-
- if (InitrdPath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
- } else {
- InitrdPath = NULL;
- }
- } else {
- InitrdPath = NULL;
- }
-
- Print(L"Arguments to pass to the binary: ");
- Status = GetHIInputAscii (AsciiCmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- CmdLineSize = AsciiStrSize (AsciiCmdLine);
- InitrdSize = GetDevicePathSize (InitrdPath);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
-
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), AsciiCmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
- } else {
- Print (L"Arguments to pass to the EFI Application: ");
- Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR (Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
-
- OptionalData = (UINT8*)CmdLine;
- OptionalDataSize = StrSize (CmdLine);
- }
+ OptionalData = (UINT8*)CmdLine;
+ OptionalDataSize = StrSize (CmdLine);

Print(L"Description for this new Entry: ");
Status = GetHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);
@@ -395,7 +312,7 @@ BootMenuAddBootOption (

// Create new entry
BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY));
- Status = BootOptionCreate (Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);
+ Status = BootOptionCreate (Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);
if (!EFI_ERROR(Status)) {
InsertTailList (BootOptionsList, &BdsLoadOptionEntry->Link);
}
@@ -446,20 +363,10 @@ BootMenuUpdateBootOption (
BDS_LOAD_OPTION_ENTRY *BootOptionEntry;
BDS_LOAD_OPTION *BootOption;
BDS_LOAD_OPTION_SUPPORT* DeviceSupport;
- 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;
- ARM_BDS_LOADER_OPTIONAL_DATA* LoaderOptionalData;
- ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
- EFI_DEVICE_PATH *InitrdPathNodes;
- EFI_DEVICE_PATH *InitrdPath;
- UINTN InitrdSize;
- UINTN CmdLineSize;
- BOOLEAN InitrdSupport;
UINT8* OptionalData;
UINTN OptionalDataSize;
BOOLEAN IsPrintable;
@@ -485,165 +392,67 @@ BootMenuUpdateBootOption (
goto EXIT;
}

- if (DeviceSupport->RequestBootType) {
- Status = BootDeviceGetType (DevicePath, &BootType, &BootOption->Attributes);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
- }
-
- LoaderOptionalData = BootOption->OptionalData;
- 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;
-
- CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
-
- InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
- if (InitrdSize > 0) {
- Print(L"Keep the initrd: ");
- } else {
- Print(L"Add an initrd: ");
- }
- Status = GetHIInputBoolean (&InitrdSupport);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto EXIT;
- }
+ Print (L"Arguments to pass to the EFI Application: ");

- 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);
- 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;
- }
- InitrdSize = GetDevicePathSize (InitrdPath);
+ if (BootOption->OptionalDataSize > 0) {
+ IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
+ if (IsPrintable) {
+ //
+ // The size in bytes of the string, final zero included, should
+ // be equal to or at least lower than "BootOption->OptionalDataSize"
+ // and the "IsPrintableString()" has already tested that the length
+ // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
+ // final '\0' included. We can thus copy the string for editing
+ // using "CopyMem()". Furthermore, note that in the case of an Unicode
+ // string "StrnCpy()" and "StrCpy()" can not be used to copy the
+ // string because the data pointed to by "BootOption->OptionalData"
+ // is not necessarily 2-byte aligned.
+ //
+ if (IsUnicode) {
+ CopyMem (
+ UnicodeCmdLine, BootOption->OptionalData,
+ MIN (sizeof (UnicodeCmdLine),
+ BootOption->OptionalDataSize)
+ );
} else {
- // Case we create the initrd device path
-
- Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes);
- 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;
- }
-
- if (InitrdPathNodes != NULL) {
- // Duplicate Linux kernel Device Path
- TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
- // Replace Linux kernel Node by EndNode
- SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
- // Append the Device Path to the selected device path
- InitrdPath = AppendDevicePath (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
- FreePool (TempInitrdPath);
- // Free the InitrdPathNodes created by Support->CreateDevicePathNode()
- FreePool (InitrdPathNodes);
- if (InitrdPath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto EXIT;
- }
- InitrdSize = GetDevicePathSize (InitrdPath);
- } else {
- InitrdPath = NULL;
- }
+ CopyMem (
+ CmdLine, BootOption->OptionalData,
+ MIN (sizeof (CmdLine),
+ BootOption->OptionalDataSize)
+ );
}
- } else {
- InitrdSize = 0;
- }
-
- Print(L"Arguments to pass to the binary: ");
- if (CmdLineSize > 0) {
- AsciiStrnCpy (CmdLine, (CONST CHAR8*)(LinuxArguments + 1), sizeof (CmdLine));
- CmdLine[sizeof (CmdLine) - 1] = '\0';
- } else {
- CmdLine[0] = '\0';
}
- Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);
- if (EFI_ERROR(Status)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- CmdLineSize = AsciiStrSize (CmdLine);
-
- OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
-
- OptionalData = (UINT8*)BootArguments;
} else {
- Print (L"Arguments to pass to the EFI Application: ");
+ UnicodeCmdLine[0] = L'\0';
+ IsPrintable = TRUE;
+ IsUnicode = TRUE;
+ }

- if (BootOption->OptionalDataSize > 0) {
- IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);
- if (IsPrintable) {
- //
- // The size in bytes of the string, final zero included, should
- // be equal to or at least lower than "BootOption->OptionalDataSize"
- // and the "IsPrintableString()" has already tested that the length
- // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,
- // final '\0' included. We can thus copy the string for editing
- // using "CopyMem()". Furthermore, note that in the case of an Unicode
- // string "StrnCpy()" and "StrCpy()" can not be used to copy the
- // string because the data pointed to by "BootOption->OptionalData"
- // is not necessarily 2-byte aligned.
- //
- if (IsUnicode) {
- CopyMem (
- UnicodeCmdLine, BootOption->OptionalData,
- MIN (sizeof (UnicodeCmdLine),
- BootOption->OptionalDataSize)
- );
- } else {
- CopyMem (
- CmdLine, BootOption->OptionalData,
- MIN (sizeof (CmdLine),
- BootOption->OptionalDataSize)
- );
- }
+ // 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;
}
- } 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);
- }
+ OptionalData = (UINT8*)UnicodeCmdLine;
+ OptionalDataSize = StrSize (UnicodeCmdLine);
} else {
- // We keep the former OptionalData
- OptionalData = BootOption->OptionalData;
- OptionalDataSize = BootOption->OptionalDataSize;
+ 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: ");
@@ -655,7 +464,7 @@ BootMenuUpdateBootOption (
}

// Update the entry
- Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

FREE_DEVICE_PATH:
FreePool (DevicePath);
@@ -1139,9 +948,6 @@ BootMenuMain (
DEBUG_CODE_BEGIN();
CHAR16* DevicePathTxt;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
- UINTN CmdLineSize;
- ARM_BDS_LOADER_TYPE LoaderType;

Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
if (EFI_ERROR(Status)) {
@@ -1153,39 +959,7 @@ BootMenuMain (

Print(L"\t- %s\n",DevicePathTxt);

- // If it is a supported BootEntry then print its details
- if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
- OptionalData = BootOption->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)) {
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
- CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);
- Print(L"\t- Initrd: %s\n", DevicePathTxt);
- }
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize) > 0) {
- Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));
- }
- }
-
- switch (LoaderType) {
- case BDS_LOADER_EFI_APPLICATION:
- Print(L"\t- LoaderType: EFI Application\n");
- break;
-
- case BDS_LOADER_KERNEL_LINUX_ATAG:
- Print(L"\t- LoaderType: Linux kernel with ATAG support\n");
- break;
-
- case BDS_LOADER_KERNEL_LINUX_FDT:
- Print(L"\t- LoaderType: Linux kernel with FDT support\n");
- break;
-
- default:
- Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType);
- }
- } else if (BootOption->OptionalData != NULL) {
+ if (BootOption->OptionalData != NULL) {
if (IsPrintableString (BootOption->OptionalData, &IsUnicode)) {
if (IsUnicode) {
Print (L"\t- Arguments: %s\n", BootOption->OptionalData);
diff --git a/ArmPlatformPkg/Bds/BootOption.c b/ArmPlatformPkg/Bds/BootOption.c
index 342d441..bdd02b4 100644
--- a/ArmPlatformPkg/Bds/BootOption.c
+++ b/ArmPlatformPkg/Bds/BootOption.c
@@ -20,48 +20,27 @@ BootOptionStart (
IN BDS_LOAD_OPTION *BootOption
)
{
- EFI_STATUS Status;
- UINT32 LoaderType;
- ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
- UINT16 LoadOptionIndexSize;
-
- if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
- Status = EFI_UNSUPPORTED;
- OptionalData = BootOption->OptionalData;
- LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
-
- if (LoaderType == BDS_LOADER_EFI_APPLICATION) {
- if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
- // Need to connect every drivers to ensure no dependencies are missing for the application
- BdsConnectAllDrivers ();
- }
+ EFI_STATUS Status;
+ UINT16 LoadOptionIndexSize;

- Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, 0, NULL);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {
- ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
- } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
- ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
- }
- } else {
- // Connect all the drivers if the EFI Application is not a EFI OS Loader
- if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
- BdsConnectAllDrivers ();
- }
+ // Connect all the drivers if the EFI Application is not a EFI OS Loader
+ if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {
+ BdsConnectAllDrivers ();
+ }

- // Set BootCurrent variable
- LoadOptionIndexSize = sizeof(UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- LoadOptionIndexSize, &(BootOption->LoadOptionIndex));
+ // Set BootCurrent variable
+ LoadOptionIndexSize = sizeof (UINT16);
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ LoadOptionIndexSize, &(BootOption->LoadOptionIndex));

- Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);
+ Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);

- // Clear BootCurrent variable
- LoadOptionIndexSize = sizeof(UINT16);
- gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0, NULL);
- }
+ // Clear BootCurrent variable
+ LoadOptionIndexSize = sizeof (UINT16);
+ gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ 0, NULL);

return Status;
}
@@ -107,7 +86,6 @@ BootOptionSetFields (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
)
@@ -117,10 +95,6 @@ BootOptionSetFields (
UINTN BootDescriptionSize;
UINT16 FilePathListLength;
UINT8* EfiLoadOptionPtr;
- UINT8* InitrdPathListPtr;
- ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments;
- ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments;
- ARM_BDS_LOADER_ARGUMENTS* BootArguments;

// If we are overwriting an existent Boot Option then we have to free previously allocated memory
if (BootOption->LoadOption) {
@@ -129,11 +103,6 @@ BootOptionSetFields (

BootDescriptionSize = StrSize (BootDescription);

- // Fixup the size in case of entry specific to ArmPlatformPkg/Bds
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- OptionalDataSize += sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- }
-
// Compute the size of the FilePath list
FilePathListLength = GetUnalignedDevicePathSize (DevicePath);

@@ -169,33 +138,10 @@ BootOptionSetFields (
// Optional Data fields, Do unaligned writes
BootOption->OptionalData = EfiLoadOptionPtr;

- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
- // Write the header
- WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);
- WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
-
- // OptionalData should have been initialized by the caller of this function
- ASSERT (OptionalData != NULL);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;
- SrcLinuxArguments = &(BootArguments->LinuxArguments);
- DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
-
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);
-
- if (SrcLinuxArguments->CmdLineSize > 0) {
- CopyMem ((VOID*)(DestLinuxArguments + 1), (VOID*)(SrcLinuxArguments + 1), SrcLinuxArguments->CmdLineSize);
- }
-
- if (SrcLinuxArguments->InitrdSize > 0) {
- InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);
- CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
- }
- } else {
- if (OptionalData != NULL) {
- CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
- }
+ if (OptionalData != NULL) {
+ CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
}
+
BootOption->OptionalDataSize = OptionalDataSize;

// If this function is called at the creation of the Boot Device entry (not at the update) the
@@ -216,7 +162,6 @@ BootOptionCreate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize,
OUT BDS_LOAD_OPTION** BdsLoadOption
@@ -237,7 +182,7 @@ BootOptionCreate (
BootOptionEntry->BdsLoadOption = (BDS_LOAD_OPTION*)AllocateZeroPool (sizeof(BDS_LOAD_OPTION));

BootOption = BootOptionEntry->BdsLoadOption;
- BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

//
// Set the related environment variables
@@ -290,7 +235,6 @@ BootOptionUpdate (
IN UINT32 Attributes,
IN CHAR16* BootDescription,
IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,
- IN ARM_BDS_LOADER_TYPE BootType,
IN UINT8* OptionalData,
IN UINTN OptionalDataSize
)
@@ -299,7 +243,7 @@ BootOptionUpdate (
CHAR16 BootVariableName[9];

// Update the BDS Load Option structure
- BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);
+ BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);

// Update the related environment variables
UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BdsLoadOption->LoadOptionIndex);
diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c
index 974f220..f50f13f 100644
--- a/ArmPlatformPkg/Bds/BootOptionSupport.c
+++ b/ArmPlatformPkg/Bds/BootOptionSupport.c
@@ -214,117 +214,6 @@ BootDeviceGetDeviceSupport (
}

EFI_STATUS
-BootDeviceGetType (
- IN EFI_DEVICE_PATH* DevicePath,
- OUT ARM_BDS_LOADER_TYPE *BootType,
- OUT UINT32 *Attributes
- )
-{
- EFI_STATUS Status;
- BOOLEAN IsEfiApp;
- BOOLEAN IsBootLoader;
- BOOLEAN HasFDTSupport;
- CHAR16* FileName;
- EFI_DEVICE_PATH* PrevDevicePathNode;
- EFI_DEVICE_PATH* DevicePathNode;
- EFI_PHYSICAL_ADDRESS Image;
- UINTN FileSize;
- EFI_IMAGE_DOS_HEADER* DosHeader;
- UINTN PeCoffHeaderOffset;
- EFI_IMAGE_NT_HEADERS32* NtHeader;
-
- //
- // Check if the last node of the device path is a FilePath node
- //
- PrevDevicePathNode = NULL;
- DevicePathNode = DevicePath;
- while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {
- PrevDevicePathNode = DevicePathNode;
- DevicePathNode = NextDevicePathNode (DevicePathNode);
- }
-
- if ((PrevDevicePathNode != NULL) &&
- (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&
- (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))
- {
- FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;
- } else {
- FileName = NULL;
- }
-
- if (FileName == NULL) {
- Print(L"Is an EFI Application? ");
- Status = GetHIInputBoolean (&IsEfiApp);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- } else if (HasFilePathEfiExtension(FileName)) {
- IsEfiApp = TRUE;
- } else {
- // Check if the file exist
- Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);
- if (!EFI_ERROR (Status)) {
-
- DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;
- if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present,
- // so read the PE header after the DOS image header.
- //
- PeCoffHeaderOffset = DosHeader->e_lfanew;
- } else {
- PeCoffHeaderOffset = 0;
- }
-
- //
- // Check PE/COFF image.
- //
- NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);
- if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {
- IsEfiApp = FALSE;
- } else {
- IsEfiApp = TRUE;
- }
-
- // Free memory
- gBS->FreePages (Image, EFI_SIZE_TO_PAGES(FileSize));
- } else {
- // If we did not manage to open it then ask for the type
- Print(L"Is an EFI Application? ");
- Status = GetHIInputBoolean (&IsEfiApp);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- }
- }
-
- if (IsEfiApp) {
- Print(L"Is your application an OS loader? ");
- Status = GetHIInputBoolean (&IsBootLoader);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- if (!IsBootLoader) {
- *Attributes |= LOAD_OPTION_CATEGORY_APP;
- }
- *BootType = BDS_LOADER_EFI_APPLICATION;
- } else {
- Print(L"Has FDT support? ");
- Status = GetHIInputBoolean (&HasFDTSupport);
- if (EFI_ERROR(Status)) {
- return EFI_ABORTED;
- }
- if (HasFDTSupport) {
- *BootType = BDS_LOADER_KERNEL_LINUX_FDT;
- } else {
- *BootType = BDS_LOADER_KERNEL_LINUX_ATAG;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
BdsLoadOptionFileSystemList (
IN OUT LIST_ENTRY* BdsLoadOptionList
)
diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
index 7aa6ce2..5338492 100644
--- a/BeagleBoardPkg/BeagleBoardPkg.dsc
+++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
@@ -362,18 +362,11 @@
gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"Linux from SD"
gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(B615F1F5-5088-43CD-809C-A16E52487D00)/HD(1,MBR,0x00000000,0x3F,0x19FC0)/Image"
gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"console=tty0 console=ttyS2,115200n8 root=UUID=a4af765b-c2b5-48f4-9564-7a4e9104c4f6 rootwait ro earlyprintk"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10

gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();VenHw(E68088EF-D1A4-4336-C1DB-4D3A204730A6)"
gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-435F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()"

- #
- # ARM OS Loader
- #
- # BeagleBoard machine type (OMAP3_BEAGLE = 1546) required for ARM Linux:
- gArmTokenSpaceGuid.PcdArmMachineType|1546
-
################################################################################
#
# Components Section - list of all EDK II Modules needed by this Platform
--
2.1.1
Loading...