From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M10Lp-0007Pa-LX for qemu-devel@nongnu.org; Mon, 04 May 2009 11:45:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M10Lk-0007Jh-II for qemu-devel@nongnu.org; Mon, 04 May 2009 11:45:04 -0400 Received: from [199.232.76.173] (port=59773 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M10Lk-0007Jb-BP for qemu-devel@nongnu.org; Mon, 04 May 2009 11:45:00 -0400 Received: from atlas.informatik.uni-freiburg.de ([132.230.150.3]:61427) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M10Lj-0004B8-SX for qemu-devel@nongnu.org; Mon, 04 May 2009 11:45:00 -0400 Received: from mafia.informatik.uni-freiburg.de ([132.230.150.87]) by atlas.informatik.uni-freiburg.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1M10Lg-0006VC-EN for qemu-devel@nongnu.org; Mon, 04 May 2009 17:44:56 +0200 Message-ID: <49FF0D77.1060205@gmx.net> Date: Mon, 04 May 2009 17:44:55 +0200 From: Thorsten Zitterell MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060000000104090208000601" Subject: [Qemu-devel] [PATCH] hw/gumstix.c: Directly load a kernel List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------060000000104090208000601 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Previously, a Gumstix connex can only be booted if a flash image is provided. This patch allows to * specify a flash image with -pflash (as before) * and/or provide a raw kernel image loaded to 0xa0000000 or elf kernel image -- Thorsten --------------060000000104090208000601 Content-Type: text/x-diff; name="qemu_gumstix_kernel_load.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu_gumstix_kernel_load.patch" diff --git a/hw/gumstix.c b/hw/gumstix.c index cce86fb..af69145 100644 --- a/hw/gumstix.c +++ b/hw/gumstix.c @@ -48,6 +48,8 @@ static void connex_init(ram_addr_t ram_size, int vga_ram_size, { struct pxa2xx_state_s *cpu; int index; + uint64_t entry; + int kernel_size; uint32_t connex_rom = 0x01000000; uint32_t connex_ram = 0x04000000; @@ -55,20 +57,37 @@ static void connex_init(ram_addr_t ram_size, int vga_ram_size, cpu = pxa255_init(connex_ram); index = drive_get_index(IF_PFLASH, 0, 0); - if (index == -1) { - fprintf(stderr, "A flash image must be given with the " - "'pflash' parameter\n"); + + if ((index == -1) && (kernel_filename == NULL)) { + fprintf(stderr, "Give a flash image with the 'pflash' parameter\n"); + fprintf(stderr, "or/and a kernel image with the 'kernel' parameter\n"); exit(1); } - if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), + if (index != -1) { + if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), drives_table[index].bdrv, sector_len, connex_rom / sector_len, - 2, 0, 0, 0, 0)) { - fprintf(stderr, "qemu: Error registering flash memory.\n"); - exit(1); + 2, 0, 0, 0, 0)) { + fprintf(stderr, "qemu: Error registering flash memory.\n"); + exit(1); + } + cpu->env->regs[15] = 0x00000000; } - cpu->env->regs[15] = 0x00000000; + if (kernel_filename) { + kernel_size = load_elf(kernel_filename, 0, &entry, NULL, NULL); + if (kernel_size < 0) { + kernel_size = load_image_targphys(kernel_filename, + PXA2XX_SDRAM_BASE, connex_ram); + cpu->env->regs[15] = PXA2XX_SDRAM_BASE; + } else { + cpu->env->regs[15] = entry; + } + if (kernel_size < 0) { + fprintf(stderr, "qemu: Error loading kernel.\n"); + exit(1); + } + } /* Interrupt line of NIC is connected to GPIO line 36 */ smc91c111_init(&nd_table[0], 0x04000300, --------------060000000104090208000601--