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