int do_bootz (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr;
int i;
void (*theKernel)(int zero, int arch, uint params);
bd_t *bd = gd->bd;
addr = 0x30008000;
printf ("## Booting image at %08lx ...\n", addr);
theKernel = (void (*)(int, int, uint))addr;
disable_interrupts();
cleanup_before_linux ();
theKernel (0, bd->bi_arch_number, bd->bi_boot_params);
return 0;
}
U_BOOT_CMD(
bootz, CFG_MAXARGS, 1, do_bootz,
"bootz - boot zImage from memory\n",
"[addr [arg ...]]\n - boot application image stored in memory\n"
"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
"\t'arg' can be the address of an initrd image\n"
);
在cmd_bootm.c 中添加,由于 uImage 只是对 zImage 封装,zImage已经封装好自解压程序,所以需要设置好环境,
然后直接跳转到 zImage 的地址就可以启动内核了。
解析cmd_bootm.c中bootz函数的内核启动机制
本文深入解析了cmd_bootm.c文件中的bootz函数,详细阐述了如何通过该函数实现从内存启动内核的过程,包括环境设置、跳转地址的设定以及关键操作步骤。
4726

被折叠的 条评论
为什么被折叠?



