1,准備
- platform-tools
- Mac/Linux/windows
- 會簡單的命令行命令
2,解鎖你的小米設備
http://en.miui.com/unlock/
按照小米官方說明的步驟進行解鎖你的小米設備。
3,Installing a custom recovery using fastboot
注意,下面的步驟請在你解鎖你的小米設備后才能進行。
- Download a custom recovery - you can download TWRP. Simply download the latest recovery file, named something like
twrp-x.x.x-x-gemini.img
. - Connect your device to your PC via USB.
- On the computer, open a command prompt (on Windows) or terminal (on Linux or macOS) window, and type:
gaoshiweideMacBook-Pro:~ gaoshiwei$ adb devices
List of devices attached
289dedcc device
// 如果成功的話會列出你的設備
// 繼續進行下面的步驟
gaoshiweideMacBook-Pro:~ gaoshiwei$ adb reboot bootloader
gaoshiweideMacBook-Pro:~ gaoshiwei$ fastboot devices
289dedcc fastboot
// 注意下面的命令,/Users/gaoshiwei/Downloads/是我Mac上存放img的路徑。(用過命令行的都懂哈)
gaoshiweideMacBook-Pro:~ gaoshiwei$ fastboot flash recovery /Users/gaoshiwei/Downloads/twrp-3.1.1-0-gemini.img
target reported max download size of 536870912 bytes
sending 'recovery' (20200 KB)...
OKAY [ 0.601s]
writing 'recovery'...
OKAY [ 0.127s]
finished. total time: 0.727s
// 上面的一條命令成功后進行下面的。
gaoshiweideMacBook-Pro:~ gaoshiwei$ fastboot boot /Users/gaoshiwei/Downloads/twrp-3.1.1-0-gemini.img
downloading 'boot.img'...
OKAY [ 0.517s]
booting...
OKAY [ 0.427s]
finished. total time: 0.945s
// finished 后,等下一下,一會就能看到圖像界面了。可以操作哦,英文一般的可以選擇語言哦,有簡體中文。
// 把電腦上下載好的系統push到手機里面去,記得push到 /sdcard/ 下
gaoshiweideMacBook-Pro:~ gaoshiwei$ adb push /Users/gaoshiwei/Downloads/lineage-17.1-nightly-gemini-signed.zip /sdcard/
/Users/gaoshiwei/Downloads/lineage-14.1-20171128-nightly-gemini...gned.zip: 1 file pushed. 12.6 MB/s (552332426 bytes in 41.791s)
// 到達這一步,我們的刷機前戲工作基本已經完成的差不多了。
4,開始刷機
- 選擇清除,然后進入高級清除
- 選擇Cache,System,Data分區,然后滑動下面的滑動圖標進行清除。
- 返回主菜單界面,然后選擇安裝。
- 導航到/sdcard,然后選擇 LineageOS系統的.zip包
- 先不要勾選驗證和安裝后重啟
- 開始安裝,如果沒有出現錯誤的話,等他安裝吧。(出現錯誤的話看下面的備注)
- 等待安裝完成后,返回主菜單,選擇重啟,然后選擇系統。
5,備注:解決LineageOS刷機 錯誤7 問題
如果當你選擇好zip,開始安裝的時候,出現錯誤,出現error 7
. 出現驗相關的問題,那么高潮來了。
- 先在你的電腦找你下載的LineageOS.zip的文件,用壓縮軟件解壓。
- 找到這個文件 META-INF/com/google/updater-script
- 用記事本之類的文本編輯器打開(我用的sublime)
- 選擇前面幾行的中的所有assert的行,進行刪除,包括空行也刪除。刪除后保存文件。
- 重新打包,把你之前解壓的所有文件,重新打進一個壓縮包,用zip的壓縮方式,包名起什么都無所謂,盡量簡單點,我就起了個mi5.zip
// 再次把系統包push到我們手機中
gaoshiweideMacBook-Pro:~ gaoshiwei$ adb push /Users/gaoshiwei/Downloads/mi5.zip /sdcard/
/Users/gaoshiwei/Downloads/mi5.zip: 1 file pushed. 16.1 MB/s (552345568 bytes in 32.774s)
push進去之后,下面就是開始刷機了。那就看前面的刷機步驟嘍。
鏈接:https://www.jianshu.com/p/1cdd45b3343d