1*cc1c8a13Swdenk/* 2*cc1c8a13Swdenk * (C) Copyright 2001 3*cc1c8a13Swdenk * Dave Ellis, SIXNET, dge@sixnetio.com 4*cc1c8a13Swdenk * 5*cc1c8a13Swdenk * See file CREDITS for list of people who contributed to this 6*cc1c8a13Swdenk * project. 7*cc1c8a13Swdenk * 8*cc1c8a13Swdenk * This program is free software; you can redistribute it and/or 9*cc1c8a13Swdenk * modify it under the terms of the GNU General Public License as 10*cc1c8a13Swdenk * published by the Free Software Foundation; either version 2 of 11*cc1c8a13Swdenk * the License, or (at your option) any later version. 12*cc1c8a13Swdenk * 13*cc1c8a13Swdenk * This program is distributed in the hope that it will be useful, 14*cc1c8a13Swdenk * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*cc1c8a13Swdenk * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*cc1c8a13Swdenk * GNU General Public License for more details. 17*cc1c8a13Swdenk * 18*cc1c8a13Swdenk * You should have received a copy of the GNU General Public License 19*cc1c8a13Swdenk * along with this program; if not, write to the Free Software 20*cc1c8a13Swdenk * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21*cc1c8a13Swdenk * MA 02111-1307 USA 22*cc1c8a13Swdenk */ 23*cc1c8a13Swdenk 24*cc1c8a13SwdenkUsing autoboot configuration options 25*cc1c8a13Swdenk==================================== 26*cc1c8a13Swdenk 27*cc1c8a13SwdenkThe basic autoboot configuration options are documented in the main 28*cc1c8a13SwdenkU-Boot README. See it for details. They are: 29*cc1c8a13Swdenk 30*cc1c8a13Swdenk bootdelay 31*cc1c8a13Swdenk bootcmd 32*cc1c8a13Swdenk CONFIG_BOOTDELAY 33*cc1c8a13Swdenk CONFIG_BOOTCOMMAND 34*cc1c8a13Swdenk 35*cc1c8a13SwdenkSome additional options that make autoboot safer in a production 36*cc1c8a13Swdenkproduct are documented here. 37*cc1c8a13Swdenk 38*cc1c8a13SwdenkWhy use them? 39*cc1c8a13Swdenk------------- 40*cc1c8a13Swdenk 41*cc1c8a13SwdenkThe basic autoboot feature allows a system to automatically boot to 42*cc1c8a13Swdenkthe real application (such as Linux) without a user having to enter 43*cc1c8a13Swdenkany commands. If any key is pressed before the boot delay time 44*cc1c8a13Swdenkexpires, U-Boot stops the autoboot process, gives a U-Boot prompt 45*cc1c8a13Swdenkand waits forever for a command. That's a good thing if you pressed a 46*cc1c8a13Swdenkkey because you wanted to get the prompt. 47*cc1c8a13Swdenk 48*cc1c8a13SwdenkIt's not so good if the key press was a stray character on the 49*cc1c8a13Swdenkconsole serial port, say because a user who knows nothing about 50*cc1c8a13SwdenkU-Boot pressed a key before the system had time to boot. It's even 51*cc1c8a13Swdenkworse on an embedded product that doesn't have a console during 52*cc1c8a13Swdenknormal use. The modem plugged into that console port sends a 53*cc1c8a13Swdenkcharacter at the wrong time and the system hangs, with no clue as to 54*cc1c8a13Swdenkwhy it isn't working. 55*cc1c8a13Swdenk 56*cc1c8a13SwdenkYou might want the system to autoboot to recover after an external 57*cc1c8a13Swdenkconfiguration program stops autoboot. If the configuration program 58*cc1c8a13Swdenkdies or loses its connection (modems can disconnect at the worst 59*cc1c8a13Swdenktime) U-Boot will patiently wait forever for it to finish. 60*cc1c8a13Swdenk 61*cc1c8a13SwdenkThese additional configuration options can help provide a system that 62*cc1c8a13Swdenkboots when it should, but still allows access to U-Boot. 63*cc1c8a13Swdenk 64*cc1c8a13SwdenkWhat they do 65*cc1c8a13Swdenk------------ 66*cc1c8a13Swdenk 67*cc1c8a13Swdenk CONFIG_BOOT_RETRY_TIME 68*cc1c8a13Swdenk CONFIG_BOOT_RETRY_MIN 69*cc1c8a13Swdenk 70*cc1c8a13Swdenk bootretry environment variable 71*cc1c8a13Swdenk 72*cc1c8a13Swdenk These options determine what happens after autoboot is 73*cc1c8a13Swdenk stopped and U-Boot is waiting for commands. 74*cc1c8a13Swdenk 75*cc1c8a13Swdenk CONFIG_BOOT_RETRY_TIME must be defined to enable the boot 76*cc1c8a13Swdenk retry feature. If the environment variable 'bootretry' is 77*cc1c8a13Swdenk found then its value is used, otherwise the retry timeout is 78*cc1c8a13Swdenk CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and 79*cc1c8a13Swdenk defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds. 80*cc1c8a13Swdenk 81*cc1c8a13Swdenk If the retry timeout is negative, the U-Boot command prompt 82*cc1c8a13Swdenk never times out. Otherwise it is forced to be at least 83*cc1c8a13Swdenk CONFIG_BOOT_RETRY_MIN seconds. If no valid U-Boot command is 84*cc1c8a13Swdenk entered before the specified time the boot delay sequence is 85*cc1c8a13Swdenk restarted. Each command that U-Boot executes restarts the 86*cc1c8a13Swdenk timeout. 87*cc1c8a13Swdenk 88*cc1c8a13Swdenk If CONFIG_BOOT_RETRY_TIME < 0 the feature is there, but 89*cc1c8a13Swdenk doesn't do anything unless the environment variable 90*cc1c8a13Swdenk 'bootretry' is >= 0. 91*cc1c8a13Swdenk 92*cc1c8a13Swdenk CONFIG_AUTOBOOT_KEYED 93*cc1c8a13Swdenk CONFIG_AUTOBOOT_PROMPT 94*cc1c8a13Swdenk CONFIG_AUTOBOOT_DELAY_STR 95*cc1c8a13Swdenk CONFIG_AUTOBOOT_STOP_STR 96*cc1c8a13Swdenk CONFIG_AUTOBOOT_DELAY_STR2 97*cc1c8a13Swdenk CONFIG_AUTOBOOT_STOP_STR2 98*cc1c8a13Swdenk 99*cc1c8a13Swdenk bootdelaykey environment variable 100*cc1c8a13Swdenk bootstopkey environment variable 101*cc1c8a13Swdenk bootdelaykey2 environment variable 102*cc1c8a13Swdenk bootstopkey2 environment variable 103*cc1c8a13Swdenk 104*cc1c8a13Swdenk These options give more control over stopping autoboot. When 105*cc1c8a13Swdenk they are used a specific character or string is required to 106*cc1c8a13Swdenk stop or delay autoboot. 107*cc1c8a13Swdenk 108*cc1c8a13Swdenk Define CONFIG_AUTOBOOT_KEYED (no value required) to enable 109*cc1c8a13Swdenk this group of options. CONFIG_AUTOBOOT_DELAY_STR, 110*cc1c8a13Swdenk CONFIG_AUTOBOOT_STOP_STR or both should be specified (or 111*cc1c8a13Swdenk specified by the corresponding environment variable), 112*cc1c8a13Swdenk otherwise there is no way to stop autoboot. 113*cc1c8a13Swdenk 114*cc1c8a13Swdenk CONFIG_AUTOBOOT_PROMPT is displayed before the boot delay 115*cc1c8a13Swdenk selected by CONFIG_BOOTDELAY starts. If it is not defined 116*cc1c8a13Swdenk there is no output indicating that autoboot is in progress. 117*cc1c8a13Swdenk If "%d" is included, it is replaced by the number of seconds 118*cc1c8a13Swdenk remaining before autoboot will start, but it does not count 119*cc1c8a13Swdenk down the seconds. "autoboot in %d seconds\n" is a reasonable 120*cc1c8a13Swdenk prompt. 121*cc1c8a13Swdenk 122*cc1c8a13Swdenk If CONFIG_AUTOBOOT_DELAY_STR or bootdelaykey is specified and 123*cc1c8a13Swdenk this string is received from console input before autoboot 124*cc1c8a13Swdenk starts booting, U-Boot gives a command prompt. The U-Boot 125*cc1c8a13Swdenk prompt will time out if CONFIG_BOOT_RETRY_TIME is used, 126*cc1c8a13Swdenk otherwise it never times out. 127*cc1c8a13Swdenk 128*cc1c8a13Swdenk If CONFIG_AUTOBOOT_STOP_STR or bootstopkey is specified and 129*cc1c8a13Swdenk this string is received from console input before autoboot 130*cc1c8a13Swdenk starts booting, U-Boot gives a command prompt. The U-Boot 131*cc1c8a13Swdenk prompt never times out, even if CONFIG_BOOT_RETRY_TIME is 132*cc1c8a13Swdenk used. 133*cc1c8a13Swdenk 134*cc1c8a13Swdenk The string recognition is not very sophisticated. If a 135*cc1c8a13Swdenk partial match is detected, the first non-matching character 136*cc1c8a13Swdenk is checked to see if starts a new match. There is no check 137*cc1c8a13Swdenk for a shorter partial match, so it's best if the first 138*cc1c8a13Swdenk character of a key string does not appear in the rest of the 139*cc1c8a13Swdenk string. 140*cc1c8a13Swdenk 141*cc1c8a13Swdenk Using the CONFIG_AUTOBOOT_DELAY_STR2 / bootdelaykey2 and/or 142*cc1c8a13Swdenk CONFIG_AUTOBOOT_STOP_STR2 / bootstopkey #defines and/or 143*cc1c8a13Swdenk environment variables you can specify a second, alternate 144*cc1c8a13Swdenk string (which allows you to haw two "password" strings). 145*cc1c8a13Swdenk 146*cc1c8a13Swdenk CONFIG_ZERO_BOOTDELAY_CHECK 147*cc1c8a13Swdenk 148*cc1c8a13Swdenk If this option is defined, you can stop the autoboot process 149*cc1c8a13Swdenk by hitting a key even in that case when "bootdelay" has been 150*cc1c8a13Swdenk set to 0. You can set "bootdelay" to a negative value to 151*cc1c8a13Swdenk prevent the check for console input. 152*cc1c8a13Swdenk 153*cc1c8a13Swdenk CONFIG_RESET_TO_RETRY 154*cc1c8a13Swdenk 155*cc1c8a13Swdenk (Only effective when CONFIG_BOOT_RETRY_TIME is also set) 156*cc1c8a13Swdenk After the countdown timed out, the board will be reset to restart 157*cc1c8a13Swdenk again. 158*cc1c8a13Swdenk 159