From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRWdm-0005c6-Cj for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:56:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRWdk-0005b6-Mn for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:56:57 -0500 Received: from [199.232.76.173] (port=35957 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRWdk-0005b1-KH for qemu-devel@nongnu.org; Mon, 26 Jan 2009 13:56:56 -0500 Received: from mx20.gnu.org ([199.232.41.8]:51837) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRVGl-0004FM-7k for qemu-devel@nongnu.org; Mon, 26 Jan 2009 12:29:07 -0500 Received: from hall.aurel32.net ([88.191.82.174]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LROeo-0003MD-IJ for qemu-devel@nongnu.org; Mon, 26 Jan 2009 05:25:30 -0500 Date: Mon, 26 Jan 2009 11:22:09 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] Always load PowerPC kernel to KERNEL_LOAD_ADDR Message-ID: <20090126102209.GA21756@volta.aurel32.net> References: <1232884467-6136-1-git-send-email-agraf@suse.de> <20090125141932.GB12918@edgar.se.axis.com> <7D365503-8C3E-40DB-ACB3-F32E8CF2A9CC@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <7D365503-8C3E-40DB-ACB3-F32E8CF2A9CC@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: qemu-devel@nongnu.org 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 >>> --- >>> 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