U-Boot2017.01的启动过程比较复杂,本文分为6部分讲述,笔者将主要过程和函数调用关系整理成一个文档方便查看,文档链接为
U-Boot2017.01启动过程分析pdf
U-Boot2017.01源码分析及启动命令解析
启动过程6部分内容如下
01-U-Boot2017.01 启动过程概述
02-U-Boot2017.01 SPL阶段分析
03-U-Boot2017.01 U-Boot阶段分析
04-U-Boot2017.01 加载内核过程
05-U-Boot2017.01 bootz加载过程
06-U-Boot2017.01 读取uEnv.txt过程
uboot读取uEnv.txt的过程如下:
/***********************************************
加载uEnv.txt
***********************************************/
s ==== fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
/* mmcdev=0 include/environment/ti/mmc.h line_10*/
/* loadaddr=0x82000000 include/configs/ti_armv7_common.h line_49 */
/* bootenvfile=uEnv.txt include/environment/ti/mmc.h line_20 */
s ==== fatload mmc 0 0x82000000 uEnv.txt
cmd is fatload
/*U_BOOT_CMD(
fatload, 7, 0, do_fat_fsload,
"load binary file from a dos filesystem","... ..."
);*/
do_fat_fsload(cmd/fat.c)
|--> do_load(fs/fs.c)
|--> fs_read(fs/fs.c)
|--> fs_get_info(fs/fs.c)
|--> fat_read_file(fs/fat/fat.c)
|--> file_fat_read_at(fs/fat/fat.c)
|--> printf("reading %s\n", filename);
reading uEnv.txt
|--> do_fat_read_at(fs/fat/fat.c)
|--> ret = file_fat_read_at(fs/fat/fat.c)
|--> if(ret)
printf("** Unable to read file %s **\n",filename); ** Unable to read file uEnv.txt **