qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: linux-mips@linux-mips.org
Subject: [Qemu-devel] [PATCH] QEMU: improvement of the initrd support for mips(el)
Date: Tue, 31 Oct 2006 21:23:09 +0100	[thread overview]
Message-ID: <20061031202309.GA16619@henry.aurel32.net> (raw)

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

Hi,

The attached patch improves the initrd support of the mips(el) platform
by passing the initrd size and location via the kernel command line. This
removes the need to pass them manually.

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian GNU/Linux developer | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

[-- Attachment #2: mips-qemu-initrd.patch --]
[-- Type: text/plain, Size: 1630 bytes --]

--- hw/mips_r4k.c.orig	2006-10-30 23:28:58.000000000 +0100
+++ hw/mips_r4k.c	2006-10-31 14:59:33.000000000 +0100
@@ -121,7 +121,7 @@
     unsigned long bios_offset;
     int ret;
     CPUState *env;
-    long kernel_size;
+    long kernel_size, initrd_size;
     int i;
 
     env = cpu_init();
@@ -163,10 +163,11 @@
 	}
 
         /* load initrd */
+        initrd_size = 0;
         if (initrd_filename) {
-            if (load_image(initrd_filename,
-			   phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND)
-		== (target_ulong) -1) {
+            initrd_size = load_image(initrd_filename,
+                                     phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND);
+            if (initrd_size == (target_ulong) -1) {
                 fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
                         initrd_filename);
                 exit(1);
@@ -174,7 +175,17 @@
         }
 
 	/* Store command line.  */
-        strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+        if (initrd_size > 0) {
+            ret = sprintf(phys_ram_base + (16 << 20) - 256, 
+                          "rd_start=0x%08x rd_size=%li ",
+                          INITRD_LOAD_ADDR,
+                          initrd_size);
+            strcpy (phys_ram_base + (16 << 20) - 256 + ret, kernel_cmdline);
+	}
+	else {
+            strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+	}
+
         /* FIXME: little endian support */
         *(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
         *(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);

                 reply	other threads:[~2006-11-02  7:41 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=20061031202309.GA16619@henry.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=linux-mips@linux-mips.org \
    --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).