说明:这个是在mkimage的源代码上移植来的。这里:http://uboot-mkimage.sourcearchive.com/downloads/0.4/

install:
    make build
clean:
    make clean
    
下面是mkheader的使用方法:
Usage: mkheader -l image
          -l ==> list image header information
       mkheader [-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'
          -O ==> set operating system to 'os'
          -T ==> set image type to 'type'
          -C ==> set compression type 'comp'
          -a ==> set load address to 'addr' (hex) 30008000
          -e ==> set burn address to 'addr' (hex) bootloader->0x0 kernel->0x60000 rootfs->0x560000
          -n ==> set image type bootloader->'BOOT' kernel->'KERN' rootfs->'ROOT'
          -d ==> use image data from 'datafile'
          -x ==> set XIP (execute in place)
只有红色部分是要改动的,其余按照例子上的一样就OK了。

bootloader:
    root@kangear:/work/tftpboot/heard# mkheader -n 'BOOT' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x0 -d u-boot.bin h_u-boot.bin
    Magic Number: 0x27051956
    Image Type:   Bootloader
    Created:      Sun Mar 24 09:28:46 2013
    Data Size:    154244 Bytes = 150.63 kB = 0.15 MB
    Load Address: 0x30008000
    Burn Address: 0x00000000
    CRC32       : 0x55D384FA
    root@kangear:/work/tftpboot/heard# ls
    h_u-boot.bin  rootfs.img  u-boot.bin  uImage
    root@kangear:/work/tftpboot/heard# 

kernel:
    root@kangear:/work/tftpboot/heard# mkheader -n 'ROOT' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x560000 -d rootfs.img h_rootfs.img
    Magic Number: 0x27051956
    Image Type:   rootfs
    Created:      Sun Mar 24 09:32:59 2013
    Data Size:    13047936 Bytes = 12742.12 kB = 12.44 MB
    Load Address: 0x30008000
    Burn Address: 0x00560000
    CRC32       : 0xE957B9D0
    root@kangear:/work/tftpboot/heard#
    
rootfs:
    root@kangear:/work/tftpboot/heard# mkheader -n 'ROOT' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x560000 -d rootfs.img h_rootfs.img
    Magic Number: 0x27051956
    Image Type:   rootfs
    Created:      Sun Mar 24 09:33:18 2013
    Data Size:    13047936 Bytes = 12742.12 kB = 12.44 MB
    Load Address: 0x30008000
    Burn Address: 0x00560000
    CRC32       : 0xE957B9D0
    root@kangear:/work/tftpboot/heard# ls
    h_rootfs.img  h_u-boot.bin  h_uImage  rootfs.img  u-boot.bin  uImage