Heinrich Schuchardt | d2c0a05 | 2020-12-12 10:53:17 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. (C) Copyright 2011-2012 Pali Rohรกr <pali@kernel.org> |
| 3 | |
| 4 | bootmenu command |
| 5 | ================ |
| 6 | |
| 7 | The "bootmenu" command uses U-Boot menu interfaces and provides |
| 8 | a simple mechanism for creating menus with different boot items. |
| 9 | The cursor keys "Up" and "Down" are used for navigation through |
| 10 | the items. Current active menu item is highlighted and can be |
| 11 | selected using the "Enter" key. The selection of the highlighted |
| 12 | menu entry invokes an U-Boot command (or a list of commands) |
| 13 | associated with this menu entry. |
| 14 | |
Heinrich Schuchardt | 37581cf | 2022-04-29 22:01:54 +0200 | [diff] [blame] | 15 | The "bootmenu" command interprets ANSI escape sequences, so |
Heinrich Schuchardt | d2c0a05 | 2020-12-12 10:53:17 +0100 | [diff] [blame] | 16 | an ANSI terminal is required for proper menu rendering and item |
| 17 | selection. |
| 18 | |
| 19 | The assembling of the menu is done via a set of environment variables |
| 20 | "bootmenu_<num>" and "bootmenu_delay", i.e.:: |
| 21 | |
| 22 | bootmenu_delay=<delay> |
| 23 | bootmenu_<num>="<title>=<commands>" |
| 24 | |
| 25 | <delay> |
| 26 | is the autoboot delay in seconds, after which the first |
| 27 | menu entry will be selected automatically |
| 28 | |
| 29 | <num> |
| 30 | is the boot menu entry number, starting from zero |
| 31 | |
| 32 | <title> |
| 33 | is the text of the menu entry shown on the console |
| 34 | or on the boot screen |
| 35 | |
| 36 | <commands> |
| 37 | are commands which will be executed when a menu |
| 38 | entry is selected |
| 39 | |
| 40 | Title and commands are separated by the first appearance of a '=' |
| 41 | character in the value of the environment variable. |
| 42 | |
| 43 | The first (optional) argument of the "bootmenu" command is a delay specifier |
| 44 | and it overrides the delay value defined by "bootmenu_delay" environment |
| 45 | variable. If the environment variable "bootmenu_delay" is not set or if |
| 46 | the argument of the "bootmenu" command is not specified, the default delay |
| 47 | will be CONFIG_BOOTDELAY. If delay is 0, no menu entries will be shown on |
| 48 | the console (or on the screen) and the command of the first menu entry will |
| 49 | be called immediately. If delay is less then 0, bootmenu will be shown and |
| 50 | autoboot will be disabled. |
| 51 | |
| 52 | Bootmenu always adds menu entry "U-Boot console" at the end of all menu |
| 53 | entries specified by environment variables. When selecting this entry |
| 54 | the bootmenu terminates and the usual U-Boot command prompt is presented |
| 55 | to the user. |
| 56 | |
| 57 | Example environment:: |
| 58 | |
| 59 | setenv bootmenu_0 Boot 1. kernel=bootm 0x82000000 # Set first menu entry |
| 60 | setenv bootmenu_1 Boot 2. kernel=bootm 0x83000000 # Set second menu entry |
| 61 | setenv bootmenu_2 Reset board=reset # Set third menu entry |
| 62 | setenv bootmenu_3 U-Boot boot order=boot # Set fourth menu entry |
| 63 | bootmenu 20 # Run bootmenu with autoboot delay 20s |
| 64 | |
| 65 | |
| 66 | The above example will be rendered as below:: |
| 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 | The selected menu entry will be highlighted - it will have inverted |
| 80 | background and text colors. |
| 81 | |
Heinrich Schuchardt | 37581cf | 2022-04-29 22:01:54 +0200 | [diff] [blame] | 82 | The "bootmenu" command is enabled by:: |
Heinrich Schuchardt | d2c0a05 | 2020-12-12 10:53:17 +0100 | [diff] [blame] | 83 | |
| 84 | CONFIG_CMD_BOOTMENU=y |
| 85 | |
| 86 | To run the bootmenu at startup add these additional settings:: |
| 87 | |
| 88 | CONFIG_AUTOBOOT_KEYED=y |
| 89 | CONFIG_BOOTDELAY=30 |
| 90 | CONFIG_AUTOBOOT_MENU_SHOW=y |