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

这篇教程详述了如何精简小米MIUI线刷包的cust.img和system.img,包括使用蘑菇助手去除boot和recovery的校验,精简系统应用,修改md5sum.xml,以及调整flash_gen_crc_list.py文件,并指导如何使用小米官方工具进行刷机。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需要准备的工具

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文件,把空格和数字也加上去

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

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值