# # The script expects that an Android build has been done. # count=`sudo adb devices | grep "device" | wc -l` if [ $count = 1 ]; then echo "No device with Android booted found" elif [ $count = 2 ];then sudo adb reboot bootloader; else echo "More than one device connected" fi # Allow some time for the device to boot into bootloader mode sleep 5 if [ `sudo fastboot devices | wc -l` = 1 ];then echo "fastboot detected device" else echo "Error: Unable to detect the device in fastboot mode. Please put the device in download mode" exit -1 fi sudo fastboot flash boot ${ANDROID_PRODUCT_OUT}/boot.img sudo fastboot flash system ${ANDROID_PRODUCT_OUT}/system.img sudo fastboot flash vendor ${ANDROID_PRODUCT_OUT}/vendor.img sudo fastboot flash cache ${ANDROID_PRODUCT_OUT}/cache.img sudo fastboot reboot