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