diff options
Diffstat (limited to 'ArmPkg/Library/BdsLib')
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsInternal.h | 1 | ||||
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsLinuxLoader.c | 29 |
2 files changed, 27 insertions, 3 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsInternal.h b/ArmPkg/Library/BdsLib/BdsInternal.h index dd961c816b..af69049576 100644 --- a/ArmPkg/Library/BdsLib/BdsInternal.h +++ b/ArmPkg/Library/BdsLib/BdsInternal.h @@ -24,7 +24,6 @@ #include <Library/MemoryAllocationLib.h> #include <Library/DebugLib.h> #include <Library/BdsLib.h> -#include <Library/BdsUnixLib.h> #include <Library/PerformanceLib.h> #include <Guid/FileInfo.h> diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c index f463fd9a34..3c1f1346b7 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c +++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c @@ -110,6 +110,8 @@ STATIC EFI_STATUS PrepareAtagList ( IN CONST CHAR8* CommandLineString, + IN EFI_PHYSICAL_ADDRESS InitrdImage, + IN UINTN InitrdImageSize, OUT LINUX_ATAG **AtagBase, OUT UINT32 *AtagSize ) @@ -147,6 +149,17 @@ PrepareAtagList ( // CommandLine setting root device SetupCmdlineTag (CommandLineString); + if (InitrdImageSize > 0 && InitrdImage != 0) { + mLinuxKernelCurrentAtag->header.size = tag_size(LINUX_ATAG_INITRD2); + mLinuxKernelCurrentAtag->header.type = ATAG_INITRD2; + + mLinuxKernelCurrentAtag->body.initrd2_tag.start = (UINT32)InitrdImage; + mLinuxKernelCurrentAtag->body.initrd2_tag.size = (UINT32)InitrdImageSize; + + // Move pointer to next tag + mLinuxKernelCurrentAtag = next_tag_address(mLinuxKernelCurrentAtag); + } + // end of tags SetupEndTag(); @@ -194,18 +207,21 @@ PreparePlatformHardware ( EFI_STATUS BdsBootLinux ( IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath, + IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath, IN CONST CHAR8* Arguments, IN EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath ) { EFI_STATUS Status; UINT32 LinuxImageSize; + UINT32 InitrdImageSize; UINT32 KernelParamsSize; EFI_PHYSICAL_ADDRESS KernelParamsAddress; UINT32 MachineType; BOOLEAN FdtSupported = FALSE; LINUX_KERNEL LinuxKernel; - EFI_PHYSICAL_ADDRESS LinuxImage;; + EFI_PHYSICAL_ADDRESS LinuxImage; + EFI_PHYSICAL_ADDRESS InitrdImage; PERF_START (NULL, "BDS", NULL, 0); @@ -219,6 +235,15 @@ BdsBootLinux ( } LinuxKernel = (LINUX_KERNEL)(UINTN)LinuxImage; + if (InitrdDevicePath) { + InitrdImageSize = 0; + Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize); + if (EFI_ERROR(Status)) { + Print (L"ERROR: Did not find initrd image.\n"); + return Status; + } + } + if (FdtDevicePath) { // Load the FDT binary from a device path KernelParamsAddress = LINUX_ATAG_MAX_OFFSET; @@ -240,7 +265,7 @@ BdsBootLinux ( MachineType = PcdGet32(PcdArmMachineType); // By setting address=0 we leave the memory allocation to the function - Status = PrepareAtagList (Arguments, (LINUX_ATAG**)&KernelParamsAddress, &KernelParamsSize); + Status = PrepareAtagList (Arguments, InitrdImage, InitrdImageSize, (LINUX_ATAG**)&KernelParamsAddress, &KernelParamsSize); if(EFI_ERROR(Status)) { Print(L"ERROR: Can not prepare ATAG list. Status=0x%X\n", Status); goto Exit; |