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