summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2017-01-12 16:57:52 +0100
committerVincent Guittot <vincent.guittot@linaro.org>2017-01-12 16:57:52 +0100
commit1da5eebac43d3ecbb614a20c55c2c7cfd56a0cc4 (patch)
treee48694d85ea53004aab3f620f11ba0d11ae71176
parentd52d34e8e5bee80ed5e05be83d10e16ac7915527 (diff)
update reboot
-rwxr-xr-xboard-reboot.sh109
l---------dragon410c-reboot.sh1
l---------dragonboard-reboot.sh1
l---------hikey-reboot.sh2
l---------[-rwxr-xr-x]mt8173evb-reboot.sh104
5 files changed, 112 insertions, 105 deletions
diff --git a/board-reboot.sh b/board-reboot.sh
new file mode 100755
index 0000000..40ccd2b
--- /dev/null
+++ b/board-reboot.sh
@@ -0,0 +1,109 @@
+#!/bin/bash -
+#===============================================================================
+#
+# FILE: reboot-mediatek.sh
+#
+# USAGE: ./reboot-mediatek.sh
+#
+# DESCRIPTION:
+#
+#
+# AUTHOR: #NAME# (#INITIALS#), #EMAIL#
+# COMPANY: #COMPANY#
+# CREATED: 08/04/2016 09:15:22 CEST
+#===============================================================================
+CMD=$(basename $0)
+SUFFIX="-reboot.sh"
+ARCH=${CMD%$SUFFIX}
+BOOT=${1-True}
+
+IP_RELAY=192.168.0.22
+
+BOOT_IMG=/srv/tftp/$ARCH/boot-${ARCH}.img
+
+# Init var
+case "$ARCH" in
+ "dragon410c")
+ RELAY=8
+ DEVICE=91db2320
+ FCMD="boot"
+#power dwon up power supply
+ POWERUP=?CloseRelay$RELAY
+ POWERDOWN=?OpenRelay$RELAY
+ ;;
+ "hikey")
+ OTG=7
+ RELAY=2
+ DEVICE=3834805900126730
+ FCMD="flash boot"
+ # assert reset signal
+ POWERUP=?OpenRelay$RELAY
+ POWERDOWN=?CloseRelay$RELAY
+ ;;
+ "mt8173evb")
+ RELAY=1
+ DEVICE=0123456789ABCDEF
+ FCMD="boot"
+ # assert reset signal
+ POWERUP=?OpenRelay$RELAY
+ POWERDOWN=?CloseRelay$RELAY
+ ;;
+ *)
+ echo "Undefined board"
+ exit 1
+ ;;
+esac
+
+
+if [ "$BOOT" == "True" ]; then
+
+# Pre Reset
+case "$ARCH" in
+ "dragon410c")
+ ;;
+ "hikey")
+ # Power up OTG
+ curl http://$IP_RELAY/?CloseRelay$OTG
+ ;;
+ "mt8173evb")
+ ;;
+ *)
+ echo "Undefined board"
+ exit 1
+ ;;
+esac
+fi
+
+# Reset
+curl http://$IP_RELAY/$POWERDOWN && sleep 1 && curl http://$IP_RELAY/$POWERUP
+
+if [ "$BOOT" == "True" ]; then
+
+#Sync with fastboot
+fastboot -s $DEVICE getvar all
+
+echo "Synced with "${ARCH}
+
+sleep 1
+
+fastboot -s $DEVICE $FCMD $BOOT_IMG
+
+# Post boot
+case "$ARCH" in
+ "dragon410c")
+ ;;
+ "hikey")
+ fastboot -s $DEVICE reboot
+ echo "Hikey rebooted"
+
+ # Power Down OTG
+ curl http://$IP_RELAY/?OpenRelay$OTG
+ ;;
+ "mt8173evb")
+ ;;
+ *)
+ echo "Undefined board"
+ exit 1
+ ;;
+esac
+fi
diff --git a/dragon410c-reboot.sh b/dragon410c-reboot.sh
new file mode 120000
index 0000000..ec1f9b6
--- /dev/null
+++ b/dragon410c-reboot.sh
@@ -0,0 +1 @@
+board-reboot.sh \ No newline at end of file
diff --git a/dragonboard-reboot.sh b/dragonboard-reboot.sh
deleted file mode 120000
index 55d40b5..0000000
--- a/dragonboard-reboot.sh
+++ /dev/null
@@ -1 +0,0 @@
-mt8173evb-reboot.sh \ No newline at end of file
diff --git a/hikey-reboot.sh b/hikey-reboot.sh
index 55d40b5..ec1f9b6 120000
--- a/hikey-reboot.sh
+++ b/hikey-reboot.sh
@@ -1 +1 @@
-mt8173evb-reboot.sh \ No newline at end of file
+board-reboot.sh \ No newline at end of file
diff --git a/mt8173evb-reboot.sh b/mt8173evb-reboot.sh
index f8cf03d..ec1f9b6 100755..120000
--- a/mt8173evb-reboot.sh
+++ b/mt8173evb-reboot.sh
@@ -1,103 +1 @@
-#!/bin/bash -
-#===============================================================================
-#
-# FILE: reboot-mediatek.sh
-#
-# USAGE: ./reboot-mediatek.sh
-#
-# DESCRIPTION:
-#
-#
-# AUTHOR: #NAME# (#INITIALS#), #EMAIL#
-# COMPANY: #COMPANY#
-# CREATED: 08/04/2016 09:15:22 CEST
-#===============================================================================
-ARCH=$(basename $0)
-BOOT=${1-True}
-
-IP_RELAY=192.168.0.22
-
-# Init var
-case "$ARCH" in
- "dragonboard-reboot.sh")
- BOOT_IMG=/srv/tftp/dragon410/boot-db410c.img
- RELAY=8
- DEVICE=91db2320
- POWERUP=?CloseRelay$RELAY
- POWERDOWN=?OpenRelay$RELAY
- ;;
- "hikey-reboot.sh")
- OTG=7
- BOOT_IMG=/srv/tftp/hikey/boot-fat.uefi.img
- RELAY=2
- DEVICE=3834805900126730
- POWERUP=?OpenRelay$RELAY
- POWERDOWN=?CloseRelay$RELAY
- curl http://$IP_RELAY/?CloseRelay$OTG
-
- ;;
- "mt8173evb-reboot.sh")
- BOOT_IMG=/srv/tftp/mt8173evb/boot.img
- RELAY=1
- DEVICE=0123456789ABCDEF
- POWERUP=?OpenRelay$RELAY
- POWERDOWN=?CloseRelay$RELAY
- ;;
- *)
- echo "Undefined board"
- exit 1
- ;;
-esac
-
-if [ "$BOOT" == "True" ]; then
-
-# Pre Reset
-case "$ARCH" in
- "dragonboard-reboot.sh")
- fastboot -s $DEVICE boot $BOOT_IMG &
- ;;
- "hikey-reboot.sh")
- # Power up OTG
- curl http://$IP_RELAY/?CloseRelay$OTG
- ;;
- "mt8173evb-reboot.sh")
- fastboot -s $DEVICE boot $BOOT_IMG &
- ;;
- *)
- echo "Undefined board"
- exit 1
- ;;
-esac
-fi
-
-curl http://$IP_RELAY/$POWERDOWN && sleep 1 && curl http://$IP_RELAY/$POWERUP
-
-if [ "$BOOT" == "True" ]; then
-case "$ARCH" in
- "dragonboard-reboot.sh")
- ;;
- "hikey-reboot.sh")
- fastboot -s $DEVICE getvar all
- echo "Synced with hikey"
-
- sleep 1
-
- fastboot -s $DEVICE flash boot $BOOT_IMG
- echo "New Image Flashed"
-
- sleep 1
-
- fastboot -s $DEVICE reboot
- echo "Hikey rebooted"
-
- # Power Down OTG
- curl http://$IP_RELAY/?OpenRelay$OTG
- ;;
- "mt8173evb-reboot.sh")
- ;;
- *)
- echo "Undefined board"
- exit 1
- ;;
-esac
-fi
+board-reboot.sh \ No newline at end of file