summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2016-07-12 17:14:56 +0100
committerVishal Bhoj <vishal.bhoj@linaro.org>2016-07-13 15:18:53 +0000
commit2df2ca745f84f791d6519740d8239164ba0464df (patch)
treebeef8f9746f980d9885a37e01f06099dac63a4a0
parent9a67d91cc3931702e597708142fb0de30426e318 (diff)
downloadhikey-nougat-mr1-wear-release.tar.gz
Now that we have support to build uefi from source, we allow user to choose which one to flash. Minor cleanup: Remove ANDROID_OUT which will be same as ANDROID_PRODUCT_OUT Fixed shellcheck errors Change-Id: I9e45b2970a481df085222ecd240e367cef75889c Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rwxr-xr-xinstaller/flash-all.sh57
1 files changed, 33 insertions, 24 deletions
diff --git a/installer/flash-all.sh b/installer/flash-all.sh
index c4049e22..7cf47758 100755
--- a/installer/flash-all.sh
+++ b/installer/flash-all.sh
@@ -5,51 +5,60 @@ if [ $# -eq 0 ]
exit
fi
-if [ ! -e $1 ]
+if [ ! -e "${1}" ]
then
- echo "device: $1 does not exist"
+ echo "device: ${1} does not exist"
exit
fi
-DEVICE_PORT=${1}
+DEVICE_PORT="${1}"
PTABLE=ptable-aosp-8g.img
if [ $# -gt 1 ]
then
- if [ $2 == '4g' ]
+ if [ "${2}" == '4g' ]
then
PTABLE=ptable-aosp-4g.img
fi
fi
-INSTALLER_DIR="`dirname $0`"
-ANDROID_TOP=${INSTALLER_DIR}/../../../../
+INSTALLER_DIR="`dirname ${0}`"
+FIRMWARE_DIR="${INSTALLER_DIR}"
+
+if [ -z "${DIST_DIR}" ]; then
+ DIST_DIR="${ANDROID_BUILD_TOP}"/out/dist
+fi
#get out directory path
while [ $# -ne 0 ]; do
- case "$1" in
- --out) OUT_IMGDIR=$2;shift;
+ case "${1}" in
+ --out) OUT_IMGDIR=${2};shift;;
+ --use-compiled-binaries) FIRMWARE_DIR="${DIST_DIR}";shift;;
esac
shift
done
-if [ -z $OUT_IMGDIR ]; then
- if [ ! -z $ANDROID_PRODUCT_OUT ]; then
- OUT_IMGDIR=${ANDROID_PRODUCT_OUT}
- else
- OUT_IMGDIR="${ANDROID_TOP}/out/target/product/hikey"
+if [[ "${FIRMWARE_DIR}" == "${DIST_DIR}" && ! -e "${DIST_DIR}"/fip.bin && ! -e "${DIST_DIR}"/l-loader.bin ]]; then
+ echo "No binaries found at ${DIST_DIR}. Please build the bootloader first"
+ exit
+fi
+
+if [ -z "${OUT_IMGDIR}" ]; then
+ if [ ! -z "${ANDROID_PRODUCT_OUT}" ]; then
+ OUT_IMGDIR="${ANDROID_PRODUCT_OUT}"
fi
fi
-if [ ! -d $OUT_IMGDIR ]; then
+if [ ! -d "${OUT_IMGDIR}" ]; then
echo "error in locating out directory, check if it exist"
exit
fi
-echo "android out dir:$OUT_IMGDIR"
-
-sudo python ${INSTALLER_DIR}/hisi-idt.py --img1=${INSTALLER_DIR}/l-loader.bin -d ${DEVICE_PORT}
-fastboot flash ptable ${INSTALLER_DIR}/${PTABLE}
-fastboot flash fastboot ${INSTALLER_DIR}/fip.bin
-fastboot flash nvme ${INSTALLER_DIR}/nvme.img
-fastboot flash boot ${OUT_IMGDIR}/boot.img
-fastboot flash system ${OUT_IMGDIR}/system.img
-fastboot flash cache ${OUT_IMGDIR}/cache.img
-fastboot flash userdata ${OUT_IMGDIR}/userdata.img
+
+echo "android out dir:${OUT_IMGDIR}"
+
+sudo python "${INSTALLER_DIR}"/hisi-idt.py --img1="${FIRMWARE_DIR}"/l-loader.bin -d "${DEVICE_PORT}"
+fastboot flash ptable "${INSTALLER_DIR}"/"${PTABLE}"
+fastboot flash fastboot "${FIRMWARE_DIR}"/fip.bin
+fastboot flash nvme "${INSTALLER_DIR}"/nvme.img
+fastboot flash boot "${OUT_IMGDIR}"/boot.img
+fastboot flash system "${OUT_IMGDIR}"/system.img
+fastboot flash cache "${OUT_IMGDIR}"/cache.img
+fastboot flash userdata "${OUT_IMGDIR}"/userdata.img