mkimage是u-boot下的一个工具,该工具是用来制作不压缩或压缩的多种可启动映像文件。
一般情况下,使用mkimage制作映像文件的时候,是在原来的可执行映像文件的前面加上一个0x40字节的头,记录参数所指定的信息,这样u-boot才能识别这个映像是针对哪个CPU体系架构的,哪个OS的,哪种类型,加载到内存中的哪个位置,入口地址在内存中的哪个位置及映像文件名是什么。
它的使用方式如下:
Usage: ./tools/mkimage -l image
-l ==> list image header information
./tools/mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
-A ==> set architecture to 'arch' // 指定CPU类型,比如ARM
-O ==> set operating system to 'os' // 指定操作系统,比如Linux
-T ==> set image type to 'type' // 指定image类型,比如kernel
-C ==> set compression type 'comp' // 指定压缩类型
-a ==> set load address to 'addr' (hex) // 指定image的载入地址
-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) // 设置执行位置
./tools/mkimage [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-i <ramdisk.cpio.gz>] fit-image
<dtb> file is used with -f auto, it may occur multiple times.
-D => set all options for device tree compiler
-f => input filename for FIT source
-i => input filename for ramdisk file
Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)
./tools/mkimage -V ==> print version information and exit
Use '-T list' to see a list of available image types