首页 > 移动平台 > 详细

Android固件img文件的解包, 修改和打包的命令行操作

时间:2019-12-09 22:36:20      阅读:343      评论:0      收藏:0      [点我收藏+]

To Unpack-Modify-Pach the system.img, I have followed the following procedure:

a) Unpacking

Run file system.img and make sure that system.img is Android Sparse Image.
Rename system.img to system.img.ext4. // Not required if you will use other name for raw image in below steps.

simg2img system.img.ext4 system.img

you will get a raw image file named system.img

mkdir system

create directory to mount system.img

sudo mount -t ext4 -o loop system.img system/

you will get all files of system.img in system folder

b) Modifying

ls -l system/init.rc

note permissions: 750

sudo chmod 777 system/init.rc

give write permissions

sudo echo "#MODIFICATION " >> system/init.rc

done some modification in init.rc

sudo chmod 750 init.rc

reset init.rc to the noted permissions

c) Calculate system sector size

tune2fs -l system.img | grep "Block size\|Block count"

you will get block size and count

echo $((1553064 * 4096))

multiply both results. I got 6361350144

d) Packing

sudo make_ext4fs -s -l 6361350144 -a system system_new.img sys/

you will get system_new.img “Android Sparse Image” that has all changes

 

Android固件img文件的解包, 修改和打包的命令行操作

原文:https://www.cnblogs.com/milton/p/12013716.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!