aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/archs38/base-files/lib/arc.sh
blob: 50aaaa2d2747e301c7e4a23aae41e6b037d2c733 (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
41
42
43
#!/bin/sh
#
# Copyright (C) 2016 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,axs103""snps,arc-sdp")
		board="arc-sdp";
		;;
        "snps,hsdk")
                board="arc-hsdk";
                ;;
	"snps,nsim_hs")
		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"
}