db845c: installer: Add bootloader binaries and flashing scripts

* Add AOSP flashing and board recovery scripts, a README for
  instructions and prebuilt flashing tool (qdl) for board recovery.
  QDL source is hosted at
    https://github.com/andersson/qdl/commits/master (760b3dffb03d)

* Also added the db845c aosp bootloader binaries from here:
  https://snapshots.linaro.org/96boards/dragonboard845c/linaro/rescue/26/

  Build description:
    Build URL: https://ci.linaro.org/job/lt-qcom-bootloader-dragonboard845c/26/
    Linux proprietary bootloaders package: RB3_firmware_20190529180356-v3.zip

    ABL source code: https://git.linaro.org/landing-teams/working/qualcomm/abl.git/commit/?id=5086ee1aa38de6d69efea1d4a5ee535203014097
    Partition table:
      AOSP: https://git.linaro.org/landing-teams/working/qualcomm/db-boot-tools.git/tree/dragonboard845c/aosp/partition.xml?id=0e8dde66a17cad7040b7f21f9e752fc1ee13006d

Change-Id: I563b09779ef506b529774bd0b32147d8d516f096
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/installer/db845c/flash-all-aosp.sh b/installer/db845c/flash-all-aosp.sh
new file mode 100755
index 0000000..182278a
--- /dev/null
+++ b/installer/db845c/flash-all-aosp.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+INSTALLER_DIR="`dirname ${0}`"
+
+FIRMWARE_DIR="dragonboard-845c-bootloader-ufs-aosp"
+
+# for cases that don't run "lunch db845c-userdebug"
+if [ -z "${ANDROID_BUILD_TOP}" ]; then
+    ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
+    ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/db845c"
+fi
+
+if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then
+    echo "FLASH-ALL-AOSP: error in locating out/target directory, check if it exist"
+    exit
+fi
+
+echo "android out dir:${ANDROID_PRODUCT_OUT}"
+
+# TODO: Pull one-time recovery/qdl path out of standard install
+# Flash bootloader firmware files
+if [ ! -d "${INSTALLER_DIR}/${FIRMWARE_DIR}/" ]; then
+    echo "FLASH-ALL-AOSP: No firmware directory? Make sure binaries have been provided"
+    exit
+fi
+
+pushd "${INSTALLER_DIR}/${FIRMWARE_DIR}" > /dev/null
+./flashall
+popd > /dev/null
+
+# Set HDMI monitor output
+echo "FLASH-ALL-AOSP: Set HDMI monitor output"
+fastboot oem select-display-panel foobar
+fastboot reboot bootloader
+
+# Slot _a is already marked as active by bootloader but just in case..
+echo "FLASH-ALL-AOSP: Mark _a slot as active"
+fastboot set_active a
+echo "FLASH-ALL-AOSP: Flash super/dynamic image"
+fastboot flash super "${ANDROID_PRODUCT_OUT}"/super.img
+echo "FLASH-ALL-AOSP: Flash userdata image"
+fastboot flash userdata "${ANDROID_PRODUCT_OUT}"/userdata.img
+
+if [ "$1" != "" ]; then
+    ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../
+    ANDROID_OUT_HOST_BIN="${ANDROID_BUILD_TOP}/out/host/linux-x86/bin"
+
+    if [ ! -d "${ANDROID_OUT_HOST_BIN}" ]; then
+        echo "FLASH-ALL-AOSP: error in locating out/host/ directory for mkbootimg, check if it exist"
+        echo "FLASH-ALL-AOSP: can't build boot image with user provided ${1} kernel image"
+        exit
+    fi
+
+    echo "FLASH-ALL-AOSP: Building boot image with user provided ${1} kernel image"
+    ${ANDROID_OUT_HOST_BIN}/mkbootimg --kernel ${1} --ramdisk ${ANDROID_PRODUCT_OUT}/ramdisk.img --base 0x80000000 --pagesize 2048 --cmdline "firmware_class.path=/vendor/firmware/ androidboot.hardware=db845c init=/init androidboot.boot_devices=soc/1d84000.ufshc printk.devkmsg=on buildvariant=userdebug" --output ${ANDROID_PRODUCT_OUT}/boot.img
+
+    echo "FLASH-ALL-AOSP: Flash boot image"
+    fastboot flash boot ${ANDROID_PRODUCT_OUT}/boot.img
+    fastboot reboot
+fi