pistachio: remove pistachio_board_name, use the generic function
[lede-git/.git] / target / linux / pistachio / base-files / lib / pistachio.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2017 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 PISTACHIO_BOARD_NAME=
10 PISTACHIO_MODEL=
11
12 pistachio_board_detect() {
13         local machine
14         local name
15
16         machine=$(cat /proc/device-tree/model)
17
18         case "$machine" in
19         "IMG Marduk (Creator Ci40)")
20                 name="marduk"
21                 ;;
22         *)
23                 name="generic"
24                 ;;
25         esac
26
27         [ -z "$PISTACHIO_BOARD_NAME" ] && PISTACHIO_BOARD_NAME="$name"
28         [ -z "$PISTACHIO_MODEL" ] && PISTACHIO_MODEL="$machine"
29
30         [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
31
32         echo "$PISTACHIO_BOARD_NAME" > /tmp/sysinfo/board_name
33         echo "$PISTACHIO_MODEL" > /tmp/sysinfo/model
34 }