Skip to contentSkip to conversation

Allow trying to boot from more than one device

PATCH In review Jeremy Katz 3 participants 4 messages Aug 9, 2006 – Aug 20, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow trying to boot from more than one device

The rombios supports trying to boot from more than one device and then falling back. The attached makes it so that we can take advantage of that in the device model. Just set 'boot=dc' in your config file to try booting first from the CD and then the hard drive.

Sent as an RFC to qemu-devel so that this can hopefully come in for free at some point. But it might be useful functionality to have before then.

Jeremy

tools/ioemu/hw/pc.c +34 -21
diff -r b60ea69932b1 tools/ioemu/hw/pc.c
@@ -158,8 +158,22 @@ static void cmos_init_hd(int type_ofs, i
     rtc_set_memory(s, info_ofs + 8, sectors);
 }
 
+static int get_bios_disk(int device) {
+    switch(device) {
+    case 'a':
+    case 'b':
+        return 0x01; /* floppy */
+    default:
+    case 'c':
+        return 0x02; /* hard drive */
+    case 'd':
+        return 0x03; /* cdrom */
+    }
+    return 0x02;
+}
+
 /* hd_table must contain 4 block drivers */
-static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table, time_t timeoffset)
+static void cmos_init(uint64_t ram_size, int boot_device[4], BlockDriverState **hd_table, time_t timeoffset)
 {
     RTCState *s = rtc_state;
     int val;
@@ -204,23 +218,22 @@ static void cmos_init(uint64_t ram_size,
         val = 65535;
     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[0] == 0) {
+        fprintf(stderr, "no boot device specified, using defaults\n"); 
+        /* default to floppy, then cd, then hd */
+        rtc_set_memory(s, 0x3d, 0x01 | (0x03 << 4));
+        rtc_set_memory(s, 0x38, 0x02 << 4);
+    } else {
+        if (boot_device[1] == 0) {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]));
+        } else {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]) | (get_bios_disk(boot_device[1]) << 4));
+            if (boot_device[2] != 0)
+                rtc_set_memory(s, 0x38, get_bios_disk(boot_device[2]) << 4);
+        }
+    }
+    
     /* floppy type */
 
     fd0 = fdctrl_get_drive_type(floppy_controller, 0);
@@ -620,7 +633,7 @@ static void pc_init_ne2k_isa(NICInfo *nd
 #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, int boot_device[4],
                      DisplayState *ds, const char **fd_filename, int snapshot,
                      const char *kernel_filename, const char *kernel_cmdline,
                      const char *initrd_filename, time_t timeoffset,
@@ -915,7 +928,7 @@ static void pc_init1(uint64_t ram_size, 
     }
 }
 
-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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
@@ -929,7 +942,7 @@ static void pc_init_pci(uint64_t ram_siz
              initrd_filename, timeoffset, 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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
tools/ioemu/vl.c +15 -10
diff -r b60ea69932b1 tools/ioemu/vl.c
@@ -124,7 +124,7 @@ int vncunused;
 int vncunused;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
-int boot_device = 'c';
+int boot_device[4];
 uint64_t ram_size;
 int pit_min_timer_count = 0;
 int nb_nics;
@@ -5823,6 +5823,7 @@ int main(int argc, char **argv)
     int start_emulation = 1;
     char net_clients[MAX_NET_CLIENTS][256];
     int nb_net_clients;
+    int nb_boot_devices;
     int optind;
     const char *r, *optarg;
     CharDriverState *monitor_hd;
@@ -6056,15 +6057,17 @@ int main(int argc, char **argv)
                 break;
 #endif /* !CONFIG_DM */
             case QEMU_OPTION_boot:
-                boot_device = optarg[0];
-                if (boot_device != 'a' && 
+                for (i = 0; optarg[i] && (nb_boot_devices < 4); i++) {
+                    if (optarg[i] != 'a' && 
 #ifdef TARGET_SPARC
-		    // Network boot
-		    boot_device != 'n' &&
-#endif
-                    boot_device != 'c' && boot_device != 'd') {
-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
-                    exit(1);
+                        // Network boot
+                        optarg[i] != 'n' &&
+#endif
+                        optarg[i] != 'c' && optarg[i] != 'd') {
+                        fprintf(stderr, "qemu: invalid boot device '%c'\n", optarg[0]);
+                        exit(1);
+                    }
+                    boot_device[nb_boot_devices++] = optarg[i];
                 }
                 break;
             case QEMU_OPTION_fda:
@@ -6326,7 +6329,8 @@ int main(int argc, char **argv)
         (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
         fd_filename[0] == '\0')
         help();
-    
+
+#if 0    
     /* boot to cd by default if no hard disk */
     if (hd_filename[0] == '\0' && boot_device == 'c') {
         if (fd_filename[0] != '\0')
@@ -6334,6 +6338,7 @@ int main(int argc, char **argv)
         else
             boot_device = 'd';
     }
+#endif
 #endif /* !CONFIG_DM */
 
     setvbuf(stdout, NULL, _IOLBF, 0);
tools/ioemu/vl.h +2 -2
diff -r b60ea69932b1 tools/ioemu/vl.h
@@ -574,7 +574,7 @@ int qcow_compress_cluster(BlockDriverSta
 #ifndef QEMU_TOOL
 
 typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
-                                 int boot_device,
+                                 int boot_device[4],
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename, time_t timeoffset);
@@ -1016,7 +1016,7 @@ void NVRAM_set_crc (m48t59_t *nvram, uin
                     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, int boot_device[4],
                           uint32_t kernel_image, uint32_t kernel_size,
                           const char *cmdline,
                           uint32_t initrd_image, uint32_t initrd_size,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 10 lines · Jeremy Katz

The rombios supports trying to boot from more than one device and then falling back. The attached makes it so that we can take advantage of that in the device model. Just set 'boot=dc' in your config file to try booting first from the CD and then the hard drive.

Sent as an RFC to qemu-devel so that this can hopefully come in for free at some point. But it might be useful functionality to have before then.

Anyone? Is this just completely bone-headed? :)

Jeremy

tools/ioemu/hw/pc.c +34 -21
diff -r b60ea69932b1 tools/ioemu/hw/pc.c
@@ -158,8 +158,22 @@ static void cmos_init_hd(int type_ofs, i
     rtc_set_memory(s, info_ofs + 8, sectors);
 }
 
+static int get_bios_disk(int device) {
+    switch(device) {
+    case 'a':
+    case 'b':
+        return 0x01; /* floppy */
+    default:
+    case 'c':
+        return 0x02; /* hard drive */
+    case 'd':
+        return 0x03; /* cdrom */
+    }
+    return 0x02;
+}
+
 /* hd_table must contain 4 block drivers */
-static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table, time_t timeoffset)
+static void cmos_init(uint64_t ram_size, int boot_device[4], BlockDriverState **hd_table, time_t timeoffset)
 {
     RTCState *s = rtc_state;
     int val;
@@ -204,23 +218,22 @@ static void cmos_init(uint64_t ram_size,
         val = 65535;
     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[0] == 0) {
+        fprintf(stderr, "no boot device specified, using defaults\n"); 
+        /* default to floppy, then cd, then hd */
+        rtc_set_memory(s, 0x3d, 0x01 | (0x03 << 4));
+        rtc_set_memory(s, 0x38, 0x02 << 4);
+    } else {
+        if (boot_device[1] == 0) {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]));
+        } else {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]) | (get_bios_disk(boot_device[1]) << 4));
+            if (boot_device[2] != 0)
+                rtc_set_memory(s, 0x38, get_bios_disk(boot_device[2]) << 4);
+        }
+    }
+    
     /* floppy type */
 
     fd0 = fdctrl_get_drive_type(floppy_controller, 0);
@@ -620,7 +633,7 @@ static void pc_init_ne2k_isa(NICInfo *nd
 #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, int boot_device[4],
                      DisplayState *ds, const char **fd_filename, int snapshot,
                      const char *kernel_filename, const char *kernel_cmdline,
                      const char *initrd_filename, time_t timeoffset,
@@ -915,7 +928,7 @@ static void pc_init1(uint64_t ram_size, 
     }
 }
 
-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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
@@ -929,7 +942,7 @@ static void pc_init_pci(uint64_t ram_siz
              initrd_filename, timeoffset, 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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
tools/ioemu/vl.c +15 -10
diff -r b60ea69932b1 tools/ioemu/vl.c
@@ -124,7 +124,7 @@ int vncunused;
 int vncunused;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
-int boot_device = 'c';
+int boot_device[4];
 uint64_t ram_size;
 int pit_min_timer_count = 0;
 int nb_nics;
@@ -5823,6 +5823,7 @@ int main(int argc, char **argv)
     int start_emulation = 1;
     char net_clients[MAX_NET_CLIENTS][256];
     int nb_net_clients;
+    int nb_boot_devices;
     int optind;
     const char *r, *optarg;
     CharDriverState *monitor_hd;
@@ -6056,15 +6057,17 @@ int main(int argc, char **argv)
                 break;
 #endif /* !CONFIG_DM */
             case QEMU_OPTION_boot:
-                boot_device = optarg[0];
-                if (boot_device != 'a' && 
+                for (i = 0; optarg[i] && (nb_boot_devices < 4); i++) {
+                    if (optarg[i] != 'a' && 
 #ifdef TARGET_SPARC
-		    // Network boot
-		    boot_device != 'n' &&
-#endif
-                    boot_device != 'c' && boot_device != 'd') {
-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
-                    exit(1);
+                        // Network boot
+                        optarg[i] != 'n' &&
+#endif
+                        optarg[i] != 'c' && optarg[i] != 'd') {
+                        fprintf(stderr, "qemu: invalid boot device '%c'\n", optarg[0]);
+                        exit(1);
+                    }
+                    boot_device[nb_boot_devices++] = optarg[i];
                 }
                 break;
             case QEMU_OPTION_fda:
@@ -6326,7 +6329,8 @@ int main(int argc, char **argv)
         (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
         fd_filename[0] == '\0')
         help();
-    
+
+#if 0    
     /* boot to cd by default if no hard disk */
     if (hd_filename[0] == '\0' && boot_device == 'c') {
         if (fd_filename[0] != '\0')
@@ -6334,6 +6338,7 @@ int main(int argc, char **argv)
         else
             boot_device = 'd';
     }
+#endif
 #endif /* !CONFIG_DM */
 
     setvbuf(stdout, NULL, _IOLBF, 0);
tools/ioemu/vl.h +2 -2
diff -r b60ea69932b1 tools/ioemu/vl.h
@@ -574,7 +574,7 @@ int qcow_compress_cluster(BlockDriverSta
 #ifndef QEMU_TOOL
 
 typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
-                                 int boot_device,
+                                 int boot_device[4],
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename, time_t timeoffset);
@@ -1016,7 +1016,7 @@ void NVRAM_set_crc (m48t59_t *nvram, uin
                     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, int boot_device[4],
                           uint32_t kernel_image, uint32_t kernel_size,
                           const char *cmdline,
                           uint32_t initrd_image, uint32_t initrd_size,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 6 lines · Rumor has it that on Mon, Aug 14, 2006 at 03:26:32PM -0400 Jeremy Katz said:
Quoted 5 lines · Jeremy Katz

The rombios supports trying to boot from more than one device and then falling back. The attached makes it so that we can take advantage of that in the device model. Just set 'boot=dc' in your config file to try booting first from the CD and then the hard drive.

Quoted 7 lines
Quoted 5 lines

Sent as an RFC to qemu-devel so that this can hopefully come in for free at some point. But it might be useful functionality to have before then.

Anyone? Is this just completely bone-headed? :)

I think it's a good idea. It makes it work more like a "standard" system.

fwiw,

Phil

Quoted 187 lines

Jeremy

diff -r b60ea69932b1 tools/ioemu/hw/pc.c

tools/ioemu/hw/pc.c +34 -21
@@ -158,8 +158,22 @@ static void cmos_init_hd(int type_ofs, i
     rtc_set_memory(s, info_ofs + 8, sectors);
 }
 
+static int get_bios_disk(int device) {
+    switch(device) {
+    case 'a':
+    case 'b':
+        return 0x01; /* floppy */
+    default:
+    case 'c':
+        return 0x02; /* hard drive */
+    case 'd':
+        return 0x03; /* cdrom */
+    }
+    return 0x02;
+}
+
 /* hd_table must contain 4 block drivers */
-static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table, time_t timeoffset)
+static void cmos_init(uint64_t ram_size, int boot_device[4], BlockDriverState **hd_table, time_t timeoffset)
 {
     RTCState *s = rtc_state;
     int val;
@@ -204,23 +218,22 @@ static void cmos_init(uint64_t ram_size,
         val = 65535;
     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[0] == 0) {
+        fprintf(stderr, "no boot device specified, using defaults\n"); 
+        /* default to floppy, then cd, then hd */
+        rtc_set_memory(s, 0x3d, 0x01 | (0x03 << 4));
+        rtc_set_memory(s, 0x38, 0x02 << 4);
+    } else {
+        if (boot_device[1] == 0) {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]));
+        } else {
+            rtc_set_memory(s, 0x3d, get_bios_disk(boot_device[0]) | (get_bios_disk(boot_device[1]) << 4));
+            if (boot_device[2] != 0)
+                rtc_set_memory(s, 0x38, get_bios_disk(boot_device[2]) << 4);
+        }
+    }
+    
     /* floppy type */
 
     fd0 = fdctrl_get_drive_type(floppy_controller, 0);
@@ -620,7 +633,7 @@ static void pc_init_ne2k_isa(NICInfo *nd
 #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, int boot_device[4],
                      DisplayState *ds, const char **fd_filename, int snapshot,
                      const char *kernel_filename, const char *kernel_cmdline,
                      const char *initrd_filename, time_t timeoffset,
@@ -915,7 +928,7 @@ static void pc_init1(uint64_t ram_size, 
     }
 }
 
-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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 
@@ -929,7 +942,7 @@ static void pc_init_pci(uint64_t ram_siz
              initrd_filename, timeoffset, 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, int boot_device[4],
                         DisplayState *ds, const char **fd_filename, 
                         int snapshot, 
                         const char *kernel_filename, 

diff -r b60ea69932b1 tools/ioemu/vl.c

tools/ioemu/vl.c +15 -10
@@ -124,7 +124,7 @@ int vncunused;
 int vncunused;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
-int boot_device = 'c';
+int boot_device[4];
 uint64_t ram_size;
 int pit_min_timer_count = 0;
 int nb_nics;
@@ -5823,6 +5823,7 @@ int main(int argc, char **argv)
     int start_emulation = 1;
     char net_clients[MAX_NET_CLIENTS][256];
     int nb_net_clients;
+    int nb_boot_devices;
     int optind;
     const char *r, *optarg;
     CharDriverState *monitor_hd;
@@ -6056,15 +6057,17 @@ int main(int argc, char **argv)
                 break;
 #endif /* !CONFIG_DM */
             case QEMU_OPTION_boot:
-                boot_device = optarg[0];
-                if (boot_device != 'a' && 
+                for (i = 0; optarg[i] && (nb_boot_devices < 4); i++) {
+                    if (optarg[i] != 'a' && 
 #ifdef TARGET_SPARC
-		    // Network boot
-		    boot_device != 'n' &&
-#endif
-                    boot_device != 'c' && boot_device != 'd') {
-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
-                    exit(1);
+                        // Network boot
+                        optarg[i] != 'n' &&
+#endif
+                        optarg[i] != 'c' && optarg[i] != 'd') {
+                        fprintf(stderr, "qemu: invalid boot device '%c'\n", optarg[0]);
+                        exit(1);
+                    }
+                    boot_device[nb_boot_devices++] = optarg[i];
                 }
                 break;
             case QEMU_OPTION_fda:
@@ -6326,7 +6329,8 @@ int main(int argc, char **argv)
         (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
         fd_filename[0] == '\0')
         help();
-    
+
+#if 0    
     /* boot to cd by default if no hard disk */
     if (hd_filename[0] == '\0' && boot_device == 'c') {
         if (fd_filename[0] != '\0')
@@ -6334,6 +6338,7 @@ int main(int argc, char **argv)
         else
             boot_device = 'd';
     }
+#endif
 #endif /* !CONFIG_DM */
 
     setvbuf(stdout, NULL, _IOLBF, 0);

diff -r b60ea69932b1 tools/ioemu/vl.h

tools/ioemu/vl.h +2 -2
@@ -574,7 +574,7 @@ int qcow_compress_cluster(BlockDriverSta
 #ifndef QEMU_TOOL
 
 typedef void QEMUMachineInitFunc(uint64_t ram_size, int vga_ram_size, 
-                                 int boot_device,
+                                 int boot_device[4],
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename, time_t timeoffset);
@@ -1016,7 +1016,7 @@ void NVRAM_set_crc (m48t59_t *nvram, uin
                     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, int boot_device[4],
                           uint32_t kernel_image, uint32_t kernel_size,
                           const char *cmdline,
                           uint32_t initrd_image, uint32_t initrd_size,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 3 lines
Philip R. Auld, Ph.D.  	        	       Egenera, Inc.    
Software Architect                            165 Forest St.
(508) 858-2628                            Marlboro, MA 01752
#3 lore raw
In reply to Jeremy Katz
Quoted 6 lines · Jeremy Katz
Quoted 5 lines · Jeremy Katz

The rombios supports trying to boot from more than one device and then falling back. The attached makes it so that we can take advantage of that in the device model. Just set 'boot=dc' in your config file to try booting first from the CD and then the hard drive.

Quoted 7 lines
Quoted 5 lines

Sent as an RFC to qemu-devel so that this can hopefully come in for free at some point. But it might be useful functionality to have before then.

Anyone? Is this just completely bone-headed? :)

No, it's ok. I've checked in the attached changes now.

christian

vl.c +10 -7
Index: ioemu/vl.c
===================================================================
@@ -124,7 +124,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;
@@ -6057,14 +6057,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, "acd"
 #ifdef TARGET_SPARC
-		    // Network boot
-		    boot_device != 'n' &&
+                           "n"
 #endif
-                    boot_device != 'c' && boot_device != 'd') {
-                    fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
+                        ) != strlen(boot_device)) {
+                    fprintf(stderr, "qemu: invalid boot device in '%s'\n",
+                            boot_device);
                     exit(1);
                 }
                 break;
@@ -6328,6 +6328,7 @@
         fd_filename[0] == '\0')
         help();
     
+#if 0
     /* boot to cd by default if no hard disk */
     if (hd_filename[0] == '\0' && boot_device == 'c') {
         if (fd_filename[0] != '\0')
@@ -6335,6 +6336,7 @@
         else
             boot_device = 'd';
     }
+#endif
 #endif /* !CONFIG_DM */
 
     setvbuf(stdout, NULL, _IOLBF, 0);
@@ -6593,6 +6595,7 @@
                   ds, fd_filename, snapshot,
                   kernel_filename, kernel_cmdline, initrd_filename,
                   timeoffset);
+    free(boot_device);
 
     /* init USB devices */
     if (usb_enabled) {
vl.h +2 -2
Index: ioemu/vl.h
===================================================================
@@ -575,7 +575,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, time_t timeoffset);
@@ -1020,7 +1020,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,
hw/pc.c +27 -19

77 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel