U-Boot启动方式源码分析


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源代码下载地址

相关内容