Index: ioemu/vl.c
===================================================================
--- ioemu.orig/vl.c	2007-05-10 15:34:25.000000000 +0100
+++ ioemu/vl.c	2007-05-10 15:35:16.000000000 +0100
@@ -135,7 +135,7 @@
 int vncunused;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
-int boot_device = 'c';
+char *boot_device = NULL;
 uint64_t ram_size;
 int pit_min_timer_count = 0;
 int nb_nics;
@@ -7051,14 +7051,14 @@
                 break;
 #endif /* !CONFIG_DM */
             case QEMU_OPTION_boot:
-                boot_device = optarg[0];
-                if (boot_device != 'a' && 
+                boot_device = strdup(optarg);
+                if (strspn(boot_device, "a"
 #if defined(TARGET_SPARC) || defined(TARGET_I386)
 		    // Network boot
-		    boot_device != 'n' &&
+		    "n"
 #endif
-                    boot_device != 'c' && boot_device != 'd') {
-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
+		    "cd") != strlen(boot_device)) {
+                    fprintf(stderr, "qemu: invalid boot device in '%s'\n", boot_device);
                     exit(1);
                 }
                 break;
@@ -7419,6 +7419,7 @@
             exit(1);
     }
 
+#ifndef CONFIG_DM
 #ifdef TARGET_I386
     if (boot_device == 'n') {
 	for (i = 0; i < nb_nics; i++) {
@@ -7440,6 +7441,7 @@
 	boot_device = 'c'; /* to prevent confusion by the BIOS */
     }
 #endif
+#endif /* !CONFIG_DM */
 
 #if defined (__ia64__)
     if (ram_size > MMIO_START)
@@ -7449,6 +7451,7 @@
     /* init the memory */
     phys_ram_size = ram_size + vga_ram_size + bios_size;
 
+#ifndef CONFIG_DM
     for (i = 0; i < nb_option_roms; i++) {
 	int ret = get_image_size(option_rom[i]);
 	if (ret == -1) {
@@ -7457,6 +7460,7 @@
 	}
 	phys_ram_size += ret;
     }
+#endif /* !CONFIG_DM */
 
 #ifdef CONFIG_DM
 
@@ -7686,6 +7690,7 @@
     machine->init(ram_size, vga_ram_size, boot_device,
                   ds, fd_filename, snapshot,
                   kernel_filename, kernel_cmdline, initrd_filename);
+    free(boot_device);
 
     /* init USB devices */
     if (usb_enabled) {
Index: ioemu/vl.h
===================================================================
--- ioemu.orig/vl.h	2007-05-10 15:34:25.000000000 +0100
+++ ioemu/vl.h	2007-05-10 15:34:28.000000000 +0100
@@ -703,7 +703,7 @@
 #ifndef QEMU_TOOL
 
 typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
-                                 int boot_device,
+                                 char *boot_device,
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename);
@@ -1217,7 +1217,7 @@
                     uint32_t start, uint32_t count);
 int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
                           const unsigned char *arch,
-                          uint32_t RAM_size, int boot_device,
+                          uint32_t RAM_size, char *boot_device,
                           uint32_t kernel_image, uint32_t kernel_size,
                           const char *cmdline,
                           uint32_t initrd_image, uint32_t initrd_size,
Index: ioemu/hw/pc.c
===================================================================
--- ioemu.orig/hw/pc.c	2007-05-10 15:34:25.000000000 +0100
+++ ioemu/hw/pc.c	2007-05-10 15:34:59.000000000 +0100
@@ -159,8 +159,25 @@
     rtc_set_memory(s, info_ofs + 8, sectors);
 }
 
+static int get_bios_disk(char *boot_device, int index) {
+
+    if (index < strlen(boot_device)) {
+        switch (boot_device[index]) {
+        case 'a':
+            return 0x01;            /* floppy */
+        case 'c':
+            return 0x02;            /* hard drive */
+        case 'd':
+            return 0x03;            /* cdrom */
+        case 'n':
+            return 0x04;            /* network */
+        }
+    }
+    return 0x00;                /* no device */
+}
+
 /* hd_table must contain 4 block drivers */
-static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table)
+static void cmos_init(uint64_t ram_size, char *boot_device, BlockDriverState **hd_table)
 {
     RTCState *s = rtc_state;
     int val;
@@ -191,21 +208,14 @@
     rtc_set_memory(s, 0x34, val);
     rtc_set_memory(s, 0x35, val >> 8);
     
-    switch(boot_device) {
-    case 'a':
-    case 'b':
-        rtc_set_memory(s, 0x3d, 0x01); /* floppy boot */
-        if (!fd_bootchk)
-            rtc_set_memory(s, 0x38, 0x01); /* disable signature check */
-        break;
-    default:
-    case 'c':
-        rtc_set_memory(s, 0x3d, 0x02); /* hard drive boot */
-        break;
-    case 'd':
-        rtc_set_memory(s, 0x3d, 0x03); /* CD-ROM boot */
-        break;
-    }
+    if (boot_device == NULL) {
+        /* default to hd, then cd, then floppy. */
+        boot_device = "cda";
+    }
+    rtc_set_memory(s, 0x3d, get_bios_disk(boot_device, 0) |
+                   (get_bios_disk(boot_device, 1) << 4));
+    rtc_set_memory(s, 0x38, (get_bios_disk(boot_device, 2) << 4) |
+                   (!fd_bootchk ? 0x01 : 0x00));
 
     /* floppy type */
 
@@ -451,7 +461,7 @@
 #define NOBIOS 1
 
 /* PC hardware initialisation */
-static void pc_init1(uint64_t ram_size, int vga_ram_size, int boot_device,
+static void pc_init1(uint64_t ram_size, int vga_ram_size, char *boot_device,
                      DisplayState *ds, const char **fd_filename, int snapshot,
                      const char *kernel_filename, const char *kernel_cmdline,
                      const char *initrd_filename,
@@ -772,7 +782,7 @@
 #endif
 }
 
-static void pc_init_pci(uint64_t ram_size, int vga_ram_size, int boot_device,
+static void pc_init_pci(uint64_t ram_size, int vga_ram_size, char *boot_device,
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
@@ -785,7 +795,7 @@
              initrd_filename, 1);
 }
 
-static void pc_init_isa(uint64_t ram_size, int vga_ram_size, int boot_device,
+static void pc_init_isa(uint64_t ram_size, int vga_ram_size, char *boot_device,
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
