blob: 294cc02b17a0aabebb6dd26a7a087415e76f4b46 [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
14 bootmenu [delay]
15
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
31The assembling of the menu is done via a set of environment variables
32"bootmenu_<num>" and "bootmenu_delay", i.e.::
33
34 bootmenu_delay=<delay>
35 bootmenu_<num>="<title>=<commands>"
36
37<delay>
38 is the autoboot delay in seconds, after which the first
39 menu entry will be selected automatically
40
41<num>
42 is the boot menu entry number, starting from zero
43
44<title>
45 is the text of the menu entry shown on the console
46 or on the boot screen
47
48<commands>
49 are commands which will be executed when a menu
50 entry is selected
51
52Title and commands are separated by the first appearance of a '='
53character in the value of the environment variable.
54
55The first (optional) argument of the "bootmenu" command is a delay specifier
56and it overrides the delay value defined by "bootmenu_delay" environment
57variable. If the environment variable "bootmenu_delay" is not set or if
58the argument of the "bootmenu" command is not specified, the default delay
59will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
60the console (or on the screen) and the command of the first menu entry will
61be called immediately. If delay is less then 0, bootmenu will be shown and
62autoboot will be disabled.
63
64Bootmenu always adds menu entry "U-Boot console" at the end of all menu
65entries specified by environment variables. When selecting this entry
66the bootmenu terminates and the usual U-Boot command prompt is presented
67to the user.
68
69Example environment::
70
71 setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry
72 setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry
73 setenv bootmenu_2 Reset board=reset # Set third menu entry
74 setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry
75 bootmenu 20 # Run bootmenu with autoboot delay 20s
76
77
78The above example will be rendered as below::
79
80 *** U-Boot Boot Menu ***
81
82 Boot 1. kernel
83 Boot 2. kernel
84 Reset board
85 U-Boot boot order
86 U-Boot console
87
88 Hit any key to stop autoboot: 20
89 Press UP/DOWN to move, ENTER to select
90
91The selected menu entry will be highlighted - it will have inverted
92background and text colors.
93
Masahisa Kojima35110242022-09-12 17:33:57 +090094UEFI boot variable enumeration
95''''''''''''''''''''''''''''''
96If enabled, the bootmenu command will automatically generate and add
97UEFI-related boot menu entries for the following items.
98
99 * possible bootable media with default file names
100 * user-defined UEFI boot options
101
102The bootmenu automatically enumerates the possible bootable
103media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
104This auto generated entry is named as "<interface> <devnum>:<part>" format.
105(e.g. "usb 0:1")
106
107The bootmenu displays the UEFI-related menu entries in order of "BootOrder".
108When the user selects the UEFI boot menu entry, the bootmenu sets
109the selected boot variable index to "BootNext" without non-volatile attribute,
110then call the uefi boot manager with the command "bootefi bootmgr".
111
112Example bootmenu is as below::
113
114 *** U-Boot Boot Menu ***
115
116 mmc 0:1
117 mmc 0:2
118 debian
119 nvme 0:1
120 ubuntu
121 nvme 0:2
122 usb 0:2
123 U-Boot console
124
125Default behavior when user exits from the bootmenu
126~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127User can exit from bootmenu by selecting the last entry
Masahisa Kojima3a9eb072023-02-02 18:24:43 +0900128"U-Boot console"/"Quit" or ESC key.
Masahisa Kojima35110242022-09-12 17:33:57 +0900129
130When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is disabled,
131user exits from the bootmenu and returns to the U-Boot console.
132
133When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not
134enter the U-Boot console. When the user exits from the bootmenu,
135the bootmenu invokes the following default behavior.
136
137 * if CONFIG_CMD_BOOTEFI_BOOTMGR is enabled, execute "bootefi bootmgr" command
138 * "bootefi bootmgr" fails or is not enabled, then execute "run bootcmd" command.
139
140Configuration
141-------------
142
Heinrich Schuchardt37581cf2022-04-29 22:01:54 +0200143The "bootmenu" command is enabled by::
Heinrich Schuchardtd2c0a052020-12-12 10:53:17 +0100144
145 CONFIG_CMD_BOOTMENU=y
146
147To run the bootmenu at startup add these additional settings::
148
149 CONFIG_AUTOBOOT_KEYED=y
150 CONFIG_BOOTDELAY=30
151 CONFIG_AUTOBOOT_MENU_SHOW=y
Masahisa Kojima35110242022-09-12 17:33:57 +0900152
153UEFI boot variable enumeration is enabled by::
154
155 CONFIG_CMD_BOOTEFI_BOOTMGR=y
156
157To improve the product security, entering U-Boot console from bootmenu
158can be disabled by::
159
160 CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE=y
161
162To scan the discoverable devices connected to the buses such as
163USB and PCIe prior to bootmenu showing up, CONFIG_PREBOOT can be
164used to run the command before showing the bootmenu, i.e.::
165
166 CONFIG_USE_PREBOOT=y
167 CONFIG_PREBOOT="pci enum; usb start; scsi scan; nvme scan; virtio scan"