xref: /openbmc/u-boot/doc/README.bootmenu (revision 62e92077)
1/*
2 * (C) Copyright 2011-2012 Pali Rohár <pali.rohar@gmail.com>
3 *
4 * SPDX-License-Identifier:	GPL-2.0+
5 */
6
7ANSI terminal bootmenu command
8
9The "bootmenu" command uses U-Boot menu interfaces and provides
10a simple mechanism for creating menus with different boot items.
11The cursor keys "Up" and "Down" are used for navigation through
12the items. Current active menu item is highlighted and can be
13selected using the "Enter" key. The selection of the highlighted
14menu entry invokes an U-Boot command (or a list of commands)
15associated with this menu entry.
16
17The "bootmenu" command interprets ANSI escape sequencies, so
18an ANSI terminal is required for proper menu rendering and item
19selection.
20
21The assembling of the menu is done via a set of environment variables
22"bootmenu_<num>" and "bootmenu_delay", i.e.:
23
24  bootmenu_delay=<delay>
25  bootmenu_<num>="<title>=<commands>"
26
27  <delay> is the autoboot delay in seconds, after which the first
28  menu entry will be selected automatically
29
30  <num> is the boot menu entry number, starting from zero
31
32  <title> is the text of the menu entry shown on the console
33  or on the boot screen
34
35  <commands> are commands which will be executed when a menu
36  entry is selected
37
38  (title and commands are separated by first appearance of '='
39   character in the environment variable)
40
41First (optional) argument of the "bootmenu" command is a delay specifier
42and it overrides the delay value defined by "bootmenu_delay" environment
43variable. If the environment variable "bootmenu_delay" is not set or if
44the argument of the "bootmenu" command is not specified, the default delay
45will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on
46the console (or on the screen) and the command of the first menu entry will
47be called immediately. If delay is less then 0, bootmenu will be shown and
48autoboot will be disabled.
49
50Bootmenu always adds menu entry "U-Boot console" at the end of all menu
51entries specified by environment variables. When selecting this entry
52the bootmenu terminates and the usual U-Boot command prompt is presented
53to the user.
54
55Example environment:
56
57  setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000  # Set first menu entry
58  setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000  # Set second menu entry
59  setenv bootmenu_2 Reset board=reset                # Set third menu entry
60  setenv bootmenu_3 U-Boot boot order=boot           # Set fourth menu entry
61  bootmenu 20        # Run bootmenu with autoboot delay 20s
62
63
64The above example will be rendered as below
65(without decorating rectangle):
66
67┌──────────────────────────────────────────┐
68│                                          │
69│  *** U-Boot Boot Menu ***                │
70│                                          │
71│     Boot 1. kernel                       │
72│     Boot 2. kernel                       │
73│     Reset board                          │
74│     U-Boot boot order                    │
75│     U-Boot console                       │
76│                                          │
77│  Hit any key to stop autoboot: 20        │
78│  Press UP/DOWN to move, ENTER to select  │
79│                                          │
80└──────────────────────────────────────────┘
81
82Selected menu entry will be highlighted - it will have inverted
83background and text colors.
84
85To enable the "bootmenu" command add following definitions to the
86board config file:
87
88  #define CONFIG_CMD_BOOTMENU
89  #define CONFIG_MENU
90
91To run the bootmenu at startup add these additional definitions:
92
93  #define CONFIG_AUTOBOOT_KEYED
94  #define CONFIG_BOOTDELAY 30
95  #define CONFIG_MENU_SHOW
96
97When you intend to use the bootmenu on color frame buffer console,
98make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the
99board config file.
100