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