aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/arc770/base-files/lib/arc.sh
blob: 185aeedb2dcf5aa6b91b244c376e1f866927d310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# Copyright (C) 2015 OpenWrt.org
#

# defaults
ARC_BOARD_NAME="generic"
ARC_BOARD_MODEL="Generic ARC board"

arc_board_detect() {
	local board
	local model
	local compatible

	[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"

	model="$( cat /proc/device-tree/model )"
	compatible="$( cat /proc/device-tree/compatible )"

	case "$compatible" in
	"snps,axs101""snps,arc-sdp")
		board="arc-sdp";
		;;
	"snps,nsim")
		board="arc-nsim";
		;;
	esac

	if [ "$board" != "" ]; then
		ARC_BOARD_NAME="$board"
	fi

	if [ "$model" != "" ]; then
		ARC_BOARD_MODEL="$model"
	fi

	echo "$ARC_BOARD_NAME" > /tmp/sysinfo/board_name
	echo "$ARC_BOARD_MODEL" > /tmp/sysinfo/model
	echo "Detected $ARC_BOARD_NAME // $ARC_BOARD_MODEL"
}