From: Thorsten Zitterell <the.real.hik@gmx.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] hw/gumstix.c: Directly load a kernel
Date: Mon, 04 May 2009 17:44:55 +0200 [thread overview]
Message-ID: <49FF0D77.1060205@gmx.net> (raw)
[-- 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,
reply other threads:[~2009-05-04 15:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49FF0D77.1060205@gmx.net \
--to=the.real.hik@gmx.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).