aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/kirkwood
diff options
context:
space:
mode:
authorLuka Perkov <luka@openwrt.org>2014-06-24 18:18:51 +0000
committerLuka Perkov <luka@openwrt.org>2014-06-24 18:18:51 +0000
commit760ba483f6d6b38b8a06f408f50d789fc7be3962 (patch)
treed4163a9a4d54658076fbba3c2457ed811ee8591d /target/linux/kirkwood
parentf49c3cdee252393ecfd6e1c7fc18b327ee2cf8d3 (diff)
downloadmaster-187ad058-760ba483f6d6b38b8a06f408f50d789fc7be3962.tar.gz
master-187ad058-760ba483f6d6b38b8a06f408f50d789fc7be3962.tar.bz2
master-187ad058-760ba483f6d6b38b8a06f408f50d789fc7be3962.zip
kirkwood: base-files: add script to detect board name and populate /tmp/sysinfo
Signed-off-by: Luka Perkov <luka@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41335 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/kirkwood')
-rwxr-xr-xtarget/linux/kirkwood/base-files/lib/functions/kirkwood.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/kirkwood/base-files/lib/functions/kirkwood.sh b/target/linux/kirkwood/base-files/lib/functions/kirkwood.sh
new file mode 100755
index 0000000000..ba080f4a7a
--- /dev/null
+++ b/target/linux/kirkwood/base-files/lib/functions/kirkwood.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+
+KIRKWOOD_BOARD_NAME=
+KIRKWOOD_MODEL=
+
+kirkwood_board_detect() {
+ local machine
+ local name
+
+ machine=$(cat /proc/device-tree/model)
+
+ case "$machine" in
+ "Seagate FreeAgent Dockstar")
+ name="dockstar"
+ ;;
+
+ "Iomega Iconnect")
+ name="iconnect"
+ ;;
+
+ "RaidSonic ICY BOX IB-NAS62x0 (Rev B)")
+ name="ib62x0"
+ ;;
+
+ "Cloud Engines Pogoplug E02")
+ name="pogo_e02"
+ ;;
+
+ "Linksys EA4500")
+ name="ea4500"
+ ;;
+
+ *)
+ name="generic"
+ ;;
+ esac
+
+ [ -z "$KIRKWOOD_BOARD_NAME" ] && KIRKWOOD_BOARD_NAME="$name"
+ [ -z "$KIRKWOOD_MODEL" ] && KIRKWOOD_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$KIRKWOOD_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$KIRKWOOD_MODEL" > /tmp/sysinfo/model
+}
+
+kirkwood_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] || kirkwood_board_detect
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}