1#!/bin/bash 2 3INSTALLER_DIR="`dirname ${0}`" 4 5# for cases that don't run "lunch db845c-trunk_staging-userdebug" 6if [ -z "${ANDROID_BUILD_TOP}" ]; then 7 ANDROID_BUILD_TOP="`readlink -f ${INSTALLER_DIR}/../../../../../`" 8 ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/db845c" 9fi 10 11if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then 12 echo "FLASH-ALL-AOSP: error in locating ${ANDROID_PRODUCT_OUT}/ directory, check if it exist" 13 exit 14fi 15 16. "${ANDROID_BUILD_TOP}/device/linaro/dragonboard/vendor-package-ver.sh" 17 18FIRMWARE_DIR="${ANDROID_BUILD_TOP}/vendor/linaro/rb5/${EXPECTED_LINARO_VENDOR_VERSION}" 19 20# TODO: Pull one-time recovery/qdl path out of standard install 21# Flash bootloader firmware files 22if [ ! -d "${FIRMWARE_DIR}/" ]; then 23 echo "FLASH-ALL-AOSP: Missing vendor firmware package?" 24 echo " Make sure the vendor binaries have been downloaded from" 25 echo " ${VND_PKG_URL}" 26 echo " and extracted to $ANDROID_BUILD_TOP." 27 exit 28fi 29 30pushd "${FIRMWARE_DIR}/rb5-bootloader-ufs-aosp" > /dev/null 31echo "FLASH-ALL-AOSP: Flash bootloader images" 32./flashall 33popd > /dev/null 34 35echo "android out dir:${ANDROID_PRODUCT_OUT}" 36 37echo "FLASH-ALL-AOSP: Flash boot img" 38fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img 39echo "FLASH-ALL-AOSP: Flash super/dynamic image" 40fastboot flash super "${ANDROID_PRODUCT_OUT}"/super.img 41echo "FLASH-ALL-AOSP: Flash userdata image" 42fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img 43echo "FLASH-ALL-AOSP: Flash vendor_boot image" 44fastboot flash vendor_boot "${ANDROID_PRODUCT_OUT}"/vendor_boot.img 45echo "FLASH-ALL-AOSP: Formatting metadata" 46fastboot format:ext4 metadata 47 48echo "FLASH-ALL-AOSP: Rebooting" 49fastboot reboot 50 51echo "FLASH-ALL-AOSP: Updating lt9611uxc firmware version" 52echo " Waiting for adb.." 53echo 54adb wait-for-device 55VERSION=`adb shell su 0 cat /sys/bus/i2c/devices/5-002b/lt9611uxc_firmware` 56if [ "$VERSION" -lt "43" ] ; then 57 echo "FLASH-ALL-AOSP: lt9611uxc 5-002b: Updating firmware... May take up to 120 seconds. Do not switch off the device" 58 adb shell "echo 1 | su 0 tee /sys/bus/i2c/devices/5-002b/lt9611uxc_firmware > /dev/null" 59 echo "FLASH-ALL-AOSP: lt9611uxc 5-002b: Firmware updates successfully" 60 echo "FLASH-ALL-AOSP: Rebooting" 61 adb reboot 62fi 63echo "FLASH-ALL-AOSP: Done" 64