qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Fix -kernel on target-ppc


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] Fix -kernel on target-ppc
Date: Sat, 24 Jan 2009 22:57:19 +0100


On 24.01.2009, at 22:48, Aurelien Jarno wrote:

On Sat, Jan 24, 2009 at 09:58:35PM +0100, Alexander Graf wrote:
OpenBIOS searches for the preloaded kernel at 0x1000000, so let's
put it there instead of an invalid location.

Your patch is actually wrong, the second argument of load_elf() is an
offset to the physical address (as found in the elf header), and not a
load address.

By chance the physical address of a >= 2.6.25 kernel is 0x00000000, so
your patch works. But it will break supports for < 2.6.25 kernel as
their physical address is 0xc0000000. Not that they are only the default
values, they can be changed in the .config file.

Aah, that explains why :-).

I have already proposed a patch to use the virtual address of the elf
header as done by yaboot or quik, but I have been told it is actually
wrong.

We have to find another way to load the elf file at a fixed address.

Hm - can't we just give load_elf an override value for the base address?

            /* address_offset is hack for kernel images that are
               linked at the wrong physical address.  */
            addr = ph->p_paddr + address_offset;

            cpu_physical_memory_write_rom(addr, data, mem_size);

Just pass another variable here that overrides addr and doesn't calculate it?

Alex



Using this patch I was able to use -kernel for a current openSUSE
11.1 kernel.

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

diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 042a40f..0af2436 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -209,7 +209,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
    if (linux_boot) {
        kernel_base = KERNEL_LOAD_ADDR;
        /* now we can load the kernel */
- kernel_size = load_elf(kernel_filename, kernel_base - 0xc0000000ULL,
+        kernel_size = load_elf(kernel_filename, KERNEL_LOAD_ADDR,
                               NULL, NULL, NULL);
        if (kernel_size < 0)
            kernel_size = load_aout(kernel_filename, kernel_base,
--
1.6.0.2





--
Aurelien Jarno                          GPG: 1024D/F1BCDB73
address@hidden                 http://www.aurel32.net





reply via email to

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