bootmenu.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. .. (C) Copyright 2011-2012 Pali Rohár <pali@kernel.org>
  3. bootmenu command
  4. ================
  5. Synopsis
  6. --------
  7. ::
  8. bootmenu [delay]
  9. Description
  10. -----------
  11. The "bootmenu" command uses U-Boot menu interfaces and provides
  12. a simple mechanism for creating menus with different boot items.
  13. The cursor keys "Up" and "Down" are used for navigation through
  14. the items. Current active menu item is highlighted and can be
  15. selected using the "Enter" key. The selection of the highlighted
  16. menu entry invokes an U-Boot command (or a list of commands)
  17. associated with this menu entry.
  18. The "bootmenu" command interprets ANSI escape sequences, so
  19. an ANSI terminal is required for proper menu rendering and item
  20. selection.
  21. The assembling of the menu is done via a set of environment variables
  22. "bootmenu_<num>" and "bootmenu_delay", i.e.::
  23. bootmenu_delay=<delay>
  24. bootmenu_<num>="<title>=<commands>"
  25. <delay>
  26. is the autoboot delay in seconds, after which the first
  27. menu entry will be selected automatically
  28. <num>
  29. is the boot menu entry number, starting from zero
  30. <title>
  31. is the text of the menu entry shown on the console
  32. or on the boot screen
  33. <commands>
  34. are commands which will be executed when a menu
  35. entry is selected
  36. Title and commands are separated by the first appearance of a '='
  37. character in the value of the environment variable.
  38. The first (optional) argument of the "bootmenu" command is a delay specifier
  39. and it overrides the delay value defined by "bootmenu_delay" environment
  40. variable. If the environment variable "bootmenu_delay" is not set or if
  41. the argument of the "bootmenu" command is not specified, the default delay
  42. will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
  43. the console (or on the screen) and the command of the first menu entry will
  44. be called immediately. If delay is less then 0, bootmenu will be shown and
  45. autoboot will be disabled.
  46. Bootmenu always adds menu entry "U-Boot console" at the end of all menu
  47. entries specified by environment variables. When selecting this entry
  48. the bootmenu terminates and the usual U-Boot command prompt is presented
  49. to the user.
  50. Example environment::
  51. setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry
  52. setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry
  53. setenv bootmenu_2 Reset board=reset # Set third menu entry
  54. setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry
  55. bootmenu 20 # Run bootmenu with autoboot delay 20s
  56. The above example will be rendered as below::
  57. *** U-Boot Boot Menu ***
  58. Boot 1. kernel
  59. Boot 2. kernel
  60. Reset board
  61. U-Boot boot order
  62. U-Boot console
  63. Hit any key to stop autoboot: 20
  64. Press UP/DOWN to move, ENTER to select
  65. The selected menu entry will be highlighted - it will have inverted
  66. background and text colors.
  67. UEFI boot variable enumeration
  68. ''''''''''''''''''''''''''''''
  69. If enabled, the bootmenu command will automatically generate and add
  70. UEFI-related boot menu entries for the following items.
  71. * possible bootable media with default file names
  72. * user-defined UEFI boot options
  73. The bootmenu automatically enumerates the possible bootable
  74. media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
  75. This auto generated entry is named as "<interface> <devnum>:<part>" format.
  76. (e.g. "usb 0:1")
  77. The bootmenu displays the UEFI-related menu entries in order of "BootOrder".
  78. When the user selects the UEFI boot menu entry, the bootmenu sets
  79. the selected boot variable index to "BootNext" without non-volatile attribute,
  80. then call the uefi boot manager with the command "bootefi bootmgr".
  81. Example bootmenu is as below::
  82. *** U-Boot Boot Menu ***
  83. mmc 0:1
  84. mmc 0:2
  85. debian
  86. nvme 0:1
  87. ubuntu
  88. nvme 0:2
  89. usb 0:2
  90. U-Boot console
  91. Default behavior when user exits from the bootmenu
  92. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  93. User can exit from bootmenu by selecting the last entry
  94. "U-Boot console"/"Quit" or ESC key.
  95. When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is disabled,
  96. user exits from the bootmenu and returns to the U-Boot console.
  97. When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not
  98. enter the U-Boot console. When the user exits from the bootmenu,
  99. the bootmenu invokes the following default behavior.
  100. * if CONFIG_CMD_BOOTEFI_BOOTMGR is enabled, execute "bootefi bootmgr" command
  101. * "bootefi bootmgr" fails or is not enabled, then execute "run bootcmd" command.
  102. Configuration
  103. -------------
  104. The "bootmenu" command is enabled by::
  105. CONFIG_CMD_BOOTMENU=y
  106. To run the bootmenu at startup add these additional settings::
  107. CONFIG_AUTOBOOT_KEYED=y
  108. CONFIG_BOOTDELAY=30
  109. CONFIG_AUTOBOOT_MENU_SHOW=y
  110. UEFI boot variable enumeration is enabled by::
  111. CONFIG_CMD_BOOTEFI_BOOTMGR=y
  112. To improve the product security, entering U-Boot console from bootmenu
  113. can be disabled by::
  114. CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE=y
  115. To scan the discoverable devices connected to the buses such as
  116. USB and PCIe prior to bootmenu showing up, CONFIG_PREBOOT can be
  117. used to run the command before showing the bootmenu, i.e.::
  118. CONFIG_USE_PREBOOT=y
  119. CONFIG_PREBOOT="pci enum; usb start; scsi scan; nvme scan; virtio scan"