aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/base-files/lib
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-12-05 12:56:20 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-12-05 12:56:20 +0000
commit65d271e73a5e2e90476065e93525228766942460 (patch)
tree2e0cbebea69755e84d578a45776b0ac5ae1262b7 /target/linux/ar71xx/base-files/lib
parent32baf22378dc16c3c7b97f5c66545a85d11d52fe (diff)
downloadupstream-65d271e73a5e2e90476065e93525228766942460.tar.gz
upstream-65d271e73a5e2e90476065e93525228766942460.tar.bz2
upstream-65d271e73a5e2e90476065e93525228766942460.zip
ar71xx: change user-space board detection
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29432 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/base-files/lib')
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh29
-rw-r--r--target/linux/ar71xx/base-files/lib/preinit/03_preinit_do_ar71xx.sh2
2 files changed, 25 insertions, 6 deletions
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 314b44e472..02286e9aab 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -1,9 +1,12 @@
#!/bin/sh
#
-# Copyright (C) 2009 OpenWrt.org
+# Copyright (C) 2009-2011 OpenWrt.org
#
-ar71xx_board_name() {
+AR71XX_BOARD_NAME=
+AR71XX_MODEL=
+
+ar71xx_board_detect() {
local machine
local name
@@ -199,10 +202,24 @@ ar71xx_board_name() {
*ZCN-1523H-5)
name="zcn-1523h-5"
;;
- *)
- name="generic"
- ;;
esac
- echo $name
+ [ -z "$name" ] && name="unknown"
+
+ [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
+ [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$AR71XX_MODEL" > /tmp/sysinfo/model
+}
+
+ar71xx_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
}
diff --git a/target/linux/ar71xx/base-files/lib/preinit/03_preinit_do_ar71xx.sh b/target/linux/ar71xx/base-files/lib/preinit/03_preinit_do_ar71xx.sh
index 367648929b..ff5407a0d4 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/03_preinit_do_ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/preinit/03_preinit_do_ar71xx.sh
@@ -2,6 +2,8 @@
do_ar71xx() {
. /lib/ar71xx.sh
+
+ ar71xx_board_detect
}
boot_hook_add preinit_main do_ar71xx