命令行模式的主逻辑接口:
- #uboot_dev/common/main.c
-
- /* 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");
-
- ...
-
- s = bootdelay_process();
- if (cli_process_fdt(&s))
- cli_secure_boot_cmd(s);
- printf("[DEBUG]: s:%s\n",s);
- autoboot_command(s);
-
- cli_loop();
- panic("No CLI available");
- }
通过env_get获取autoboot命令字符串s:
- #uboot_dev/common/autoboot.c
-
- const char *bootdelay_process(void)
- {
- char *s;
- int bootdelay;
-
- bootcount_inc();
-
- s = env_get("bootdelay");
- bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
-
- ...
-
- #ifdef CONFIG_POST
- if (gd->flags & GD_FLG_POSTFAIL) {
- s = env_get("failbootcmd");
- } else
- #endif