aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-18 10:08:12 +0000
committerJohn Crispin <blogic@openwrt.org>2014-06-18 10:08:12 +0000
commit814e6c7b356cca249ba9b6c60e8586a5ad1088f8 (patch)
tree179d2aea347aa49345337779d13ff14312e31bbf /target
parente1da5d10dfb5a067bb99b479f4240f2b3bafa38f (diff)
downloadupstream-814e6c7b356cca249ba9b6c60e8586a5ad1088f8.tar.gz
upstream-814e6c7b356cca249ba9b6c60e8586a5ad1088f8.tar.bz2
upstream-814e6c7b356cca249ba9b6c60e8586a5ad1088f8.zip
imx6: add a script to detect the board name and populate /tmp/sysinfo
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41256 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rwxr-xr-xtarget/linux/imx6/base-files/lib/imx6.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/imx6/base-files/lib/imx6.sh b/target/linux/imx6/base-files/lib/imx6.sh
new file mode 100755
index 0000000000..914374e6f5
--- /dev/null
+++ b/target/linux/imx6/base-files/lib/imx6.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright (C) 2010-2013 OpenWrt.org
+#
+
+IMX6_BOARD_NAME=
+IMX6_MODEL=
+
+imx6_board_detect() {
+ local machine
+ local name
+
+ machine=$(cat /proc/device-tree/model)
+
+ case "$machine" in
+ "Gateworks Ventana i.MX6 DualLite/Solo GW51XX" |\
+ "Gateworks Ventana i.MX6 Dual/Quad GW51XX")
+ name="gw51xx"
+ ;;
+
+ "Gateworks Ventana i.MX6 DualLite/Solo GW52XX" |\
+ "Gateworks Ventana i.MX6 Dual/Quad GW52XX")
+ name="gw52xx"
+ ;;
+
+ "Gateworks Ventana i.MX6 DualLite/Solo GW53XX" |\
+ "Gateworks Ventana i.MX6 Dual/Quad GW53XX")
+ name="gw53xx"
+ ;;
+
+ "Gateworks Ventana i.MX6 DualLite/Solo GW54XX" |\
+ "Gateworks Ventana i.MX6 Dual/Quad GW54XX" |\
+ "Gateworks Ventana GW5400-A")
+ name="gw54xx"
+ ;;
+
+ "Wandboard i.MX6 Dual Lite Board")
+ name="wandaboard"
+ ;;
+
+ *)
+ name="generic"
+ ;;
+ esac
+
+ [ -z "$IMX6_BOARD_NAME" ] && IMX6_BOARD_NAME="$name"
+ [ -z "$IMX6_MODEL" ] && IMX6_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$IMX6_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$IMX6_MODEL" > /tmp/sysinfo/model
+}
+
+imx6_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] || imx6_board_detect
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}