]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | SPDX-License-Identifier: GPL-2.0+ |
e7abe919 | 2 | /* |
53086653 | 3 | * (C) Copyright 2011-2012 Pali Rohár <[email protected]> |
e7abe919 T |
4 | */ |
5 | ||
6 | ANSI terminal bootmenu command | |
7 | ||
8 | The "bootmenu" command uses U-Boot menu interfaces and provides | |
9 | a simple mechanism for creating menus with different boot items. | |
10 | The cursor keys "Up" and "Down" are used for navigation through | |
11 | the items. Current active menu item is highlighted and can be | |
12 | selected using the "Enter" key. The selection of the highlighted | |
13 | menu entry invokes an U-Boot command (or a list of commands) | |
14 | associated with this menu entry. | |
15 | ||
16 | The "bootmenu" command interprets ANSI escape sequencies, so | |
17 | an ANSI terminal is required for proper menu rendering and item | |
18 | selection. | |
19 | ||
20 | The 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 | ||
40 | First (optional) argument of the "bootmenu" command is a delay specifier | |
41 | and it overrides the delay value defined by "bootmenu_delay" environment | |
42 | variable. If the environment variable "bootmenu_delay" is not set or if | |
43 | the argument of the "bootmenu" command is not specified, the default delay | |
44 | will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on | |
45 | the console (or on the screen) and the command of the first menu entry will | |
46 | be called immediately. If delay is less then 0, bootmenu will be shown and | |
47 | autoboot will be disabled. | |
48 | ||
49 | Bootmenu always adds menu entry "U-Boot console" at the end of all menu | |
50 | entries specified by environment variables. When selecting this entry | |
51 | the bootmenu terminates and the usual U-Boot command prompt is presented | |
52 | to the user. | |
53 | ||
54 | Example 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 | ||
63 | The 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 | ||
81 | Selected menu entry will be highlighted - it will have inverted | |
82 | background and text colors. | |
83 | ||
84 | To enable the "bootmenu" command add following definitions to the | |
85 | board config file: | |
86 | ||
87 | #define CONFIG_CMD_BOOTMENU | |
88 | #define CONFIG_MENU | |
89 | ||
90 | To run the bootmenu at startup add these additional definitions: | |
91 | ||
92 | #define CONFIG_AUTOBOOT_KEYED | |
93 | #define CONFIG_BOOTDELAY 30 | |
e231306e | 94 | #define CONFIG_AUTOBOOT_MENU_SHOW |
e7abe919 T |
95 | |
96 | When you intend to use the bootmenu on color frame buffer console, | |
97 | make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the | |
98 | board config file. |