* [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
@ 2009-01-25 11:54 Alexander Graf
2009-01-25 14:19 ` Edgar E. Iglesias
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Graf @ 2009-01-25 11:54 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien
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 <agraf@suse.de>
---
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);
if (kernel_size < 0)
kernel_size = load_aout(kernel_filename, kernel_base,
--
1.6.0.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
2009-01-25 11:54 [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR Alexander Graf
@ 2009-01-25 14:19 ` Edgar E. Iglesias
2009-01-25 14:22 ` Alexander Graf
0 siblings, 1 reply; 6+ messages in thread
From: Edgar E. Iglesias @ 2009-01-25 14:19 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel, aurelien
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 <agraf@suse.de>
> ---
> 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?
Maybe also a comment or two in the code explaining the hack.. :)
Cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
2009-01-25 14:19 ` Edgar E. Iglesias
@ 2009-01-25 14:22 ` Alexander Graf
2009-01-25 14:36 ` Edgar E. Iglesias
2009-01-26 10:22 ` Aurelien Jarno
0 siblings, 2 replies; 6+ messages in thread
From: Alexander Graf @ 2009-01-25 14:22 UTC (permalink / raw)
To: Edgar E. Iglesias; +Cc: qemu-devel, aurelien
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 <agraf@suse.de>
>> ---
>> 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.
Alex
>
>
> Cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
2009-01-25 14:22 ` Alexander Graf
@ 2009-01-25 14:36 ` Edgar E. Iglesias
2009-01-26 10:22 ` Aurelien Jarno
1 sibling, 0 replies; 6+ messages in thread
From: Edgar E. Iglesias @ 2009-01-25 14:36 UTC (permalink / raw)
To: Alexander Graf; +Cc: Edgar E. Iglesias, qemu-devel, aurelien
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 <agraf@suse.de>
>>> ---
>>> 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
> :-).
Yes, if it works :)
Cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
2009-01-25 14:22 ` Alexander Graf
2009-01-25 14:36 ` Edgar E. Iglesias
@ 2009-01-26 10:22 ` Aurelien Jarno
2009-01-26 10:28 ` Alexander Graf
1 sibling, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2009-01-26 10:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexander Graf, Edgar E. Iglesias
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 <agraf@suse.de>
>>> ---
>>> 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.
Aurelien
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR
2009-01-26 10:22 ` Aurelien Jarno
@ 2009-01-26 10:28 ` Alexander Graf
0 siblings, 0 replies; 6+ messages in thread
From: Alexander Graf @ 2009-01-26 10:28 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: qemu-devel, Edgar E. Iglesias
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 <agraf@suse.de>
>>>> ---
>>>> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-01-26 18:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-25 11:54 [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR Alexander Graf
2009-01-25 14:19 ` Edgar E. Iglesias
2009-01-25 14:22 ` Alexander Graf
2009-01-25 14:36 ` Edgar E. Iglesias
2009-01-26 10:22 ` Aurelien Jarno
2009-01-26 10:28 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).