Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | INSTALLER_DIR="`dirname ${0}`" |
| 4 | |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 5 | # for cases that don't run "lunch rb5-userdebug" |
| 6 | if [ -z "${ANDROID_BUILD_TOP}" ]; then |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 7 | ANDROID_BUILD_TOP="`readlink -f ${INSTALLER_DIR}/../../../../../`" |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 8 | ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/rb5" |
| 9 | fi |
| 10 | |
| 11 | if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 12 | echo "FLASH-ALL-AOSP: error in locating ${ANDROID_PRODUCT_OUT}/ directory, check if it exist" |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 13 | exit |
| 14 | fi |
| 15 | |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 16 | . "${ANDROID_BUILD_TOP}/device/linaro/dragonboard/vendor-package-ver.sh" |
| 17 | |
| 18 | FIRMWARE_DIR="${ANDROID_BUILD_TOP}/vendor/linaro/rb5/${EXPECTED_LINARO_VENDOR_VERSION}" |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 19 | |
| 20 | # TODO: Pull one-time recovery/qdl path out of standard install |
| 21 | # Flash bootloader firmware files |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 22 | if [ ! -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 Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 27 | exit |
| 28 | fi |
| 29 | |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 30 | pushd "${FIRMWARE_DIR}/rb5-bootloader-ufs-aosp" > /dev/null |
| 31 | echo "FLASH-ALL-AOSP: Flash bootloader images" |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 32 | ./flashall |
| 33 | popd > /dev/null |
| 34 | |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 35 | echo "android out dir:${ANDROID_PRODUCT_OUT}" |
| 36 | |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 37 | echo "FLASH-ALL-AOSP: Flash boot img" |
| 38 | fastboot flash boot "${ANDROID_PRODUCT_OUT}"/boot.img |
| 39 | echo "FLASH-ALL-AOSP: Flash super/dynamic image" |
| 40 | fastboot flash super "${ANDROID_PRODUCT_OUT}"/super.img |
| 41 | echo "FLASH-ALL-AOSP: Flash userdata image" |
| 42 | fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img |
| 43 | echo "FLASH-ALL-AOSP: Flash vendor_boot image" |
| 44 | fastboot flash vendor_boot "${ANDROID_PRODUCT_OUT}"/vendor_boot.img |
| 45 | echo "FLASH-ALL-AOSP: Formatting metadata" |
| 46 | fastboot format:ext4 metadata |
| 47 | |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 48 | echo "FLASH-ALL-AOSP: Rebooting" |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 49 | fastboot reboot |
| 50 | |
| 51 | echo "FLASH-ALL-AOSP: Updating lt9611uxc firmware version" |
Amit Pundir | fbd3fbb | 2021-11-18 14:59:17 +0530 | [diff] [blame] | 52 | echo " Waiting for adb.." |
| 53 | echo |
Amit Pundir | e4ca84a | 2021-05-26 14:30:57 +0530 | [diff] [blame] | 54 | adb wait-for-device |
| 55 | VERSION=`adb shell su 0 cat /sys/bus/i2c/devices/5-002b/lt9611uxc_firmware` |
| 56 | if [ "$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 |
| 62 | fi |
| 63 | echo "FLASH-ALL-AOSP: Done" |