Android系统System.img解包和重新打包过程

系统System.img解包和重新打包过程

  • 把system.img转换成ext4格式
    ./simg2img system.img system_ext4.img
  • 挂载ext4到systemMount目录进行修改
    sudo mount system_ext4.img systemMount/ -o loop
  • 修改完成后执行
./make_ext4fs -s -T -1 -S file_contexts -l 2952790016 -a system system_e2.img systemMount

1.2952790016代表你要打包的system.img大小,这个值可以参考挂载前system.img的大小

2."-a system",是指这个img用于android系统,挂载点是/systemMount

3.system_e2.img是生成的文件名。
4.-s 就是生成ext4的S模式制作

root@ubuntu:/home/ubuntu64/bkm02a/systemImg# ./make_ext4fs 
Expected filename after options
make_ext4fs [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]
    [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]
    [ -L <label> ] [ -f ] [ -a <android mountpoint> ] [ -u ]
    [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]
    [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]
    [ -d <base_alloc_file_in> ] [ -D <base_alloc_file_out> ]
    <filename> [[<directory>] <target_out_directory>]

注意事项

file_contexts 文件7.0的系统里没有,是file_contexts.bin文件需要转换

文件路径:out/target/product/msm8937_64/root/file_contexts.bin

链接:https://pan.baidu.com/s/1cSXXwtFvIbMZYvbzRN952w

提取码:hacp

file_contexts.bin 转换成 file_contexts

    $ ./sefcontext -o file_contexts file_contexts.bin

file_contexts 转换成 file_contexts.bin

    $ ./sefcontext_compile -o file_contexts.bin file_contexts

参考连接:安卓7.0、8.0file_contexts.bin和file_contexts转换工具

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容