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 <olivier.mar...@arm.com> Reviewed-by: Ronald Cron <ronald.c...@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 ------------------------------------------------------------------------------ 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-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel