本文针对python3更新, 并解决上次博客中的一些问题. 参考MIUI9线刷包精简: https://blog.csdn.net/zhuyu4839/article/details/77979255
note: 安卓9 boot和recovery镜像解包工具: https://github.com/GameTheory-/mktool/releases
1. md5文件更新直接使用: flash_gen_md5_list.py, 此文件更新内容:
删除第31行: file = os.path.join(path, file)或者在前面加#
2. crc校验文件生成, 使用: flash_gen_crc_list.py
更新110行左右(不同机型线刷包的该文件可能不一样, 后面不赘述):
for i in xrange(1,total_chunks+1):
为:
for i in range(1,total_chunks+1):
更新180行左右:
try:
为:
with open(sparsecrclist, 'w') as fs, open(crclist, 'w') as f:
更新第203行左右# need get the sparsecount之后的三行:
cmdarg = './flash_gen_resparsecount' + ' -S ' + str(max_download_size) + ' ' + filepath
cmd = os.path.join(thispath, cmdarg)
count = get_sparse_count(cmd)
为:
count = size // max_download_size
if size % max_download_size > 0:
count += 1 #注意这行比上一行多缩进4个空格
倒数四行删除或者在前面加#
except Exception as e:
os.remove(crclist)
os.remove(sparsecrclist)
raise
安装好python3并关联py文件直接双击运行即可自动生成crclist.txt和sparsecrclist.txt文件.
注: 原线刷包flash_gen_crc_list.py文件运行需要依赖flash_gen_resparsecount(此文件为Linux下可执行文件), 按此方法更新后解决.