blob: cd5597bc64698d61c56025afe9b82a38fb63b319 [file] [log] [blame]
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +01001.. SPDX-License-Identifier: GPL-2.0+
2.. (C) Copyright 2011-2012 Pali Rohรกr <pali@kernel.org>
3
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01004.. index::
5 single: bootmenu (command)
6
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +01007bootmenu command
8================
9
Masahisa Kojima35110242022-09-12 17:33:57 +090010Synopsis
11--------
12::
13
Heinrich Schuchardt0259d412024-11-27 08:06:30 +010014 bootmenu [-e] [delay]
Masahisa Kojima35110242022-09-12 17:33:57 +090015
16Description
17-----------
18
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +010019The "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
Heinrich Schuchardt37581cf2022-04-29 22:01:54 +020027The "bootmenu" command interprets ANSI escape sequences, so
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +010028an ANSI terminal is required for proper menu rendering and item
29selection.
30
Heinrich Schuchardt0259d412024-11-27 08:06:30 +010031-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
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +010039The 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>
Heinrich Schuchardt0259d412024-11-27 08:06:30 +010046 autostart delay in seconds
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +010047
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
Masahisa Kojima35110242022-09-12 17:33:57 +0900101UEFI 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
Masahisa Kojima3a9eb072023-02-02 18:24:43 +0900135"U-Boot console"/"Quit" or ESC key.
Masahisa Kojima35110242022-09-12 17:33:57 +0900136
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
Heinrich Schuchardt37581cf2022-04-29 22:01:54 +0200150The "bootmenu" command is enabled by::
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +0100151
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
Masahisa Kojima35110242022-09-12 17:33:57 +0900159
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"