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