@ECHO OFF
:: Copyright 2012 The Android Open Source Project
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
rem 下面是添加 fastboot 以及ping 命令的路径。
PATH=%PATH%;"%SYSTEMROOT%\System32"
rem 设备解锁,才可以进行后续烧写操作。
fastboot oem unlock
rem 后续擦除原有系统 === 也可以不擦除,如果不怕出错的话。 分别是引导区,高速缓冲,恢复,系统,用户数据区等。
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata
rem 烧写设备冷启动引导程序并重启系统
fastboot flash bootloader bootloader-grouper-4.23.img
fastboot reboot-bootloader
rem 检查本地连接是否正常 - 这是在设备重启之后的动作。
ping -n 10 127.0.0.1 >nul
rem 把固件写入到设备中。这里使用的是update命令,把系统压缩包直接更新。
fastboot -w update image-nakasi-lmy47v.zip
rem 完成后重启设备,完成刷机工作。
echo Press any key to exit...
pause >nul
exit
如果不需要擦除全部数据,而只是更新个别分区,则使用单独的命令行进行。如仅更新system分区,命令如下: D:\APKide\tools>fastboot flash system system.img
这样就可以完成单个分区的写入。这样写入的速度虽然快速,但是存在系统不稳定的风险,因此一般情况下把所有分区按顺序写入到设备中,然后在执行重启动作,完成刷机过程。