uboot的header结构

    如果要编译uboot的kernel的话需要执行make uImage,根据make help说明:
                uImage        - U-Boot wrapped zImage
是在生成的Image中加入了一些信息供uboot读取,使用的工具是mkimage。所以如果执行make uImage而没有指定mkimage的路径的话会报错。但是mkimage到底对Image加入了一些什么信息呢?
这是测试的一个uImge文件
Image Name:   Linux-2.6.35.7+
Created:      Thu Mar 14 17:28:42 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3646944 Bytes = 3561.47 kB = 3.48 MB
Load Address: 00008000
Entry Point:  00008000
这是测试的一个Image或者zImage文件:
Image is like this:Bad Magic Number
zImage is like this:Bad Magic Number

 

使用命令od -A n -h -j 0 -N 64 uImage 得到如下信息:
 0527 5619 a3d9 90e8 4151 4a98 3700 e0a5
 0000 0080 0000 0080 5663 3ca7 0205 0002
 694c 756e 2d78 2e32 2e36 3533 372e 002b
 0000 0000 0000 0000 0000 0000 0000 0000
 这就是uboot的头,具体表示什么意思呢?查看image.h文件,它在uboot源码的include目录下,可以在这个地址查看:

https://github.com/EmcraftSystems/u-boot/blob/master/include/image.h

得到如下信息:
 #define IH_NMLEN                32
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;

至此,uboot的结构以及它们的含义已经搞清楚了。

uboot的header结构

上一篇:NDK环境搭建


下一篇:20131127-正则表达式