uboot 启动Linux内核使用bootz命令。当然还有其它的启动命令,例如,bootm命令等等。
本文只分析 bootz命令启动 Linux内核的过程中涉及的几个重要函数。具体分析 do_bootm_states 函数执行过程。
本文继上一篇文章,地址如下:
bootz启动 Linux内核过程中涉及的 do_bootm_states 函数-CSDN博客
bootz 命令的执行函数为 do_bootz函数。而 do_bootz函数主要调用如下函数:
bootz_start 函数,bootm_disable_interrupts 函数,设置 images.os.os ,do_bootm_states 函数。
这里简单分析一下 bootm_os_get_boot_func 函数。
此函数定义 在文件 common/bootm_os.c 中,函数内容如下:
- boot_os_fn *bootm_os_get_boot_func(int os)
- {
- #ifdef CONFIG_NEEDS_MANUAL_RELOC
- static bool relocated;
-
- if (!relocated) {
- int i;
-
- /* relocate boot function table */
- for (i = 0; i < ARRAY_SIZE(boot_os); i++)
- if (boot_os[i] != NULL)
- boot_os[i] += gd->reloc_off;
-
- relocated = true;
- }
- #endif
- return boot_os[os];
- }
- static boot_os_fn *boot_os[] = {
- [IH_OS_U_BOOT] = do_bootm_standalone,
- #ifdef CONFIG_BOOTM_LINUX
- [IH_OS_LINUX] = do_bootm_linux,
- #endif
- ............
- #ifdef CONFIG_BOOTM_OPENRTOS
- [IH_OS_OPENRTOS] = do_bootm_openrtos,
- #endif
- };