uboot直接启动 zImage

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 的地址就可以启动内核了。


你可能感兴趣的:(嵌入式LINUX)