summaryrefslogtreecommitdiffstats
path: root/target/device/Atmel/atngw100/target_skeleton/etc/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'target/device/Atmel/atngw100/target_skeleton/etc/init.d')
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/K70sendsig0
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/K80netfs0
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/K85network11
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/K90localfs0
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S00mountvirtfs75
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S01hotplug14
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S02hostname47
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S08syslog24
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S09klog16
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S10modules-init21
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S15localfs11
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S20network11
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S21dnsmasq18
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables43
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S40telnetd16
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S41inetd16
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S42httpd16
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S43ntp27
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S49netfs11
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio142
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/rcK6
-rwxr-xr-xtarget/device/Atmel/atngw100/target_skeleton/etc/init.d/rcS9
22 files changed, 534 insertions, 0 deletions
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K70sendsig b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K70sendsig
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K70sendsig
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K80netfs b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K80netfs
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K80netfs
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K85network b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K85network
new file mode 100755
index 000000000..5b6d3cdc7
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K85network
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+IFDOWN=/sbin/ifdown
+
+echo -n "Stopping networking:"
+if ${IFDOWN} -a; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K90localfs b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K90localfs
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/K90localfs
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S00mountvirtfs b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S00mountvirtfs
new file mode 100755
index 000000000..f0193f5dd
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S00mountvirtfs
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+MOUNT=/bin/mount
+MKDIR=/bin/mkdir
+
+retval=0
+
+mount_fs()
+{
+ if [ "$1" = "" -o "$2" = "" -o "$3" = "" ]; then
+ return;
+ fi
+
+ if [ "$4" = "" ]; then
+ if ! ${MOUNT} -t $3 $1 $2; then
+ echo " mount $2 failed"
+ retval=1
+ return 1
+ else
+ echo " $2 mounted"
+ fi
+ else
+ if ! ${MOUNT} -t $3 -o $4 $1 $2; then
+ echo " mount $2 failed"
+ retval=1
+ return 1
+ else
+ echo " $2 mounted"
+ fi
+ fi
+
+ return 0
+}
+
+mkdir_fs()
+{
+ if [ "$1" = "" ]; then
+ return;
+ fi
+
+ if ! ${MKDIR} $1; then
+ echo " mkdir $1 failed"
+ retval=1
+ return 1
+ else
+ echo " $1 directory made"
+ fi
+
+ return 0
+}
+
+echo "Mounting virtual filesystems:"
+
+mount_fs proc /proc proc
+mount_fs sys /sys sysfs
+
+if mount_fs dev /dev tmpfs "size=512k,mode=0755"; then
+ mkdir_fs /dev/pts
+ mount_fs pts /dev/pts devpts
+ mkdir_fs /dev/shm
+ # Hack to enable mouse support when using buildroot mdev
+ ln -s . /dev/input
+ ln -s . /dev/snd
+fi
+
+mount_fs config /config configfs
+mount_fs tmp /tmp tmpfs
+mount_fs run /var/run tmpfs
+mount_fs log /var/log tmpfs
+
+if [ $retval -ne 0 ]; then
+ echo " WARNING: not able to mount all virtual file systems"
+fi
+
+exit $retval
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S01hotplug b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S01hotplug
new file mode 100755
index 000000000..89c49e117
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S01hotplug
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+echo -n "Setting up mdev:"
+set -e
+trap 'echo " failed"' EXIT
+/bin/ln -s /proc/self/fd /dev/fd
+/bin/ln -s /proc/self/fd/0 /dev/stdin
+/bin/ln -s /proc/self/fd/1 /dev/stdout
+/bin/ln -s /proc/self/fd/2 /dev/stderr
+/bin/ln -s /proc/kcore /dev/core
+/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
+/sbin/mdev -s
+trap - EXIT
+echo " done"
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S02hostname b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S02hostname
new file mode 100755
index 000000000..fcad428af
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S02hostname
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+PROGRAM=/bin/hostname
+
+echo -n "Setting hostname:"
+[ -x ${PROGRAM} ] || (echo " missing"; exit 0)
+
+if [ -f /etc/hostname ]; then
+ HOST="$(cat /etc/hostname)"
+else
+ HOST="localhost.localdomain"
+fi
+
+start() {
+ if ${PROGRAM} "${HOST}" > /dev/null 2> /dev/null; then
+ echo " '${HOST}'"
+ else
+ echo " failed"
+ exit 1
+ fi
+}
+
+stop() {
+ return 0
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S08syslog b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S08syslog
new file mode 100755
index 000000000..63951e023
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S08syslog
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+SYSLOGD=/sbin/syslogd
+
+echo -n "Starting syslogd:"
+if [ ! -x "${SYSLOGD}" ]; then
+ echo " missing"
+ exit 1
+fi
+
+if ${SYSLOGD} > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
+
+echo -n "Log messages to syslog:"
+if echo 4 4 1 7 > /proc/sys/kernel/printk 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S09klog b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S09klog
new file mode 100755
index 000000000..4c6763bbd
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S09klog
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+KLOGD=/sbin/klogd
+
+echo -n "Starting klogd:"
+if [ ! -x "${KLOGD}" ]; then
+ echo " missing"
+ exit 1
+fi
+
+if ${KLOGD} > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S10modules-init b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S10modules-init
new file mode 100755
index 000000000..d1fcc26e3
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S10modules-init
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+MODPROBE=/sbin/modprobe
+
+echo -n "Probing modules:"
+if [ ! -x "${MODPROBE}" -o ! -f "/etc/modules" ]; then
+ echo " missing"
+ exit 1
+else
+ echo
+fi
+
+grep '^[^#]' "/etc/modules" | \
+while read module args; do
+ [ "$module" ] || continue
+ if ${MODPROBE} $module $args > /dev/null 2> /dev/null; then
+ echo " $module loaded"
+ else
+ echo " $module failed"
+ fi
+done
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S15localfs b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S15localfs
new file mode 100755
index 000000000..9672752a0
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S15localfs
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+MOUNT=/bin/mount
+
+echo -n "Mounting local filesystems:"
+if ${MOUNT} -a > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S20network b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S20network
new file mode 100755
index 000000000..a9787cdfd
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S20network
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+IFUP=/sbin/ifup
+
+echo -n "Network interfaces:"
+if ${IFUP} -a > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S21dnsmasq b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S21dnsmasq
new file mode 100755
index 000000000..8ddd149e3
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S21dnsmasq
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+DNSMASQ=/usr/sbin/dnsmasq
+
+echo -n "Starting dnsmasq: "
+if [ ! -x "${DNSMASQ}" ]; then
+ echo "missing"
+ exit 1
+fi
+
+if ${DNSMASQ}; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+exit 0
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
new file mode 100755
index 000000000..dff63c200
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S22iptables
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+IPTABLES=`which iptables`
+
+echo "Enable NAT: "
+echo -n " IPv4 forwarding: "
+if echo 1 > /proc/sys/net/ipv4/ip_forward; then
+ echo "done"
+else
+ echo "failed"
+ return 1
+fi
+
+echo -n " iptables postrouting: "
+if [ ! -x "${IPTABLES}" ]; then
+ echo "missing"
+ exit 1
+fi
+
+if ${IPTABLES} -t nat -A POSTROUTING -o eth0 -j MASQUERADE > /dev/null 2> /dev/null; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+echo -n " iptables incoming trafic: "
+if ${IPTABLES} -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT > /dev/null 2> /dev/null; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+echo -n " iptables outgoung trafic: "
+if ${IPTABLES} -A FORWARD -i eth1 -o eth0 -j ACCEPT > /dev/null 2> /dev/null; then
+ echo "done"
+else
+ echo "failed"
+ exit 1
+fi
+
+exit 0
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S40telnetd b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S40telnetd
new file mode 100755
index 000000000..c44bbb5ae
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S40telnetd
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+TELNETD=/usr/sbin/telnetd
+
+echo -n "Starting telnetd:"
+if [ ! -x "${TELNETD}" ]; then
+ echo " missing"
+ exit 1
+fi
+
+if ${TELNETD} -l /bin/ash > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S41inetd b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S41inetd
new file mode 100755
index 000000000..cf85c13f1
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S41inetd
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+INETD=/usr/sbin/inetd
+
+echo -n "Starting inted:"
+if [ ! -x "${INETD}" ]; then
+ echo " missing"
+ exit 1
+fi
+
+if ${INETD} > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S42httpd b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S42httpd
new file mode 100755
index 000000000..202e9d2eb
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S42httpd
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+HTTPD=/usr/sbin/httpd
+
+echo -n "Starting httpd:"
+if [ ! -x "${HTTPD}" ]; then
+ echo " missing"
+ exit 1
+fi
+
+if ${HTTPD} -h /www > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S43ntp b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S43ntp
new file mode 100755
index 000000000..f996ab09f
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S43ntp
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+NTPDATE=/usr/bin/ntpdate
+
+if [ -f /etc/default/ntpdate ]; then
+ . /etc/default/ntpdate
+else
+ echo " missing /etc/default/ntpdate"
+ exit 1
+fi
+
+echo -n "Starting ntpdate:"
+if [ ! -x ${NTPDATE} ]; then
+ echo " missing"
+ echo -n " WARNING: could not syncronize clock, "
+ echo "edit NTPSERVERS in /etc/default/ntpdate."
+ exit 1
+fi
+
+if ${NTPDATE} $NTPOPTIONS $NTPSERVERS > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ echo -n " WARNING: could not syncronize clock, "
+ echo "edit NTPSERVERS in /etc/default/ntpdate."
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S49netfs b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S49netfs
new file mode 100755
index 000000000..99782b481
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S49netfs
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+MOUNT=/bin/mount
+
+echo -n "Mounting remote filesystems:"
+if ${MOUNT} -t nfs -a > /dev/null 2> /dev/null; then
+ echo " done"
+else
+ echo " failed"
+ exit 1
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio
new file mode 100755
index 000000000..ea077846c
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio
@@ -0,0 +1,142 @@
+#!/bin/sh
+
+echo -n "Get board type for GPIO: "
+if [ ! -e "/etc/release" ]; then
+ echo "missing";
+ exit 1
+fi
+
+BOARD=`cat /etc/release | cut -d ' ' -f1`
+
+if [ "${BOARD}" == "" ]; then
+ echo "none";
+elif [ "${BOARD}" == "NGW100" ]; then
+ echo "'${BOARD}'"
+
+ echo -n " boot LED: "
+ if mkdir /config/gpio/bootled > /dev/null 2> /dev/null; then
+ if ! echo 0 > /config/gpio/bootled/gpio_id; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x10000 > /config/gpio/bootled/pin_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x10000 > /config/gpio/bootled/oe_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 1 > /config/gpio/bootled/enabled; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x10000 > /dev/gpio0; then
+ echo "failed"
+ exit 1
+ fi
+
+ echo "done"
+ else
+ echo "failed"
+ exit 1
+ fi
+
+ echo -n " LED A: "
+ if mkdir /config/gpio/leda > /dev/null 2> /dev/null; then
+ if ! echo 0 > /config/gpio/leda/gpio_id; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x80000 > /config/gpio/leda/pin_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x80000 > /config/gpio/leda/oe_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 1 > /config/gpio/leda/enabled; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0 > /dev/gpio1; then
+ echo "failed"
+ exit 1
+ fi
+
+ echo "done"
+ else
+ echo "failed"
+ exit 1
+ fi
+
+ echo -n " LED B: "
+ if mkdir /config/gpio/ledb > /dev/null 2> /dev/null; then
+ if ! echo 4 > /config/gpio/ledb/gpio_id; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x80000 > /config/gpio/ledb/pin_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0x80000 > /config/gpio/ledb/oe_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 1 > /config/gpio/ledb/enabled; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0 > /dev/gpio2; then
+ echo "failed"
+ exit 1
+ fi
+
+ echo "done"
+ else
+ echo "failed"
+ exit 1
+ fi
+elif [ "${BOARD}" == "STK1000" ]; then # end NGW100
+ echo "'${BOARD}'"
+
+ echo -n " switches: "
+ if mkdir /config/gpio/switches > /dev/null 2> /dev/null; then
+ if ! echo 1 > /config/gpio/switches/gpio_id; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 0xff > /config/gpio/switches/pin_mask; then
+ echo "failed"
+ exit 1
+ fi
+
+ if ! echo 1 > /config/gpio/switches/enabled; then
+ echo "failed"
+ exit 1
+ fi
+
+ echo "done"
+ else
+ echo "failed"
+ exit 1
+ fi
+else # end STK1000
+ echo "'${BOARD}'"
+ echo " WARNING: no GPIO for this board"
+fi
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcK b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcK
new file mode 100755
index 000000000..1db1400fa
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcK
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+echo "Shutting down ..."
+for k in /etc/init.d/K*; do
+ $k stop
+done
diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcS b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcS
new file mode 100755
index 000000000..0d574e67b
--- /dev/null
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/rcS
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+for s in /etc/init.d/S*; do
+ $s start
+done
+
+echo
+echo "STK1000 ready"
+echo