安卓手机刷机包制作教程

@zgcwkj  2023年02月19日

分类:

代码 其它 

payload、lpmake、simg2img、lpdump、img2simg、erofsUnpack、mkfs.erofs 的命令来实现制作安卓手机刷机包

工具

内容已隐藏,需要评论并且审核通过后,才能阅读隐藏内容

payload.bin 解包

tool\payload.exe -o payload payload.bin
参数说明
l列出包含的镜像
p提取镜像名称
o输出目录

查看手机动态分区信息

adb shell lpdump

查看手机分区信息

adb shell ls -al /dev/block/platform/.../by-name

super.img 解包(vab分区示例)

tool\lpunpack superr.img .\super_output

super.img 打包(vab分区示例)

tool\lpmake --super-name super \
--metadata-size 65536 \
--device super:9653190656 \
--metadata-slots 3 \
--group qti_dynamic_partitions_a:9653190656 \
--group qti_dynamic_partitions_b:9653190656 \
-p 'mi_ext_a:readonly:20480:qti_dynamic_partitions_a'v \
-i 'mi_ext_a=super_output/mi_ext_a.img' \
-p 'odm_a:readonly:802078720:qti_dynamic_partitions_a' \
-i 'odm_a=super_output/odm_a.img' \
-p 'product_a:readonly:4567310336:qti_dynamic_partitions_a' \
-i 'product_a=super_output/product_a.img' \
-p 'system_a:readonly:769331200:qti_dynamic_partitions_a' \
-i 'system_a=super_output/system_a.img' \
-p 'system_dlkm_a:readonly:348160:qti_dynamic_partitions_a' \
-i 'system_dlkm_a=super_output/system_dlkm_a.img' \
-p 'system_ext_a:readonly:497364992:qti_dynamic_partitions_a' \
-i 'system_ext_a=super_output/system_ext_a.img' \
-p 'vendor_a:readonly:1512857600:qti_dynamic_partitions_a' \
-i 'vendor_a=super_output/vendor_a.img' \
-p 'vendor_dlkm_a:readonly:38088704:qti_dynamic_partitions_a' \
-i 'vendor_dlkm_a=super_output/vendor_dlkm_a.img' \
-p 'mi_ext_b:readonly:0:qti_dynamic_partitions_b' \
-p 'odm_b:readonly:0:qti_dynamic_partitions_b' \
-p 'product_b:readonly:0:qti_dynamic_partitions_b' \
-p 'system_b:readonly:0:qti_dynamic_partitions_b' \
-p 'system_dlkm_b:readonly:0:qti_dynamic_partitions_b' \
-p 'system_ext_b:readonly:0:qti_dynamic_partitions_b' \
-p 'vendor_b:readonly:0:qti_dynamic_partitions_b' \
-p 'vendor_dlkm_b:readonly:0:qti_dynamic_partitions_b' \
--sparse --output super.img
在 windows 中,请用一行
tool\lpmake.exe --super-name super --metadata-size 65536 --device super:9653190656 --metadata-slots 3 --group qti_dynamic_partitions_a:9653190656 --group qti_dynamic_partitions_b:9653190656 -p 'mi_ext_a:readonly:20480:qti_dynamic_partitions_a' -i 'mi_ext_a=super_output/mi_ext_a.img' -p 'odm_a:readonly:802078720:qti_dynamic_partitions_a' -i 'odm_a=super_output/odm_a.img' -p 'product_a:readonly:4567310336:qti_dynamic_partitions_a' -i 'product_a=super_output/product_a.img' -p 'system_a:readonly:769331200:qti_dynamic_partitions_a' -i 'system_a=super_output/system_a.img' -p 'system_dlkm_a:readonly:348160:qti_dynamic_partitions_a' -i 'system_dlkm_a=super_output/system_dlkm_a.img' -p 'system_ext_a:readonly:497364992:qti_dynamic_partitions_a' -i 'system_ext_a=super_output/system_ext_a.img' -p 'vendor_a:readonly:1512857600:qti_dynamic_partitions_a' -i 'vendor_a=super_output/vendor_a.img' -p 'vendor_dlkm_a:readonly:38088704:qti_dynamic_partitions_a' -i 'vendor_dlkm_a=super_output/vendor_dlkm_a.img' -p 'mi_ext_b:readonly:0:qti_dynamic_partitions_b' -p 'odm_b:readonly:0:qti_dynamic_partitions_b' -p 'product_b:readonly:0:qti_dynamic_partitions_b' -p 'system_b:readonly:0:qti_dynamic_partitions_b' -p 'system_dlkm_b:readonly:0:qti_dynamic_partitions_b' -p 'system_ext_b:readonly:0:qti_dynamic_partitions_b' -p 'vendor_b:readonly:0:qti_dynamic_partitions_b' -p 'vendor_dlkm_b:readonly:0:qti_dynamic_partitions_b' --sparse --output super.img
参数说明
super-name分区名
metadata-sizemetadata 大小
device分区名:大小
metadata-slots分区数量
group分区组名:大小
p分区:大小
i分区镜像
sparse格式
output输出镜像

转换(sparse 转换为 raw)

tool\simg2img.exe super.img superr.img
参数说明
参数1转换前路径
参数2转换后路径

信息(查看 raw 分区详情)

tool\lpdump.exe superr.img
参数说明
参数1镜像路径

转换(raw 转换为 sparse)

tool\img2simg.exe superr.img super.img
参数说明
参数1转换前路径
参数2转换后路径

erofs 解包

tool\erofsUnpack.exe .\system.img system
参数说明
参数1镜像路径
参数2文件夹路径

erofs 打包

tool\mkfs.erofs -T 1230768000 \
--mount-point /system \
--fs-config-file system_fs_config \
--file-contexts system_file_contexts \
-zlz4 system.img system/
在 windows 中,请用一行
tool\mkfs.erofs.exe -T 1230768000 --mount-point /system --fs-config-file system_fs_config --file-contexts system_file_contexts -zlz4 system.img system/
参数说明
help帮助
T起始时间戳
mount-point挂载点
fs-config-filesystem_fs_config 文件路径
file-contextssystem_file_contexts 文件路径
zlz4压缩方式(有 lz4,lz4hc 等)
末2镜像路径
末1文件夹路径

去除 avb2.0 校验

使用命令
fastboot --disable-verity --disable-verification flash vbmeta_a vbmeta.img
fastboot --disable-verity --disable-verification flash vbmeta_system_a vbmeta_system.img

镜像文件
https://blog.xzr.moe/archives/226/
https://github.com/libxzr/vbmeta-disable-verification

挂在镜像

mkdir /temppath
mount imgfile.img /temppath

视频

1、移植包相关
https://www.bilibili.com/video/BV1Jh4y197K5

注意

  1. vbmeta.img 和 vbmeta_system.img 需要关闭 avb2.0 校验
  2. data 分区加密在 vendor.img 里,去除之后 data 分区就不会根据密钥加密了
  3. erofs 解包后,添加或删除文件时都需要修改 system_fs_config 和 system_file_contexts ,可以用记事本打开它


评论已关闭

Top