四、uboot_引导内核

一、uboot引导内核

1、flash分区

1、flash分区(include/configs/mini2440.h)
#define MTDIDS_DEFAULT "nand0=nandflash0"
#define MTDPARTS_DEFAULT "mtdparts=nandflash0:256@0(bootloader)"\
							"128k(params)," \
							"2m(kernel)," \
                            "8m(jffs2)," \
                            "-(yaffs)"

2、uboot引导内核依赖两个变量

bootcmd= nand read 31000000 400000 500000 \; bootm 31000000

1、bootcmd(common/main.c : main_loop())
s = getenv ("bootcmd");

2、执行bootm引导内核

3、读取头部
typedef struct image_header {
	uint32_t	ih_magic;	/* Image Header Magic Number	*/
	uint32_t	ih_hcrc;	/* Image Header CRC Checksum	*/
	uint32_t	ih_time;	/* Image Creation Timestamp	*/
	uint32_t	ih_size;	/* Image Data Size		*/
	uint32_t	ih_load;	/* Data	 Load  Address		*/
	uint32_t	ih_ep;		/* Entry Point Address		*/
	uint32_t	ih_dcrc;	/* Image Data CRC Checksum	*/
	uint8_t		ih_os;		/* Operating System		*/
	uint8_t		ih_arch;	/* CPU architecture		*/
	uint8_t		ih_type;	/* Image Type			*/
	uint8_t		ih_comp;	/* Compression Type		*/
	uint8_t		ih_name[IH_NMLEN];	/* Image Name		*/
} image_header_t;

4、启动内核
do_bootm_linux  (cmdtp, flag, argc, argv, addr, len_ptr, verify);

5、跳转至内核
<lib_arm/armlinuc.c>
void (*theKernel)(int zero, int arch, uint params);
theKernel = (void (*)(int, int, uint))ntohl(hdr->ih_ep);
theKernel (0, bd->bi_arch_number, bd->bi_boot_params);

6、内核参数
setup_start_tag (bd);
setup_memory_tags (bd);
setup_commandline_tag (bd, commandline);    //commandline来源于bootargs
setup_end_tag (bd)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值