payload、lpmake、simg2img、lpdump、img2simg、erofsUnpack、mkfs.erofs 的命令来实现制作安卓手机刷机包
工具
内容已隐藏,需要评论并且审核通过后,才能阅读隐藏内容
payload.bin 解包
tool\payload.exe -o payload payload.bin
查看手机动态分区信息
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-size | metadata 大小 |
device | 分区名:大小 |
metadata-slots | 分区数量 |
group | 分区组名:大小 |
p | 分区:大小 |
i | 分区镜像 |
sparse | 格式 |
output | 输出镜像 |
转换(sparse 转换为 raw)
tool\simg2img.exe super.img superr.img
信息(查看 raw 分区详情)
tool\lpdump.exe superr.img
转换(raw 转换为 sparse)
tool\img2simg.exe superr.img super.img
erofs 解包
tool\erofsUnpack.exe .\system.img system
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-file | system_fs_config 文件路径 |
file-contexts | system_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
注意
- vbmeta.img 和 vbmeta_system.img 需要关闭 avb2.0 校验
- data 分区加密在 vendor.img 里,去除之后 data 分区就不会根据密钥加密了
erofs 解包后,添加或删除文件时都需要修改 system_fs_config 和 system_file_contexts ,可以用记事本打开它
版权属于:zgcwkj
本文链接:https://zgcwkj.com/archives/202.html
转载声明:请注明本文章的标题及内容的出处和声明,谢谢
评论已关闭