1、
s = getenv ("bootdelay"); //得到環境變量指定的delay值
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
s = getenv ("bootcmd"); //得到自啟動命令
if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
# ifdef CONFIG_AUTOBOOT_KEYED
int prev = disable_ctrlc(1);/* disable Control C checking */
# endif
# ifndef CFG_HUSH_PARSER
run_command (s, 0);
# else
parse_string_outer(s, FLAG_PARSE_SEMICOLON |
FLAG_EXIT_FROM_LOOP);
# endif
# ifdef CONFIG_AUTOBOOT_KEYED
disable_ctrlc(prev);/* restore Control C checking */
# endif
}
/*如果bootdelay的值是大於或等於0,並且abortboot(bootdelay)返回0,那麼就執行自動啟動。abortboot()函數輸出提示用戶在指定時間內按下任意按鍵將停止自動運行,然後等待用戶輸入,如果bootdelay已經減到0,並且用戶還沒有輸入,函數將返回0,否則返回1.
U-Boot源代碼下載地址 http://www.linuxidc.com/Linux/2011-07/38897.htm