From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LDIYh-0006JM-5N for qemu-devel@nongnu.org; Thu, 18 Dec 2008 08:04:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LDIYg-0006JA-IB for qemu-devel@nongnu.org; Thu, 18 Dec 2008 08:04:54 -0500 Received: from [199.232.76.173] (port=58015 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDIYg-0006J7-EV for qemu-devel@nongnu.org; Thu, 18 Dec 2008 08:04:54 -0500 Received: from gecko.sbs.de ([194.138.37.40]:22052) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LDIYf-0005EH-I8 for qemu-devel@nongnu.org; Thu, 18 Dec 2008 08:04:53 -0500 Received: from mail1.sbs.de (localhost [127.0.0.1]) by gecko.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id mBID4oJX031468 for ; Thu, 18 Dec 2008 14:04:50 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id mBID4o6M015591 for ; Thu, 18 Dec 2008 14:04:50 +0100 Message-ID: <494A4A55.2090700@siemens.com> Date: Thu, 18 Dec 2008 14:04:21 +0100 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] x86: Manage BIOS boot menu via command line Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org When booting a guest from the command line, you normally do not need the interactive boot menu with its 3 s waiting that someone might press F12. So this patch introduces a mechanism to enable the boot menu only on demand, ie. when the user provided the command line switch -bootmenu. This reduces boot times to their original dimension. The host-guest interface used here is CMOS RAM byte 0x60. If it is non-zero, the guest BIOS will skip the F12 delay, keeping the previous behavior in case the host does not support it. -bootmenu was chosen in favor of -boot as the syntax of the latter is not easily and cleanly extensible. Signed-off-by: Jan Kiszka --- hw/pc.c | 3 +++ pc-bios/bios-pq/0006_optional-boot-menu.patch | 19 +++++++++++++++++++ pc-bios/bios-pq/series | 1 + sysemu.h | 1 + vl.c | 9 +++++++++ 5 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 pc-bios/bios-pq/0006_optional-boot-menu.patch diff --git a/hw/pc.c b/hw/pc.c index 64c08a4..11576d1 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -348,6 +348,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, } } rtc_set_memory(s, 0x39, val); + + if (!bootmenu) + rtc_set_memory(s, 0x60, 1); } void ioport_set_a20(int enable) diff --git a/pc-bios/bios-pq/0006_optional-boot-menu.patch b/pc-bios/bios-pq/0006_optional-boot-menu.patch new file mode 100644 index 0000000..bbe5753 --- /dev/null +++ b/pc-bios/bios-pq/0006_optional-boot-menu.patch @@ -0,0 +1,19 @@ +Make interactive boot menu optional. + +Signed-off-by: Jan Kiszka + +diff --git a/bios/rombios.c b/bios/rombios.c +index 123672f..7ce5b6c 100644 +--- a/bios/rombios.c ++++ b/bios/rombios.c +@@ -2026,6 +2026,10 @@ interactive_bootkey() + Bit16u ss = get_SS(); + Bit16u valid_choice = 0; + ++ /* QEMU sets CMOS byte 0x60 to non-zero if the boot menu should be skipped */ ++ if (inb_cmos(0x60)) ++ return; ++ + while (check_for_keystroke()) + get_keystroke(); + diff --git a/pc-bios/bios-pq/series b/pc-bios/bios-pq/series index beff2c6..9c7b6a1 100644 --- a/pc-bios/bios-pq/series +++ b/pc-bios/bios-pq/series @@ -3,3 +3,4 @@ 0003_smp-startup-poll.patch 0004_no-stack-protector.patch 0005_hpet.patch +0006_optional-boot-menu.patch diff --git a/sysemu.h b/sysemu.h index 94cffaf..1ecaed9 100644 --- a/sysemu.h +++ b/sysemu.h @@ -99,6 +99,7 @@ extern int semihosting_enabled; extern int old_param; extern const char *bootp_filename; extern DisplayState display_state; +extern int bootmenu; #ifdef USE_KQEMU extern int kqemu_allowed; diff --git a/vl.c b/vl.c index 66dd975..fea9293 100644 --- a/vl.c +++ b/vl.c @@ -218,6 +218,7 @@ int no_quit = 0; CharDriverState *serial_hds[MAX_SERIAL_PORTS]; CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; #ifdef TARGET_I386 +int bootmenu = 0; int win2k_install_hack = 0; #endif int usb_enabled = 0; @@ -3840,6 +3841,9 @@ static void help(int exitcode) "-sd file use 'file' as SecureDigital card image\n" "-pflash file use 'file' as a parallel flash image\n" "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" +#ifdef TARGET_I386 + "-bootmenu BIOS will display boot menu when pressing F12\n" +#endif "-snapshot write to temporary files instead of disk image files\n" #ifdef CONFIG_SDL "-no-frame open SDL window without a frame and window decorations\n" @@ -4018,6 +4022,7 @@ enum { QEMU_OPTION_boot, QEMU_OPTION_snapshot, #ifdef TARGET_I386 + QEMU_OPTION_bootmenu, QEMU_OPTION_no_fd_bootchk, #endif QEMU_OPTION_m, @@ -4114,6 +4119,7 @@ static const QEMUOption qemu_options[] = { { "boot", HAS_ARG, QEMU_OPTION_boot }, { "snapshot", 0, QEMU_OPTION_snapshot }, #ifdef TARGET_I386 + { "bootmenu", 0, QEMU_OPTION_bootmenu }, { "no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk }, #endif { "m", HAS_ARG, QEMU_OPTION_m }, @@ -4772,6 +4778,9 @@ int main(int argc, char **argv, char **envp) drive_add(optarg, FD_ALIAS, popt->index - QEMU_OPTION_fda); break; #ifdef TARGET_I386 + case QEMU_OPTION_bootmenu: + bootmenu = 1; + break; case QEMU_OPTION_no_fd_bootchk: fd_bootchk = 0; break;