zoukankan      html  css  js  c++  java
  • Android固件img文件的解包, 修改和打包的命令行操作

    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
    

      

  • 相关阅读:
    Ext.Net多表头跨行跨列
    操作文件
    HighMaps
    HighCharts动态读取显示
    SAP CRM 项目笔记(一) SOW(工作说明书)讨论
    .net 动态编译解决考勤计算问题
    CPU的大小端模式
    将一个数转化为任意进制的数
    关于内存对齐
    常量指针与指针常量
  • 原文地址:https://www.cnblogs.com/milton/p/12013716.html
Copyright © 2011-2022 走看看