From: oliviermartin Date: Thu, 9 Feb 2012 15:25:40 +0000 (+0000) Subject: ArmPkg/BdsLib: Load initrd next to the Linux kernel to allow to reduce the memory... X-Git-Tag: edk2-stable201903~13657 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=4671d15d7a1a749999ee7f900a75d9644bd60a78 ArmPkg/BdsLib: Load initrd next to the Linux kernel to allow to reduce the memory from the Linux command line The initrd was loaded at the top of the UEFI System Memory. By consequence, if the system memory was reduced by the Linux command line then the initrd was not part of the system memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12994 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c index 5c24366e45..12a88623db 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c +++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c @@ -155,7 +155,12 @@ BdsBootLinuxAtag ( } if (InitrdDevicePath) { - Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize); + // Load the initrd near to the Linux kernel + InitrdImage = LINUX_KERNEL_MAX_OFFSET; + Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImage, &InitrdImageSize); + if (Status == EFI_OUT_OF_RESOURCES) { + Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize); + } if (EFI_ERROR(Status)) { Print (L"ERROR: Did not find initrd image.\n"); return Status; @@ -218,7 +223,11 @@ BdsBootLinuxFdt ( } if (InitrdDevicePath) { - Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize); + InitrdImage = LINUX_KERNEL_MAX_OFFSET; + Status = BdsLoadImage (InitrdDevicePath, AllocateMaxAddress, &InitrdImage, &InitrdImageSize); + if (Status == EFI_OUT_OF_RESOURCES) { + Status = BdsLoadImage (InitrdDevicePath, AllocateAnyPages, &InitrdImage, &InitrdImageSize); + } if (EFI_ERROR(Status)) { Print (L"ERROR: Did not find initrd image.\n"); return Status;