blob: d3063c7de7bdbc2aa1d5f644bd2542d2d45126ff [file] [log] [blame]
Amit Pundire4ca84a2021-05-26 14:30:57 +05301#!/bin/bash
2
3INSTALLER_DIR="`dirname ${0}`"
4
Amit Pundir2505ddf2024-03-29 11:54:48 +05305# for cases that don't run "lunch db845c-trunk_staging-userdebug"
Amit Pundire4ca84a2021-05-26 14:30:57 +05306if [ -z "${ANDROID_BUILD_TOP}" ]; then
Amit Pundirfbd3fbb2021-11-18 14:59:17 +05307 ANDROID_BUILD_TOP="`readlink -f ${INSTALLER_DIR}/../../../../../`"
Amit Pundir2505ddf2024-03-29 11:54:48 +05308 ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/db845c"
Amit Pundire4ca84a2021-05-26 14:30:57 +05309fi
10
11if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053012 echo "FLASH-ALL-AOSP: error in locating ${ANDROID_PRODUCT_OUT}/ directory, check if it exist"
Amit Pundire4ca84a2021-05-26 14:30:57 +053013 exit
14fi
15
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053016. "${ANDROID_BUILD_TOP}/device/linaro/dragonboard/vendor-package-ver.sh"
17
18FIRMWARE_DIR="${ANDROID_BUILD_TOP}/vendor/linaro/rb5/${EXPECTED_LINARO_VENDOR_VERSION}"
Amit Pundire4ca84a2021-05-26 14:30:57 +053019
20# TODO: Pull one-time recovery/qdl path out of standard install
21# Flash bootloader firmware files
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053022if [ ! -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."
Amit Pundire4ca84a2021-05-26 14:30:57 +053027 exit
28fi
29
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053030pushd "${FIRMWARE_DIR}/rb5-bootloader-ufs-aosp" > /dev/null
31echo "FLASH-ALL-AOSP: Flash bootloader images"
Amit Pundire4ca84a2021-05-26 14:30:57 +053032./flashall
33popd > /dev/null
34
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053035echo "android out dir:${ANDROID_PRODUCT_OUT}"
36
Amit Pundire4ca84a2021-05-26 14:30:57 +053037echo "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
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053048echo "FLASH-ALL-AOSP: Rebooting"
Amit Pundire4ca84a2021-05-26 14:30:57 +053049fastboot reboot
50
51echo "FLASH-ALL-AOSP: Updating lt9611uxc firmware version"
Amit Pundirfbd3fbb2021-11-18 14:59:17 +053052echo " Waiting for adb.."
53echo
Amit Pundire4ca84a2021-05-26 14:30:57 +053054adb 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"