Uboot 2015 代码解析6 main_loop

从board_init_r跳转到main_loop完成uboot最后工作:命令行解析,启动kernel。

简介

main_loop主要做了

1.命令行解析初始化。

2.进入命令行解析函数cli_loop();

3.启动kernel。

代码注释

/* We come here after U-Boot is initialised and ready to process commands */
void main_loop(void)
{
    const char *s;

    bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");                       //mark 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 by the late 2014 may break or be removed.\n");
#endif

    modem_init();                                                                   //modem初始化
#ifdef CONFIG_VERSION_VARIABLE
    setenv("ver", version_string);  /* set version variable */                      //
#endif /* CONFIG_VERSION_VARIABLE */

    cli_init();                                                                     //cmd line初始化

    run_preboot_environment_command();                                              //执行preboot 命令

#if defined(CONFIG_UPDATE_TFTP)
    update_tftp(0UL);                                                               //?
#endif /* CONFIG_UPDATE_TFTP */

    s = bootdelay_process();                                                        //s=获取bootcmd
    if (cli_process_fdt(&s))
        cli_secure_boot_cmd(s);

    autoboot_command(s);                                                            //执行命令s

    cli_loop();                                                                     //进入命令行解析
}   

猜你喜欢

转载自blog.csdn.net/a827143452/article/details/89413995