README.bootmenu 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2011-2012 Pali Rohár <pali.rohar@gmail.com>
  4. */
  5. ANSI terminal bootmenu command
  6. The "bootmenu" command uses U-Boot menu interfaces and provides
  7. a simple mechanism for creating menus with different boot items.
  8. The cursor keys "Up" and "Down" are used for navigation through
  9. the items. Current active menu item is highlighted and can be
  10. selected using the "Enter" key. The selection of the highlighted
  11. menu entry invokes an U-Boot command (or a list of commands)
  12. associated with this menu entry.
  13. The "bootmenu" command interprets ANSI escape sequencies, so
  14. an ANSI terminal is required for proper menu rendering and item
  15. selection.
  16. The assembling of the menu is done via a set of environment variables
  17. "bootmenu_<num>" and "bootmenu_delay", i.e.:
  18. bootmenu_delay=<delay>
  19. bootmenu_<num>="<title>=<commands>"
  20. <delay> is the autoboot delay in seconds, after which the first
  21. menu entry will be selected automatically
  22. <num> is the boot menu entry number, starting from zero
  23. <title> is the text of the menu entry shown on the console
  24. or on the boot screen
  25. <commands> are commands which will be executed when a menu
  26. entry is selected
  27. (title and commands are separated by first appearance of '='
  28. character in the environment variable)
  29. First (optional) argument of the "bootmenu" command is a delay specifier
  30. and it overrides the delay value defined by "bootmenu_delay" environment
  31. variable. If the environment variable "bootmenu_delay" is not set or if
  32. the argument of the "bootmenu" command is not specified, the default delay
  33. will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
  34. the console (or on the screen) and the command of the first menu entry will
  35. be called immediately. If delay is less then 0, bootmenu will be shown and
  36. autoboot will be disabled.
  37. Bootmenu always adds menu entry "U-Boot console" at the end of all menu
  38. entries specified by environment variables. When selecting this entry
  39. the bootmenu terminates and the usual U-Boot command prompt is presented
  40. to the user.
  41. Example environment:
  42. setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry
  43. setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry
  44. setenv bootmenu_2 Reset board=reset # Set third menu entry
  45. setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry
  46. bootmenu 20 # Run bootmenu with autoboot delay 20s
  47. The above example will be rendered as below
  48. (without decorating rectangle):
  49. ┌──────────────────────────────────────────┐
  50. │ │
  51. │ *** U-Boot Boot Menu *** │
  52. │ │
  53. │ Boot 1. kernel │
  54. │ Boot 2. kernel │
  55. │ Reset board │
  56. │ U-Boot boot order │
  57. │ U-Boot console │
  58. │ │
  59. │ Hit any key to stop autoboot: 20 │
  60. │ Press UP/DOWN to move, ENTER to select │
  61. │ │
  62. └──────────────────────────────────────────┘
  63. Selected menu entry will be highlighted - it will have inverted
  64. background and text colors.
  65. To enable the "bootmenu" command add following definitions to the
  66. board config file:
  67. #define CONFIG_CMD_BOOTMENU
  68. #define CONFIG_MENU
  69. To run the bootmenu at startup add these additional definitions:
  70. #define CONFIG_AUTOBOOT_KEYED
  71. #define CONFIG_BOOTDELAY 30
  72. #define CONFIG_AUTOBOOT_MENU_SHOW
  73. When you intend to use the bootmenu on color frame buffer console,
  74. make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the
  75. board config file.