Android固件img文件的解包打包

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

Amlogic固件的解包修改和打包

需要两个工具, 一个是linux下的工具

https://github.com/natinusala/linux-amlogic-toolkit

另一个是windows下的解包和打包工具 Amlogic CustomizationTool

因为前者的打包存在bug, 所以只用于对system.img进行修改, 后者用于最外层的解包和打包工作. 

 

# Mount system RW: mount -o rw,remount /system# Mount system RO: mount -o ro,remount /system

  

/init.rc 内, 找到 service console 之后添加

service daemonsu /system/xbin/daemonsu --auto-daemon &    class main                   oneshot

  

 

更多相关文章

  1. 常用网址
  2. android下使用i2c-tools工具
  3. 【android】查看软件布局神器Hierarchy Viewer
  4. android 多渠道打包,build.gradle文件配置、manifest文件配置
  5. [android]system.img文件的打包和解包
  6. 新建android opengl工程
  7. Android(安卓)多渠道打包进阶版
  8. Android(安卓)APK 反编译工具
  9. Android(安卓)文件下载工具类

随机推荐

  1. Android Context原理分析
  2. 查看android里的数据库的内容的方法
  3. [置顶] Android(安卓)Handler Message Lo
  4. android 通过schema唤起应用指定页面
  5. android app内置webview,随android版本升
  6. 2013.03.19(5)———android 获取状态栏的
  7. [置顶] android framework Service分析
  8. android sdk 编译--如何将源代码加入andr
  9. Android中调用Rest web服务
  10. android滑屏两三事