打包:mkimage用法
mkimage -n name [-x] -A arch -O os -T type -C comp -a addr -e ep -d data_file[:data_file...] uImage
参数解释:
- -n 给image指定名字
- -x 指定内核就在Flash中运行,即XIP(execute in place)
- -T 指定文件类型,如kernel、filesystem、firmware、multi、ramdisk
- -A 指定处理器架构
- -O 操作系统类型,如linux、vxworks、u-boot等
- -C 指定压缩模式,有none、bzip2、gzip
- -a 程序被解压缩或复制到RAM中的地址
- -e 指定程序(内核)的入口地址
- -d 输入的程序源文件,可有多个文件, 用冒号分隔
- uImage 输出文件名
mkimage、dumpimage的安装:
命令:sudo apt-get install u-boot-tools
查看boot.img信息:
命令:file boot.img
biren@ubuntu:~/downloads$ file boot.img
boot.img: u-boot legacy uImage, MStar-linux, Linux/ARM, Multi-File Image (Not compressed), 3683426 bytes, Sun Dec 16 08:35:49 2012, Load Address: 0x40208000, Entry Point: 0x40208000, Header CRC: 0x31D11693, Data CRC: 0x2940EEB0
关键信息:
- magic : u-boot
- image type : Multi-File Image (Not compressed)
- Load Address: 0x40208000 加载到RAM中的地址
- Entry Point: 0x40208000 执行时的入口地址
命令:mkimage -l boot.img
biren@ubuntu:~/downloads$ mkimage -l boot.img
Image Name: MStar-linux
Created: Sun Dec 16 16:35:49 2012
Image Type: ARM Linux Multi-File Image (uncompressed)
Data Size: 3683426 Bytes = 3597.10 KiB = 3.51 MiB
Load Address: 40208000
Entry Point: 40208000
Contents:
Image 0: 3516928 Bytes = 3434.50 KiB = 3.35 MiB 此镜像的顺序号是0
Image 1: 166486 Bytes = 162.58 KiB = 0.16 MiB 此镜像的顺序号是1
关键信息:
Contents : 有image 0和 image 1表明有2个镜像(通常是kernel , ramdisk)
解 包:
dumpimage用法:
Usage: dumpimage -l image
-l ==> list image header information 列出头部信息
dumpimage [-T type] [-p position] [-o outfile] image
-T ==> declare image type as 'type' 指定镜像类型
-p ==> 'position' (starting at 0) of the component to extract from image
指定镜像的顺序号
-o ==>