summaryrefslogtreecommitdiff
path: root/recipes-core/multitech
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/multitech')
-rw-r--r--recipes-core/multitech/config/config.init105
-rw-r--r--recipes-core/multitech/config/network/interfaces29
-rw-r--r--recipes-core/multitech/config/ppp/chap-secrets3
-rw-r--r--recipes-core/multitech/config/ppp/options22
-rw-r--r--recipes-core/multitech/config/ppp/pap-secrets3
-rw-r--r--recipes-core/multitech/config/ppp/peers/cdma9
-rw-r--r--recipes-core/multitech/config/ppp/peers/cdma_chat18
-rw-r--r--recipes-core/multitech/config/ppp/peers/gsm11
-rw-r--r--recipes-core/multitech/config/ppp/peers/gsm_chat26
-rw-r--r--recipes-core/multitech/config_1.0.bb40
-rw-r--r--recipes-core/multitech/mlinux-version.bb22
-rw-r--r--recipes-core/multitech/reset-handler/reset-handler.default2
-rw-r--r--recipes-core/multitech/reset-handler/reset-handler.init30
-rwxr-xr-xrecipes-core/multitech/reset-handler/reset-handler.sh72
-rw-r--r--recipes-core/multitech/reset-handler_1.0.bb29
-rw-r--r--recipes-core/multitech/upgrade-reboot_1.0.0.bb17
16 files changed, 438 insertions, 0 deletions
diff --git a/recipes-core/multitech/config/config.init b/recipes-core/multitech/config/config.init
new file mode 100644
index 0000000..874416c
--- /dev/null
+++ b/recipes-core/multitech/config/config.init
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+CONFIG_MTDC=/dev/mtd6
+CONFIG_MTDB=/dev/mtdblock6
+CONFIG_DIR=/var/config
+
+OEM_MTDC=/dev/mtd7
+OEM_MTDB=/dev/mtdblock7
+OEM_DIR=/var/oem
+
+FILES="network/interfaces \
+ppp/options \
+ppp/pap-secrets \
+ppp/chap-secrets \
+ppp/peers \
+"
+
+mount_config() {
+ echo "Mounting ${CONFIG_DIR}"
+ mkdir -p ${CONFIG_DIR}
+ mount ${CONFIG_DIR}
+
+ # Prepare flash for JFFS2 if mount fails
+ if [ $? -ne 0 ]; then
+ echo "Creating ${CONFIG_DIR}"
+ flash_erase -j ${CONFIG_MTDC} 0 0
+ mount ${CONFIG_DIR}
+ fi
+}
+
+mount_oem() {
+ echo "Mounting ${OEM_DIR}"
+ mkdir -p ${OEM_DIR}
+ mount ${OEM_DIR}
+
+ # Prepare flash for JFFS2 if mount fails
+ if [ $? -ne 0 ]; then
+ echo "Creating ${OEM_DIR}"
+ flash_erase -j ${OEM_MTDC} 0 0
+ mount ${OEM_DIR}
+ fi
+}
+
+case $1 in
+ start)
+ # mount config if not already mounted
+ if ! grep -q "^${CONFIG_MTDB} " /proc/mounts; then
+ mount_config
+ else
+ echo "$CONFIG_DIR already mounted"
+ fi
+
+ # mount oem if specified in /etc/fstab and it isn't already mounted
+ if grep -qE "^${OEM_MTDB}\s+${OEM_DIR}\s+" /etc/fstab; then
+ if ! grep -q "^${OEM_MTDB} " /proc/mounts; then
+ mount_oem
+ else
+ echo "$OEM_DIR already mounted"
+ fi
+ fi
+
+ # Default all config files if requested
+ cd ${CONFIG_DIR}
+ if [ -f force_defaults ]; then
+ echo "Extracting default config files"
+ tar -xvf /etc/defaults.tar.gz
+
+ if [ -f /etc/default_pass ]; then
+ echo "Defaulting root password"
+ PASSHASH=`cat /etc/default_pass`
+ PASSFILE=/etc/shadow
+ if [ ! -e /etc/shadow ]; then
+ PASSFILE=/etc/passwd
+ fi
+ sed -i "s%^root:[^:]*:%root:${PASSHASH}:%" $PASSFILE
+ fi
+
+ rm -f force_defaults
+ fi
+
+ # Extract any missing files
+ TARFILES=`tar -tf /etc/defaults.tar.gz`
+ for file in $TARFILES; do
+ if [ ! -e $file ]; then
+ tar -xvf /etc/defaults.tar.gz $file
+ fi
+ done
+
+ # Create links in /etc
+ for file in $FILES; do
+ if [ ! -L /etc/$file ]; then
+ echo "Creating link to ${CONFIG_DIR}/$file"
+ rm -rf /etc/$file
+ ln -sf ${CONFIG_DIR}/$file /etc/$file
+ fi
+ done
+
+ ;;
+
+ *)
+ echo "Usage: $0 {start}"
+ exit 2
+ ;;
+
+esac
diff --git a/recipes-core/multitech/config/network/interfaces b/recipes-core/multitech/config/network/interfaces
new file mode 100644
index 0000000..546fd29
--- /dev/null
+++ b/recipes-core/multitech/config/network/interfaces
@@ -0,0 +1,29 @@
+# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
+
+# The loopback interface
+auto lo
+iface lo inet loopback
+
+# Wired interface
+auto eth0
+iface eth0 inet static
+address 192.168.2.1
+netmask 255.255.255.0
+
+# Bridge interface with eth0 (comment out eth0 lines above to use with bridge)
+# iface eth0 inet manual
+#
+# auto br0
+# iface br0 inet static
+# bridge_ports eth0
+# address 192.168.2.1
+# netmask 255.255.255.0
+
+# Wifi client
+# NOTE: udev rules will bring up wlan0 automatically if a wifi device is detected
+# and the wlan0 interface is defined, therefore an "auto wlan0" line is not needed.
+# If "auto wlan0" is also specified, startup conflicts may result.
+#iface wlan0 inet dhcp
+#wpa-conf /var/config/wpa_supplicant.conf
+#wpa-driver nl80211
+
diff --git a/recipes-core/multitech/config/ppp/chap-secrets b/recipes-core/multitech/config/ppp/chap-secrets
new file mode 100644
index 0000000..60efe8f
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/chap-secrets
@@ -0,0 +1,3 @@
+# Secrets for authentication using CHAP
+# client server secret IP addresses
+* * "" *
diff --git a/recipes-core/multitech/config/ppp/options b/recipes-core/multitech/config/ppp/options
new file mode 100644
index 0000000..34654c1
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/options
@@ -0,0 +1,22 @@
+# Select tty device
+#
+# First modem AT command port (symlink to actual device)
+/dev/modem_at0
+
+# Uncomment below to run in foreground
+#nodetach
+
+# Uncomment below to emit debug
+#debug
+
+# Uncomment to keep pppd up if the connection terminates
+#persist
+# Uncomment for unlimited connection attempts
+#maxfail 0
+
+# disable logging to /etc/ppp/connect-errors
+# and only log to syslog
+logfile /dev/null
+
+lock
+
diff --git a/recipes-core/multitech/config/ppp/pap-secrets b/recipes-core/multitech/config/ppp/pap-secrets
new file mode 100644
index 0000000..f782b4a
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/pap-secrets
@@ -0,0 +1,3 @@
+# Secrets for authentication using PAP
+# client server secret IP addresses
+* * "" *
diff --git a/recipes-core/multitech/config/ppp/peers/cdma b/recipes-core/multitech/config/ppp/peers/cdma
new file mode 100644
index 0000000..3fc231f
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/peers/cdma
@@ -0,0 +1,9 @@
+linkname ppp0
+230400
+defaultroute
+replacedefaultroute
+usepeerdns
+noauth
+crtscts
+novj
+connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/cdma_chat'
diff --git a/recipes-core/multitech/config/ppp/peers/cdma_chat b/recipes-core/multitech/config/ppp/peers/cdma_chat
new file mode 100644
index 0000000..6ff750e
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/peers/cdma_chat
@@ -0,0 +1,18 @@
+SAY "CDMA chat\n"
+ECHO OFF
+ABORT 'NO DIAL TONE'
+ABORT 'NO DIALTONE'
+ABORT 'NO ANSWER'
+ABORT 'NO CARRIER'
+ABORT 'DELAYED'
+ABORT 'VOICE'
+ABORT 'BUSY'
+'' 'AT'
+OK 'ATZ'
+OK 'AT+CSQ'
+SAY "Dialing...\n"
+OK 'ATD#777'
+SAY "Waiting for CONNECT...\n"
+TIMEOUT 120
+CONNECT ''
+SAY "Connected\n"
diff --git a/recipes-core/multitech/config/ppp/peers/gsm b/recipes-core/multitech/config/ppp/peers/gsm
new file mode 100644
index 0000000..d23957e
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/peers/gsm
@@ -0,0 +1,11 @@
+linkname ppp0
+230400
+defaultroute
+replacedefaultroute
+usepeerdns
+ipcp-max-failure 10
+ipcp-restart 10
+noauth
+crtscts
+novj
+connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat'
diff --git a/recipes-core/multitech/config/ppp/peers/gsm_chat b/recipes-core/multitech/config/ppp/peers/gsm_chat
new file mode 100644
index 0000000..5e18e05
--- /dev/null
+++ b/recipes-core/multitech/config/ppp/peers/gsm_chat
@@ -0,0 +1,26 @@
+SAY "GSM chat\n"
+ECHO OFF
+ABORT 'NO DIAL TONE'
+ABORT 'NO DIALTONE'
+ABORT 'NO ANSWER'
+ABORT 'NO CARRIER'
+ABORT 'DELAYED'
+ABORT 'VOICE'
+ABORT 'BUSY'
+'' 'AT'
+OK 'ATZ'
+OK 'AT+CSQ'
+# ----------------------------------
+# Set the APN for your provider here
+# ----------------------------------
+#OK 'AT+CGDCONT=1,"IP","proxy"'
+#OK 'AT+CGDCONT=1,"IP","ISP.CINGULAR"'
+#OK 'AT+CGDCONT=1,"IP","internet2.voicestream.com"'
+OK 'AT+CGDCONT=1,"IP","internet"'
+SAY "Dialing...\n"
+#OK 'ATD*99#'
+OK 'ATD*99***1#'
+SAY "Waiting for CONNECT...\n"
+TIMEOUT 120
+CONNECT ''
+SAY "Connected\n"
diff --git a/recipes-core/multitech/config_1.0.bb b/recipes-core/multitech/config_1.0.bb
new file mode 100644
index 0000000..149946d
--- /dev/null
+++ b/recipes-core/multitech/config_1.0.bb
@@ -0,0 +1,40 @@
+DESCRIPTION = "Provides default system config files and /var/config fs"
+SECTION = "base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+PR = "r4"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "config"
+INITSCRIPT_PARAMS = "start 31 S ."
+
+SRC_URI = "\
+ file://network \
+ file://ppp \
+ file://config.init \
+"
+
+CONFIGFILES = "network ppp"
+
+fakeroot do_install () {
+ cd ${WORKDIR}
+
+ # default config files
+ rm -f defaults.tar.gz
+ chown root:root -R ${CONFIGFILES}
+ tar czf defaults.tar.gz ${CONFIGFILES}
+ install -d ${D}${sysconfdir}
+ install -m 0644 ${WORKDIR}/defaults.tar.gz ${D}${sysconfdir}/defaults.tar.gz
+
+ # save root password for resetting to defaults
+ echo -n "${ROOT_PASSWORD_HASH}" > ${D}${sysconfdir}/default_pass
+ chmod 400 ${D}${sysconfdir}/default_pass
+
+ # init script
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/config.init ${D}${sysconfdir}/init.d/config
+}
+
+FILES_${PN} = "${sysconfdir}/defaults.tar.gz ${sysconfdir}/default_pass"
+FILES_${PN} += "${sysconfdir}/init.d/config"
diff --git a/recipes-core/multitech/mlinux-version.bb b/recipes-core/multitech/mlinux-version.bb
new file mode 100644
index 0000000..f2debe1
--- /dev/null
+++ b/recipes-core/multitech/mlinux-version.bb
@@ -0,0 +1,22 @@
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+inherit mlinux_metadata_scm
+
+# always parse this file so PV can change automatically
+__BB_DONT_CACHE = "1"
+
+PV = "${DISTRO_VERSION}_${MLINUX_METADATA_REVISION}"
+PR = "r2"
+PE = "1"
+
+PACKAGES = "${PN}"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+do_install() {
+ mkdir -p ${D}${sysconfdir}
+ echo "mLinux ${DISTRO_VERSION}" > ${D}${sysconfdir}/mlinux-version
+ echo "Built from branch: ${MLINUX_METADATA_BRANCH}" >> ${D}${sysconfdir}/mlinux-version
+ echo "Revision: ${MLINUX_METADATA_REVISION}" >> ${D}${sysconfdir}/mlinux-version
+ echo "${MLINUX_LAYERS}" > ${D}${sysconfdir}/mlinux-layers
+}
diff --git a/recipes-core/multitech/reset-handler/reset-handler.default b/recipes-core/multitech/reset-handler/reset-handler.default
new file mode 100644
index 0000000..71b3e24
--- /dev/null
+++ b/recipes-core/multitech/reset-handler/reset-handler.default
@@ -0,0 +1,2 @@
+# set to "no" to disable reset-handler starting on boot
+ENABLED="yes"
diff --git a/recipes-core/multitech/reset-handler/reset-handler.init b/recipes-core/multitech/reset-handler/reset-handler.init
new file mode 100644
index 0000000..b50e7b8
--- /dev/null
+++ b/recipes-core/multitech/reset-handler/reset-handler.init
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+DAEMON=/usr/sbin/reset-handler
+PIDFILE=/var/run/reset-handler.pid
+ENABLED="yes"
+
+[ -r /etc/default/reset-handler ] && . /etc/default/reset-handler
+[ -x $DAEMON ] || exit 0
+[ "$ENABLED" = "yes" ] || exit 0
+
+case "$1" in
+ start)
+ if [ -f $PIDFILE ]; then
+ echo "reset-handler pid file exists, not starting"
+ exit 1
+ else
+ echo "Starting reset-handler"
+ start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON
+ fi
+ ;;
+ stop)
+ echo "Stopping reset-handler"
+ start-stop-daemon --stop --oknodo --pidfile $PIDFILE
+ rm -f $PIDFILE
+ ;;
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 2
+ ;;
+esac
diff --git a/recipes-core/multitech/reset-handler/reset-handler.sh b/recipes-core/multitech/reset-handler/reset-handler.sh
new file mode 100755
index 0000000..62eeda8
--- /dev/null
+++ b/recipes-core/multitech/reset-handler/reset-handler.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# Copyright (C) 2014 Multi-Tech Systems
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+name="reset-handler"
+log="logger -t $name -s"
+pid="$$"
+
+short_signal=10 # SIGUSR1
+long_signal=12 # SIGUSR2
+extralong_signal=1 # SIGHUP
+
+do_reboot() {
+ $log "Rebooting on button press"
+ sleep 1
+ reboot
+}
+
+do_restore_defaults() {
+ $log "Setting restore defaults on reboot"
+ touch /var/config/force_defaults
+ $log "Rebooting"
+ sleep 1
+ reboot
+}
+
+log_exit() {
+ $log "Exiting on SIGTERM"
+ exit 0
+}
+
+idle_wait() {
+ pipe=/var/tmp/$name.fifo
+ rm -f $pipe
+ mkfifo -m 400 $pipe
+
+ # sneaky way to do nothing forever
+ while true; do
+ read < $pipe
+ done
+}
+
+trap do_reboot $short_signal
+trap do_restore_defaults $long_signal
+trap do_restore_defaults $extralong_signal
+trap log_exit TERM
+
+$log "Enabling reset-monitor for pid $pid"
+mts-io-sysfs store reset-monitor "$pid $short_signal $long_signal $extralong_signal"
+# set long press to 5 seconds for reset to defaults
+mts-io-sysfs store reset-monitor-intervals "5 30"
+
+# wait for signals
+idle_wait
diff --git a/recipes-core/multitech/reset-handler_1.0.bb b/recipes-core/multitech/reset-handler_1.0.bb
new file mode 100644
index 0000000..4342bdd
--- /dev/null
+++ b/recipes-core/multitech/reset-handler_1.0.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "Default reset button handler"
+SECTION = "base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+PR = "r0"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "reset-handler"
+INITSCRIPT_PARAMS = "start 99 2 3 4 5 ."
+CONFFILES_${PN} = "${sysconfdir}/default/reset-handler"
+
+SRC_URI = "\
+ file://reset-handler.sh \
+ file://reset-handler.init \
+ file://reset-handler.default \
+"
+
+do_install () {
+ install -d ${D}${sbindir}
+ install -m 0755 ${WORKDIR}/reset-handler.sh ${D}${sbindir}/reset-handler
+
+ # init script
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/reset-handler.init ${D}${sysconfdir}/init.d/reset-handler
+
+ install -d ${D}${sysconfdir}/default
+ install -m 0644 ${WORKDIR}/reset-handler.default ${D}${sysconfdir}/default/reset-handler
+}
diff --git a/recipes-core/multitech/upgrade-reboot_1.0.0.bb b/recipes-core/multitech/upgrade-reboot_1.0.0.bb
new file mode 100644
index 0000000..c506db3
--- /dev/null
+++ b/recipes-core/multitech/upgrade-reboot_1.0.0.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "Reboot command to run after firmware upgrade"
+HOMEPAGE = "http://www.multitech.net/"
+SECTION = "console/utils"
+PRIORITY = "optional"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+PR = "r0"
+
+# tag 1.0.0
+SRCREV = "6b917d88f41a4694a85b86cd047e10ddbd8c691f"
+
+SRC_URI = "git://git.multitech.net/upgrade-reboot.git;protocol=git"
+S = "${WORKDIR}/git"
+
+inherit autotools
+
+PARALLEL_MAKE = ""