If the ARM BDS detected that there was an EFI stub on the kernel or application that was being booted, it forced the user to boot it as an EFI application and didn't give the user an option to boot it as an FDT or ATAGS kernel.
It was also very slow because it had to load the image from disk/wherever to check the image.
This patch removes that check and reverts to the original behaviour where the user is asked if it is an EFI application or not.
This patch is also needed to be able to boot via TFTP. The orginal code would download the file from the server and if it found the EFI header, it doesn't give the user the option to specify an initrd or FDT to load.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ryan Harkin ryan.harkin@linaro.org --- ArmPlatformPkg/Bds/BootLinux.c | 44 +++++------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-)
diff --git a/ArmPlatformPkg/Bds/BootLinux.c b/ArmPlatformPkg/Bds/BootLinux.c index 0445e89..82a23d4 100644 --- a/ArmPlatformPkg/Bds/BootLinux.c +++ b/ArmPlatformPkg/Bds/BootLinux.c @@ -47,11 +47,6 @@ IsEfiBinary ( 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);
@@ -83,40 +78,11 @@ IsEfiBinary ( } 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; - } + // 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; } }