From 4a5485922e9013e554b4a84214adaf10846d74c4 Mon Sep 17 00:00:00 2001 From: Ryan Harkin Date: Tue, 19 Nov 2013 09:21:20 -0600 Subject: ArmPlatformPkg/Bds: skip initrd if not found When loading a Linux image, if the initrd is not found, we will display an error, but attempt to load the kernel anyway. Previous behaviour dropped the user back to the menu, thus allowing them to update the config. However, this does not suit booting in automated environments where test images may or may not have an initrd. Example, Ubuntu and Android images require an initrd; OpenEmbedded images do not. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ryan Harkin Signed-off-by: Steven Kinney --- ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c index d0eb075c6..4805b40bc 100644 --- a/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c +++ b/ArmPkg/Library/BdsLib/Arm/BdsLinuxLoader.c @@ -258,19 +258,20 @@ BdsBootLinuxFdt ( Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImageBase, &InitrdImageBaseSize); } if (EFI_ERROR(Status)) { - Print (L"ERROR: Did not find initrd image.\n"); - goto EXIT_FREE_LINUX; - } - - // Check if the initrd is a uInitrd - if (*(UINT32*)((UINTN)InitrdImageBase) == LINUX_UIMAGE_SIGNATURE) { - // Skip the 64-byte image header - InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImageBase + 64); - InitrdImageSize = InitrdImageBaseSize - 64; - } else { - InitrdImage = InitrdImageBase; - InitrdImageSize = InitrdImageBaseSize; + Print (L"ERROR: Did not find initrd image, you may need to update your config. Attempting to continue without it.\n"); + InitrdImageBase = 0; } + else { + // Check if the initrd is a uInitrd + if (*(UINT32*)((UINTN)InitrdImageBase) == LINUX_UIMAGE_SIGNATURE) { + // Skip the 64-byte image header + InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImageBase + 64); + InitrdImageSize = InitrdImageBaseSize - 64; + } else { + InitrdImage = InitrdImageBase; + InitrdImageSize = InitrdImageBaseSize; + } + } } // Load the FDT binary from a device path. The FDT will be reloaded later to a more appropriate location for the Linux kernel. @@ -299,7 +300,6 @@ EXIT_FREE_INITRD: gBS->FreePages (InitrdImageBase, EFI_SIZE_TO_PAGES (InitrdImageBaseSize)); } -EXIT_FREE_LINUX: gBS->FreePages (LinuxImage, EFI_SIZE_TO_PAGES (LinuxImageSize)); return Status; -- cgit v1.2.3