aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/cns3xxx/base-files/lib
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/cns3xxx/base-files/lib')
-rw-r--r--target/linux/cns3xxx/base-files/lib/cns3xxx.sh27
-rw-r--r--target/linux/cns3xxx/base-files/lib/preinit/01_sysinfo9
2 files changed, 30 insertions, 6 deletions
diff --git a/target/linux/cns3xxx/base-files/lib/cns3xxx.sh b/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
index 476f9be21d..fb2c1043e1 100644
--- a/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
+++ b/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-cns3xxx_board_name() {
+CNS3XXX_BOARD_NAME=
+CNS3XXX_MODEL=
+
+cns3xxx_board_detect() {
local machine
local name
@@ -17,6 +17,21 @@ cns3xxx_board_name() {
name="generic";
;;
esac
-
- echo $name
+
+ [ -z "$CNS3XXX_BOARD_NAME" ] && CNS3XXX_BOARD_NAME="$name"
+ [ -z "$CNS3XXX_MODEL" ] && CNS3XXX_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$CNS3XXX_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$CNS3XXX_MODEL" > /tmp/sysinfo/model
+}
+
+cns3xxx_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/cns3xxx/base-files/lib/preinit/01_sysinfo b/target/linux/cns3xxx/base-files/lib/preinit/01_sysinfo
new file mode 100644
index 0000000000..cc7b5551e9
--- /dev/null
+++ b/target/linux/cns3xxx/base-files/lib/preinit/01_sysinfo
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_sysinfo_cns3xxx() {
+ . /lib/cns3xxx.sh
+
+ cns3xxx_board_detect
+}
+
+boot_hook_add preinit_main do_sysinfo_cns3xxx