aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2018-02-26 20:59:12 -0800
committerJohn Stultz <john.stultz@linaro.org>2018-02-26 20:59:12 -0800
commit4870c8857b1f8b99fdf889d3a99a017a134a200e (patch)
tree3de425688638c50936e3c8ce68e3449d1956bcb9
parent2197ce1e19b51b3ccca0f5780d158547ce174e53 (diff)
downloadknown-good-manifests-4870c8857b1f8b99fdf889d3a99a017a134a200e.tar.gz
flash.sh: First pass at flash helper script
Signed-off-by: John Stultz <john.stultz@linaro.org>
-rwxr-xr-xflash.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/flash.sh b/flash.sh
new file mode 100755
index 0000000..757d1af
--- /dev/null
+++ b/flash.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+DIRPATH=imgs
+BOARD=$1
+
+if [ $# -eq 0 ]; then
+ echo "Error: No arguments"
+ echo "Usage: ./flash.sh <valid board name>"
+ exit -1
+fi
+
+echo "Flashing $BOARD"
+
+if [ ! -d "$DIRPATH/$BOARD" ]; then
+ echo "ERROR: No such path: $DIRPATH/$BOARD"
+ exit -1
+fi
+
+pushd $DIRPATH/$BOARD > /dev/null
+
+IMGS="boot.img.xz system.img.xz cache.img.xz userdata.img.xz dt.img.xz"
+for i in $IMGS; do
+ xz -d $i
+done
+
+#special case for hikey960 dts partition
+if [$BOARD -eq "hikey960" ] ; then
+ fastboot flash dts dt.img
+fi
+fastboot flash boot boot.img
+fastboot flash cache cache.img
+fastboot flash system system.img
+# we skip flashing userdata here
+
+fastboot reboot
+popd >/dev/null
+