分享

Mkimage参数意义解析

 njy131 2012-06-06

通过mkimage这个tool可以给zImage添加一个header:

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;

 

此header是如何生成的?利用u-boot里面的mkimage工具来生成uImage   (u-boot源码包/tools/mkimage.c )

这里解释一下参数的意义:

-A ==> set architecture to 'arch'

-O ==> set operating system to 'os'

-T ==> set image type to 'type' “kernel或是ramdisk”

-C ==> set compression type 'comp'

-a ==> set load address to 'addr' (hex)

-e ==> set entry point to 'ep' (hex)(内核启动时在此位置查询完整的内核印象)

-n ==> set image name to 'name'

-d ==> use image data from 'datafile'

-x ==> set XIP (execute in place,即不进行文件的拷贝,在当前位置执行)

 

对于ARM linux内核映象用法:

-A arm     -------- 架构是arm
-O linux    -------- 操作系统是
linux
-T kernel  -------- 类型是
kernel
-C none/bzip/gzip    -------- 压缩类型

-a 20008000 ---- image的载入地址(hex),通常为0xX00008000
-e 200080XX---- 内核的入口地址(hex),XX为0x40或者
0x00
-n linux-XXX --- image的名字,任意

-d nameXXX             ---- 无头信息的image文件名,你的源内核文件
uImageXXX    ---- 加了头信息之后的image文件名,任意取

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多