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
//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>]
整體思路是將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,從新打包的過程完成
http://rex-shen.net/android-unpackpack-factory-images/android
#操做命令 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
#安裝命令 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