diff mbox

[17/48] add multi-sd support

Message ID f2a55403a3fce1585ae7138f9f3f049921cf77ea.1269617186.git.riku.voipio@nokia.com
State New
Headers show

Commit Message

Riku Voipio March 26, 2010, 4:06 p.m. UTC
From: Riku Voipio <riku.voipio@nokia.com>

N900 and other devices can have more than one sd/mmc card, and thus
the -sd command line option needs to be read multiple times.

Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>

---
 vl.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/vl.c b/vl.c
index d69250c..b4dfb2e 100644
--- a/vl.c
+++ b/vl.c
@@ -752,7 +752,7 @@  static int bt_parse(const char *opt)
 #define FD_ALIAS "index=%d,if=floppy"
 #define PFLASH_ALIAS "if=pflash"
 #define MTD_ALIAS "if=mtd"
-#define SD_ALIAS "index=0,if=sd"
+#define SD_ALIAS "index=%d,if=sd"
 
 QemuOpts *drive_add(const char *file, const char *fmt, ...)
 {
@@ -3738,6 +3738,7 @@  int main(int argc, char **argv, char **envp)
     CPUState *env;
     int show_vnc_port = 0;
     int defconfig = 1;
+    int sd_device_index = 0;
 
     error_set_progname(argv[0]);
 
@@ -3920,7 +3921,7 @@  int main(int argc, char **argv, char **envp)
                 drive_add(optarg, MTD_ALIAS);
                 break;
             case QEMU_OPTION_sd:
-                drive_add(optarg, SD_ALIAS);
+                drive_add(optarg, SD_ALIAS, sd_device_index++);
                 break;
             case QEMU_OPTION_pflash:
                 drive_add(optarg, PFLASH_ALIAS);
@@ -4762,7 +4763,7 @@  int main(int argc, char **argv, char **envp)
 
     if (default_sdcard) {
         /* we always create one sd slot, even if no card is in it */
-        drive_add(NULL, SD_ALIAS);
+        drive_add(NULL, SD_ALIAS, 0);
     }
 
     /* open the virtual block devices */