diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-24 17:04:57 +0900 | 
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2018-06-05 20:19:08 -0400 | 
| commit | 86fbad2492cc51f0489253d50ce5f06b5e5b2fb9 (patch) | |
| tree | 3b02198cbdc22db98dec9f59a2f66c978f81c093 /lib/efi_loader | |
| parent | 955575c8dc83a1e4cee69d3ebcc03eef5634aedf (diff) | |
menu: fix timeout duration
For distro-boot, the TIMEOUT directive in the boot script specifies
how long to pause in units of 1/10 sec. [1]
Commit 8594753ba0a7 ("menu: only timeout when menu is displayed")
corrected this by simply dividing the timeout value by 10 in
menu_interactive_choice().
I see two problems:
 - For example, "TIMEOUT 5" should wait for 0.5 sec, but the current
   implementation cannot handle the granularity of 1/10 sec.
   In fact, it never breaks because "m->timeout / 10" is zero,
   which means no timeout.
 - The menu API is used not only by cmd/pxe.c but also by
   common/autoboot.c .  For the latter case, the unit of the
   timeout value is _second_ because its default is associated
   with CONFIG_BOOTDELAY.
To fix the first issue, use DIV_ROUND_UP() so that the timeout value
is rounded up to the closest integer.
For the second issue, move the division to the boundary between
cmd/pxe.c and common/menu.c .  This is a more desirable place because
the comment of struct pxe_menu says:
 * timeout - time in tenths of a second to wait for a user key-press before
 *           booting the default label.
Then, the comment of menu_create() says:
 * timeout - A delay in seconds to wait for user input. If 0, timeout is
 * disabled, and the default choice will be returned unless prompt is 1.
[1] https://www.syslinux.org/wiki/index.php?title=SYSLINUX#TIMEOUT_timeout
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'lib/efi_loader')
0 files changed, 0 insertions, 0 deletions
