blob: 076b5809a0559b49cdd0e96758f9bd7f9dd47151 [file] [log] [blame]
Vishal Bhojca1fbcd2015-12-16 00:25:24 +05301#!/bin/bash
2if [ $# -eq 0 ]
3 then
4 echo "Provide the right /dev/ttyUSBX specific to recovery device"
5 exit
6fi
7
8if [ ! -e $1 ]
9 then
10 echo "device: $1 does not exist"
11 exit
12fi
Satish Pateldc91c892016-03-28 10:03:21 +053013DEVICE_PORT=${1}
Dmitry Shmidt06cb4cd2016-01-27 11:00:33 -080014PTABLE=ptable-aosp-8g.img
15if [ $# -gt 1 ]
16 then
17 if [ $2 == '4g' ]
18 then
19 PTABLE=ptable-aosp-4g.img
20 fi
21fi
22
Vishal Bhojca1fbcd2015-12-16 00:25:24 +053023INSTALLER_DIR="`dirname $0`"
24ANDROID_TOP=${INSTALLER_DIR}/../../../../
Satish Pateldc91c892016-03-28 10:03:21 +053025
26#get out directory path
27while [ $# -ne 0 ]; do
28 case "$1" in
29 --out) OUT_IMGDIR=$2;shift;
30 esac
31 shift
32done
33
34if [ -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
40fi
41
42if [ ! -d $OUT_IMGDIR ]; then
43 echo "error in locating out directory, check if it exist"
44 exit
45fi
46echo "android out dir:$OUT_IMGDIR"
47
48python ${INSTALLER_DIR}/hisi-idt.py --img1=${INSTALLER_DIR}/l-loader.bin -d ${DEVICE_PORT}
Dmitry Shmidt06cb4cd2016-01-27 11:00:33 -080049fastboot flash ptable ${INSTALLER_DIR}/${PTABLE}
Vishal Bhojca1fbcd2015-12-16 00:25:24 +053050fastboot flash fastboot ${INSTALLER_DIR}/fip.bin
51fastboot flash nvme ${INSTALLER_DIR}/nvme.img
Satish Pateldc91c892016-03-28 10:03:21 +053052fastboot flash boot ${OUT_IMGDIR}/boot_fat.uefi.img
53fastboot flash system ${OUT_IMGDIR}/system.img
54fastboot flash cache ${OUT_IMGDIR}/cache.img
55fastboot flash userdata ${OUT_IMGDIR}/userdata.img