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 | |
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')
-rw-r--r-- | ArmPkg/Include/Library/BdsLib.h | 3 | ||||
-rw-r--r-- | ArmPkg/Include/Library/BdsUnixLib.h | 1 | ||||
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsInternal.h | 1 | ||||
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsLinuxLoader.c | 29 |
4 files changed, 30 insertions, 4 deletions
diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h index 75d01505fd..b7aa724925 100644 --- a/ArmPkg/Include/Library/BdsLib.h +++ b/ArmPkg/Include/Library/BdsLib.h @@ -62,7 +62,8 @@ BdsConnectAllDrivers ( EFI_STATUS
BdsBootLinux (
IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,
- IN CONST CHAR8* Arguments,
+ IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,
+ IN CONST CHAR8* Arguments,
IN EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath
);
diff --git a/ArmPkg/Include/Library/BdsUnixLib.h b/ArmPkg/Include/Library/BdsUnixLib.h index d5f5ffa202..24fc33a894 100644 --- a/ArmPkg/Include/Library/BdsUnixLib.h +++ b/ArmPkg/Include/Library/BdsUnixLib.h @@ -30,6 +30,7 @@ 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
);
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; |