认识 uboot 和 内核 之间不可不说的关系
uboot 镜像为 uboot.bin,Linux 镜像为 zImage
嵌入式设备中的分区表是自己定义的,uboot 和内核中的分区表应一致
内核运行前必须加载到 ddr 中指定的地址处
uboot 需要提供内核必要的参数
内核启动的方式
uboot 启动内核有两种方式,一种是等待倒计时结束后直接启动内核,一种是在 uboot 命令行中使用 boot 命令启动内核
其代码分别如下
其中 parse_string_outer 的作用是解析 boot 参数并执行
/*------------------倒计时----------------------*/
s = getenv ("bootcmd");
if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
...
parse_string_outer(s, FLAG_PARSE_SEMICOLON |
FLAG_EXIT_FROM_LOOP);
...
}
/*------------------命令行----------------------*/
int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
...
if (parse_string_outer (getenv ("bootcmd"),
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
rcode = 1;
...
}
U_BOOT_CMD(
boot, 1, 1, do_bootd,
"boot - boot default, i.e., run 'boo