安装Homebrew(已安装跳过)

raw.githubusercontent.com域名被污染,如果报错,host文件添加

199.232.68.133 raw.githubusercontent.com

安装安卓工具

brew cask install android-platform-tools

解压fastboot线刷固件,cd到含boot.img、system.img、cache.img等文件的文件夹下

开始刷机

1.设备打开USB选项

【关于设备】连续点击内核版本 直到弹出已处于开发者模式

【设置】--> 【开发者选项】--> 【USB调试】

2.adb查看设备连接状态

super@superdeMBP emmc % adb devices
List of devices attached
1af7de5	device

3.adb进入fastboot模式

super@superdeMBP emmc % adb reboot bootloader

4.fastboot查看设备

super@superdeMBP emmc % fastboot devices     
1af7de5	fastboot

5.fastboot抹掉旧系统,写入新系统,依次执行以下命令

 抹掉旧版本分区内容
 1. fastboot erase boot
 2. fastboot erase system 
 3. fastboot erase userdata 
 4. fastboot erase recovery
 刷入对应分区内容
 1. fastboot flash boot boot.img
 2. fastboot flash system system.img
 3. fastboot flash userdata userdata.img
 4. fastboot flash recovery recovery.img
 重启搞定
    fastboot reboot
super@superdeMBP emmc % fastboot erase boot
Erasing 'boot'                                     OKAY [  0.004s]
Finished. Total time: 0.012s
super@superdeMBP emmc % fastboot erase system
Erasing 'system'                                   OKAY [  0.004s]
Finished. Total time: 0.011s
super@superdeMBP emmc % fastboot erase userdata
Erasing 'userdata'                                 OKAY [  0.005s]
Finished. Total time: 0.013s
super@superdeMBP emmc % fastboot erase recovery
Erasing 'recovery'                                 OKAY [  0.004s]
Finished. Total time: 0.013s
super@superdeMBP emmc % fastboot flash boot boot.img
Sending 'boot' (6388 KB)                           OKAY [  0.207s]
Writing 'boot'                                     OKAY [  0.506s]
Finished. Total time: 0.724s
super@superdeMBP emmc % fastboot flash system system.img
Sending 'system' (511318 KB)                       ERROR: usb_write failed with status e00002eb // 此处如果有类似报错,可以报错后等待3min左右的写入时间(我这边虽然报错,但实际上正在Writing),再执行下一步
FAILED (Write to device failed in SendBuffer() (No such file or directory))
fastboot: error: Command failed
super@superdeMBP emmc % fastboot flash userdata userdata.img
Sending 'userdata' (35889 KB)                      OKAY [  1.198s]
Writing 'userdata'                                 OKAY [  2.083s]
Finished. Total time: 3.300s
super@superdeMBP emmc % fastboot flash recovery recovery.img
Sending 'recovery' (6778 KB)                       OKAY [  0.229s]
Writing 'recovery'                                 OKAY [  0.331s]
Finished. Total time: 0.572s
super@superdeMBP emmc % fastboot reboot
Rebooting   

6.Okay!