[android]system.img文件的打包和解包

1:system.img的两种格式

system2_0.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (extents) (large files) system1_0.img: Android sparse image, version: 1.0, Total of 393216 4096-byte output blocks in 1765 input chunks. 以上两种格式分别为: ext4 filesystem data Android sparse image

2:两种格式的相互转化工具

//sparse image转化成为ext4的raw imge
Usage: simg2img <sparse_image_files> <raw_image_file> //ext4的raw image to sparse image Usage: img2simg <raw_image_file> <sparse_image_file> [<block_size>]

3:system.img文件从新打包的过程

整体思路是将system.img镜像挂载后,而后修改,修改完成为使用make_ext4fs命令进行打包。

1:先将system.img文件转化为ext4的raw image file(只要这个格式的system.img能够挂载) 2:而后挂载system.img sudo mount system.img /mnt/system  3:而后根据本身的须要,修改/mnt/system目录下的文件 4:从新打包 sudo make_ext4fs -s -l 3096M new.img /mnt/system  5:从新打包后的文件new.img是sparse image格式,因此须要转化成ext4的 raw image sim2img new.img system.img  6:至此,修改system.img,从新打包的过程完成 

4:recovery.img的打包解包过程

http://rex-shen.net/android-unpackpack-factory-images/android

6:boot.img文件的解包

#操做命令 mkdir boot && cd boot abooting -x ../boot.img #获得这三个文件 :bootimg.cfg initrd.img zImage  #initrd.img文件的解包 file initrd.img initrd.img: gzip compressed data, from Unix #能够看到是一个gzip的压缩文件  #下面是解压initrd.img文件的命令 mkdir initrd cd initrd cat ../initrd.img | gunzip | cpio -vid #解压上面的initrd.img后,能够看到很是多的文件  #上面编辑完后,从新打包命令以下 cd initrd find . | cpio --create --format='newc' | gzip > ../myinitd.img  #新写打包boot.img abootimg --create myboot.img -f bootimg.cfg -k zImage -r myinitrd.img  #下面的命令能够打印出myboot.img文件中的config信息 abootimg -i myboot.img 

5:Debian系统中包含的Android开发工具

#安装命令 sudo apt-get install android-tools-adb android-tools-fastboot android-tools-fsutils abootimg #每一个工具的用途,根据须要安装 android-tools-adb Android Debug Bridge CLI tool android-tools-fastboot Android Fastboot protocol CLI tool android-tools-fsutils Android ext4 utilities with sparse support abootimg Tool to read/write/update android boot images
相关文章
相关标签/搜索