Skip to contentSkip to conversation

Fix -kernel on target-ppc

PATCH In review Alexander Graf 4 participants 13 messages Jan 24, 2009 – Jan 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix -kernel on target-ppc

OpenBIOS searches for the preloaded kernel at 0x1000000, so let's put it there instead of an invalid location.

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

---
 hw/ppc_oldworld.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/ppc_oldworld.c +1 -1
index 042a40f..0af2436 100644
@@ -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,
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 2 lines · Alexander Graf

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.

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.

Quoted 27 lines

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

---
 hw/ppc_oldworld.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/ppc_oldworld.c +1 -1
index 042a40f..0af2436 100644
@@ -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,
Signature · 1 line
1.6.0.2
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#2 lore raw
Quoted 4 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

OpenBIOS searches for the preloaded kernel at 0x1000000, so let's put it there instead of an invalid location.

Quoted 8 lines

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 :-).

Quoted 5 lines

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

Quoted 35 lines
Quoted 31 lines

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

---
hw/ppc_oldworld.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
hw/ppc_oldworld.c +1 -1
index 042a40f..0af2436 100644
@@ -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,

Signature · 1 line
1.6.0.2
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw
Quoted 27 lines · Alexander Graf
Quoted 8 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 5 lines

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 :-).

Quoted 5 lines

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?

Quoted 8 lines
            /* 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?

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#4 lore raw
Quoted 32 lines · Aurelien Jarno
Quoted 31 lines · Alexander Graf
Quoted 8 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 5 lines

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 :-).

Quoted 5 lines

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;
Quoted 8 lines
Quoted 4 lines
           cpu_physical_memory_write_rom(addr, data, mem_size);

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

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here. And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

Alex

Quoted 5 lines
Signature · 3 lines
-- 
Aurelien Jarno                            GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#12 lore raw
In reply to Aurelien Jarno
Quoted 18 lines
Quoted 18 lines
Quoted 8 lines

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);
Quoted 8 lines
Quoted 2 lines

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

Except that they can be more than one segment to load, so the last one
will overwrite the previous ones. The PowerPC kernels I have seen only
have one load segment, but I am not sure it is always the case.

The Haiku bootloader currently has both a text and data segment, but I suppose I can easily change the ldscript.
It's not exactly a kernel but it's what is supposed to be loaded because we have our own way to load modules and setup things.

I'd only need -kernel to ease testing anyway, I'd rather have OpenBIOS actually read the ISO/HFS image and dig the loader from there... The available commands seem a bit scarce.

François.

#5 lore raw
In reply to Alexander Graf
Quoted 49 lines · Alexander Graf
Quoted 43 lines · Aurelien Jarno
Quoted 41 lines · Alexander Graf
Quoted 10 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 6 lines

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 :-).

Quoted 7 lines

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?

Quoted 6 lines
Quoted 3 lines

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the elf header.

Quoted 3 lines

And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

As far as I understand it has been done like that to be able to support multiple segments. If the elf header says that the first segment has to be loaded at 0xc0000000 and the second at 0xd0000000, loading both at 0x10000000 won't work. Loading them with an offset of -0xb000000 will load the first one at 0x10000000 and the second one just after at 0x20000000.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#6 lore raw
Quoted 64 lines · Aurelien Jarno
Quoted 49 lines · Alexander Graf
Quoted 43 lines · Aurelien Jarno
Quoted 41 lines · Alexander Graf
Quoted 10 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 6 lines

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 :-).

Quoted 7 lines

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?

Quoted 6 lines
Quoted 3 lines

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the elf header.

Quoted 3 lines

And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

Quoted 6 lines

As far as I understand it has been done like that to be able to support multiple segments. If the elf header says that the first segment has to be loaded at 0xc0000000 and the second at 0xd0000000, loading both at 0x10000000 won't work. Loading them with an offset of -0xb000000 will load the first one at 0x10000000 and the second one just after at 0x20000000.

Aaah I'm starting to see the picture now :-). Sorry, I probably shouldn't do this on a weekend at night.

So at least for the Linux kernel case it would be enough to know which lowest address the kernel is loaded to, right? Because that's what we need to use as negative offset.

So if we call load_elf twice, once to get the lowest address the binary is loaded to (lowaddr) and the second one to actually load it, this should at least fix it for Linux without breaking multiple segment support, as long as the first segment is the text segment.

Am I getting this right?

Alex

#7 lore raw
Quoted 81 lines · Alexander Graf
Quoted 64 lines · Aurelien Jarno
Quoted 49 lines · Alexander Graf
Quoted 43 lines · Aurelien Jarno
Quoted 41 lines · Alexander Graf
Quoted 10 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 6 lines

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 :-).

Quoted 7 lines

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?

Quoted 6 lines
Quoted 3 lines

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the elf header.

Quoted 3 lines

And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

Quoted 6 lines

As far as I understand it has been done like that to be able to support multiple segments. If the elf header says that the first segment has to be loaded at 0xc0000000 and the second at 0xd0000000, loading both at 0x10000000 won't work. Loading them with an offset of -0xb000000 will load the first one at 0x10000000 and the second one just after at 0x20000000.

Aaah I'm starting to see the picture now :-). Sorry, I probably shouldn't do this on a weekend at night.

So at least for the Linux kernel case it would be enough to know which lowest address the kernel is loaded to, right? Because that's what we need to use as negative offset.

Quoted 6 lines

So if we call load_elf twice, once to get the lowest address the binary is loaded to (lowaddr) and the second one to actually load it, this should at least fix it for Linux without breaking multiple segment support, as long as the first segment is the text segment.

Am I getting this right?

I think so, that same kind of speculative loading is what I had in mind:
http://lists.gnu.org/archive/html/qemu-devel/2009-01/msg00438.html

Best regards

#8 lore raw
Quoted 87 lines · Edgar E. Iglesias
Quoted 86 lines · Alexander Graf
Quoted 64 lines · Aurelien Jarno
Quoted 49 lines · Alexander Graf
Quoted 43 lines · Aurelien Jarno
Quoted 41 lines · Alexander Graf
Quoted 10 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 6 lines

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 :-).

Quoted 7 lines

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?

Quoted 6 lines
Quoted 3 lines

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the elf header.

Quoted 3 lines

And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

Quoted 6 lines

As far as I understand it has been done like that to be able to support multiple segments. If the elf header says that the first segment has to be loaded at 0xc0000000 and the second at 0xd0000000, loading both at 0x10000000 won't work. Loading them with an offset of -0xb000000 will load the first one at 0x10000000 and the second one just after at 0x20000000.

Aaah I'm starting to see the picture now :-). Sorry, I probably shouldn't do this on a weekend at night.

So at least for the Linux kernel case it would be enough to know which lowest address the kernel is loaded to, right? Because that's what we need to use as negative offset.

So if we call load_elf twice, once to get the lowest address the binary is loaded to (lowaddr) and the second one to actually load it, this should at least fix it for Linux without breaking multiple segment support, as long as the first segment is the text segment.

Quoted 4 lines
Quoted 1 line

Am I getting this right?

I think so, that same kind of speculative loading is what I had in mind:
http://lists.gnu.org/archive/html/qemu-devel/2009-01/msg00438.html

Ah :-). Does anyone have an old and a Haiku kernel lying around he could point me to so I can write a small patch?

Also has anyone gotten console output from loaded kernels? For me the kernel switches consoles from udbg0 to .. eh ... something. And after that nothing gets displayed anymore. -append console=ttyS0 doesn't work either.

Btw - is cdrom booting supported yet?

Alex

#9 lore raw
Quoted 90 lines · Alexander Graf
Quoted 87 lines · Edgar E. Iglesias
Quoted 86 lines · Alexander Graf
Quoted 64 lines · Aurelien Jarno
Quoted 49 lines · Alexander Graf
Quoted 43 lines · Aurelien Jarno
Quoted 41 lines · Alexander Graf
Quoted 10 lines · Aurelien Jarno
Quoted 2 lines · Alexander Graf

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.

Quoted 6 lines

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 :-).

Quoted 7 lines

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?

Quoted 6 lines
Quoted 3 lines

Except that they can be more than one segment to load, so the last one will overwrite the previous ones. The PowerPC kernels I have seen only have one load segment, but I am not sure it is always the case.

But then the addr hack wouldn't work either, right? It's just a question if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the elf header.

Quoted 3 lines

And fwiw in this case relative to the elf header's value doesn't make any sense at all when the firmware expects the blob on a specific address.

Quoted 6 lines

As far as I understand it has been done like that to be able to support multiple segments. If the elf header says that the first segment has to be loaded at 0xc0000000 and the second at 0xd0000000, loading both at 0x10000000 won't work. Loading them with an offset of -0xb000000 will load the first one at 0x10000000 and the second one just after at 0x20000000.

Aaah I'm starting to see the picture now :-). Sorry, I probably shouldn't do this on a weekend at night.

So at least for the Linux kernel case it would be enough to know which lowest address the kernel is loaded to, right? Because that's what we need to use as negative offset.

So if we call load_elf twice, once to get the lowest address the binary is loaded to (lowaddr) and the second one to actually load it, this should at least fix it for Linux without breaking multiple segment support, as long as the first segment is the text segment.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Am I getting this right?

I think so, that same kind of speculative loading is what I had in mind:
http://lists.gnu.org/archive/html/qemu-devel/2009-01/msg00438.html

Ah :-). Does anyone have an old and a Haiku kernel lying around he could point me to so I can write a small patch?

Also has anyone gotten console output from loaded kernels? For me the kernel switches consoles from udbg0 to .. eh ... something. And after that nothing gets displayed anymore. -append console=ttyS0 doesn't work either.

Scratch that part. -append console=ttyS0 causes the console switching which doesn't work. Normal fb does seem fine.

Alex

#10 lore raw
Quoted 125 lines · Alexander Graf
Quoted 122 lines · Alexander Graf
Quoted 110 lines · Edgar E. Iglesias
Quoted 109 lines · Alexander Graf
Quoted 77 lines · Aurelien Jarno
Quoted 63 lines · Alexander Graf
Quoted 47 lines · Aurelien Jarno
Quoted 46 lines · Alexander Graf
Quoted 13 lines · Aurelien Jarno
Quoted 3 lines · Alexander Graf

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.

Quoted 8 lines

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 :-).

Quoted 9 lines

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);
Quoted 8 lines
Quoted 2 lines

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

Except that they can be more than one segment to load, so the last one
will overwrite the previous ones. The PowerPC kernels I have seen only
have one load segment, but I am not sure it is always the case.

Quoted 3 lines

But then the addr hack wouldn't work either, right? It's just a question
if addr_offset is relative or absolute here.

addr_offset is just an offset that is added to the load address of the
elf header.

Quoted 4 lines

And fwiw in this case relative to the elf header's value doesn't make
any sense at all when the firmware expects the blob on a specific address.

Quoted 10 lines

As far as I understand it has been done like that to be able to support
multiple segments. If the elf header says that the first segment has to
be loaded at 0xc0000000 and the second at 0xd0000000, loading both at
0x10000000 won't work. Loading them with an offset of -0xb000000 will
load the first one at 0x10000000 and the second one just after at 0x20000000.

Aaah I'm starting to see the picture now :-). Sorry, I probably shouldn't
do this on a weekend at night.

So at least for the Linux kernel case it would be enough to know which
lowest address the kernel is loaded to, right? Because that's what we need
to use as negative offset.

So if we call load_elf twice, once to get the lowest address the binary is
loaded to (lowaddr) and the second one to actually load it, this should at
least fix it for Linux without breaking multiple segment support, as long
as the first segment is the text segment.

Quoted 5 lines
Quoted 1 line

Am I getting this right?

I think so, that same kind of speculative loading is what I had in mind:
http://lists.gnu.org/archive/html/qemu-devel/2009-01/msg00438.html

Ah :-). Does anyone have an old and a Haiku kernel lying around he could point me to so I can write a small patch?

Quoted 8 lines
Quoted 4 lines

Also has anyone gotten console output from loaded kernels? For me the kernel switches consoles from udbg0 to .. eh ... something. And after that nothing gets displayed anymore. -append console=ttyS0 doesn't work either.

Scratch that part. -append console=ttyS0 causes the console switching which doesn't work. Normal fb does seem fine.

If you have a recent kernel, try ttyPZ0 instead.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net