Skip to contentSkip to conversation

PPC: Fix kernel loading

PATCH New Blue Swirl 1 participant 1 message Dec 23, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

PATCH 1/1 PPC: Fix kernel loading

Hi,

I found out why Linux loaded using -kernel does not work: it's loaded as a binary image! No wonder why it didn't work.

With this patch (applied after the previous three, current OpenBIOS) Linux executes until via_calibrate_decr, where it hangs.

hw/ppc_oldworld.c +9 -1
Index: qemu/hw/ppc_oldworld.c
===================================================================
@@ -207,7 +207,15 @@
     if (linux_boot) {
         kernel_base = KERNEL_LOAD_ADDR;
         /* now we can load the kernel */
-        kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base);
+        kernel_size = load_elf(kernel_filename, kernel_base - 0xc0000000ULL,
+                               NULL, NULL, NULL);
+        if (kernel_size < 0)
+            kernel_size = load_aout(kernel_filename, kernel_base,
+                                    ram_size - kernel_base);
+        if (kernel_size < 0)
+            kernel_size = load_image_targphys(kernel_filename,
+                                              kernel_base,
+                                              ram_size - kernel_base);
         if (kernel_size < 0) {
             cpu_abort(env, "qemu: could not load kernel '%s'\n",
                       kernel_filename);