summaryrefslogtreecommitdiff
path: root/flash-all.sh
blob: 8f9bc82ccddda3a47bb18209b9941dda792b61ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# 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