Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MM8AI-0000ME-0c for qemu-devel@nongnu.org; Wed, 01 Jul 2009 18:20:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MM8AE-0000L2-3Y for qemu-devel@nongnu.org; Wed, 01 Jul 2009 18:20:29 -0400 Received: from [199.232.76.173] (port=44704 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MM8AD-0000Ky-NU for qemu-devel@nongnu.org; Wed, 01 Jul 2009 18:20:25 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:58116) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MM8AC-0005wy-Lf for qemu-devel@nongnu.org; Wed, 01 Jul 2009 18:20:25 -0400 Resent-To: Anthony Liguori Resent-Message-Id: <4A4BE121.30407@web.de> From: Jan Kiszka Date: Thu, 02 Jul 2009 00:19:02 +0200 Message-ID: <20090701221902.22031.45696.stgit@mchn012c.ww002.siemens.net> In-Reply-To: <20090701221901.22031.39985.stgit@mchn012c.ww002.siemens.net> References: <20090701221901.22031.39985.stgit@mchn012c.ww002.siemens.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH 6/7] Add boot menu control via command line switch List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org 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 --- hw/fw_cfg.c | 1 + hw/fw_cfg.h | 1 + sysemu.h | 1 + vl.c | 16 +++++++++++++++- 4 files changed, 18 insertions(+), 1 deletions(-) diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index ce57de7..d75cce4 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); + fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s); qemu_register_reset(fw_cfg_reset, s); diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index f616ed2..9fee181 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -15,6 +15,7 @@ #define FW_CFG_INITRD_SIZE 0x0b #define FW_CFG_BOOT_DEVICE 0x0c #define FW_CFG_NUMA 0x0d +#define FW_CFG_BOOT_MENU 0x0e #define FW_CFG_MAX_ENTRY 0x10 #define FW_CFG_WRITE_CHANNEL 0x4000 diff --git a/sysemu.h b/sysemu.h index 06dc4c6..df19f02 100644 --- a/sysemu.h +++ b/sysemu.h @@ -124,6 +124,7 @@ extern int graphic_rotate; extern int no_quit; extern int semihosting_enabled; extern int old_param; +extern int boot_menu; #ifdef CONFIG_KQEMU extern int kqemu_allowed; diff --git a/vl.c b/vl.c index cd71710..0cae0bc 100644 --- a/vl.c +++ b/vl.c @@ -268,6 +268,7 @@ const char *prom_envs[MAX_PROM_ENVS]; #endif int nb_drives_opt; struct drive_opt drives_opt[MAX_DRIVES]; +int boot_menu; int nb_numa_nodes; uint64_t node_mem[MAX_NODES]; @@ -5334,7 +5335,7 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_boot: { static const char * const params[] = { - "order", "once", NULL + "order", "once", "menu", NULL }; char buf[sizeof(boot_devices)]; char *standard_boot_devices; @@ -5364,6 +5365,19 @@ int main(int argc, char **argv, char **envp) qemu_register_reset(restore_boot_devices, standard_boot_devices); } + if (get_param_value(buf, sizeof(buf), + "menu", optarg)) { + if (!strcmp(buf, "on")) { + boot_menu = 1; + } else if (!strcmp(buf, "off")) { + boot_menu = 0; + } else { + fprintf(stderr, + "qemu: invalid option value '%s'\n", + buf); + exit(1); + } + } } } break;