Amit Pundir | ed3f821 | 2019-07-01 18:02:54 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | INSTALLER_DIR="`dirname ${0}`" |
| 4 | |
| 5 | FIRMWARE_DIR="dragonboard-845c-bootloader-ufs-aosp" |
| 6 | |
| 7 | # for cases that don't run "lunch db845c-userdebug" |
| 8 | if [ -z "${ANDROID_BUILD_TOP}" ]; then |
| 9 | ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../ |
| 10 | ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/db845c" |
| 11 | fi |
| 12 | |
| 13 | if [ ! -d "${ANDROID_PRODUCT_OUT}" ]; then |
| 14 | echo "FLASH-ALL-AOSP: error in locating out/target directory, check if it exist" |
| 15 | exit |
| 16 | fi |
| 17 | |
| 18 | echo "android out dir:${ANDROID_PRODUCT_OUT}" |
| 19 | |
| 20 | # TODO: Pull one-time recovery/qdl path out of standard install |
| 21 | # Flash bootloader firmware files |
| 22 | if [ ! -d "${INSTALLER_DIR}/${FIRMWARE_DIR}/" ]; then |
| 23 | echo "FLASH-ALL-AOSP: No firmware directory? Make sure binaries have been provided" |
| 24 | exit |
| 25 | fi |
| 26 | |
| 27 | pushd "${INSTALLER_DIR}/${FIRMWARE_DIR}" > /dev/null |
| 28 | ./flashall |
| 29 | popd > /dev/null |
| 30 | |
| 31 | # Set HDMI monitor output |
| 32 | echo "FLASH-ALL-AOSP: Set HDMI monitor output" |
| 33 | fastboot oem select-display-panel foobar |
| 34 | fastboot reboot bootloader |
| 35 | |
| 36 | # Slot _a is already marked as active by bootloader but just in case.. |
| 37 | echo "FLASH-ALL-AOSP: Mark _a slot as active" |
| 38 | fastboot set_active a |
| 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 | |
| 44 | if [ "$1" != "" ]; then |
Amit Pundir | 0cc0a3b | 2019-12-05 21:06:16 +0530 | [diff] [blame^] | 45 | if [ "$2" = "" ]; then |
| 46 | echo "FLASH-ALL-AOSP: Trying to build boot.img? Pass corresponding dtb as well" |
| 47 | echo " Usage: flash-all-aosp.sh Image.gz sdm845-db845c.dtb" |
| 48 | exit |
| 49 | fi |
| 50 | |
Amit Pundir | ed3f821 | 2019-07-01 18:02:54 +0000 | [diff] [blame] | 51 | ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../../ |
| 52 | ANDROID_OUT_HOST_BIN="${ANDROID_BUILD_TOP}/out/host/linux-x86/bin" |
| 53 | |
| 54 | if [ ! -d "${ANDROID_OUT_HOST_BIN}" ]; then |
| 55 | echo "FLASH-ALL-AOSP: error in locating out/host/ directory for mkbootimg, check if it exist" |
Amit Pundir | 0cc0a3b | 2019-12-05 21:06:16 +0530 | [diff] [blame^] | 56 | echo "FLASH-ALL-AOSP: can't build boot image with user provided kernel image and dtb" |
Amit Pundir | ed3f821 | 2019-07-01 18:02:54 +0000 | [diff] [blame] | 57 | exit |
| 58 | fi |
| 59 | |
Amit Pundir | 0cc0a3b | 2019-12-05 21:06:16 +0530 | [diff] [blame^] | 60 | echo "FLASH-ALL-AOSP: Building boot image with user provided ${1} kernel image and ${2} dtb" |
| 61 | ${ANDROID_OUT_HOST_BIN}/mkbootimg --kernel ${1} --dtb ${2} --ramdisk ${ANDROID_PRODUCT_OUT}/ramdisk.img --header_version 2 --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 |
Amit Pundir | ed3f821 | 2019-07-01 18:02:54 +0000 | [diff] [blame] | 62 | |
| 63 | echo "FLASH-ALL-AOSP: Flash boot image" |
| 64 | fastboot flash boot ${ANDROID_PRODUCT_OUT}/boot.img |
| 65 | fastboot reboot |
| 66 | fi |