--- vl.h 2007-02-05 21:20:30.000000000 +0100 +++ vl.h_2 2007-03-14 16:22:14.000000000 +0100 @@ -683,6 +683,9 @@ typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size, int boot_device, +#ifdef TARGET_I386 + int boot_device_2, +#endif DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename); --- vl.c 2007-02-05 21:46:05.000000000 +0100 +++ vl.c_2.c 2007-03-14 15:16:49.000000000 +0100 @@ -131,6 +131,7 @@ const char* keyboard_layout = NULL; int64_t ticks_per_sec; int boot_device = 'c'; +int boot_device_2 = 'd'; int ram_size; int pit_min_timer_count = 0; int nb_nics; @@ -6021,7 +6022,11 @@ "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n" "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" +#ifdef TARGET_I386 + "-boot d1(,d2) boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" +#else "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" +#endif "-snapshot write to temporary files instead of disk image files\n" #ifdef CONFIG_SDL "-no-quit disable SDL window close capability\n" @@ -6721,6 +6734,15 @@ break; case QEMU_OPTION_boot: boot_device = optarg[0]; +#ifdef TARGET_I386 + if (strlen(optarg) == 3) { //we have a second bootdevice + boot_device_2 = optarg[2]; + if (boot_device_2 != 'a' && boot_device_2 != 'c' && boot_device_2 != 'd') { + fprintf(stderr, "qemu: invalid second boot device '%c'\n", boot_device_2); + exit(1); + } + } +#endif if (boot_device != 'a' && #if defined(TARGET_SPARC) || defined(TARGET_I386) // Network boot @@ -7199,8 +7220,11 @@ qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i); } } - +#ifdef TARGET_I386 + machine->init(ram_size, vga_ram_size, boot_device, boot_device_2, +#else machine->init(ram_size, vga_ram_size, boot_device, +#endif ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, initrd_filename); --- hw/pc.c 2007-02-02 04:13:18.000000000 +0100 +++ hw/pc.c_2 2007-03-14 15:58:38.000000000 +0100 @@ -154,7 +154,7 @@ } /* hd_table must contain 4 block drivers */ -static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table) +static void cmos_init(int ram_size, int boot_device, int boot_device_2, BlockDriverState **hd_table) { RTCState *s = rtc_state; int val; @@ -185,19 +185,32 @@ rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x35, val >> 8); + int bd2_val; + switch(boot_device_2) { + case 'a': + bd2_val = 0x10; + break; + case 'c': + bd2_val = 0x20; + break; + case 'd': + bd2_val = 0x30; + break; + } + switch(boot_device) { case 'a': case 'b': - rtc_set_memory(s, 0x3d, 0x01); /* floppy boot */ + rtc_set_memory(s, 0x3d, bd2_val | 0x01); /* floppy boot */ if (!fd_bootchk) - rtc_set_memory(s, 0x38, 0x01); /* disable signature check */ + rtc_set_memory(s, 0x38, bd2_val | 0x01); /* disable signature check */ break; default: case 'c': - rtc_set_memory(s, 0x3d, 0x02); /* hard drive boot */ + rtc_set_memory(s, 0x3d, bd2_val | 0x02); /* hard drive boot */ break; case 'd': - rtc_set_memory(s, 0x3d, 0x03); /* CD-ROM boot */ + rtc_set_memory(s, 0x3d, bd2_val | 0x03); /* CD-ROM boot */ break; } @@ -443,7 +459,8 @@ } /* PC hardware initialisation */ -static void pc_init1(int ram_size, int vga_ram_size, int boot_device, +static void pc_init1(int ram_size, int vga_ram_size, + int boot_device, int boot_device_2, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, @@ -692,7 +709,7 @@ floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); - cmos_init(ram_size, boot_device, bs_table); + cmos_init(ram_size, boot_device, boot_device_2, bs_table); if (pci_enabled && usb_enabled) { usb_uhci_init(pci_bus, piix3_devfn + 2); @@ -730,27 +747,29 @@ #endif } -static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device, +static void pc_init_pci(int ram_size, int vga_ram_size, + int boot_device, int boot_device_2, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename) { - pc_init1(ram_size, vga_ram_size, boot_device, + pc_init1(ram_size, vga_ram_size, boot_device, boot_device_2, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, initrd_filename, 1); } -static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device, +static void pc_init_isa(int ram_size, int vga_ram_size, + int boot_device, int boot_device_2, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename) { - pc_init1(ram_size, vga_ram_size, boot_device, + pc_init1(ram_size, vga_ram_size, boot_device, boot_device_2, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, initrd_filename, 0);