wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Dave Ellis, SIXNET, dge@sixnetio.com |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | Using autoboot configuration options |
| 9 | ==================================== |
| 10 | |
| 11 | The basic autoboot configuration options are documented in the main |
| 12 | U-Boot README. See it for details. They are: |
| 13 | |
| 14 | bootdelay |
| 15 | bootcmd |
| 16 | CONFIG_BOOTDELAY |
| 17 | CONFIG_BOOTCOMMAND |
| 18 | |
| 19 | Some additional options that make autoboot safer in a production |
| 20 | product are documented here. |
| 21 | |
| 22 | Why use them? |
| 23 | ------------- |
| 24 | |
| 25 | The basic autoboot feature allows a system to automatically boot to |
| 26 | the real application (such as Linux) without a user having to enter |
| 27 | any commands. If any key is pressed before the boot delay time |
| 28 | expires, U-Boot stops the autoboot process, gives a U-Boot prompt |
| 29 | and waits forever for a command. That's a good thing if you pressed a |
| 30 | key because you wanted to get the prompt. |
| 31 | |
| 32 | It's not so good if the key press was a stray character on the |
| 33 | console serial port, say because a user who knows nothing about |
| 34 | U-Boot pressed a key before the system had time to boot. It's even |
| 35 | worse on an embedded product that doesn't have a console during |
| 36 | normal use. The modem plugged into that console port sends a |
| 37 | character at the wrong time and the system hangs, with no clue as to |
| 38 | why it isn't working. |
| 39 | |
| 40 | You might want the system to autoboot to recover after an external |
| 41 | configuration program stops autoboot. If the configuration program |
| 42 | dies or loses its connection (modems can disconnect at the worst |
| 43 | time) U-Boot will patiently wait forever for it to finish. |
| 44 | |
| 45 | These additional configuration options can help provide a system that |
| 46 | boots when it should, but still allows access to U-Boot. |
| 47 | |
| 48 | What they do |
| 49 | ------------ |
| 50 | |
| 51 | CONFIG_BOOT_RETRY_TIME |
| 52 | CONFIG_BOOT_RETRY_MIN |
| 53 | |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 54 | "bootretry" environment variable |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 55 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 56 | These options determine what happens after autoboot is |
| 57 | stopped and U-Boot is waiting for commands. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 58 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 59 | CONFIG_BOOT_RETRY_TIME must be defined to enable the boot |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 60 | retry feature. If the environment variable "bootretry" is |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 61 | found then its value is used, otherwise the retry timeout is |
| 62 | CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and |
| 63 | defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 64 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 65 | If the retry timeout is negative, the U-Boot command prompt |
| 66 | never times out. Otherwise it is forced to be at least |
| 67 | CONFIG_BOOT_RETRY_MIN seconds. If no valid U-Boot command is |
| 68 | entered before the specified time the boot delay sequence is |
| 69 | restarted. Each command that U-Boot executes restarts the |
| 70 | timeout. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 71 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 72 | If CONFIG_BOOT_RETRY_TIME < 0 the feature is there, but |
| 73 | doesn't do anything unless the environment variable |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 74 | "bootretry" is >= 0. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 75 | |
| 76 | CONFIG_AUTOBOOT_KEYED |
| 77 | CONFIG_AUTOBOOT_PROMPT |
| 78 | CONFIG_AUTOBOOT_DELAY_STR |
| 79 | CONFIG_AUTOBOOT_STOP_STR |
| 80 | CONFIG_AUTOBOOT_DELAY_STR2 |
| 81 | CONFIG_AUTOBOOT_STOP_STR2 |
| 82 | |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 83 | "bootdelaykey" environment variable |
wdenk | 8b74bf3 | 2004-10-11 23:10:30 +0000 | [diff] [blame] | 84 | "bootstopkey" environment variable |
wdenk | e1599e8 | 2004-10-10 23:27:33 +0000 | [diff] [blame] | 85 | "bootdelaykey2" environment variable |
| 86 | "bootstopkey2" environment variable |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 87 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 88 | These options give more control over stopping autoboot. When |
| 89 | they are used a specific character or string is required to |
| 90 | stop or delay autoboot. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 91 | |
| 92 | Define CONFIG_AUTOBOOT_KEYED (no value required) to enable |
wdenk | 8b74bf3 | 2004-10-11 23:10:30 +0000 | [diff] [blame] | 93 | this group of options. CONFIG_AUTOBOOT_DELAY_STR, |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 94 | CONFIG_AUTOBOOT_STOP_STR or both should be specified (or |
| 95 | specified by the corresponding environment variable), |
| 96 | otherwise there is no way to stop autoboot. |
| 97 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 98 | CONFIG_AUTOBOOT_PROMPT is displayed before the boot delay |
| 99 | selected by CONFIG_BOOTDELAY starts. If it is not defined |
| 100 | there is no output indicating that autoboot is in progress. |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 101 | |
| 102 | Note that CONFIG_AUTOBOOT_PROMPT is used as the (only) |
| 103 | argument to a printf() call, so it may contain '%' format |
| 104 | specifications, provided that it also includes, sepearated by |
| 105 | commas exactly like in a printf statement, the required |
| 106 | arguments. It is the responsibility of the user to select only |
| 107 | such arguments that are valid in the given context. A |
| 108 | reasonable prompt could be defined as |
| 109 | |
| 110 | #define CONFIG_AUTOBOOT_PROMPT \ |
| 111 | "autoboot in %d seconds\n",bootdelay |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 112 | |
wdenk | 8b74bf3 | 2004-10-11 23:10:30 +0000 | [diff] [blame] | 113 | If CONFIG_AUTOBOOT_DELAY_STR or "bootdelaykey" is specified |
| 114 | and this string is received from console input before |
| 115 | autoboot starts booting, U-Boot gives a command prompt. The |
| 116 | U-Boot prompt will time out if CONFIG_BOOT_RETRY_TIME is |
| 117 | used, otherwise it never times out. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 118 | |
wdenk | 8b74bf3 | 2004-10-11 23:10:30 +0000 | [diff] [blame] | 119 | If CONFIG_AUTOBOOT_STOP_STR or "bootstopkey" is specified and |
| 120 | this string is received from console input before autoboot |
| 121 | starts booting, U-Boot gives a command prompt. The U-Boot |
| 122 | prompt never times out, even if CONFIG_BOOT_RETRY_TIME is |
| 123 | used. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 124 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 125 | The string recognition is not very sophisticated. If a |
| 126 | partial match is detected, the first non-matching character |
| 127 | is checked to see if starts a new match. There is no check |
| 128 | for a shorter partial match, so it's best if the first |
| 129 | character of a key string does not appear in the rest of the |
| 130 | string. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 131 | |
wdenk | 8b74bf3 | 2004-10-11 23:10:30 +0000 | [diff] [blame] | 132 | Using the CONFIG_AUTOBOOT_DELAY_STR2 #define or the |
| 133 | "bootdelaykey2" environment variable and/or the |
| 134 | CONFIG_AUTOBOOT_STOP_STR2 #define or the "bootstopkey" |
| 135 | environment variable you can specify a second, alternate |
| 136 | string (which allows you to have two "password" strings). |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 137 | |
| 138 | CONFIG_ZERO_BOOTDELAY_CHECK |
| 139 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 140 | If this option is defined, you can stop the autoboot process |
| 141 | by hitting a key even in that case when "bootdelay" has been |
| 142 | set to 0. You can set "bootdelay" to a negative value to |
| 143 | prevent the check for console input. |
wdenk | cc1c8a1 | 2002-11-02 22:58:18 +0000 | [diff] [blame] | 144 | |
| 145 | CONFIG_RESET_TO_RETRY |
| 146 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 147 | (Only effective when CONFIG_BOOT_RETRY_TIME is also set) |
| 148 | After the countdown timed out, the board will be reset to restart |
| 149 | again. |