研究Android启动过程中,搞了一个刷机脚本,如下:
用途:
将此将本放在ANdroid源码第一级目录下,修改完源码,full_passion-userdebug编译完成后,可直接调用此脚本刷系统。
注意:
错误检查可能不完备
源码如下:
#!/bin/bash
CMD_PATH="out/host/linux-x86/bin"
IMG_PATH="out/target/product/passion/"
CMD_FASTBOOT="sudo $CMD_PATH/fastboot"
CMD_ADB="sudo $CMD_PATH/adb"
BOOTIMG=$IMG_PATH"boot.img"
SYSTEMIMG=$IMG_PATH"system.img"
USERDATAIMG=$IMG_PATH"userdata.img"
IMAGES="$BOOTIMG $SYSTEMIMG $USERDATAIMG"
device=`$CMD_ADB devices | grep -v List`
if [ $? -eq 0 ]
then
echo "======Reboot device to flash: $device======"
$CMD_ADB reboot bootloader
fi
sleep 10
device=`$CMD_FASTBOOT devices`
if [ $? -ne 0 ]
then
echo $device
exit
fi
echo "======Flash device: $device======"
for img in $IMAGES
do
f=`basename $img | awk -F. '{print $1}'`
echo "flash $f image: $img"
res=`$CMD_FASTBOOT flash $f $img`
if [ $? -ne 0 ];
then
echo $res
exit
fi
done
echo "======Reboot Mobile System======"
$CMD_FASTBOOT reboot
|
阅读(2049) | 评论(0) | 转发(0) |