mountd: update to latest git HEAD
[openwrt/openwrt.git] / target / linux / netlogic / base-files / lib / netlogic.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2014 OpenWrt.org
4 #
5
6 NETLOGIC_BOARD_NAME=
7 NETLOGIC_MODEL=
8
9 netlogic_board_detect() {
10 local machine
11 local name
12
13 machine=$(awk 'BEGIN{FS="[ \t:/]+"} /machine/ {print $2}' /proc/cpuinfo)
14
15 case "$machine" in
16 *"netlogic,XLP-EVP")
17 name="xlp-evp"
18 ;;
19 *"netlogic,XLP-FVP")
20 name="xlp-fvp"
21 ;;
22 *"netlogic,XLP-GVP")
23 name="xlp-gvp"
24 ;;
25 *"netlogic,XLP-SVP")
26 name="xlp-svp"
27 ;;
28 esac
29
30 [ -z "$name" ] && name="unknown"
31
32 [ -z "$NETLOGIC_BOARD_NAME" ] && NETLOGIC_BOARD_NAME="$name"
33 [ -z "$NETLOGIC_MODEL" ] && NETLOGIC_MODEL="$machine"
34
35 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
36
37 echo "$NETLOGIC_BOARD_NAME" > /tmp/sysinfo/board_name
38 echo "$NETLOGIC_MODEL" > /tmp/sysinfo/model
39 }
40
41 netlogic_board_name() {
42 local name
43
44 [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
45 [ -z "$name" ] && name="unknown"
46
47 echo "$name"
48 }