安装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查看设备连接状态
[email protected] emmc % adb devices
List of devices attached
1af7de5device
3.adb进入fastboot模式
[email protected] emmc % adb reboot bootloader
4.fastboot查看设备
[email protected] emmc % fastboot devices
1af7de5fastboot
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
[email protected] emmc % fastboot erase boot
Erasing ‘boot‘ OKAY [ 0.004s]
Finished. Total time: 0.012s
[email protected] emmc % fastboot erase system
Erasing ‘system‘ OKAY [ 0.004s]
Finished. Total time: 0.011s
[email protected] emmc % fastboot erase userdata
Erasing ‘userdata‘ OKAY [ 0.005s]
Finished. Total time: 0.013s
[email protected] emmc % fastboot erase recovery
Erasing ‘recovery‘ OKAY [ 0.004s]
Finished. Total time: 0.013s
[email protected] emmc % fastboot flash boot boot.img
Sending ‘boot‘ (6388 KB) OKAY [ 0.207s]
Writing ‘boot‘ OKAY [ 0.506s]
Finished. Total time: 0.724s
[email protected] 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
[email protected] emmc % fastboot flash userdata userdata.img
Sending ‘userdata‘ (35889 KB) OKAY [ 1.198s]
Writing ‘userdata‘ OKAY [ 2.083s]
Finished. Total time: 3.300s
[email protected] emmc % fastboot flash recovery recovery.img
Sending ‘recovery‘ (6778 KB) OKAY [ 0.229s]
Writing ‘recovery‘ OKAY [ 0.331s]
Finished. Total time: 0.572s
[email protected] emmc % fastboot reboot
Rebooting
6.Okay!
原文:https://www.cnblogs.com/chao8888/p/13094854.html