1#!/bin/bash
2
3INSTALLER_DIR="`dirname ${0}`"
4
5# for cases that don't run "lunch db845c-userdebug"
6if [ -z "${ANDROID_BUILD_TOP}" ]; then
7    ANDROID_BUILD_TOP="`readlink -f ${INSTALLER_DIR}/../../../../../`"
8fi
9
10
11. "${ANDROID_BUILD_TOP}/device/linaro/dragonboard/vendor-package-ver.sh"
12
13FIRMWARE_DIR="${ANDROID_BUILD_TOP}/vendor/linaro/db845c/${EXPECTED_LINARO_VENDOR_VERSION}"
14
15# TODO: Pull one-time recovery/qdl path out of standard install
16# Flash bootloader firmware files
17if [ ! -d "${FIRMWARE_DIR}/" ]; then
18    echo "RECOVERY: Missing vendor firmware package?"
19    echo "          Make sure the vendor binaries have been downloaded from"
20    echo "          ${VND_PKG_URL}"
21    echo "          and extracted to $ANDROID_BUILD_TOP."
22    exit
23fi
24
25QDL="`readlink -f ${FIRMWARE_DIR}/qdl/qdl`"
26
27pushd "${FIRMWARE_DIR}/dragonboard-845c-bootloader-ufs-aosp" > /dev/null
28echo "RECOVERY: Running QDL board recovery tool"
29sudo ${QDL} prog_firehose_ddr.elf rawprogram[012345].xml patch[012345].xml
30popd > /dev/null
31
32echo
33echo
34echo "RECOVERY: Please boot the db845c into fastboot mode, and use the flash-all-aosp.sh script!"
35echo
36