make the showing time configurable.
Signed-off-by: Wayne Xia xiawenc@linux.vnet.ibm.com --- src/boot.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/src/boot.c b/src/boot.c index f3c165c..a76da4f 100644 --- a/src/boot.c +++ b/src/boot.c @@ -381,8 +381,31 @@ boot_add_cbfs(void *data, const char *desc, int prio) static void interactive_bootmenu(void) { - if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu()) + int filecfg_size; + u8 *filecfg_p = romfile_loadfile("qemu_extra_params_fw.cfg", &filecfg_size); + u16 splash_time = 0; + + if (filecfg_p != NULL && filecfg_size >= 2) { + splash_time = *(filecfg_p+0)+(*(filecfg_p+1)<<8); /* little endian */ + free(filecfg_p); + } + + /* the user do not want to show the menu, so normally bootup */ + if (!qemu_cfg_show_boot_menu()) { + if (splash_time > 0) { + while (get_keystroke(0) >= 0) + ; + enable_bootsplash(); + get_keystroke(splash_time); + disable_bootsplash(); + } return; + } else { + /* user want to show menu, check the if the bios config allow it */ + if (!CONFIG_BOOTMENU) + return; + } +
while (get_keystroke(0) >= 0) ;
On Mon, Jul 04, 2011 at 03:51:57PM +0800, Wayne Xia wrote:
make the showing time configurable.
Signed-off-by: Wayne Xia xiawenc@linux.vnet.ibm.com
Thanks. I'm okay with the first two patches, and will commit them if there are no further comments.
--- a/src/boot.c +++ b/src/boot.c @@ -381,8 +381,31 @@ boot_add_cbfs(void *data, const char *desc, int prio) static void interactive_bootmenu(void) {
- if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu())
- int filecfg_size;
- u8 *filecfg_p = romfile_loadfile("qemu_extra_params_fw.cfg", &filecfg_size);
- u16 splash_time = 0;
- if (filecfg_p != NULL && filecfg_size >= 2) {
splash_time = *(filecfg_p+0)+(*(filecfg_p+1)<<8); /* little endian */
free(filecfg_p);
- }
[...]
This patch should be simplified though - I think the boot code should end up looking something like:
static void interactive_bootmenu(void) { if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu()) return;
u32 menutime = romfile_getint("etc/bootmenu_wait", CONFIG_BOOTMENU_WAIT);
while (get_keystroke(0) >= 0) ;
printf("Press F12 for boot menu.\n\n");
enable_bootsplash(); int scan_code = get_keystroke(menutime); ...
That is, the config extraction should be abstracted out of the boot code, and a splash time variable shouldn't be needed as a bootmenu variable should be enough.
I'll try and write up the code for romfile_getint().
-Kevin
δΊ 2011-7-5 0:22, Kevin O'Connor ει:
On Mon, Jul 04, 2011 at 03:51:57PM +0800, Wayne Xia wrote:
make the showing time configurable.
Signed-off-by: Wayne Xiaxiawenc@linux.vnet.ibm.com
Thanks. I'm okay with the first two patches, and will commit them if there are no further comments.
--- a/src/boot.c +++ b/src/boot.c @@ -381,8 +381,31 @@ boot_add_cbfs(void *data, const char *desc, int prio) static void interactive_bootmenu(void) {
- if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu())
- int filecfg_size;
- u8 *filecfg_p = romfile_loadfile("qemu_extra_params_fw.cfg",&filecfg_size);
- u16 splash_time = 0;
- if (filecfg_p != NULL&& filecfg_size>= 2) {
splash_time = *(filecfg_p+0)+(*(filecfg_p+1)<<8); /* little endian */
free(filecfg_p);
- }
[...]
This patch should be simplified though - I think the boot code should end up looking something like:
static void interactive_bootmenu(void) { if (! CONFIG_BOOTMENU || ! qemu_cfg_show_boot_menu()) return;
u32 menutime = romfile_getint("etc/bootmenu_wait", CONFIG_BOOTMENU_WAIT); while (get_keystroke(0)>= 0) ; printf("Press F12 for boot menu.\n\n"); enable_bootsplash(); int scan_code = get_keystroke(menutime); ...
That is, the config extraction should be abstracted out of the boot code, and a splash time variable shouldn't be needed as a bootmenu variable should be enough.
I'll try and write up the code for romfile_getint().
I am OK about abstracting the time from seabios itself, but I think at the start of the "interactive_bootmenu(void)", a communication method with qemu, is needed, to let qemu decide whether to show the logo, when it is invoked without -menu=on specified.
So the splash_time acts like a flag more than a quantity variable. If it is removed, I think at this point the image data should be tried to read, to get the qemu's decision. maybe keep this variable here would make things simple.
-Kevin