Commit 6ac0e82da197d42b84f6ac5509fa22f90cb357be

Authored by balrog
1 parent 926c2d23

Set boot sequence from command line (Dan Kenigsberg).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3497 c046a42c-6fe2-441c-8c8c-71466251a162
hw/an5206.c
... ... @@ -27,7 +27,7 @@ void DMA_run (void)
27 27  
28 28 /* Board init. */
29 29  
30   -static void an5206_init(int ram_size, int vga_ram_size, int boot_device,
  30 +static void an5206_init(int ram_size, int vga_ram_size, const char *boot_device,
31 31 DisplayState *ds, const char **fd_filename, int snapshot,
32 32 const char *kernel_filename, const char *kernel_cmdline,
33 33 const char *initrd_filename, const char *cpu_model)
... ...
hw/etraxfs.c
... ... @@ -107,7 +107,7 @@ static void dummy_cpu_set_irq(void *opaque, int irq, int level)
107 107 }
108 108  
109 109 static
110   -void bareetraxfs_init (int ram_size, int vga_ram_size, int boot_device,
  110 +void bareetraxfs_init (int ram_size, int vga_ram_size, const char *boot_device,
111 111 DisplayState *ds, const char **fd_filename, int snapshot,
112 112 const char *kernel_filename, const char *kernel_cmdline,
113 113 const char *initrd_filename, const char *cpu_model)
... ...
hw/integratorcp.c
... ... @@ -462,8 +462,9 @@ static void icp_control_init(uint32_t base)
462 462  
463 463 /* Board init. */
464 464  
465   -static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
466   - DisplayState *ds, const char **fd_filename, int snapshot,
  465 +static void integratorcp_init(int ram_size, int vga_ram_size,
  466 + const char *boot_device, DisplayState *ds,
  467 + const char **fd_filename, int snapshot,
467 468 const char *kernel_filename, const char *kernel_cmdline,
468 469 const char *initrd_filename, const char *cpu_model)
469 470 {
... ...
hw/mcf5208.c
... ... @@ -197,8 +197,9 @@ static void mcf5208_sys_init(qemu_irq *pic)
197 197 }
198 198 }
199 199  
200   -static void mcf5208evb_init(int ram_size, int vga_ram_size, int boot_device,
201   - DisplayState *ds, const char **fd_filename, int snapshot,
  200 +static void mcf5208evb_init(int ram_size, int vga_ram_size,
  201 + const char *boot_device, DisplayState *ds,
  202 + const char **fd_filename, int snapshot,
202 203 const char *kernel_filename, const char *kernel_cmdline,
203 204 const char *initrd_filename, const char *cpu_model)
204 205 {
... ...
hw/mips_malta.c
... ... @@ -740,7 +740,7 @@ static void main_cpu_reset(void *opaque)
740 740 }
741 741  
742 742 static
743   -void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
  743 +void mips_malta_init (int ram_size, int vga_ram_size, const char *boot_device,
744 744 DisplayState *ds, const char **fd_filename, int snapshot,
745 745 const char *kernel_filename, const char *kernel_cmdline,
746 746 const char *initrd_filename, const char *cpu_model)
... ...
hw/mips_mipssim.c
... ... @@ -74,7 +74,7 @@ static void main_cpu_reset(void *opaque)
74 74 }
75 75  
76 76 static void
77   -mips_mipssim_init (int ram_size, int vga_ram_size, int boot_device,
  77 +mips_mipssim_init (int ram_size, int vga_ram_size, const char *boot_device,
78 78 DisplayState *ds, const char **fd_filename, int snapshot,
79 79 const char *kernel_filename, const char *kernel_cmdline,
80 80 const char *initrd_filename, const char *cpu_model)
... ...
hw/mips_pica61.c
... ... @@ -55,7 +55,7 @@ static void main_cpu_reset(void *opaque)
55 55 }
56 56  
57 57 static
58   -void mips_pica61_init (int ram_size, int vga_ram_size, int boot_device,
  58 +void mips_pica61_init (int ram_size, int vga_ram_size, const char *boot_device,
59 59 DisplayState *ds, const char **fd_filename, int snapshot,
60 60 const char *kernel_filename, const char *kernel_cmdline,
61 61 const char *initrd_filename, const char *cpu_model)
... ...
hw/mips_r4k.c
... ... @@ -137,7 +137,7 @@ static void main_cpu_reset(void *opaque)
137 137 }
138 138  
139 139 static
140   -void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
  140 +void mips_r4k_init (int ram_size, int vga_ram_size, const char *boot_device,
141 141 DisplayState *ds, const char **fd_filename, int snapshot,
142 142 const char *kernel_filename, const char *kernel_cmdline,
143 143 const char *initrd_filename, const char *cpu_model)
... ...
hw/palm.c
... ... @@ -115,8 +115,9 @@ static void palmte_button_event(void *opaque, int keycode)
115 115 !(keycode & 0x80));
116 116 }
117 117  
118   -static void palmte_init(int ram_size, int vga_ram_size, int boot_device,
119   - DisplayState *ds, const char **fd_filename, int snapshot,
  118 +static void palmte_init(int ram_size, int vga_ram_size,
  119 + const char *boot_device, DisplayState *ds,
  120 + const char **fd_filename, int snapshot,
120 121 const char *kernel_filename, const char *kernel_cmdline,
121 122 const char *initrd_filename, const char *cpu_model)
122 123 {
... ...
... ... @@ -152,8 +152,25 @@ static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd)
152 152 rtc_set_memory(s, info_ofs + 8, sectors);
153 153 }
154 154  
  155 +/* convert boot_device letter to something recognizable by the bios */
  156 +static int boot_device2nibble(char boot_device)
  157 +{
  158 + switch(boot_device) {
  159 + case 'a':
  160 + case 'b':
  161 + return 0x01; /* floppy boot */
  162 + case 'c':
  163 + return 0x02; /* hard drive boot */
  164 + case 'd':
  165 + return 0x03; /* CD-ROM boot */
  166 + case 'n':
  167 + return 0x04; /* Network boot */
  168 + }
  169 + return 0;
  170 +}
  171 +
155 172 /* hd_table must contain 4 block drivers */
156   -static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table)
  173 +static void cmos_init(int ram_size, const char *boot_device, BlockDriverState **hd_table)
157 174 {
158 175 RTCState *s = rtc_state;
159 176 int val;
... ... @@ -184,24 +201,12 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
184 201 rtc_set_memory(s, 0x34, val);
185 202 rtc_set_memory(s, 0x35, val >> 8);
186 203  
187   - switch(boot_device) {
188   - case 'a':
189   - case 'b':
190   - rtc_set_memory(s, 0x3d, 0x01); /* floppy boot */
191   - if (!fd_bootchk)
192   - rtc_set_memory(s, 0x38, 0x01); /* disable signature check */
193   - break;
194   - default:
195   - case 'c':
196   - rtc_set_memory(s, 0x3d, 0x02); /* hard drive boot */
197   - break;
198   - case 'd':
199   - rtc_set_memory(s, 0x3d, 0x03); /* CD-ROM boot */
200   - break;
201   - case 'n':
202   - rtc_set_memory(s, 0x3d, 0x04); /* Network boot */
203   - break;
204   - }
  204 + /* set boot devices, and disable floppy signature check if requested */
  205 + rtc_set_memory(s, 0x3d,
  206 + boot_device2nibble(boot_device[1]) << 4 |
  207 + boot_device2nibble(boot_device[0]) );
  208 + rtc_set_memory(s, 0x38,
  209 + boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1));
205 210  
206 211 /* floppy type */
207 212  
... ... @@ -663,7 +668,7 @@ static void pc_init_ne2k_isa(NICInfo *nd, qemu_irq *pic)
663 668 }
664 669  
665 670 /* PC hardware initialisation */
666   -static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
  671 +static void pc_init1(int ram_size, int vga_ram_size, const char *boot_device,
667 672 DisplayState *ds, const char **fd_filename, int snapshot,
668 673 const char *kernel_filename, const char *kernel_cmdline,
669 674 const char *initrd_filename,
... ... @@ -940,7 +945,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
940 945 #endif
941 946 }
942 947  
943   -static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
  948 +static void pc_init_pci(int ram_size, int vga_ram_size, const char *boot_device,
944 949 DisplayState *ds, const char **fd_filename,
945 950 int snapshot,
946 951 const char *kernel_filename,
... ... @@ -954,7 +959,7 @@ static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
954 959 initrd_filename, 1);
955 960 }
956 961  
957   -static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device,
  962 +static void pc_init_isa(int ram_size, int vga_ram_size, const char *boot_device,
958 963 DisplayState *ds, const char **fd_filename,
959 964 int snapshot,
960 965 const char *kernel_filename,
... ...
hw/ppc405_boards.c
... ... @@ -171,9 +171,9 @@ static void ref405ep_fpga_init (uint32_t base)
171 171 }
172 172 }
173 173  
174   -static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
175   - DisplayState *ds, const char **fd_filename,
176   - int snapshot,
  174 +static void ref405ep_init (int ram_size, int vga_ram_size,
  175 + const char *boot_device, DisplayState *ds,
  176 + const char **fd_filename, int snapshot,
177 177 const char *kernel_filename,
178 178 const char *kernel_cmdline,
179 179 const char *initrd_filename,
... ... @@ -191,6 +191,7 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
191 191 target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
192 192 int linux_boot;
193 193 int fl_idx, fl_sectors, len;
  194 + int ppc_boot_device = boot_device[0];
194 195  
195 196 /* XXX: fix this */
196 197 ram_bases[0] = 0x00000000;
... ... @@ -322,7 +323,7 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
322 323 }
323 324 env->gpr[4] = initrd_base;
324 325 env->gpr[5] = initrd_size;
325   - boot_device = 'm';
  326 + ppc_boot_device = 'm';
326 327 if (kernel_cmdline != NULL) {
327 328 len = strlen(kernel_cmdline);
328 329 bdloc -= ((len + 255) & ~255);
... ... @@ -496,9 +497,9 @@ static void taihu_cpld_init (uint32_t base)
496 497 }
497 498 }
498 499  
499   -static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
500   - DisplayState *ds, const char **fd_filename,
501   - int snapshot,
  500 +static void taihu_405ep_init(int ram_size, int vga_ram_size,
  501 + const char *boot_device, DisplayState *ds,
  502 + const char **fd_filename, int snapshot,
502 503 const char *kernel_filename,
503 504 const char *kernel_cmdline,
504 505 const char *initrd_filename,
... ... @@ -513,6 +514,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
513 514 target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
514 515 int linux_boot;
515 516 int fl_idx, fl_sectors;
  517 + int ppc_boot_device = boot_device[0];
516 518  
517 519 /* RAM is soldered to the board so the size cannot be changed */
518 520 ram_bases[0] = 0x00000000;
... ... @@ -615,7 +617,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
615 617 initrd_base = 0;
616 618 initrd_size = 0;
617 619 }
618   - boot_device = 'm';
  620 + ppc_boot_device = 'm';
619 621 } else {
620 622 kernel_base = 0;
621 623 kernel_size = 0;
... ...
hw/ppc_chrp.c
... ... @@ -48,9 +48,9 @@ static CPUReadMemoryFunc *unin_read[] = {
48 48 };
49 49  
50 50 /* PowerPC Mac99 hardware initialisation */
51   -static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
52   - DisplayState *ds, const char **fd_filename,
53   - int snapshot,
  51 +static void ppc_core99_init (int ram_size, int vga_ram_size,
  52 + const char *boot_device, DisplayState *ds,
  53 + const char **fd_filename, int snapshot,
54 54 const char *kernel_filename,
55 55 const char *kernel_cmdline,
56 56 const char *initrd_filename,
... ... @@ -75,6 +75,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
75 75 qemu_irq *dummy_irq;
76 76 int pic_mem_index, dbdma_mem_index, cuda_mem_index;
77 77 int ide_mem_index[2];
  78 + int ppc_boot_device = boot_device[0];
78 79  
79 80 linux_boot = (kernel_filename != NULL);
80 81  
... ... @@ -171,7 +172,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
171 172 initrd_base = 0;
172 173 initrd_size = 0;
173 174 }
174   - boot_device = 'm';
  175 + ppc_boot_device = 'm';
175 176 } else {
176 177 kernel_base = 0;
177 178 kernel_size = 0;
... ... @@ -285,8 +286,8 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
285 286 nvram.read_fn = &m48t59_read;
286 287 nvram.write_fn = &m48t59_write;
287 288 #endif
288   - PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size, boot_device,
289   - kernel_base, kernel_size,
  289 + PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size,
  290 + ppc_boot_device, kernel_base, kernel_size,
290 291 kernel_cmdline,
291 292 initrd_base, initrd_size,
292 293 /* XXX: need an option to load a NVRAM image */
... ...
hw/ppc_oldworld.c
... ... @@ -92,9 +92,9 @@ static int vga_osi_call (CPUState *env)
92 92 return 1; /* osi_call handled */
93 93 }
94 94  
95   -static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
96   - DisplayState *ds, const char **fd_filename,
97   - int snapshot,
  95 +static void ppc_heathrow_init (int ram_size, int vga_ram_size,
  96 + const char *boot_device, DisplayState *ds,
  97 + const char **fd_filename, int snapshot,
98 98 const char *kernel_filename,
99 99 const char *kernel_cmdline,
100 100 const char *initrd_filename,
... ... @@ -114,6 +114,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
114 114 int vga_bios_size, bios_size;
115 115 qemu_irq *dummy_irq;
116 116 int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index;
  117 + int ppc_boot_device = boot_device[0];
117 118  
118 119 linux_boot = (kernel_filename != NULL);
119 120  
... ... @@ -208,7 +209,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
208 209 initrd_base = 0;
209 210 initrd_size = 0;
210 211 }
211   - boot_device = 'm';
  212 + ppc_boot_device = 'm';
212 213 } else {
213 214 kernel_base = 0;
214 215 kernel_size = 0;
... ... @@ -289,8 +290,8 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
289 290 nvram.opaque = m48t59;
290 291 nvram.read_fn = &m48t59_read;
291 292 nvram.write_fn = &m48t59_write;
292   - PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "HEATHROW", ram_size, boot_device,
293   - kernel_base, kernel_size,
  293 + PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "HEATHROW", ram_size,
  294 + ppc_boot_device, kernel_base, kernel_size,
294 295 kernel_cmdline,
295 296 initrd_base, initrd_size,
296 297 /* XXX: need an option to load a NVRAM image */
... ...
hw/ppc_prep.c
... ... @@ -521,7 +521,7 @@ CPUReadMemoryFunc *PPC_prep_io_read[] = {
521 521 #define NVRAM_SIZE 0x2000
522 522  
523 523 /* PowerPC PREP hardware initialisation */
524   -static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
  524 +static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_device,
525 525 DisplayState *ds, const char **fd_filename,
526 526 int snapshot, const char *kernel_filename,
527 527 const char *kernel_cmdline,
... ... @@ -539,6 +539,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
539 539 ppc_def_t *def;
540 540 PCIBus *pci_bus;
541 541 qemu_irq *i8259;
  542 + int ppc_boot_device = boot_device[0];
542 543  
543 544 sysctrl = qemu_mallocz(sizeof(sysctrl_t));
544 545 if (sysctrl == NULL)
... ... @@ -607,7 +608,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
607 608 initrd_base = 0;
608 609 initrd_size = 0;
609 610 }
610   - boot_device = 'm';
  611 + ppc_boot_device = 'm';
611 612 } else {
612 613 kernel_base = 0;
613 614 kernel_size = 0;
... ... @@ -695,7 +696,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
695 696 nvram.opaque = m48t59;
696 697 nvram.read_fn = &m48t59_read;
697 698 nvram.write_fn = &m48t59_write;
698   - PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, boot_device,
  699 + PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device,
699 700 kernel_base, kernel_size,
700 701 kernel_cmdline,
701 702 initrd_base, initrd_size,
... ...
hw/r2d.c
... ... @@ -27,7 +27,7 @@
27 27 #define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
28 28 #define SDRAM_SIZE 0x04000000
29 29  
30   -void r2d_init(int ram_size, int vga_ram_size, int boot_device,
  30 +static void r2d_init(int ram_size, int vga_ram_size, const char *boot_device,
31 31 DisplayState * ds, const char **fd_filename, int snapshot,
32 32 const char *kernel_filename, const char *kernel_cmdline,
33 33 const char *initrd_filename, const char *cpu_model)
... ...
hw/realview.c
... ... @@ -12,8 +12,9 @@
12 12  
13 13 /* Board init. */
14 14  
15   -static void realview_init(int ram_size, int vga_ram_size, int boot_device,
16   - DisplayState *ds, const char **fd_filename, int snapshot,
  15 +static void realview_init(int ram_size, int vga_ram_size,
  16 + const char *boot_device, DisplayState *ds,
  17 + const char **fd_filename, int snapshot,
17 18 const char *kernel_filename, const char *kernel_cmdline,
18 19 const char *initrd_filename, const char *cpu_model)
19 20 {
... ...
hw/shix.c
... ... @@ -62,7 +62,7 @@ void vga_screen_dump(const char *filename)
62 62 /* XXXXX */
63 63 }
64 64  
65   -void shix_init(int ram_size, int vga_ram_size, int boot_device,
  65 +static void shix_init(int ram_size, int vga_ram_size, const char *boot_device,
66 66 DisplayState * ds, const char **fd_filename, int snapshot,
67 67 const char *kernel_filename, const char *kernel_cmdline,
68 68 const char *initrd_filename, const char *cpu_model)
... ...
hw/spitz.c
... ... @@ -1228,8 +1228,9 @@ static void spitz_common_init(int ram_size, int vga_ram_size,
1228 1228 sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_SDRAM_BASE);
1229 1229 }
1230 1230  
1231   -static void spitz_init(int ram_size, int vga_ram_size, int boot_device,
1232   - DisplayState *ds, const char **fd_filename, int snapshot,
  1231 +static void spitz_init(int ram_size, int vga_ram_size,
  1232 + const char *boot_device, DisplayState *ds,
  1233 + const char **fd_filename, int snapshot,
1233 1234 const char *kernel_filename, const char *kernel_cmdline,
1234 1235 const char *initrd_filename, const char *cpu_model)
1235 1236 {
... ... @@ -1237,8 +1238,9 @@ static void spitz_init(int ram_size, int vga_ram_size, int boot_device,
1237 1238 kernel_cmdline, initrd_filename, cpu_model, spitz, 0x2c9);
1238 1239 }
1239 1240  
1240   -static void borzoi_init(int ram_size, int vga_ram_size, int boot_device,
1241   - DisplayState *ds, const char **fd_filename, int snapshot,
  1241 +static void borzoi_init(int ram_size, int vga_ram_size,
  1242 + const char *boot_device, DisplayState *ds,
  1243 + const char **fd_filename, int snapshot,
1242 1244 const char *kernel_filename, const char *kernel_cmdline,
1243 1245 const char *initrd_filename, const char *cpu_model)
1244 1246 {
... ... @@ -1246,8 +1248,9 @@ static void borzoi_init(int ram_size, int vga_ram_size, int boot_device,
1246 1248 kernel_cmdline, initrd_filename, cpu_model, borzoi, 0x33f);
1247 1249 }
1248 1250  
1249   -static void akita_init(int ram_size, int vga_ram_size, int boot_device,
1250   - DisplayState *ds, const char **fd_filename, int snapshot,
  1251 +static void akita_init(int ram_size, int vga_ram_size,
  1252 + const char *boot_device, DisplayState *ds,
  1253 + const char **fd_filename, int snapshot,
1251 1254 const char *kernel_filename, const char *kernel_cmdline,
1252 1255 const char *initrd_filename, const char *cpu_model)
1253 1256 {
... ... @@ -1255,8 +1258,9 @@ static void akita_init(int ram_size, int vga_ram_size, int boot_device,
1255 1258 kernel_cmdline, initrd_filename, cpu_model, akita, 0x2e8);
1256 1259 }
1257 1260  
1258   -static void terrier_init(int ram_size, int vga_ram_size, int boot_device,
1259   - DisplayState *ds, const char **fd_filename, int snapshot,
  1261 +static void terrier_init(int ram_size, int vga_ram_size,
  1262 + const char *boot_device, DisplayState *ds,
  1263 + const char **fd_filename, int snapshot,
1260 1264 const char *kernel_filename, const char *kernel_cmdline,
1261 1265 const char *initrd_filename, const char *cpu_model)
1262 1266 {
... ...
hw/sun4m.c
... ... @@ -158,7 +158,7 @@ static void nvram_finish_partition (m48t59_t *nvram, uint32_t start,
158 158 extern int nographic;
159 159  
160 160 static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
161   - int boot_device, uint32_t RAM_size,
  161 + const char *boot_device, uint32_t RAM_size,
162 162 uint32_t kernel_size,
163 163 int width, int height, int depth,
164 164 int machine_id)
... ... @@ -175,7 +175,7 @@ static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
175 175 m48t59_write(nvram, 0x2E, 0);
176 176 m48t59_write(nvram, 0x2F, nographic & 0xff);
177 177 nvram_set_lword(nvram, 0x30, RAM_size);
178   - m48t59_write(nvram, 0x34, boot_device & 0xff);
  178 + m48t59_write(nvram, 0x34, boot_device[0] & 0xff);
179 179 nvram_set_lword(nvram, 0x38, KERNEL_LOAD_ADDR);
180 180 nvram_set_lword(nvram, 0x3C, kernel_size);
181 181 if (cmdline) {
... ... @@ -408,7 +408,8 @@ static void *sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
408 408 return nvram;
409 409 }
410 410  
411   -static void sun4m_load_kernel(long vram_size, int RAM_size, int boot_device,
  411 +static void sun4m_load_kernel(long vram_size, int RAM_size,
  412 + const char *boot_device,
412 413 const char *kernel_filename,
413 414 const char *kernel_cmdline,
414 415 const char *initrd_filename,
... ... @@ -548,7 +549,7 @@ static const struct hwdef hwdefs[] = {
548 549 },
549 550 };
550 551  
551   -static void sun4m_common_init(int RAM_size, int boot_device, DisplayState *ds,
  552 +static void sun4m_common_init(int RAM_size, const char *boot_device, DisplayState *ds,
552 553 const char *kernel_filename, const char *kernel_cmdline,
553 554 const char *initrd_filename, const char *cpu_model,
554 555 unsigned int machine, int max_ram)
... ... @@ -569,7 +570,7 @@ static void sun4m_common_init(int RAM_size, int boot_device, DisplayState *ds,
569 570 }
570 571  
571 572 /* SPARCstation 5 hardware initialisation */
572   -static void ss5_init(int RAM_size, int vga_ram_size, int boot_device,
  573 +static void ss5_init(int RAM_size, int vga_ram_size, const char *boot_device,
573 574 DisplayState *ds, const char **fd_filename, int snapshot,
574 575 const char *kernel_filename, const char *kernel_cmdline,
575 576 const char *initrd_filename, const char *cpu_model)
... ... @@ -582,7 +583,7 @@ static void ss5_init(int RAM_size, int vga_ram_size, int boot_device,
582 583 }
583 584  
584 585 /* SPARCstation 10 hardware initialisation */
585   -static void ss10_init(int RAM_size, int vga_ram_size, int boot_device,
  586 +static void ss10_init(int RAM_size, int vga_ram_size, const char *boot_device,
586 587 DisplayState *ds, const char **fd_filename, int snapshot,
587 588 const char *kernel_filename, const char *kernel_cmdline,
588 589 const char *initrd_filename, const char *cpu_model)
... ...
hw/sun4u.c
... ... @@ -331,7 +331,7 @@ static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
331 331 static fdctrl_t *floppy_controller;
332 332  
333 333 /* Sun4u hardware initialisation */
334   -static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
  334 +static void sun4u_init(int ram_size, int vga_ram_size, const char *boot_device,
335 335 DisplayState *ds, const char **fd_filename, int snapshot,
336 336 const char *kernel_filename, const char *kernel_cmdline,
337 337 const char *initrd_filename, const char *cpu_model)
... ... @@ -456,7 +456,7 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
456 456 i8042_init(NULL/*1*/, NULL/*12*/, 0x60);
457 457 floppy_controller = fdctrl_init(NULL/*6*/, 2, 0, 0x3f0, fd_table);
458 458 nvram = m48t59_init(NULL/*8*/, 0, 0x0074, NVRAM_SIZE, 59);
459   - sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ram_size, boot_device,
  459 + sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ram_size, boot_device[0],
460 460 KERNEL_LOAD_ADDR, kernel_size,
461 461 kernel_cmdline,
462 462 INITRD_LOAD_ADDR, initrd_size,
... ...
hw/versatilepb.c
... ... @@ -151,8 +151,9 @@ static qemu_irq *vpb_sic_init(uint32_t base, qemu_irq *parent, int irq)
151 151 peripherans and expansion busses. For now we emulate a subset of the
152 152 PB peripherals and just change the board ID. */
153 153  
154   -static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
155   - DisplayState *ds, const char **fd_filename, int snapshot,
  154 +static void versatile_init(int ram_size, int vga_ram_size,
  155 + const char *boot_device, DisplayState *ds,
  156 + const char **fd_filename, int snapshot,
156 157 const char *kernel_filename, const char *kernel_cmdline,
157 158 const char *initrd_filename, const char *cpu_model,
158 159 int board_id)
... ... @@ -266,7 +267,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
266 267 initrd_filename, board_id, 0x0);
267 268 }
268 269  
269   -static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
  270 +static void vpb_init(int ram_size, int vga_ram_size, const char *boot_device,
270 271 DisplayState *ds, const char **fd_filename, int snapshot,
271 272 const char *kernel_filename, const char *kernel_cmdline,
272 273 const char *initrd_filename, const char *cpu_model)
... ... @@ -277,7 +278,7 @@ static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
277 278 initrd_filename, cpu_model, 0x183);
278 279 }
279 280  
280   -static void vab_init(int ram_size, int vga_ram_size, int boot_device,
  281 +static void vab_init(int ram_size, int vga_ram_size, const char *boot_device,
281 282 DisplayState *ds, const char **fd_filename, int snapshot,
282 283 const char *kernel_filename, const char *kernel_cmdline,
283 284 const char *initrd_filename, const char *cpu_model)
... ...
... ... @@ -162,7 +162,12 @@ static DisplayState display_state;
162 162 int nographic;
163 163 const char* keyboard_layout = NULL;
164 164 int64_t ticks_per_sec;
165   -int boot_device = 'c';
  165 +#if defined(TARGET_I386)
  166 +#define MAX_BOOT_DEVICES 3
  167 +#else
  168 +#define MAX_BOOT_DEVICES 1
  169 +#endif
  170 +static char boot_device[MAX_BOOT_DEVICES + 1];
166 171 int ram_size;
167 172 int pit_min_timer_count = 0;
168 173 int nb_nics;
... ... @@ -7810,14 +7815,19 @@ int main(int argc, char **argv)
7810 7815 }
7811 7816 break;
7812 7817 case QEMU_OPTION_boot:
7813   - boot_device = optarg[0];
7814   - if (boot_device != 'a' &&
  7818 + if (strlen(optarg) > MAX_BOOT_DEVICES) {
  7819 + fprintf(stderr, "qemu: too many boot devices\n");
  7820 + exit(1);
  7821 + }
  7822 + strncpy(boot_device, optarg, MAX_BOOT_DEVICES);
7815 7823 #if defined(TARGET_SPARC) || defined(TARGET_I386)
7816   - // Network boot
7817   - boot_device != 'n' &&
  7824 +#define BOOTCHARS "acdn"
  7825 +#else
  7826 +#define BOOTCHARS "acd"
7818 7827 #endif
7819   - boot_device != 'c' && boot_device != 'd') {
7820   - fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
  7828 + if (strlen(boot_device) != strspn(boot_device, BOOTCHARS)) {
  7829 + fprintf(stderr, "qemu: invalid boot device "
  7830 + "sequence '%s'\n", boot_device);
7821 7831 exit(1);
7822 7832 }
7823 7833 break;
... ... @@ -8168,20 +8178,22 @@ int main(int argc, char **argv)
8168 8178 linux_boot = (kernel_filename != NULL);
8169 8179  
8170 8180 if (!linux_boot &&
8171   - boot_device != 'n' &&
  8181 + (!strchr(boot_device, 'n')) &&
8172 8182 hd_filename[0] == '\0' &&
8173 8183 (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
8174 8184 fd_filename[0] == '\0')
8175 8185 help(1);
8176 8186  
8177 8187 /* boot to floppy or the default cd if no hard disk defined yet */
8178   - if (hd_filename[0] == '\0' && boot_device == 'c') {
8179   - if (fd_filename[0] != '\0')
8180   - boot_device = 'a';
  8188 + if (!boot_device[0]) {
  8189 + if (hd_filename[0] != '\0')
  8190 + boot_device[0] = 'c';
  8191 + else if (fd_filename[0] != '\0')
  8192 + boot_device[0] = 'a';
8181 8193 else
8182   - boot_device = 'd';
  8194 + boot_device[0] = 'd';
  8195 + boot_device[1] = 0;
8183 8196 }
8184   -
8185 8197 setvbuf(stdout, NULL, _IOLBF, 0);
8186 8198  
8187 8199 init_timers();
... ... @@ -8220,7 +8232,7 @@ int main(int argc, char **argv)
8220 8232 }
8221 8233  
8222 8234 #ifdef TARGET_I386
8223   - if (boot_device == 'n') {
  8235 + if (strchr(boot_device, 'n')) {
8224 8236 for (i = 0; i < nb_nics; i++) {
8225 8237 const char *model = nd_table[i].model;
8226 8238 char buf[1024];
... ...
... ... @@ -731,7 +731,7 @@ void path_combine(char *dest, int dest_size,
731 731 #ifndef QEMU_TOOL
732 732  
733 733 typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size,
734   - int boot_device,
  734 + const char *boot_device,
735 735 DisplayState *ds, const char **fd_filename, int snapshot,
736 736 const char *kernel_filename, const char *kernel_cmdline,
737 737 const char *initrd_filename, const char *cpu_model);
... ...