diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-18 13:21:14 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-08-18 13:21:14 +0000 |
commit | 656416bc2ee1409492343cde3f27ce717e90fdf7 (patch) | |
tree | 13b6a4458149cd6a4360afb4515b4a9c299d51e3 /ArmPkg/Library/BdsLib/BdsLinuxLoader.c | |
parent | 326d1df9193fae2be1cce85be9c361eb6eabe182 (diff) | |
download | edk2-platforms-656416bc2ee1409492343cde3f27ce717e90fdf7.tar.xz |
ArmPlatformPkg/Bds: Add Linux 'initrd' support to BDS
An 'initrd' file can be specified for a Linux kernel.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12169 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library/BdsLib/BdsLinuxLoader.c')
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsLinuxLoader.c | 29 |
1 files changed, 27 insertions, 2 deletions
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; |