传入的flag参数BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO。do_bootm_states会根据传入的标识位的不同,选择性执行相应函数。 1.通过 函数 bootm_os_get_boot_func 来查找系统启动函数,参数 images->os.os 就是系统类型,根据这 个系统类型来选择对应的启动函数,在 do_bootz 中设...
2.2 do_bootm_states 前面将state先处理了 BOOTM_STATE_START 阶段,接下来处里下面三个状态: BOOTM_STATE_OS_PREP| BOOTM_STATE_OS_FAKE_GO |BOOTM_STATE_OS_GO 2.2.1 bootm_os_get_boot_func 进入第658行,通过bootm_os_get_boot_func来查找系统启动函数。由于前面提到images->os.os 就是系统类型设置 为...
这样会走到最后函数do_bootm_states,那就来看看核心函数do_bootm_states 参数中需要注意bootm_headers_t *images,这个参数用来存储由image头64字节获取到的的基本信息。由do_bootm传来的该参数是images,是一个全局的静态变量。 首先将states存储在images的state中,因为states中有BOOTM_STATE_START,调用bootm_start...
BOOTM_STATE_OS_PREP|BOOTM_STATE_OS_FAKE_GO| BOOTM_STATE_OS_GO,&images,1); } 从以上源码可以看出,bootm和bootz都是调用do_bootm_states函数启动内核的,下面分析do_bootm_states实现过程。 do_bootm_states函数 以下是该函数源码 /** * Execute selected states of the bootm command. * * Note the ar...
总结bootz启动过程,首先定义images全局变量,接着执行bootz_start设置系统镜像入口点,调用do_bootm_states处理不同阶段,最终通过boot_selected_os启动Linux内核。对于uboot启动Linux测试,可以通过EMMC或网络方式实现。在EMMC启动测试中,首先检查分区1中是否存在zImage和设备树文件,设置bootargs和bootcmd环境...
执行函数do_bootm_subcommand,这个函数中执行了do_bootm_states,uboot分阶段启动,每一个阶段称之为subcommand而do_bootm_states执行的就是不同阶段的subcommand在这里我们可以见到,如果没有传入do_bootm参数,也就是参数argc为0,那么do_bootm_states的state参数将会是一大堆的标志宏,这些标志宏就是uboot启动时需要的...
int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], int states, bootm_headers_t *images, int boot_progress) { boot_os_fn *boot_fn; ulong iflag = 0; int ret = 0, need_boot_fn; images->state |= states; //经过打印得知,镜像...
bootm.c(cmd) do_bootm //如果argc大于1,则进行其他处理 //bootm_headers_t images; //uboot_sdk/common /* pointers to os/initrd/fdt images */ do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START | BOOTM_STATE_FINDOS | ...
do_bootz(cmd/bootz.c) bootz命令执行函数 do_bootm_states(common/bootm.c) 处理uboot启动状态 bootm_os_get_boot_func(common/bootm_os.c) 通过boot_os_fn查找系统启动函数 boot_selected_os (common/bootm_os.c) -> do_bootm_linux(arch/arm/lib/bootm.c) 启动 Linux 内核,调用 系统启动函数 boot_...
do_booti bootm_headers结构体存储了os image信息、os的入口、ramdisk的起始地址、设备树地址和长度、cmdline的起始位置(传给内核)。 typedef struct bootm_headers { image_header_t *legacy_hdr_os; /* image header pointer */ image_header_t legacy_hdr_os_copy; /* header copy */ ulong legacy_hdr_val...