aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/base-files/lib/apm821xx.sh
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/apm821xx/base-files/lib/apm821xx.sh')
-rwxr-xr-xtarget/linux/apm821xx/base-files/lib/apm821xx.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/target/linux/apm821xx/base-files/lib/apm821xx.sh b/target/linux/apm821xx/base-files/lib/apm821xx.sh
new file mode 100755
index 0000000000..8f15ced8ca
--- /dev/null
+++ b/target/linux/apm821xx/base-files/lib/apm821xx.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+APM821XX_BOARD_NAME=
+APM821XX_MODEL=
+
+apm821xx_board_detect() {
+ local model
+ local name
+
+ model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
+
+ case "$model" in
+ *)
+ name="unknown"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -z "$APM821XX_BOARD_NAME" ] && APM821XX_BOARD_NAME="$name"
+ [ -z "$APM821XX_MODEL" ] && APM821XX_MODEL="$model"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$APM821XX_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$APM821XX_MODEL" > /tmp/sysinfo/model
+}
+
+apm821xx_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}