Commit 9538749118d47dfcd3ed45804736027d87ec054e

Authored by Jan Kiszka
Committed by Anthony Liguori
1 parent e0f084bf

Add boot menu control via command line switch

Disable the lengthy BIOS prompt for selecting a boot device by default,
but let the user reenable it via '-boot menu=on'.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/fw_cfg.c
... ... @@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
279 279 fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
280 280 fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
281 281 fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
  282 + fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
282 283  
283 284 register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
284 285 qemu_register_reset(fw_cfg_reset, s);
... ...
hw/fw_cfg.h
... ... @@ -15,6 +15,7 @@
15 15 #define FW_CFG_INITRD_SIZE 0x0b
16 16 #define FW_CFG_BOOT_DEVICE 0x0c
17 17 #define FW_CFG_NUMA 0x0d
  18 +#define FW_CFG_BOOT_MENU 0x0e
18 19 #define FW_CFG_MAX_ENTRY 0x10
19 20  
20 21 #define FW_CFG_WRITE_CHANNEL 0x4000
... ...
sysemu.h
... ... @@ -124,6 +124,7 @@ extern int graphic_rotate;
124 124 extern int no_quit;
125 125 extern int semihosting_enabled;
126 126 extern int old_param;
  127 +extern int boot_menu;
127 128  
128 129 #ifdef CONFIG_KQEMU
129 130 extern int kqemu_allowed;
... ...
... ... @@ -254,6 +254,7 @@ const char *prom_envs[MAX_PROM_ENVS];
254 254 #endif
255 255 int nb_drives_opt;
256 256 struct drive_opt drives_opt[MAX_DRIVES];
  257 +int boot_menu;
257 258  
258 259 int nb_numa_nodes;
259 260 uint64_t node_mem[MAX_NODES];
... ... @@ -5121,7 +5122,7 @@ int main(int argc, char **argv, char **envp)
5121 5122 case QEMU_OPTION_boot:
5122 5123 {
5123 5124 static const char * const params[] = {
5124   - "order", "once", NULL
  5125 + "order", "once", "menu", NULL
5125 5126 };
5126 5127 char buf[sizeof(boot_devices)];
5127 5128 char *standard_boot_devices;
... ... @@ -5151,6 +5152,19 @@ int main(int argc, char **argv, char **envp)
5151 5152 qemu_register_reset(restore_boot_devices,
5152 5153 standard_boot_devices);
5153 5154 }
  5155 + if (get_param_value(buf, sizeof(buf),
  5156 + "menu", optarg)) {
  5157 + if (!strcmp(buf, "on")) {
  5158 + boot_menu = 1;
  5159 + } else if (!strcmp(buf, "off")) {
  5160 + boot_menu = 0;
  5161 + } else {
  5162 + fprintf(stderr,
  5163 + "qemu: invalid option value '%s'\n",
  5164 + buf);
  5165 + exit(1);
  5166 + }
  5167 + }
5154 5168 }
5155 5169 }
5156 5170 break;
... ...