9ca1a2c09a401c01268914d4f38a6a81369a0c0c
[openwrt/openwrt.git] / target / linux / archs38 / base-files / lib / arc.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2016 OpenWrt.org
4 #
5
6 # defaults
7 ARC_BOARD_NAME="generic"
8 ARC_BOARD_MODEL="Generic ARC board"
9
10 arc_board_detect() {
11 local board
12 local model
13 local compatible
14
15 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
16
17 model="$( cat /proc/device-tree/model )"
18 compatible="$( cat /proc/device-tree/compatible )"
19
20 case "$compatible" in
21 "snps,axs103""snps,arc-sdp")
22 board="arc-sdp";
23 ;;
24 "snps,nsim_hs")
25 board="arc-nsim";
26 ;;
27 esac
28
29 if [ "$board" != "" ]; then
30 ARC_BOARD_NAME="$board"
31 fi
32
33 if [ "$model" != "" ]; then
34 ARC_BOARD_MODEL="$model"
35 fi
36
37 echo "$ARC_BOARD_NAME" > /tmp/sysinfo/board_name
38 echo "$ARC_BOARD_MODEL" > /tmp/sysinfo/model
39 echo "Detected $ARC_BOARD_NAME // $ARC_BOARD_MODEL"
40 }