README.bootmenu 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * (C) Copyright 2011-2012 Pali Rohár <pali.rohar@gmail.com>
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. ANSI terminal bootmenu command
  23. The "bootmenu" command uses U-Boot menu interfaces and provides
  24. a simple mechanism for creating menus with different boot items.
  25. The cursor keys "Up" and "Down" are used for navigation through
  26. the items. Current active menu item is highlighted and can be
  27. selected using the "Enter" key. The selection of the highlighted
  28. menu entry invokes an U-Boot command (or a list of commands)
  29. associated with this menu entry.
  30. The "bootmenu" command interprets ANSI escape sequencies, so
  31. an ANSI terminal is required for proper menu rendering and item
  32. selection.
  33. The assembling of the menu is done via a set of environment variables
  34. "bootmenu_<num>" and "bootmenu_delay", i.e.:
  35. bootmenu_delay=<delay>
  36. bootmenu_<num>="<title>=<commands>"
  37. <delay> is the autoboot delay in seconds, after which the first
  38. menu entry will be selected automatically
  39. <num> is the boot menu entry number, starting from zero
  40. <title> is the text of the menu entry shown on the console
  41. or on the boot screen
  42. <commands> are commands which will be executed when a menu
  43. entry is selected
  44. (title and commands are separated by first appearance of '='
  45. character in the environment variable)
  46. First (optional) argument of the "bootmenu" command is a delay specifier
  47. and it overrides the delay value defined by "bootmenu_delay" environment
  48. variable. If the environment variable "bootmenu_delay" is not set or if
  49. the argument of the "bootmenu" command is not specified, the default delay
  50. will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
  51. the console (or on the screen) and the command of the first menu entry will
  52. be called immediately. If delay is less then 0, bootmenu will be shown and
  53. autoboot will be disabled.
  54. Bootmenu always adds menu entry "U-Boot console" at the end of all menu
  55. entries specified by environment variables. When selecting this entry
  56. the bootmenu terminates and the usual U-Boot command prompt is presented
  57. to the user.
  58. Example environment:
  59. setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry
  60. setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry
  61. setenv bootmenu_2 Reset board=reset # Set third menu entry
  62. setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry
  63. bootmenu 20 # Run bootmenu with autoboot delay 20s
  64. The above example will be rendered as below
  65. (without decorating rectangle):
  66. ┌──────────────────────────────────────────┐
  67. │ │
  68. │ *** U-Boot Boot Menu *** │
  69. │ │
  70. │ Boot 1. kernel │
  71. │ Boot 2. kernel │
  72. │ Reset board │
  73. │ U-Boot boot order │
  74. │ U-Boot console │
  75. │ │
  76. │ Hit any key to stop autoboot: 20 │
  77. │ Press UP/DOWN to move, ENTER to select │
  78. │ │
  79. └──────────────────────────────────────────┘
  80. Selected menu entry will be highlighted - it will have inverted
  81. background and text colors.
  82. To enable the "bootmenu" command add following definitions to the
  83. board config file:
  84. #define CONFIG_CMD_BOOTMENU
  85. #define CONFIG_MENU
  86. To run the bootmenu at startup add these additional definitions:
  87. #define CONFIG_AUTOBOOT_KEYED
  88. #define CONFIG_BOOTDELAY 30
  89. #define CONFIG_MENU_SHOW
  90. When you intend to use the bootmenu on color frame buffer console,
  91. make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the
  92. board config file.