Commit 6ac0e82d authored by balrog's avatar balrog

Set boot sequence from command line (Dan Kenigsberg).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3497 c046a42c-6fe2-441c-8c8c-71466251a162
parent 926c2d23
......@@ -27,7 +27,7 @@ void DMA_run (void)
/* Board init. */
static void an5206_init(int ram_size, int vga_ram_size, int boot_device,
static void an5206_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -107,7 +107,7 @@ static void dummy_cpu_set_irq(void *opaque, int irq, int level)
}
static
void bareetraxfs_init (int ram_size, int vga_ram_size, int boot_device,
void bareetraxfs_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -462,8 +462,9 @@ static void icp_control_init(uint32_t base)
/* Board init. */
static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void integratorcp_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
......@@ -197,8 +197,9 @@ static void mcf5208_sys_init(qemu_irq *pic)
}
}
static void mcf5208evb_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void mcf5208evb_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
......@@ -740,7 +740,7 @@ static void main_cpu_reset(void *opaque)
}
static
void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
void mips_malta_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -74,7 +74,7 @@ static void main_cpu_reset(void *opaque)
}
static void
mips_mipssim_init (int ram_size, int vga_ram_size, int boot_device,
mips_mipssim_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -55,7 +55,7 @@ static void main_cpu_reset(void *opaque)
}
static
void mips_pica61_init (int ram_size, int vga_ram_size, int boot_device,
void mips_pica61_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -137,7 +137,7 @@ static void main_cpu_reset(void *opaque)
}
static
void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
void mips_r4k_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -115,8 +115,9 @@ static void palmte_button_event(void *opaque, int keycode)
!(keycode & 0x80));
}
static void palmte_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void palmte_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
......@@ -152,8 +152,25 @@ static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd)
rtc_set_memory(s, info_ofs + 8, sectors);
}
/* convert boot_device letter to something recognizable by the bios */
static int boot_device2nibble(char boot_device)
{
switch(boot_device) {
case 'a':
case 'b':
return 0x01; /* floppy boot */
case 'c':
return 0x02; /* hard drive boot */
case 'd':
return 0x03; /* CD-ROM boot */
case 'n':
return 0x04; /* Network boot */
}
return 0;
}
/* 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, const char *boot_device, BlockDriverState **hd_table)
{
RTCState *s = rtc_state;
int val;
......@@ -184,24 +201,12 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
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;
case 'n':
rtc_set_memory(s, 0x3d, 0x04); /* Network boot */
break;
}
/* set boot devices, and disable floppy signature check if requested */
rtc_set_memory(s, 0x3d,
boot_device2nibble(boot_device[1]) << 4 |
boot_device2nibble(boot_device[0]) );
rtc_set_memory(s, 0x38,
boot_device2nibble(boot_device[2]) << 4 | (fd_bootchk ? 0x0 : 0x1));
/* floppy type */
......@@ -663,7 +668,7 @@ static void pc_init_ne2k_isa(NICInfo *nd, qemu_irq *pic)
}
/* 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, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename,
......@@ -940,7 +945,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
#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, const char *boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
const char *kernel_filename,
......@@ -954,7 +959,7 @@ static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
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, const char *boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
const char *kernel_filename,
......
......@@ -171,9 +171,9 @@ static void ref405ep_fpga_init (uint32_t base)
}
}
static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
static void ref405ep_init (int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
......@@ -191,6 +191,7 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot;
int fl_idx, fl_sectors, len;
int ppc_boot_device = boot_device[0];
/* XXX: fix this */
ram_bases[0] = 0x00000000;
......@@ -322,7 +323,7 @@ static void ref405ep_init (int ram_size, int vga_ram_size, int boot_device,
}
env->gpr[4] = initrd_base;
env->gpr[5] = initrd_size;
boot_device = 'm';
ppc_boot_device = 'm';
if (kernel_cmdline != NULL) {
len = strlen(kernel_cmdline);
bdloc -= ((len + 255) & ~255);
......@@ -496,9 +497,9 @@ static void taihu_cpld_init (uint32_t base)
}
}
static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
static void taihu_405ep_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
......@@ -513,6 +514,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot;
int fl_idx, fl_sectors;
int ppc_boot_device = boot_device[0];
/* RAM is soldered to the board so the size cannot be changed */
ram_bases[0] = 0x00000000;
......@@ -615,7 +617,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
initrd_base = 0;
initrd_size = 0;
}
boot_device = 'm';
ppc_boot_device = 'm';
} else {
kernel_base = 0;
kernel_size = 0;
......
......@@ -48,9 +48,9 @@ static CPUReadMemoryFunc *unin_read[] = {
};
/* PowerPC Mac99 hardware initialisation */
static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
static void ppc_core99_init (int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
......@@ -75,6 +75,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
qemu_irq *dummy_irq;
int pic_mem_index, dbdma_mem_index, cuda_mem_index;
int ide_mem_index[2];
int ppc_boot_device = boot_device[0];
linux_boot = (kernel_filename != NULL);
......@@ -171,7 +172,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
initrd_base = 0;
initrd_size = 0;
}
boot_device = 'm';
ppc_boot_device = 'm';
} else {
kernel_base = 0;
kernel_size = 0;
......@@ -285,8 +286,8 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
nvram.read_fn = &m48t59_read;
nvram.write_fn = &m48t59_write;
#endif
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size, boot_device,
kernel_base, kernel_size,
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size,
ppc_boot_device, kernel_base, kernel_size,
kernel_cmdline,
initrd_base, initrd_size,
/* XXX: need an option to load a NVRAM image */
......
......@@ -92,9 +92,9 @@ static int vga_osi_call (CPUState *env)
return 1; /* osi_call handled */
}
static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot,
static void ppc_heathrow_init (int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
......@@ -114,6 +114,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
int vga_bios_size, bios_size;
qemu_irq *dummy_irq;
int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index;
int ppc_boot_device = boot_device[0];
linux_boot = (kernel_filename != NULL);
......@@ -208,7 +209,7 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
initrd_base = 0;
initrd_size = 0;
}
boot_device = 'm';
ppc_boot_device = 'm';
} else {
kernel_base = 0;
kernel_size = 0;
......@@ -289,8 +290,8 @@ static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
nvram.opaque = m48t59;
nvram.read_fn = &m48t59_read;
nvram.write_fn = &m48t59_write;
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "HEATHROW", ram_size, boot_device,
kernel_base, kernel_size,
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "HEATHROW", ram_size,
ppc_boot_device, kernel_base, kernel_size,
kernel_cmdline,
initrd_base, initrd_size,
/* XXX: need an option to load a NVRAM image */
......
......@@ -521,7 +521,7 @@ CPUReadMemoryFunc *PPC_prep_io_read[] = {
#define NVRAM_SIZE 0x2000
/* PowerPC PREP hardware initialisation */
static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
static void ppc_prep_init (int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename,
int snapshot, const char *kernel_filename,
const char *kernel_cmdline,
......@@ -539,6 +539,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
ppc_def_t *def;
PCIBus *pci_bus;
qemu_irq *i8259;
int ppc_boot_device = boot_device[0];
sysctrl = qemu_mallocz(sizeof(sysctrl_t));
if (sysctrl == NULL)
......@@ -607,7 +608,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
initrd_base = 0;
initrd_size = 0;
}
boot_device = 'm';
ppc_boot_device = 'm';
} else {
kernel_base = 0;
kernel_size = 0;
......@@ -695,7 +696,7 @@ static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device,
nvram.opaque = m48t59;
nvram.read_fn = &m48t59_read;
nvram.write_fn = &m48t59_write;
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, boot_device,
PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device,
kernel_base, kernel_size,
kernel_cmdline,
initrd_base, initrd_size,
......
......@@ -27,7 +27,7 @@
#define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
#define SDRAM_SIZE 0x04000000
void r2d_init(int ram_size, int vga_ram_size, int boot_device,
static void r2d_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState * ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -12,8 +12,9 @@
/* Board init. */
static void realview_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void realview_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
......@@ -62,7 +62,7 @@ void vga_screen_dump(const char *filename)
/* XXXXX */
}
void shix_init(int ram_size, int vga_ram_size, int boot_device,
static void shix_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState * ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -1228,8 +1228,9 @@ static void spitz_common_init(int ram_size, int vga_ram_size,
sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_SDRAM_BASE);
}
static void spitz_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void spitz_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......@@ -1237,8 +1238,9 @@ static void spitz_init(int ram_size, int vga_ram_size, int boot_device,
kernel_cmdline, initrd_filename, cpu_model, spitz, 0x2c9);
}
static void borzoi_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void borzoi_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......@@ -1246,8 +1248,9 @@ static void borzoi_init(int ram_size, int vga_ram_size, int boot_device,
kernel_cmdline, initrd_filename, cpu_model, borzoi, 0x33f);
}
static void akita_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void akita_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......@@ -1255,8 +1258,9 @@ static void akita_init(int ram_size, int vga_ram_size, int boot_device,
kernel_cmdline, initrd_filename, cpu_model, akita, 0x2e8);
}
static void terrier_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void terrier_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
......
......@@ -158,7 +158,7 @@ static void nvram_finish_partition (m48t59_t *nvram, uint32_t start,
extern int nographic;
static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
int boot_device, uint32_t RAM_size,
const char *boot_device, uint32_t RAM_size,
uint32_t kernel_size,
int width, int height, int depth,
int machine_id)
......@@ -175,7 +175,7 @@ static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
m48t59_write(nvram, 0x2E, 0);
m48t59_write(nvram, 0x2F, nographic & 0xff);
nvram_set_lword(nvram, 0x30, RAM_size);
m48t59_write(nvram, 0x34, boot_device & 0xff);
m48t59_write(nvram, 0x34, boot_device[0] & 0xff);
nvram_set_lword(nvram, 0x38, KERNEL_LOAD_ADDR);
nvram_set_lword(nvram, 0x3C, kernel_size);
if (cmdline) {
......@@ -408,7 +408,8 @@ static void *sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
return nvram;
}
static void sun4m_load_kernel(long vram_size, int RAM_size, int boot_device,
static void sun4m_load_kernel(long vram_size, int RAM_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
......@@ -548,7 +549,7 @@ static const struct hwdef hwdefs[] = {
},
};
static void sun4m_common_init(int RAM_size, int boot_device, DisplayState *ds,
static void sun4m_common_init(int RAM_size, const char *boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model,
unsigned int machine, int max_ram)
......@@ -569,7 +570,7 @@ static void sun4m_common_init(int RAM_size, int boot_device, DisplayState *ds,
}
/* SPARCstation 5 hardware initialisation */
static void ss5_init(int RAM_size, int vga_ram_size, int boot_device,
static void ss5_init(int RAM_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
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,
}
/* SPARCstation 10 hardware initialisation */
static void ss10_init(int RAM_size, int vga_ram_size, int boot_device,
static void ss10_init(int RAM_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -331,7 +331,7 @@ static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
static fdctrl_t *floppy_controller;
/* Sun4u hardware initialisation */
static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
static void sun4u_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
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,
i8042_init(NULL/*1*/, NULL/*12*/, 0x60);
floppy_controller = fdctrl_init(NULL/*6*/, 2, 0, 0x3f0, fd_table);
nvram = m48t59_init(NULL/*8*/, 0, 0x0074, NVRAM_SIZE, 59);
sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ram_size, boot_device,
sun4u_NVRAM_set_params(nvram, NVRAM_SIZE, "Sun4u", ram_size, boot_device[0],
KERNEL_LOAD_ADDR, kernel_size,
kernel_cmdline,
INITRD_LOAD_ADDR, initrd_size,
......
......@@ -151,8 +151,9 @@ static qemu_irq *vpb_sic_init(uint32_t base, qemu_irq *parent, int irq)
peripherans and expansion busses. For now we emulate a subset of the
PB peripherals and just change the board ID. */
static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
static void versatile_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model,
int board_id)
......@@ -266,7 +267,7 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device,
initrd_filename, board_id, 0x0);
}
static void vpb_init(int ram_size, int vga_ram_size, int boot_device,
static void vpb_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
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,
initrd_filename, cpu_model, 0x183);
}
static void vab_init(int ram_size, int vga_ram_size, int boot_device,
static void vab_init(int ram_size, int vga_ram_size, const char *boot_device,
DisplayState *ds, const char **fd_filename, int snapshot,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
......
......@@ -162,7 +162,12 @@ static DisplayState display_state;
int nographic;
const char* keyboard_layout = NULL;
int64_t ticks_per_sec;
int boot_device = 'c';
#if defined(TARGET_I386)
#define MAX_BOOT_DEVICES 3
#else
#define MAX_BOOT_DEVICES 1
#endif
static char boot_device[MAX_BOOT_DEVICES + 1];
int ram_size;
int pit_min_timer_count = 0;
int nb_nics;
......@@ -7810,14 +7815,19 @@ int main(int argc, char **argv)
}
break;
case QEMU_OPTION_boot:
boot_device = optarg[0];
if (boot_device != 'a' &&
if (strlen(optarg) > MAX_BOOT_DEVICES) {
fprintf(stderr, "qemu: too many boot devices\n");
exit(1);
}
strncpy(boot_device, optarg, MAX_BOOT_DEVICES);
#if defined(TARGET_SPARC) || defined(TARGET_I386)
// Network boot
boot_device != 'n' &&
#define BOOTCHARS "acdn"
#else
#define BOOTCHARS "acd"
#endif
boot_device != 'c' && boot_device != 'd') {
fprintf(stderr, "qemu: invalid boot device '%c'\n", boot_device);
if (strlen(boot_device) != strspn(boot_device, BOOTCHARS)) {
fprintf(stderr, "qemu: invalid boot device "
"sequence '%s'\n", boot_device);
exit(1);
}
break;
......@@ -8168,20 +8178,22 @@ int main(int argc, char **argv)
linux_boot = (kernel_filename != NULL);
if (!linux_boot &&
boot_device != 'n' &&
(!strchr(boot_device, 'n')) &&
hd_filename[0] == '\0' &&
(cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
fd_filename[0] == '\0')
help(1);
/* boot to floppy or the default cd if no hard disk defined yet */
if (hd_filename[0] == '\0' && boot_device == 'c') {
if (fd_filename[0] != '\0')
boot_device = 'a';
if (!boot_device[0]) {
if (hd_filename[0] != '\0')
boot_device[0] = 'c';
else if (fd_filename[0] != '\0')
boot_device[0] = 'a';
else
boot_device = 'd';
boot_device[0] = 'd';
boot_device[1] = 0;
}
setvbuf(stdout, NULL, _IOLBF, 0);
init_timers();
......@@ -8220,7 +8232,7 @@ int main(int argc, char **argv)
}
#ifdef TARGET_I386