aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/sunxi/base-files/lib/sunxi.sh
blob: ce1292b5fd4c3ae372150f2f2f600756f2ba7cd3 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/sh

# defaults
SUNXI_BOARD_NAME="generic"
SUNXI_BOARD_MODEL="Generic sunxi board"

sunxi_board_detect() {
	local board
	local model

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

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

	case "$model" in
		"Mele A1000")
			board="a1000"
			;;

		"BA10 tvbox")
			board="ba10-tvbox"
			;;

		"Cubietech Cubieboard")
			board="cubieboard"
			;;

		"Miniand Hackberry")
			board="hackberry"
			;;

		"INet-97F Rev 02")
			board="inet97fv2"
			;;

		"PineRiver Mini X-Plus")
			board="mini-xplus"
			;;

		"Olimex A10-OLinuXino-LIME")
			board="olinuxino-lime"
			;;

		"LinkSprite pcDuino")
			board="pcduino"
			;;

		"Olimex A10s-Olinuxino Micro")
			board="olinuxino-micro"
			;;

		"R7 A10s hdmi tv-stick")
			board="r7-tv-dongle"
			;;

		"HSG H702")
			board="hsg-h702"
			;;

		"Olimex A13-Olinuxino")
			board="olinuxino"
			;;

		"Olimex A13-Olinuxino Micro")
			board="olinuxino-micro"
			;;

		"Allwinner A31 APP4 EVB1 Evaluation Board")
			board="app4-evb1"
			;;

		"WITS A31 Colombus Evaluation Board")
			board="colombus"
			;;

		"Merrii A31 Hummingbird")
			board="hummingbird"
			;;

		"Mele M9 / A1000G Quad top set box")
			board="m9"
			;;

		"LeMaker Banana Pi")
			board="bananapi"
			;;

		"LeMaker Banana Pro")
			board="bananapro"
			;;

		"Cubietech Cubieboard2")
			board="cubieboard2"
			;;

		"Cubietech Cubietruck")
			board="cubietruck"
			;;

		"Merrii A20 Hummingbird")
			board="hummingbird"
			;;

		"I12 / Q5 / QT840A A20 tvbox")
			board="i12-tvbox"
			;;

		"Lamobo R1")
			board="lamobo-r1"
			;;

		"Olimex A20-OLinuXino-LIME")
			board="olinuxino-lime"
			;;

		"Olimex A20-Olinuxino Micro")
			board="olinuxino-a20-micro"
			;;

		"LinkSprite pcDuino3")
			board="pcduino3"
			;;

		"Ippo Q8H Dual Core Tablet (v5)")
			board="ippo-q8h-v5"
			;;
	esac

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

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


	echo "$SUNXI_BOARD_NAME" > /tmp/sysinfo/board_name
	echo "$SUNXI_BOARD_MODEL" > /tmp/sysinfo/model
	echo "Detected $SUNXI_BOARD_NAME // $SUNXI_BOARD_MODEL"
}

sunxi_board_name() {
	local name

	[ -f /tmp/sysinfo/board_name ] && name="$(cat /tmp/sysinfo/board_name)"
	[ -z "$name" ] && name="unknown"

	echo "$name"
}