]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Remove Linux specific boot path
authorOlivier Martin <Olivier.Martin@arm.com>
Tue, 14 Jul 2015 14:36:49 +0000 (14:36 +0000)
committeroliviermartin <oliviermartin@Edk2>
Tue, 14 Jul 2015 14:36:49 +0000 (14:36 +0000)
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.Martin@arm.com>
Reviewed-by: Ronald Cron <Ronald.Cron@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17970 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds/Bds.inf
ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg/Bds/BootMenu.c
ArmPlatformPkg/Bds/BootOption.c
ArmPlatformPkg/Bds/BootOptionSupport.c

index 1fab43976f29c0940be607acd85db3a776b99f40..3ee866c9f2f53808f1a81793071b93e792c3e915 100644 (file)
@@ -220,12 +220,6 @@ DefineDefaultBootEntries (
   EFI_STATUS                          Status;\r
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;\r
   EFI_DEVICE_PATH*                    BootDevicePath;\r
-  UINT8*                              OptionalData;\r
-  UINTN                               OptionalDataSize;\r
-  ARM_BDS_LOADER_ARGUMENTS*           BootArguments;\r
-  ARM_BDS_LOADER_TYPE                 BootType;\r
-  EFI_DEVICE_PATH*                    InitrdPath;\r
-  UINTN                               InitrdSize;\r
   UINTN                               CmdLineSize;\r
   UINTN                               CmdLineAsciiSize;\r
   CHAR16*                             DefaultBootArgument;\r
@@ -269,8 +263,6 @@ DefineDefaultBootEntries (
 \r
     // Create the entry is the Default values are correct\r
     if (BootDevicePath != NULL) {\r
-      BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);\r
-\r
       // We do not support NULL pointer\r
       ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);\r
 \r
@@ -308,33 +300,11 @@ DefineDefaultBootEntries (
         AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);\r
       }\r
 \r
-      if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-        InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));\r
-        InitrdSize = GetDevicePathSize (InitrdPath);\r
-\r
-        OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;\r
-        BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);\r
-        if (BootArguments == NULL) {\r
-          return EFI_OUT_OF_RESOURCES;\r
-        }\r
-        BootArguments->LinuxArguments.CmdLineSize = CmdLineAsciiSize;\r
-        BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
-\r
-        CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);\r
-        CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);\r
-\r
-        OptionalData = (UINT8*)BootArguments;\r
-      } else {\r
-        OptionalData = (UINT8*)DefaultBootArgument;\r
-        OptionalDataSize = CmdLineSize;\r
-      }\r
-\r
       BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,\r
-        (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),\r
+        (CHAR16*)PcdGetPtr (PcdDefaultBootDescription),\r
         BootDevicePath,\r
-        BootType,\r
-        OptionalData,\r
-        OptionalDataSize,\r
+        (UINT8 *)DefaultBootArgument, // OptionalData\r
+        CmdLineSize,                  // OptionalDataSize\r
         &BdsLoadOption\r
         );\r
       FreePool (BdsLoadOption);\r
index 9639f1424e96d3f4fa68b131421f8168ef2bd110..3b6ffc38a827e2839a0dafb5a2aa4ff9d79b4f4c 100644 (file)
@@ -24,7 +24,7 @@
 \r
   ENTRY_POINT                    = BdsInitialize\r
 \r
-[Sources.common]\r
+[Sources]\r
   Bds.c\r
   BdsHelper.c\r
   BootMenu.c\r
 \r
 [LibraryClasses]\r
   BdsLib\r
-  TimerLib\r
-  PerformanceLib\r
   UefiBootServicesTableLib\r
   DxeServicesTableLib\r
   UefiDriverEntryPoint\r
   DebugLib\r
+  PerformanceLib\r
   PrintLib\r
   BaseLib\r
   FdtLib\r
@@ -77,9 +76,7 @@
   gArmPlatformTokenSpaceGuid.PcdFirmwareVendor\r
   gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription\r
   gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath\r
-  gArmPlatformTokenSpaceGuid.PcdDefaultBootInitrdPath\r
   gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument\r
-  gArmPlatformTokenSpaceGuid.PcdDefaultBootType\r
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut\r
   gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths\r
   gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths\r
index 1cb154eab70f2947c49fa610cb047996ced8b35a..fe4fd79289529ca194e1f1cd5f6f6be49e1bdd11 100644 (file)
 #define BOOT_DEVICE_OPTION_MAX        300\r
 #define BOOT_DEVICE_ADDRESS_MAX       (sizeof(L"0x0000000000000000"))\r
 \r
-#define ARM_BDS_OPTIONAL_DATA_SIGNATURE   SIGNATURE_32('a', 'b', 'o', 'd')\r
-\r
-#define IS_ARM_BDS_BOOTENTRY(ptr)  \\r
-  (((ptr)->OptionalData != NULL) && \\r
-   (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) \\r
-      == ARM_BDS_OPTIONAL_DATA_SIGNATURE))\r
-\r
 #define UPDATE_BOOT_ENTRY L"Update entry: "\r
 #define DELETE_BOOT_ENTRY L"Delete entry: "\r
 #define MOVE_BOOT_ENTRY   L"Move entry: "\r
 \r
-typedef enum {\r
-    BDS_LOADER_EFI_APPLICATION = 0,\r
-    BDS_LOADER_KERNEL_LINUX_ATAG,\r
-    BDS_LOADER_KERNEL_LINUX_FDT,\r
-} ARM_BDS_LOADER_TYPE;\r
-\r
-typedef struct {\r
-  UINT16                     CmdLineSize;\r
-  UINT16                     InitrdSize;\r
-\r
-  // These following fields have variable length and are packed:\r
-  //CHAR8                      *CmdLine;\r
-  //EFI_DEVICE_PATH_PROTOCOL   *InitrdPathList;\r
-} ARM_BDS_LINUX_ARGUMENTS;\r
-\r
-typedef union {\r
-  ARM_BDS_LINUX_ARGUMENTS    LinuxArguments;\r
-} ARM_BDS_LOADER_ARGUMENTS;\r
-\r
-typedef struct {\r
-  UINT32                     Signature;\r
-  ARM_BDS_LOADER_TYPE        LoaderType;\r
-} ARM_BDS_LOADER_OPTIONAL_DATA_HEADER;\r
-\r
-typedef struct {\r
-  ARM_BDS_LOADER_OPTIONAL_DATA_HEADER Header;\r
-  ARM_BDS_LOADER_ARGUMENTS            Arguments;\r
-} ARM_BDS_LOADER_OPTIONAL_DATA;\r
-\r
 typedef struct {\r
   LIST_ENTRY                  Link;\r
   BDS_LOAD_OPTION*            BdsLoadOption;\r
@@ -230,7 +194,6 @@ BootOptionCreate (
   IN  UINT32                    Attributes,\r
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  ARM_BDS_LOADER_TYPE       BootType,\r
   IN  UINT8*                    OptionalData,\r
   IN  UINTN                     OptionalDataSize,\r
   OUT BDS_LOAD_OPTION**         BdsLoadOption\r
@@ -242,7 +205,6 @@ BootOptionUpdate (
   IN  UINT32                    Attributes,\r
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  ARM_BDS_LOADER_TYPE       BootType,\r
   IN UINT8*                     OptionalData,\r
   IN UINTN                      OptionalDataSize\r
   );\r
@@ -252,13 +214,6 @@ BootOptionDelete (
   IN  BDS_LOAD_OPTION *BootOption\r
   );\r
 \r
-EFI_STATUS\r
-BootDeviceGetType (\r
-  IN  EFI_DEVICE_PATH* DevicePath,\r
-  OUT ARM_BDS_LOADER_TYPE *BootType,\r
-  OUT UINT32 *Attributes\r
-  );\r
-\r
 EFI_STATUS\r
 BootMenuMain (\r
   VOID\r
index a304cc4ce916f39dbe060095d3f5cec06f12013d..af7f1f1ac402ba5cc384eed55eb44f63cf4b9e80 100644 (file)
@@ -54,8 +54,6 @@ DisplayBootOptions (
     DEBUG_CODE_BEGIN ();\r
       CHAR16*                           DevicePathTxt;\r
       EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
-      ARM_BDS_LOADER_TYPE               LoaderType;\r
-      ARM_BDS_LOADER_OPTIONAL_DATA*     OptionalData;\r
 \r
       Status = gBS->LocateProtocol (\r
                      &gEfiDevicePathToTextProtocolGuid,\r
@@ -70,20 +68,11 @@ DisplayBootOptions (
                                                   );\r
       Print (L"\t- %s\n", DevicePathTxt);\r
 \r
-      OptionalData = BdsLoadOption->OptionalData;\r
-      if (IS_ARM_BDS_BOOTENTRY (BdsLoadOption)) {\r
-        LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
-        if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) ||\r
-            (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT )   ) {\r
-          Print (L"\t- Arguments: %a\n", &OptionalData->Arguments.LinuxArguments + 1);\r
-        }\r
-      } else if (OptionalData != NULL) {\r
-        if (IsPrintableString (OptionalData, &IsUnicode)) {\r
-          if (IsUnicode) {\r
-            Print (L"\t- Arguments: %s\n", OptionalData);\r
-          } else {\r
-            AsciiPrint ("\t- Arguments: %a\n", OptionalData);\r
-          }\r
+      if (IsPrintableString (BdsLoadOption->OptionalData, &IsUnicode)) {\r
+        if (IsUnicode) {\r
+          Print (L"\t- Arguments: %s\n", BdsLoadOption->OptionalData);\r
+        } else {\r
+          AsciiPrint ("\t- Arguments: %a\n", BdsLoadOption->OptionalData);\r
         }\r
       }\r
 \r
@@ -272,20 +261,12 @@ BootMenuAddBootOption (
 {\r
   EFI_STATUS                Status;\r
   BDS_SUPPORTED_DEVICE*     SupportedBootDevice;\r
-  ARM_BDS_LOADER_ARGUMENTS* BootArguments;\r
   CHAR16                    BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];\r
-  CHAR8                     AsciiCmdLine[BOOT_DEVICE_OPTION_MAX];\r
   CHAR16                    CmdLine[BOOT_DEVICE_OPTION_MAX];\r
   UINT32                    Attributes;\r
-  ARM_BDS_LOADER_TYPE       BootType;\r
   BDS_LOAD_OPTION_ENTRY     *BdsLoadOptionEntry;\r
   EFI_DEVICE_PATH           *DevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePathNodes;\r
-  EFI_DEVICE_PATH_PROTOCOL  *InitrdPathNodes;\r
-  EFI_DEVICE_PATH_PROTOCOL  *InitrdPath;\r
-  UINTN                     CmdLineSize;\r
-  BOOLEAN                   InitrdSupport;\r
-  UINTN                     InitrdSize;\r
   UINT8*                    OptionalData;\r
   UINTN                     OptionalDataSize;\r
 \r
@@ -312,79 +293,15 @@ BootMenuAddBootOption (
     goto EXIT;\r
   }\r
 \r
-  if (SupportedBootDevice->Support->RequestBootType) {\r
-    Status = BootDeviceGetType (DevicePath, &BootType, &Attributes);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
-    }\r
-  } else {\r
-    BootType = BDS_LOADER_EFI_APPLICATION;\r
+  Print (L"Arguments to pass to the EFI Application: ");\r
+  Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
+  if (EFI_ERROR (Status)) {\r
+    Status = EFI_ABORTED;\r
+    goto EXIT;\r
   }\r
 \r
-  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-    Print(L"Add an initrd: ");\r
-    Status = GetHIInputBoolean (&InitrdSupport);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
-    }\r
-\r
-    if (InitrdSupport) {\r
-      // Create the specific device path node\r
-      Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes);\r
-      if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
-        Status = EFI_ABORTED;\r
-        goto EXIT;\r
-      }\r
-\r
-      if (InitrdPathNodes != NULL) {\r
-        // Append the Device Path to the selected device path\r
-        InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);\r
-        // Free the InitrdPathNodes created by Support->CreateDevicePathNode()\r
-        FreePool (InitrdPathNodes);\r
-\r
-        if (InitrdPath == NULL) {\r
-          Status = EFI_OUT_OF_RESOURCES;\r
-          goto EXIT;\r
-        }\r
-      } else {\r
-        InitrdPath = NULL;\r
-      }\r
-    } else {\r
-      InitrdPath = NULL;\r
-    }\r
-\r
-    Print(L"Arguments to pass to the binary: ");\r
-    Status = GetHIInputAscii (AsciiCmdLine, BOOT_DEVICE_OPTION_MAX);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto FREE_DEVICE_PATH;\r
-    }\r
-\r
-    CmdLineSize = AsciiStrSize (AsciiCmdLine);\r
-    InitrdSize = GetDevicePathSize (InitrdPath);\r
-\r
-    OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;\r
-    BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);\r
-\r
-    BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
-    BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
-    CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), AsciiCmdLine, CmdLineSize);\r
-    CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);\r
-\r
-    OptionalData = (UINT8*)BootArguments;\r
-  } else {\r
-    Print (L"Arguments to pass to the EFI Application: ");\r
-    Status = GetHIInputStr (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
-    if (EFI_ERROR (Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
-    }\r
-\r
-    OptionalData = (UINT8*)CmdLine;\r
-    OptionalDataSize = StrSize (CmdLine);\r
-  }\r
+  OptionalData = (UINT8*)CmdLine;\r
+  OptionalDataSize = StrSize (CmdLine);\r
 \r
   Print(L"Description for this new Entry: ");\r
   Status = GetHIInputStr (BootDescription, BOOT_DEVICE_DESCRIPTION_MAX);\r
@@ -395,7 +312,7 @@ BootMenuAddBootOption (
 \r
   // Create new entry\r
   BdsLoadOptionEntry = (BDS_LOAD_OPTION_ENTRY*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY));\r
-  Status = BootOptionCreate (Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);\r
+  Status = BootOptionCreate (Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize, &BdsLoadOptionEntry->BdsLoadOption);\r
   if (!EFI_ERROR(Status)) {\r
     InsertTailList (BootOptionsList, &BdsLoadOptionEntry->Link);\r
   }\r
@@ -446,20 +363,10 @@ BootMenuUpdateBootOption (
   BDS_LOAD_OPTION_ENTRY         *BootOptionEntry;\r
   BDS_LOAD_OPTION               *BootOption;\r
   BDS_LOAD_OPTION_SUPPORT*      DeviceSupport;\r
-  ARM_BDS_LOADER_ARGUMENTS*     BootArguments;\r
   CHAR16                        BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];\r
   CHAR8                         CmdLine[BOOT_DEVICE_OPTION_MAX];\r
   CHAR16                        UnicodeCmdLine[BOOT_DEVICE_OPTION_MAX];\r
   EFI_DEVICE_PATH               *DevicePath;\r
-  EFI_DEVICE_PATH               *TempInitrdPath;\r
-  ARM_BDS_LOADER_TYPE           BootType;\r
-  ARM_BDS_LOADER_OPTIONAL_DATA* LoaderOptionalData;\r
-  ARM_BDS_LINUX_ARGUMENTS*      LinuxArguments;\r
-  EFI_DEVICE_PATH               *InitrdPathNodes;\r
-  EFI_DEVICE_PATH               *InitrdPath;\r
-  UINTN                         InitrdSize;\r
-  UINTN                         CmdLineSize;\r
-  BOOLEAN                       InitrdSupport;\r
   UINT8*                        OptionalData;\r
   UINTN                         OptionalDataSize;\r
   BOOLEAN                       IsPrintable;\r
@@ -485,165 +392,67 @@ BootMenuUpdateBootOption (
     goto EXIT;\r
   }\r
 \r
-  if (DeviceSupport->RequestBootType) {\r
-    Status = BootDeviceGetType (DevicePath, &BootType, &BootOption->Attributes);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
-    }\r
-  }\r
-\r
-  LoaderOptionalData = BootOption->OptionalData;\r
-  if (LoaderOptionalData != NULL) {\r
-    BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&LoaderOptionalData->Header.LoaderType));\r
-  } else {\r
-    BootType = BDS_LOADER_EFI_APPLICATION;\r
-  }\r
-\r
-  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-    LinuxArguments = &LoaderOptionalData->Arguments.LinuxArguments;\r
-\r
-    CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
-\r
-    InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);\r
-    if (InitrdSize > 0) {\r
-      Print(L"Keep the initrd: ");\r
-    } else {\r
-      Print(L"Add an initrd: ");\r
-    }\r
-    Status = GetHIInputBoolean (&InitrdSupport);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto EXIT;\r
-    }\r
+  Print (L"Arguments to pass to the EFI Application: ");\r
 \r
-    if (InitrdSupport) {\r
-      if (InitrdSize > 0) {\r
-        // Case we update the initrd device path\r
-        Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath);\r
-        if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
-          Status = EFI_ABORTED;\r
-          goto EXIT;\r
-        }\r
-        InitrdSize = GetDevicePathSize (InitrdPath);\r
+  if (BootOption->OptionalDataSize > 0) {\r
+    IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);\r
+    if (IsPrintable) {\r
+        //\r
+        // The size in bytes of the string, final zero included, should\r
+        // be equal to or at least lower than "BootOption->OptionalDataSize"\r
+        // and the "IsPrintableString()" has already tested that the length\r
+        // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,\r
+        // final '\0' included. We can thus copy the string for editing\r
+        // using "CopyMem()". Furthermore, note that in the case of an Unicode\r
+        // string "StrnCpy()" and "StrCpy()" can not be used to copy the\r
+        // string because the data pointed to by "BootOption->OptionalData"\r
+        // is not necessarily 2-byte aligned.\r
+        //\r
+      if (IsUnicode) {\r
+        CopyMem (\r
+          UnicodeCmdLine, BootOption->OptionalData,\r
+          MIN (sizeof (UnicodeCmdLine),\r
+               BootOption->OptionalDataSize)\r
+          );\r
       } else {\r
-        // Case we create the initrd device path\r
-\r
-        Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes);\r
-        if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
-          Status = EFI_ABORTED;\r
-          goto EXIT;\r
-        }\r
-\r
-        if (InitrdPathNodes != NULL) {\r
-          // Duplicate Linux kernel Device Path\r
-          TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);\r
-          // Replace Linux kernel Node by EndNode\r
-          SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));\r
-          // Append the Device Path to the selected device path\r
-          InitrdPath = AppendDevicePath (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);\r
-          FreePool (TempInitrdPath);\r
-          // Free the InitrdPathNodes created by Support->CreateDevicePathNode()\r
-          FreePool (InitrdPathNodes);\r
-          if (InitrdPath == NULL) {\r
-            Status = EFI_OUT_OF_RESOURCES;\r
-            goto EXIT;\r
-          }\r
-          InitrdSize = GetDevicePathSize (InitrdPath);\r
-        } else {\r
-          InitrdPath = NULL;\r
-        }\r
+        CopyMem (\r
+          CmdLine, BootOption->OptionalData,\r
+          MIN (sizeof (CmdLine),\r
+               BootOption->OptionalDataSize)\r
+          );\r
       }\r
-    } else {\r
-      InitrdSize = 0;\r
-    }\r
-\r
-    Print(L"Arguments to pass to the binary: ");\r
-    if (CmdLineSize > 0) {\r
-      AsciiStrnCpy (CmdLine, (CONST CHAR8*)(LinuxArguments + 1), sizeof (CmdLine));\r
-      CmdLine[sizeof (CmdLine) - 1] = '\0';\r
-    } else {\r
-      CmdLine[0] = '\0';\r
     }\r
-    Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
-    if (EFI_ERROR(Status)) {\r
-      Status = EFI_ABORTED;\r
-      goto FREE_DEVICE_PATH;\r
-    }\r
-\r
-    CmdLineSize = AsciiStrSize (CmdLine);\r
-\r
-    OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize;\r
-    BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);\r
-    BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
-    BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
-    CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);\r
-    CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);\r
-\r
-    OptionalData = (UINT8*)BootArguments;\r
   } else {\r
-    Print (L"Arguments to pass to the EFI Application: ");\r
+    UnicodeCmdLine[0] = L'\0';\r
+    IsPrintable = TRUE;\r
+    IsUnicode = TRUE;\r
+  }\r
 \r
-    if (BootOption->OptionalDataSize > 0) {\r
-      IsPrintable = IsPrintableString (BootOption->OptionalData, &IsUnicode);\r
-      if (IsPrintable) {\r
-          //\r
-          // The size in bytes of the string, final zero included, should\r
-          // be equal to or at least lower than "BootOption->OptionalDataSize"\r
-          // and the "IsPrintableString()" has already tested that the length\r
-          // in number of characters is smaller than BOOT_DEVICE_OPTION_MAX,\r
-          // final '\0' included. We can thus copy the string for editing\r
-          // using "CopyMem()". Furthermore, note that in the case of an Unicode\r
-          // string "StrnCpy()" and "StrCpy()" can not be used to copy the\r
-          // string because the data pointed to by "BootOption->OptionalData"\r
-          // is not necessarily 2-byte aligned.\r
-          //\r
-        if (IsUnicode) {\r
-          CopyMem (\r
-            UnicodeCmdLine, BootOption->OptionalData,\r
-            MIN (sizeof (UnicodeCmdLine),\r
-                 BootOption->OptionalDataSize)\r
-            );\r
-        } else {\r
-          CopyMem (\r
-            CmdLine, BootOption->OptionalData,\r
-            MIN (sizeof (CmdLine),\r
-                 BootOption->OptionalDataSize)\r
-            );\r
-        }\r
+  // We do not request arguments for OptionalData that cannot be printed\r
+  if (IsPrintable) {\r
+    if (IsUnicode) {\r
+      Status = EditHIInputStr (UnicodeCmdLine, BOOT_DEVICE_OPTION_MAX);\r
+      if (EFI_ERROR (Status)) {\r
+        Status = EFI_ABORTED;\r
+        goto FREE_DEVICE_PATH;\r
       }\r
-    } else {\r
-      UnicodeCmdLine[0] = L'\0';\r
-      IsPrintable = TRUE;\r
-      IsUnicode = TRUE;\r
-    }\r
-\r
-    // We do not request arguments for OptionalData that cannot be printed\r
-    if (IsPrintable) {\r
-      if (IsUnicode) {\r
-        Status = EditHIInputStr (UnicodeCmdLine, BOOT_DEVICE_OPTION_MAX);\r
-        if (EFI_ERROR (Status)) {\r
-          Status = EFI_ABORTED;\r
-          goto FREE_DEVICE_PATH;\r
-        }\r
-\r
-        OptionalData = (UINT8*)UnicodeCmdLine;\r
-        OptionalDataSize = StrSize (UnicodeCmdLine);\r
-      } else {\r
-        Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
-        if (EFI_ERROR (Status)) {\r
-          Status = EFI_ABORTED;\r
-          goto FREE_DEVICE_PATH;\r
-        }\r
 \r
-        OptionalData = (UINT8*)CmdLine;\r
-        OptionalDataSize = AsciiStrSize (CmdLine);\r
-      }\r
+      OptionalData = (UINT8*)UnicodeCmdLine;\r
+      OptionalDataSize = StrSize (UnicodeCmdLine);\r
     } else {\r
-      // We keep the former OptionalData\r
-      OptionalData = BootOption->OptionalData;\r
-      OptionalDataSize = BootOption->OptionalDataSize;\r
+      Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
+      if (EFI_ERROR (Status)) {\r
+        Status = EFI_ABORTED;\r
+        goto FREE_DEVICE_PATH;\r
+      }\r
+\r
+      OptionalData = (UINT8*)CmdLine;\r
+      OptionalDataSize = AsciiStrSize (CmdLine);\r
     }\r
+  } else {\r
+    // We keep the former OptionalData\r
+    OptionalData = BootOption->OptionalData;\r
+    OptionalDataSize = BootOption->OptionalDataSize;\r
   }\r
 \r
   Print(L"Description for this new Entry: ");\r
@@ -655,7 +464,7 @@ BootMenuUpdateBootOption (
   }\r
 \r
   // Update the entry\r
-  Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);\r
+  Status = BootOptionUpdate (BootOption, BootOption->Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);\r
 \r
 FREE_DEVICE_PATH:\r
   FreePool (DevicePath);\r
@@ -1139,9 +948,6 @@ BootMenuMain (
       DEBUG_CODE_BEGIN();\r
         CHAR16*                           DevicePathTxt;\r
         EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;\r
-        ARM_BDS_LOADER_OPTIONAL_DATA*     OptionalData;\r
-        UINTN                             CmdLineSize;\r
-        ARM_BDS_LOADER_TYPE               LoaderType;\r
 \r
         Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);\r
         if (EFI_ERROR(Status)) {\r
@@ -1153,39 +959,7 @@ BootMenuMain (
 \r
         Print(L"\t- %s\n",DevicePathTxt);\r
 \r
-        // If it is a supported BootEntry then print its details\r
-        if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
-          OptionalData = BootOption->OptionalData;\r
-          LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
-          if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-            if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {\r
-              CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);\r
-              DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (\r
-                  GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize)), TRUE, TRUE);\r
-              Print(L"\t- Initrd: %s\n", DevicePathTxt);\r
-            }\r
-            if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize) > 0) {\r
-              Print(L"\t- Arguments: %a\n", (&OptionalData->Arguments.LinuxArguments + 1));\r
-            }\r
-          }\r
-\r
-          switch (LoaderType) {\r
-            case BDS_LOADER_EFI_APPLICATION:\r
-              Print(L"\t- LoaderType: EFI Application\n");\r
-              break;\r
-\r
-            case BDS_LOADER_KERNEL_LINUX_ATAG:\r
-              Print(L"\t- LoaderType: Linux kernel with ATAG support\n");\r
-              break;\r
-\r
-            case BDS_LOADER_KERNEL_LINUX_FDT:\r
-              Print(L"\t- LoaderType: Linux kernel with FDT support\n");\r
-              break;\r
-\r
-            default:\r
-              Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType);\r
-          }\r
-        } else if (BootOption->OptionalData != NULL) {\r
+        if (BootOption->OptionalData != NULL) {\r
           if (IsPrintableString (BootOption->OptionalData, &IsUnicode)) {\r
             if (IsUnicode) {\r
               Print (L"\t- Arguments: %s\n", BootOption->OptionalData);\r
index 342d441f056bbcae16f931897548f6af134890e7..bdd02b4ecda0c312c070427cb0b5e9bb9e4c420b 100644 (file)
@@ -20,48 +20,27 @@ BootOptionStart (
   IN BDS_LOAD_OPTION *BootOption\r
   )\r
 {\r
-  EFI_STATUS                            Status;\r
-  UINT32                                LoaderType;\r
-  ARM_BDS_LOADER_OPTIONAL_DATA*         OptionalData;\r
-  UINT16                                LoadOptionIndexSize;\r
-\r
-  if (IS_ARM_BDS_BOOTENTRY (BootOption)) {\r
-    Status = EFI_UNSUPPORTED;\r
-    OptionalData = BootOption->OptionalData;\r
-    LoaderType = ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);\r
-\r
-    if (LoaderType == BDS_LOADER_EFI_APPLICATION) {\r
-      if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {\r
-        // Need to connect every drivers to ensure no dependencies are missing for the application\r
-        BdsConnectAllDrivers ();\r
-      }\r
+  EFI_STATUS Status;\r
+  UINT16     LoadOptionIndexSize;\r
 \r
-      Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, 0, NULL);\r
-    } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) {\r
-      ASSERT_EFI_ERROR (EFI_UNSUPPORTED);\r
-    } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {\r
-      ASSERT_EFI_ERROR (EFI_UNSUPPORTED);\r
-    }\r
-  } else {\r
-    // Connect all the drivers if the EFI Application is not a EFI OS Loader\r
-    if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {\r
-      BdsConnectAllDrivers ();\r
-    }\r
+  // Connect all the drivers if the EFI Application is not a EFI OS Loader\r
+  if ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_APP) {\r
+    BdsConnectAllDrivers ();\r
+  }\r
 \r
-    // Set BootCurrent variable\r
-    LoadOptionIndexSize = sizeof(UINT16);\r
-    gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
-              EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-              LoadOptionIndexSize, &(BootOption->LoadOptionIndex));\r
+  // Set BootCurrent variable\r
+  LoadOptionIndexSize = sizeof (UINT16);\r
+  gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+            EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+            LoadOptionIndexSize, &(BootOption->LoadOptionIndex));\r
 \r
-    Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
+  Status = BdsStartEfiApplication (gImageHandle, BootOption->FilePathList, BootOption->OptionalDataSize, BootOption->OptionalData);\r
 \r
-    // Clear BootCurrent variable\r
-    LoadOptionIndexSize = sizeof(UINT16);\r
-    gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
-              EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
-              0, NULL);\r
-  }\r
+  // Clear BootCurrent variable\r
+  LoadOptionIndexSize = sizeof (UINT16);\r
+  gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,\r
+            EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+            0, NULL);\r
 \r
   return Status;\r
 }\r
@@ -107,7 +86,6 @@ BootOptionSetFields (
   IN UINT32                     Attributes,\r
   IN CHAR16*                    BootDescription,\r
   IN EFI_DEVICE_PATH_PROTOCOL*  DevicePath,\r
-  IN ARM_BDS_LOADER_TYPE        BootType,\r
   IN UINT8*                     OptionalData,\r
   IN UINTN                      OptionalDataSize\r
   )\r
@@ -117,10 +95,6 @@ BootOptionSetFields (
   UINTN                         BootDescriptionSize;\r
   UINT16                        FilePathListLength;\r
   UINT8*                        EfiLoadOptionPtr;\r
-  UINT8*                        InitrdPathListPtr;\r
-  ARM_BDS_LINUX_ARGUMENTS*      DestLinuxArguments;\r
-  ARM_BDS_LINUX_ARGUMENTS*      SrcLinuxArguments;\r
-  ARM_BDS_LOADER_ARGUMENTS*     BootArguments;\r
 \r
   // If we are overwriting an existent Boot Option then we have to free previously allocated memory\r
   if (BootOption->LoadOption) {\r
@@ -129,11 +103,6 @@ BootOptionSetFields (
 \r
   BootDescriptionSize = StrSize (BootDescription);\r
 \r
-  // Fixup the size in case of entry specific to ArmPlatformPkg/Bds\r
-  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-    OptionalDataSize += sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);\r
-  }\r
-\r
   // Compute the size of the FilePath list\r
   FilePathListLength = GetUnalignedDevicePathSize (DevicePath);\r
 \r
@@ -169,33 +138,10 @@ BootOptionSetFields (
   // Optional Data fields, Do unaligned writes\r
   BootOption->OptionalData = EfiLoadOptionPtr;\r
 \r
-  if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
-    // Write the header\r
-    WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, ARM_BDS_OPTIONAL_DATA_SIGNATURE);\r
-    WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);\r
-\r
-    // OptionalData should have been initialized by the caller of this function\r
-    ASSERT (OptionalData != NULL);\r
-    BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;\r
-    SrcLinuxArguments = &(BootArguments->LinuxArguments);\r
-    DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;\r
-\r
-    WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);\r
-    WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);\r
-\r
-    if (SrcLinuxArguments->CmdLineSize > 0) {\r
-      CopyMem ((VOID*)(DestLinuxArguments + 1), (VOID*)(SrcLinuxArguments + 1), SrcLinuxArguments->CmdLineSize);\r
-    }\r
-\r
-    if (SrcLinuxArguments->InitrdSize > 0) {\r
-      InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);\r
-      CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);\r
-    }\r
-  } else {\r
-    if (OptionalData != NULL) {\r
-      CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);\r
-    }\r
+  if (OptionalData != NULL) {\r
+    CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);\r
   }\r
+\r
   BootOption->OptionalDataSize = OptionalDataSize;\r
 \r
   // If this function is called at the creation of the Boot Device entry (not at the update) the\r
@@ -216,7 +162,6 @@ BootOptionCreate (
   IN  UINT32                    Attributes,\r
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  ARM_BDS_LOADER_TYPE       BootType,\r
   IN  UINT8*                    OptionalData,\r
   IN  UINTN                     OptionalDataSize,\r
   OUT BDS_LOAD_OPTION**         BdsLoadOption\r
@@ -237,7 +182,7 @@ BootOptionCreate (
   BootOptionEntry->BdsLoadOption = (BDS_LOAD_OPTION*)AllocateZeroPool (sizeof(BDS_LOAD_OPTION));\r
 \r
   BootOption = BootOptionEntry->BdsLoadOption;\r
-  BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);\r
+  BootOptionSetFields (BootOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);\r
 \r
   //\r
   // Set the related environment variables\r
@@ -290,7 +235,6 @@ BootOptionUpdate (
   IN  UINT32                    Attributes,\r
   IN  CHAR16*                   BootDescription,\r
   IN  EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
-  IN  ARM_BDS_LOADER_TYPE       BootType,\r
   IN UINT8*                     OptionalData,\r
   IN UINTN                      OptionalDataSize\r
   )\r
@@ -299,7 +243,7 @@ BootOptionUpdate (
   CHAR16          BootVariableName[9];\r
 \r
   // Update the BDS Load Option structure\r
-  BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, BootType, OptionalData, OptionalDataSize);\r
+  BootOptionSetFields (BdsLoadOption, Attributes, BootDescription, DevicePath, OptionalData, OptionalDataSize);\r
 \r
   // Update the related environment variables\r
   UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BdsLoadOption->LoadOptionIndex);\r
index 974f220553a3f746934efb25de48f89b447b9703..f50f13f71dd23f0dc428d9aeed8ec4fdc193c6ec 100644 (file)
@@ -213,117 +213,6 @@ BootDeviceGetDeviceSupport (
   return EFI_UNSUPPORTED;\r
 }\r
 \r
-EFI_STATUS\r
-BootDeviceGetType (\r
-  IN  EFI_DEVICE_PATH* DevicePath,\r
-  OUT ARM_BDS_LOADER_TYPE *BootType,\r
-  OUT UINT32 *Attributes\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
-  BOOLEAN                 IsEfiApp;\r
-  BOOLEAN                 IsBootLoader;\r
-  BOOLEAN                 HasFDTSupport;\r
-  CHAR16*                 FileName;\r
-  EFI_DEVICE_PATH*        PrevDevicePathNode;\r
-  EFI_DEVICE_PATH*        DevicePathNode;\r
-  EFI_PHYSICAL_ADDRESS    Image;\r
-  UINTN                   FileSize;\r
-  EFI_IMAGE_DOS_HEADER*   DosHeader;\r
-  UINTN                   PeCoffHeaderOffset;\r
-  EFI_IMAGE_NT_HEADERS32* NtHeader;\r
-\r
-  //\r
-  // Check if the last node of the device path is a FilePath node\r
-  //\r
-  PrevDevicePathNode = NULL;\r
-  DevicePathNode = DevicePath;\r
-  while ((DevicePathNode != NULL) && !IsDevicePathEnd (DevicePathNode)) {\r
-    PrevDevicePathNode = DevicePathNode;\r
-    DevicePathNode = NextDevicePathNode (DevicePathNode);\r
-  }\r
-\r
-  if ((PrevDevicePathNode != NULL) &&\r
-      (PrevDevicePathNode->Type == MEDIA_DEVICE_PATH) &&\r
-      (PrevDevicePathNode->SubType == MEDIA_FILEPATH_DP))\r
-  {\r
-    FileName = ((FILEPATH_DEVICE_PATH*)PrevDevicePathNode)->PathName;\r
-  } else {\r
-    FileName = NULL;\r
-  }\r
-\r
-  if (FileName == NULL) {\r
-    Print(L"Is an EFI Application? ");\r
-    Status = GetHIInputBoolean (&IsEfiApp);\r
-    if (EFI_ERROR(Status)) {\r
-      return EFI_ABORTED;\r
-    }\r
-  } else if (HasFilePathEfiExtension(FileName)) {\r
-    IsEfiApp = TRUE;\r
-  } else {\r
-    // Check if the file exist\r
-    Status = BdsLoadImage (DevicePath, AllocateAnyPages, &Image, &FileSize);\r
-    if (!EFI_ERROR (Status)) {\r
-\r
-      DosHeader = (EFI_IMAGE_DOS_HEADER *)(UINTN) Image;\r
-      if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
-        //\r
-        // DOS image header is present,\r
-        // so read the PE header after the DOS image header.\r
-        //\r
-        PeCoffHeaderOffset = DosHeader->e_lfanew;\r
-      } else {\r
-        PeCoffHeaderOffset = 0;\r
-      }\r
-\r
-      //\r
-      // Check PE/COFF image.\r
-      //\r
-      NtHeader = (EFI_IMAGE_NT_HEADERS32 *)(UINTN) (Image + PeCoffHeaderOffset);\r
-      if (NtHeader->Signature != EFI_IMAGE_NT_SIGNATURE) {\r
-        IsEfiApp = FALSE;\r
-      } else {\r
-        IsEfiApp = TRUE;\r
-      }\r
-\r
-      // Free memory\r
-      gBS->FreePages (Image, EFI_SIZE_TO_PAGES(FileSize));\r
-    } else {\r
-      // If we did not manage to open it then ask for the type\r
-      Print(L"Is an EFI Application? ");\r
-      Status = GetHIInputBoolean (&IsEfiApp);\r
-      if (EFI_ERROR(Status)) {\r
-        return EFI_ABORTED;\r
-      }\r
-    }\r
-  }\r
-\r
-  if (IsEfiApp) {\r
-    Print(L"Is your application an OS loader? ");\r
-    Status = GetHIInputBoolean (&IsBootLoader);\r
-    if (EFI_ERROR(Status)) {\r
-      return EFI_ABORTED;\r
-    }\r
-    if (!IsBootLoader) {\r
-      *Attributes |= LOAD_OPTION_CATEGORY_APP;\r
-    }\r
-    *BootType = BDS_LOADER_EFI_APPLICATION;\r
-  } else {\r
-    Print(L"Has FDT support? ");\r
-    Status = GetHIInputBoolean (&HasFDTSupport);\r
-    if (EFI_ERROR(Status)) {\r
-      return EFI_ABORTED;\r
-    }\r
-    if (HasFDTSupport) {\r
-      *BootType = BDS_LOADER_KERNEL_LINUX_FDT;\r
-    } else {\r
-      *BootType = BDS_LOADER_KERNEL_LINUX_ATAG;\r
-    }\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 EFI_STATUS\r
 BdsLoadOptionFileSystemList (\r
   IN OUT LIST_ENTRY* BdsLoadOptionList\r