qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
Date: Mon, 26 Jan 2009 11:28:31 +0100


On 26.01.2009, at 11:22, Aurelien Jarno wrote:

On Sun, Jan 25, 2009 at 03:22:25PM +0100, Alexander Graf wrote:

On 25.01.2009, at 15:19, Edgar E. Iglesias wrote:

On Sun, Jan 25, 2009 at 12:54:27PM +0100, Alexander Graf wrote:
Linux changed its physical address location in the elf header from
0xc0000000 to 0 on 2.6.25, causing later kernels to fail booting
with the -kernel option.

This patch assures that the lowest segment in the elf binary is
loaded
to KERNEL_LOAD_ADDR, which is where the firmware expects it.

With this patch applied, I was able to successfully boot a 2.6.18 and
a 2.6.27 Linux kernel using the -kernel option.

Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppc_oldworld.c |    4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 042a40f..f64884b 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -207,9 +207,11 @@ static void ppc_heathrow_init (ram_addr_t
ram_size, int vga_ram_size,
   }

   if (linux_boot) {
+        uint64_t lowaddr = 0;
       kernel_base = KERNEL_LOAD_ADDR;
       /* now we can load the kernel */
-        kernel_size = load_elf(kernel_filename, kernel_base -
0xc0000000ULL,
+        load_elf(kernel_filename, 0, NULL, &lowaddr, NULL);
+        kernel_size = load_elf(kernel_filename, kernel_base -
lowaddr,
                              NULL, NULL, NULL);

Hello,

Can't you speculatively load at kernel_base assuming it's a new
kernel,
then only if lowaddr indicates it was an old kernel you do the second
load to fix things up?

Hm - so we only call load_elf once for new kernels? Sounds like a good
idea :-).

Maybe also a comment or two in the code explaining the hack.. :)

Right, that might be nice.


I have just committed a fix based on your patch and implementing that. I
also added a comment explaining the hack.

Heh - I literally started to look at the patch again about 2 seconds before your mail came in.

Thanks!

Alex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]