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. android下使用i2c-tools工具
  2. 通用android studio gradle 文件(电商商家版,两个gradle不同)
  3. Android 文件下载工具类
  4. Android APK 反编译工具
  5. Android 封装自己的工具Jar
  6. Android 调试工具集合
  7. android TraceView (图形化性能测试工具)使用入门笔记
  8. 使用Android编译环境编译小工具

随机推荐

  1. android ble蓝牙开发略解-Android(安卓)
  2. 如何将android(gingerbread)源码导入eclips
  3. 总体把握Android中的触摸事件处理
  4. Android中Application、静态变量和Shared
  5. 移植Android3.0 SDK到freescale imx51_bb
  6. 利用android_ndk以及OpenGLES开发动态壁
  7. android Xfermode
  8. android Dialog去掉标题栏 和边框
  9. 《Android》Lesson01-环境配置
  10. 郭霖深入了解View系列 共4篇