treewide: drop target board_name functions
[openwrt/.git] / target / linux / ixp4xx / base-files / lib / ixp4xx.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2012 OpenWrt.org
4 #
5
6 IXP4XX_BOARD_NAME=
7 IXP4XX_MODEL=
8
9 ixp4xx_board_detect() {
10         local machine
11         local name
12
13         machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /Hardware/ {print $2}' /proc/cpuinfo)
14
15         case "$machine" in
16         "Gateworks Cambria"*)
17                 name="cambria"
18                 ;;
19         "Gateworks Avila"*)
20                 name="avila"
21                 ;;
22         *)
23                 name="generic";
24                 ;;
25         esac
26
27         [ -z "$IXP4XX_BOARD_NAME" ] && IXP4XX_BOARD_NAME="$name"
28         [ -z "$IXP4XX_MODEL" ] && IXP4XX_MODEL="$machine"
29
30         [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
31
32         echo "$IXP4XX_BOARD_NAME" > /tmp/sysinfo/board_name
33         echo "$IXP4XX_MODEL" > /tmp/sysinfo/model
34 }