u-boot 加载kernel, 需要将kernel image 变换为uboot img
uimg 只是在原来img 基础上加了一个64byte 头部。如下:
0000000: 2705 1956 5e24 0227 55bb 30d2 001e 56b0 '..V^$.'U.0...V.0000010: 0001 0000 0001 0000 44c1 8989 0502 0200 ........D.......
0000020: 7a49 6d61 6765 2d68 6a6a 0000 0000 0000 zImage-hjj......
0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0000040: 0000 a0e1 0000 a0e1 0000 a0e1 0000 a0e1 ................
0x40 往后是原内核数据, 头部解释如下:
gdb$ p hdr
$4 = (const image_header_t *) 0x7ffff782f000
gdb$ p *hdr
$5 = {
ih_magic = 0x56190527,
ih_hcrc = 0x2702245e,
ih_time = 0xd230bb55,
ih_size = 0xb0561e00,
ih_load = 0x100,
ih_ep = 0x100,
ih_dcrc = 0x8989c144,
ih_os = 0x5,
ih_arch = 0x2,
ih_type = 0x2,
ih_comp = 0x0,
ih_name = "zImage-hjj", '\000' <repeats 21 times>
}
检查是否是一个合法uimg, 需检查
ih_magic(可以支持好几种类型,本例为default),
ih_hcrc(image hearder crc check),
ih_dcrc(image data crc check)
均通过为校验合格。
其它域为信息域。
~
~
~