@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 設備解鎖,才可以進行后續(xù)燒寫操作。
fastboot oem unlock
rem 后續(xù)擦除原有系統(tǒng) === 也可以不擦除,如果不怕出錯的話。 分別是引導區(qū),高速緩沖,恢復,系統(tǒng),用戶數據區(qū)等。
fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata
rem 燒寫設備冷啟動引導程序并重啟系統(tǒng)
fastboot flash bootloader bootloader-grouper-4.23.img
fastboot reboot-bootloader
rem 檢查本地連接是否正常 - 這是在設備重啟之后的動作。
ping -n 10 127.0.0.1 >nul
rem 把固件寫入到設備中。這里使用的是update命令,把系統(tǒng)壓縮包直接更新。
fastboot -w update image-nakasi-lmy47v.zip
rem 完成后重啟設備,完成刷機工作。
echo Press any key to exit...
pause >nul
exit
如果不需要擦除全部數據,而只是更新個別分區(qū),則使用單獨的命令行進行。如僅更新system分區(qū),命令如下: D:\APKide\tools>fastboot flash system system.img
這樣就可以完成單個分區(qū)的寫入。這樣寫入的速度雖然快速,但是存在系統(tǒng)不穩(wěn)定的風險,因此一般情況下把所有分區(qū)按順序寫入到設備中,然后在執(zhí)行重啟動作,完成刷機過程。