lantiq: move lantiq_board_detect() to 03_preinit_board.sh
[openwrt/openwrt.git] / target / linux / lantiq / base-files / lib / preinit / 03_preinit_board.sh
index 6d4bd67..aef9460 100755 (executable)
@@ -1,5 +1,15 @@
 #!/bin/sh
 
+lantiq_board_detect() {
+       name=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"`
+       model=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g"`
+       [ -z "$name" ] && name="unknown"
+       [ -z "$model" ] && model="unknown"
+       [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+       echo $name > /tmp/sysinfo/board_name
+       echo $model > /tmp/sysinfo/model
+}
+
 do_lantiq() {
        . /lib/functions/lantiq.sh