AML_uboot

/* 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");

#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();
#ifdef CONFIG_VERSION_VARIABLE
    setenv("ver", version_string);  /* set version variable */
#endif /* CONFIG_VERSION_VARIABLE */

    cli_init();

    run_preboot_environment_command();/*获取preboot环境变量,并执行这个命令*/

    s = bootdelay_process();/*获取环境变量bootcmd, bootdelay等环境变量*/
    if (cli_process_fdt(&s))
        cli_secure_boot_cmd(s);

    autoboot_command(s);/*是否进入boot command string### main_loop: bootcmd="run storeboot"
Hit Enter or space or Ctrl+C key to stop autoboot -- :  0 如果没有接收到任何按键,则执行bootcmd if imgread kernel boot ${loadaddr}; then bootm ${loadaddr}; fi;run update;*/
printf("%s %d\n",__FUNCTION__,__LINE__);

    cli_loop();/*循环处理用户的输入,并执行相应的命令操作*/
}

/*如果没有按下任何按键,则处理传入的bootcmd命令,此处为启动系统的环境变量### main_loop: bootcmd="run storeboot"*/
void autoboot_command(const char *s)
{
    printf("### main_loop: bootcmd=\"%s\"\n", s ? s : "");

    if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
        int prev = disable_ctrlc(1);    /* disable Control C checking */
#endif

        run_command_list(s, -1, 0);/*执行传入的命令*/

#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
        disable_ctrlc(prev);    /* restore Control C checking */
#endif
    }

#ifdef CONFIG_MENUKEY /*进入菜单项的方式*/
    if (menukey == CONFIG_MENUKEY) {
        s = getenv("menucmd");
        if (s)
            run_command_list(s, -1, 0);
    }
#endif /* CONFIG_MENUKEY */
}



你可能感兴趣的:(uboot)