mkimage命令 – 制作可启动映象文件

mkimage工具是u-boot用来制作镜像文件的工具,其源代码在u-boot源码的tools目录下:mkimage.c。我们使用bootm命令加载的内核和根文件系统,都要用这个工具加上个头。

语法格式:mkimage [参数]

常用参数:

-A


CPU 架构,可选的值有:
"alpha","arm","x86","ia64","m6k8","microblaze","mips","mips64","nios","nios2","ppc","s390","sh","sparc","sparc64",
"blackfin","avr32"
-O操作系统。可选的值有:
"4_4bsd","artos","esix","freebsd","irix","linux","lynxos","ncr","netbsd","openbsd","psos","qnx","rtems","sco","sloaris",
"u-boot",vxworks"
-T镜像类型。可选的值有:
"filesystem","firmware","firmware","kernel","multi","ramdisk","script","standalone","flat_dt"
-C镜像压缩类型。可选的值有:
"none","bzip2","gzip" none为没有压缩

参考实例

为内核加上u-boot引导所需要的文件头:

[root@linuxyeah ~]# mkimage -n 'linux-2.6.14' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d zImage zImage.img

指定CPU架构和操作系统:

[root@linuxyeah ~]# mkimage -A arm -O linux -a 0x20008000 -e 0x20008000 -d linux.bin.gz uImage

指定压缩格式:

[root@linuxyeah ~]# mkimage -A arm -O linux -C bzip2 -a 0x20008000 -e 0x20008000 -d linux.bin.gz uImage

Comments are closed.