]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/BdsLib: Added support for using uInitrd
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 24 Feb 2012 16:11:51 +0000 (16:11 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 24 Feb 2012 16:11:51 +0000 (16:11 +0000)
Detect if there is a u-boot header on the initrd (by checking the
signature) and skip it.

Signed-off-by: ryan.harkin@linaro.org
Reviewed-by: oliviermartin
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13031 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/BdsLib/BdsLinuxLoader.c

index d2e0effb35f275147a6903027bec7ed49cc325b5..6cd49a2fca825a0c930020979a66a4e5d903602f 100644 (file)
@@ -166,6 +166,13 @@ BdsBootLinuxAtag (
       Print (L"ERROR: Did not find initrd image.\n");
       return Status;
     }
+    
+    // Check if the initrd is a uInitrd
+    if (*(UINT32*)((UINTN)InitrdImage) == LINUX_UIMAGE_SIGNATURE) {
+      // Skip the 64-byte image header
+      InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImage + 64);
+      InitrdImageSize -= 64;
+    }
   }
 
   //
@@ -233,6 +240,13 @@ BdsBootLinuxFdt (
       Print (L"ERROR: Did not find initrd image.\n");
       return Status;
     }
+
+    // Check if the initrd is a uInitrd
+    if (*(UINT32*)((UINTN)InitrdImage) == LINUX_UIMAGE_SIGNATURE) {
+      // Skip the 64-byte image header
+      InitrdImage = (EFI_PHYSICAL_ADDRESS)((UINTN)InitrdImage + 64);
+      InitrdImageSize -= 64;
+    }
   }
 
   // Load the FDT binary from a device path