summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalle Vahlman <kalle.vahlman@movial.com>2011-10-25 13:03:07 +0300
committerKalle Vahlman <kalle.vahlman@movial.com>2011-10-25 13:03:07 +0300
commitb5339bcfcf6eba1d860980b4d794772df4317d07 (patch)
treee7b785fc2bbe5af6436150fe1d6094cb447b29c7
Snowball init scripts
-rw-r--r--Makefile11
-rwxr-xr-xsnowball87
-rw-r--r--snowball.conf14
3 files changed, 112 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..acac6d7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+
+all:
+
+install:
+ # install the traditional-style init script to init.d/
+ install -d ${DESTDIR}/etc/init.d
+ install -m 0775 snowball ${DESTDIR}/etc/init.d/snowball
+
+ # install the upstart-style task to init/
+ install -d ${DESTDIR}/etc/init
+ install -m 0664 snowball.conf ${DESTDIR}/etc/init/snowball.conf
diff --git a/snowball b/snowball
new file mode 100755
index 0000000..d4b5a51
--- /dev/null
+++ b/snowball
@@ -0,0 +1,87 @@
+#!/bin/sh -e
+#
+# ST-Ericsson Snowball board peripherial setup script
+#
+#
+
+# (Limited) OTG HOST support
+start_musb() {
+ modprobe g_multi
+}
+stop_musb() {
+ modprobe -r g_multi
+}
+
+# Bluetooth
+start_bluetooth() {
+ hciattach -a 23 -s 115200 /dev/ttyAMA0 cg2900 115200 flow
+ sleep 4
+ hciconfig hci0 up
+}
+stop_bluetooth() {
+ killall hciattach
+}
+
+# WLAN (requires Bluetooth to be running currently!)
+start_wlan() {
+ if [ "$WLAN_MAC" ]
+ then
+ modprobe cw1200_wlan macaddr=$WLAN_MAC
+ else
+ modprobe cw1200_wlan
+ fi
+}
+stop_wlan() {
+ modprobe -r cw1200_wlan
+}
+
+# AV8100 output mode
+# 0 = HDMI (default)
+# 1 = CVBS
+# 2 = DVI-D
+set_av8100_mode() {
+ if [ "$AV8100_MODE" ]
+ then
+ echo $AV8100_MODE > /sys/devices/av8100_hdmi.3/hdmisdtvswitch
+ fi
+}
+
+# Configuration options:
+# - a line with 'WLAN_MAC=0x00,0x80,0xe1,0xb6,0xaf,0xed' sets WLAN MAC
+# - a line with 'AV8100_MODE=N' selects AV8100 mode
+if [ -e /etc/snowballrc ]
+then
+ . /etc/snowballrc
+fi
+
+
+case "$1" in
+start)
+ start_musb
+ start_bluetooth
+ start_wlan
+ set_av8100_mode
+ ;;
+
+stop)
+ stop_musb
+ stop_bluetooth
+ stop_wlan
+ ;;
+force-reload|restart)
+ stop_musb
+ stop_bluetooth
+ stop_wlan
+ sleep 5
+ start_musb
+ start_bluetooth
+ start_wlan
+ set_av8100_mode
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart}"
+ ;;
+esac
+
+exit 0
+
diff --git a/snowball.conf b/snowball.conf
new file mode 100644
index 0000000..b4c5aa7
--- /dev/null
+++ b/snowball.conf
@@ -0,0 +1,14 @@
+# snowball - ST-Ericsson Snowball board startup init
+#
+
+description "ST-Ericsson Snowball init"
+author "Kalle Vahlman <kalle.vahlman@movial.com>"
+
+# We want to be started before GDM to make sure the AV8100 is correct
+start on starting gdm
+
+emits snowball-start
+
+task
+
+exec /etc/init.d/snowball start