小米MIUI线刷包cust.img、system.img精简教程(一)

需要准备的工具

python2.7  https://www.python.org/ftp/python/2.7/python-2.7.amd64.msi

蘑菇rom助手  http://down.yzmg.com/mogu/romzhushou/download/RomZhuShouSetup_18.0.1710.02.exe

文本编辑器notepad++   https://notepad-plus-plus.org/repository/7.x/7.5.8/npp.7.5.8.Installer.x64.exe

小米官方bootloader解锁工具  http://www.miui.com/unlock/index.html

小米官方刷机工具  http://bigota.d.miui.com/tools/MiFlash2018-5-28-0.zip

miui线刷包  http://www.miui.com/zt/miuirom/download.php

一、对boot.img和recovery.img去除boot校验

在蘑菇助手工具箱选择“boot编辑”,“选择文件”(miui线刷包解压目录images文件夹下)打开,选择“自动去除boot校验”,分别修改boot.img和recovery.img,蘑菇助手会自动把原文件命名为boot_old.img、recovery_old.img。

二、精简system.img和cust.img

使用蘑菇助手精简不需要使用的APK,具体的下一篇文章详细讲解。

三、修改md5sum.xml

在蘑菇助手的MD5计算功能中,把修改过的boot.img、recovery.img、system.img和cust.img的MD5复制到下图。

四、修改flash_gen_crc_list.py(注意python语法对齐使用tab,不能使用空格)

使用Notepad++打开flash_gen_crc_list.py,拖至文件最后代码处。

                    cmd = os.path.join(thispath, cmdarg)
                    count = get_sparse_count(cmd)
                    if count>0:
                        countstr = str(count)
                        crc = gen_sparse_crc(filepath)
                        if crc:
                            fs.write(ptn + ' ' + hex(crc & (2**32-1)) + ' ' + countstr + '\n')
    except Exception, e:
        os.remove(crclist)
        os.remove(sparsecrclist)
        raise

将下面的代码覆盖上图的代码(注意此处代码容易出BUG,建议复制

                    cmd = os.path.join(thispath, cmdarg)
                    crc = gen_sparse_crc(filepath)
                    if    crc:
                        fs.write(ptn + '    ' + hex(crc & (2**32-1)) + '    '  + '\n')
    except Exception, e:
            print(e)
            raise

 五、修改sparsecrclist.txt和crclist.tx

将MIUI线刷包images文件夹下sparsecrclist.txt和crclist.txt改名为sparsecrclist.txt.bak和crclist.txt.bak

然后打开CMD功能(快捷键win+R,输入CMD,回车),拖动flash_gen_crc_list.py至CMD窗口,回车。

使用Notepad++打开新生成的sparsecrclist.txt和crclist.txt,备份的sparsecrclist.txt.bak和crclist.txt.bak四个文件

把crclist.txt每行末尾的L字母删除,然后再crclist.txt中找到cust行,把整行剪切放到sparsecrclist.txt中,参照原sparsecrclist.txt.bak文件,把空格和数字也加上去

六、使用小米线刷工具刷机

猜你喜欢

转载自blog.csdn.net/cfq1491/article/details/81260068