Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LR5pr-0002wj-8x for qemu-devel@nongnu.org; Sun, 25 Jan 2009 09:19:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LR5pm-0002tI-DZ for qemu-devel@nongnu.org; Sun, 25 Jan 2009 09:19:38 -0500 Received: from [199.232.76.173] (port=54596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LR5pm-0002tD-AJ for qemu-devel@nongnu.org; Sun, 25 Jan 2009 09:19:34 -0500 Received: from bart.se.axis.com ([195.60.68.10]:43755) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LR5pl-0000zz-VH for qemu-devel@nongnu.org; Sun, 25 Jan 2009 09:19:34 -0500 Received: from bart.se.axis.com (bart.se.axis.com [127.0.0.1]) by bart.se.axis.com (Postfix) with ESMTP id 0663564090 for ; Sun, 25 Jan 2009 15:19:33 +0100 (CET) Received: from axis.com (edgar.se.axis.com [10.93.151.1]) by bart.se.axis.com (Postfix) with ESMTP id E214764079 for ; Sun, 25 Jan 2009 15:19:32 +0100 (CET) Date: Sun, 25 Jan 2009 15:19:32 +0100 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR Message-ID: <20090125141932.GB12918@edgar.se.axis.com> References: <1232884467-6136-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1232884467-6136-1-git-send-email-agraf@suse.de> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-devel@nongnu.org, aurelien@aurel32.net 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 > --- > 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