]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Load initrd next to the Linux kernel to allow to reduce the memory...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:25:40 +0000 (15:25 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Feb 2012 15:25:40 +0000 (15:25 +0000)
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

ArmPkg/Library/BdsLib/BdsLinuxLoader.c

index 5c24366e455b9ef61a52eb27dbb248b6c45117ab..12a88623dbe31e15838168f3104b0d0faa2e9132 100644 (file)
@@ -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;