xref: /openbmc/u-boot/doc/README.autoboot (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom RiniSPDX-License-Identifier: GPL-2.0+
2cc1c8a13Swdenk/*
3cc1c8a13Swdenk * (C) Copyright 2001
4cc1c8a13Swdenk * Dave Ellis, SIXNET, dge@sixnetio.com
5cc1c8a13Swdenk *
6cc1c8a13Swdenk */
7cc1c8a13Swdenk
8cc1c8a13SwdenkUsing autoboot configuration options
9cc1c8a13Swdenk====================================
10cc1c8a13Swdenk
11cc1c8a13SwdenkThe basic autoboot configuration options are documented in the main
12cc1c8a13SwdenkU-Boot README. See it for details. They are:
13cc1c8a13Swdenk
14cc1c8a13Swdenk  bootdelay
15cc1c8a13Swdenk  bootcmd
16cc1c8a13Swdenk  CONFIG_BOOTDELAY
17cc1c8a13Swdenk  CONFIG_BOOTCOMMAND
18cc1c8a13Swdenk
19cc1c8a13SwdenkSome additional options that make autoboot safer in a production
20cc1c8a13Swdenkproduct are documented here.
21cc1c8a13Swdenk
22cc1c8a13SwdenkWhy use them?
23cc1c8a13Swdenk-------------
24cc1c8a13Swdenk
25cc1c8a13SwdenkThe basic autoboot feature allows a system to automatically boot to
26cc1c8a13Swdenkthe real application (such as Linux) without a user having to enter
27cc1c8a13Swdenkany commands. If any key is pressed before the boot delay time
28cc1c8a13Swdenkexpires, U-Boot stops the autoboot process, gives a U-Boot prompt
29cc1c8a13Swdenkand waits forever for a command. That's a good thing if you pressed a
30cc1c8a13Swdenkkey because you wanted to get the prompt.
31cc1c8a13Swdenk
32cc1c8a13SwdenkIt's not so good if the key press was a stray character on the
33cc1c8a13Swdenkconsole serial port, say because a user who knows nothing about
34cc1c8a13SwdenkU-Boot pressed a key before the system had time to boot. It's even
35cc1c8a13Swdenkworse on an embedded product that doesn't have a console during
36cc1c8a13Swdenknormal use. The modem plugged into that console port sends a
37cc1c8a13Swdenkcharacter at the wrong time and the system hangs, with no clue as to
38cc1c8a13Swdenkwhy it isn't working.
39cc1c8a13Swdenk
40cc1c8a13SwdenkYou might want the system to autoboot to recover after an external
41cc1c8a13Swdenkconfiguration program stops autoboot. If the configuration program
42cc1c8a13Swdenkdies or loses its connection (modems can disconnect at the worst
43cc1c8a13Swdenktime) U-Boot will patiently wait forever for it to finish.
44cc1c8a13Swdenk
45cc1c8a13SwdenkThese additional configuration options can help provide a system that
46cc1c8a13Swdenkboots when it should, but still allows access to U-Boot.
47cc1c8a13Swdenk
48cc1c8a13SwdenkWhat they do
49cc1c8a13Swdenk------------
50cc1c8a13Swdenk
51cc1c8a13Swdenk  CONFIG_BOOT_RETRY_TIME
52cc1c8a13Swdenk  CONFIG_BOOT_RETRY_MIN
53cc1c8a13Swdenk
54e1599e83Swdenk  "bootretry" environment variable
55cc1c8a13Swdenk
56cc1c8a13Swdenk	These options determine what happens after autoboot is
57cc1c8a13Swdenk	stopped and U-Boot is waiting for commands.
58cc1c8a13Swdenk
59cc1c8a13Swdenk	CONFIG_BOOT_RETRY_TIME must be defined to enable the boot
60e1599e83Swdenk	retry feature. If the environment variable "bootretry" is
61cc1c8a13Swdenk	found then its value is used, otherwise the retry timeout is
62cc1c8a13Swdenk	CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and
63cc1c8a13Swdenk	defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds.
64cc1c8a13Swdenk
65cc1c8a13Swdenk	If the retry timeout is negative, the U-Boot command prompt
66cc1c8a13Swdenk	never times out. Otherwise it is forced to be at least
67cc1c8a13Swdenk	CONFIG_BOOT_RETRY_MIN seconds. If no valid U-Boot command is
68cc1c8a13Swdenk	entered before the specified time the boot delay sequence is
69cc1c8a13Swdenk	restarted. Each command that U-Boot executes restarts the
70cc1c8a13Swdenk	timeout.
71cc1c8a13Swdenk
72cc1c8a13Swdenk	If CONFIG_BOOT_RETRY_TIME < 0 the feature is there, but
73cc1c8a13Swdenk	doesn't do anything unless the environment variable
74e1599e83Swdenk	"bootretry" is >= 0.
75cc1c8a13Swdenk
76cc1c8a13Swdenk  CONFIG_AUTOBOOT_KEYED
7700ddacc1SMark Langsdorf  CONFIG_AUTOBOOT_KEYED_CTRLC
78cc1c8a13Swdenk  CONFIG_AUTOBOOT_PROMPT
79cc1c8a13Swdenk  CONFIG_AUTOBOOT_DELAY_STR
80cc1c8a13Swdenk  CONFIG_AUTOBOOT_STOP_STR
81cc1c8a13Swdenk
82e1599e83Swdenk  "bootdelaykey"  environment variable
83e1599e83Swdenk  "bootstopkey"	  environment variable
84cc1c8a13Swdenk
85cc1c8a13Swdenk	These options give more control over stopping autoboot. When
86cc1c8a13Swdenk	they are used a specific character or string is required to
87cc1c8a13Swdenk	stop or delay autoboot.
88cc1c8a13Swdenk
89cc1c8a13Swdenk	Define CONFIG_AUTOBOOT_KEYED (no value required) to enable
90cc1c8a13Swdenk	this group of options.	CONFIG_AUTOBOOT_DELAY_STR,
91cc1c8a13Swdenk	CONFIG_AUTOBOOT_STOP_STR or both should be specified (or
92cc1c8a13Swdenk	specified by the corresponding environment variable),
93cc1c8a13Swdenk	otherwise there is no way to stop autoboot.
94cc1c8a13Swdenk
95cc1c8a13Swdenk	CONFIG_AUTOBOOT_PROMPT is displayed before the boot delay
96cc1c8a13Swdenk	selected by CONFIG_BOOTDELAY starts. If it is not defined
97cc1c8a13Swdenk	there is no output indicating that autoboot is in progress.
98f2302d44SStefan Roese
99f2302d44SStefan Roese	Note that CONFIG_AUTOBOOT_PROMPT is used as the (only)
100f2302d44SStefan Roese	argument to a printf() call, so it may contain '%' format
101f2302d44SStefan Roese	specifications, provided that it also includes, sepearated by
102f2302d44SStefan Roese	commas exactly like in a printf statement, the required
103f2302d44SStefan Roese	arguments. It is the responsibility of the user to select only
104f2302d44SStefan Roese	such arguments that are valid in the given context. A
105f2302d44SStefan Roese	reasonable prompt could be defined as
106f2302d44SStefan Roese
107f2302d44SStefan Roese		#define CONFIG_AUTOBOOT_PROMPT \
108f2302d44SStefan Roese			"autoboot in %d seconds\n",bootdelay
109cc1c8a13Swdenk
110e1599e83Swdenk	If CONFIG_AUTOBOOT_DELAY_STR or "bootdelaykey" is specified
111e1599e83Swdenk	and this string is received from console input before
112e1599e83Swdenk	autoboot starts booting, U-Boot gives a command prompt. The
113e1599e83Swdenk	U-Boot prompt will time out if CONFIG_BOOT_RETRY_TIME is
114e1599e83Swdenk	used, otherwise it never times out.
115cc1c8a13Swdenk
116e1599e83Swdenk	If CONFIG_AUTOBOOT_STOP_STR or "bootstopkey" is specified and
117cc1c8a13Swdenk	this string is received from console input before autoboot
118cc1c8a13Swdenk	starts booting, U-Boot gives a command prompt. The U-Boot
119cc1c8a13Swdenk	prompt never times out, even if CONFIG_BOOT_RETRY_TIME is
120cc1c8a13Swdenk	used.
121cc1c8a13Swdenk
122cc1c8a13Swdenk	The string recognition is not very sophisticated. If a
123cc1c8a13Swdenk	partial match is detected, the first non-matching character
124cc1c8a13Swdenk	is checked to see if starts a new match. There is no check
125cc1c8a13Swdenk	for a shorter partial match, so it's best if the first
126cc1c8a13Swdenk	character of a key string does not appear in the rest of the
127cc1c8a13Swdenk	string.
128cc1c8a13Swdenk
12900ddacc1SMark Langsdorf	The CONFIG_AUTOBOOT_KEYED_CTRLC #define allows for the boot
13000ddacc1SMark Langsdorf	sequence to be interrupted by ctrl-c, in addition to the
13100ddacc1SMark Langsdorf	"bootdelaykey" and "bootstopkey". Setting this variable
13200ddacc1SMark Langsdorf	provides an escape sequence from the limited "password"
13300ddacc1SMark Langsdorf	strings.
13400ddacc1SMark Langsdorf
135cc1c8a13Swdenk  CONFIG_RESET_TO_RETRY
136cc1c8a13Swdenk
137cc1c8a13Swdenk	(Only effective when CONFIG_BOOT_RETRY_TIME is also set)
138cc1c8a13Swdenk	After the countdown timed out, the board will be reset to restart
139cc1c8a13Swdenk	again.
140