Vishal Bhoj | ca1fbcd | 2015-12-16 00:25:24 +0530 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | if [ $# -eq 0 ] |
| 3 | then |
| 4 | echo "Provide the right /dev/ttyUSBX specific to recovery device" |
| 5 | exit |
| 6 | fi |
| 7 | |
| 8 | if [ ! -e $1 ] |
| 9 | then |
| 10 | echo "device: $1 does not exist" |
| 11 | exit |
| 12 | fi |
Satish Patel | dc91c89 | 2016-03-28 10:03:21 +0530 | [diff] [blame] | 13 | DEVICE_PORT=${1} |
Dmitry Shmidt | 06cb4cd | 2016-01-27 11:00:33 -0800 | [diff] [blame] | 14 | PTABLE=ptable-aosp-8g.img |
| 15 | if [ $# -gt 1 ] |
| 16 | then |
| 17 | if [ $2 == '4g' ] |
| 18 | then |
| 19 | PTABLE=ptable-aosp-4g.img |
| 20 | fi |
| 21 | fi |
| 22 | |
Vishal Bhoj | ca1fbcd | 2015-12-16 00:25:24 +0530 | [diff] [blame] | 23 | INSTALLER_DIR="`dirname $0`" |
| 24 | ANDROID_TOP=${INSTALLER_DIR}/../../../../ |
Satish Patel | dc91c89 | 2016-03-28 10:03:21 +0530 | [diff] [blame] | 25 | |
| 26 | #get out directory path |
| 27 | while [ $# -ne 0 ]; do |
| 28 | case "$1" in |
| 29 | --out) OUT_IMGDIR=$2;shift; |
| 30 | esac |
| 31 | shift |
| 32 | done |
| 33 | |
| 34 | if [ -z $OUT_IMGDIR ]; then |
| 35 | if [ ! -z $ANDROID_PRODUCT_OUT ]; then |
| 36 | OUT_IMGDIR=${ANDROID_PRODUCT_OUT} |
| 37 | else |
| 38 | OUT_IMGDIR="${ANDROID_TOP}/out/target/product/hikey" |
| 39 | fi |
| 40 | fi |
| 41 | |
| 42 | if [ ! -d $OUT_IMGDIR ]; then |
| 43 | echo "error in locating out directory, check if it exist" |
| 44 | exit |
| 45 | fi |
| 46 | echo "android out dir:$OUT_IMGDIR" |
| 47 | |
| 48 | python ${INSTALLER_DIR}/hisi-idt.py --img1=${INSTALLER_DIR}/l-loader.bin -d ${DEVICE_PORT} |
Dmitry Shmidt | 06cb4cd | 2016-01-27 11:00:33 -0800 | [diff] [blame] | 49 | fastboot flash ptable ${INSTALLER_DIR}/${PTABLE} |
Vishal Bhoj | ca1fbcd | 2015-12-16 00:25:24 +0530 | [diff] [blame] | 50 | fastboot flash fastboot ${INSTALLER_DIR}/fip.bin |
| 51 | fastboot flash nvme ${INSTALLER_DIR}/nvme.img |
Satish Patel | dc91c89 | 2016-03-28 10:03:21 +0530 | [diff] [blame] | 52 | fastboot flash boot ${OUT_IMGDIR}/boot_fat.uefi.img |
| 53 | fastboot flash system ${OUT_IMGDIR}/system.img |
| 54 | fastboot flash cache ${OUT_IMGDIR}/cache.img |
| 55 | fastboot flash userdata ${OUT_IMGDIR}/userdata.img |