您的位置:首页 > 移动开发 > Android开发

如何对system.img和userdata.img解包,再重新打包

2016-08-17 10:48 585 查看
下载代码仓储 <https://android.googlesource.com/platform/system/extras>:
git clone https://android.googlesource.com/platform/system/extras
选择对应的版本:
cd extras
git checkout android-4.1.1_r1
编译 simg2img:
cd ext4_utils
gcc -o simg2img -lz sparse_crc32.c simg2img.c
拆包android镜像文件:
cd ../../
./extras/ext4_utils/simg2img system.img system.raw.img
./extras/ext4_utils/simg2img userdata.img userdata.raw.img
通过mount挂载镜像(Mac osx系统可以使用Paragon's ExtFS):
mkdir /mnt/my_system /mnt/my_userdata
mount -t ext4 -o loop userdata.raw.img /mnt/my_userdata
编译 make_ext4fs:
cd extras/ext4_utils
gcc -o make_ext4fs -lz make_ext4fs_main.c make_ext4fs.c ext4fixup.c ext4_utils.c allocate.c backed_block.c output_file.c contents.c extent.c indirect.c uuid.c sha1.c sparse_crc32.c wipe.c
重新打包镜像:
cd ../../
PATH="$PATH:$(pwd)/extras/ext4_utils/make_ext4fs" ./extras/ext4_utils/mkuserimg.sh -s /mnt/my_system_dir my_system.img ext4 /tmp 512M
原文转自:http://www.yinqisen.cn/blog-270.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  如何 android 仓储