The load_ramdisk function is used to load ramdisk featuring a U-Boot
header.

Signed-off-by: Soren Brinkmann <soren.brinkm...@xilinx.com>
---
v2:
 - try to load a u-boot ramdisk using the new load_ramdisk() function
   first. And then, in case of an error, fall back to the traditional
   way for loading a ramdisk. In order to keep ramdisk and kernel
   loading symmetrical.

 hw/arm/boot.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 7c0090f..a356b53 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -425,10 +425,16 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info 
*info)
     info->entry = entry;
     if (is_linux) {
         if (info->initrd_filename) {
-            initrd_size = load_image_targphys(info->initrd_filename,
-                                              info->initrd_start,
-                                              info->ram_size -
-                                              info->initrd_start);
+            initrd_size = load_ramdisk(info->initrd_filename,
+                                       info->initrd_start,
+                                       info->ram_size -
+                                       info->initrd_start);
+            if (initrd_size < 0) {
+                initrd_size = load_image_targphys(info->initrd_filename,
+                                                  info->initrd_start,
+                                                  info->ram_size -
+                                                  info->initrd_start);
+            }
             if (initrd_size < 0) {
                 fprintf(stderr, "qemu: could not load initrd '%s'\n",
                         info->initrd_filename);
-- 
1.8.3.2


Reply via email to