一. uboot启动
uboot命令模式:uboot
启动以后会进入
3
秒倒计时,如果在
3
秒倒计时结束之前按下按下回车键,那么就会进入
uboot
的命令模式。
如果在 uboot 倒计时结束以后都没有按下回车键,就会自动启动
Linux
内
核 , 这 个 功 能 就 是 由
run_main_loop
函 数 来 完 成 的 。
二. run_main_loop函数 到 cmd_process处理
1. run_main_loop函数
run_main_loop
函 数 定 义 在 文 件
common/board_r.c
中,函数内容如下:
static int run_main_loop(void)
{
#ifdef CONFIG_SANDBOX
sandbox_main_loop_init();
#endif
/* main_loop() can return to retry autoboot, if so just run it again */
for (;;)
main_loop();
return 0;
}
" for (;;)
" 和 " while(1)
" 功能一样,死循环里面就一个
main_loop
函数。
2. main_loop 函数
main_loop 函数定义在
common/main.c
文件 里面。
代码如下:
void main_loop(void)
{
const char *s;
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
#ifndef CONFIG_SYS_GENERIC_BOARD
puts("Warning: Your board does not use generic board. Please read\n");
puts("doc/README.generic-board and take action. Boards not\n");
puts("upgraded

本文详细介绍了U-Boot启动过程中的run_main_loop函数和main_loop函数的作用,包括倒计时、版本变量设置、命令处理以及hushshell的运用。同时概述了uboot启动时的命令模式和内核自动启动机制。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



