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