qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/gumstix.c: Directly load a kernel
@ 2009-05-04 15:44 Thorsten Zitterell
  0 siblings, 0 replies; only message in thread
From: Thorsten Zitterell @ 2009-05-04 15:44 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]

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





[-- Attachment #2: qemu_gumstix_kernel_load.patch --]
[-- Type: text/x-diff, Size: 2151 bytes --]

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,





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-04 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04 15:44 [Qemu-devel] [PATCH] hw/gumstix.c: Directly load a kernel Thorsten Zitterell

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