安卓刷机脚本一例
作者:
汶水一方 | 来源:发表于
2019-03-05 11:52 被阅读2次#!/bin/sh
ADB_MODE=`adb devices | grep -v "List\|killin\|daemon\|^$"`
FASTBOOT_MODE=`fastboot devices`
IMG_DIR=$PWD
if [ -n "$ADB_MODE" ];then
echo "reboot to fastboot..."
adb reboot bootloader
elif [ -z "$FASTBOOT_MODE" ];then
echo "waiting for your device to connect ..."
adb wait-for-device
adb reboot bootloader
fi
IMAGE_FILE=`ls $IMG_DIR | grep "img\|elf"`
SLOT=`fastboot getvar current-slot 2>&1 | grep current-slot | awk '{print $2}'`
for file in $IMAGE_FILE
do
echo Downloading image file: $file ...
case $file in
'boot.img')
fastboot flash boot$SLOT boot.img
;;
'modem.img')
fastboot flash modem$SLOT modem.img
;;
'xbl.img')
fastboot flash xbl$SLOT xbl.img
;;
'abl.elf')
fastboot flash abl$SLOT abl.elf
;;
'system.img')
fastboot flash -S 400M system$SLOT system.img
;;
'dsp.img')
fastboot flash dsp$SLOT dsp.img
;;
'userdata.img')
fastboot flash userdata userdata.img
;;
*)
echo unsupported image file: $file
;;
esac
done
echo "Done!"
fastboot reboot
本文标题:安卓刷机脚本一例
本文链接:https://www.haomeiwen.com/subject/tlynuqtx.html
网友评论