aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/at91/base-files/lib/at91.sh
blob: 0fa2ee32515539b2266c61ee0f04b6d2748250c8 (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
#!/bin/sh
#
# Copyright (C) 2014 OpenWrt.org
#

AT91_BOARD_NAME=
AT91_MODEL=

at91_board_detect() {
	local machine
	local name

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

	case "$machine" in
	*"Atmel at91sam9263ek")
		name="at91sam9263ek"
		;;
	*"Atmel AT91SAM9G15-EK")
		name="at91sam9g15ek"
		;;
	*"Atmel at91sam9g20ek")
		name="at91sam9g20ek"
		;;
	*"Atmel at91sam9g20ek 2 mmc")
		name="at91sam9g20ek_2mmc"
		;;
	*"Atmel AT91SAM9G25-EK")
		name="at91sam9g25ek"
		;;
	*"Atmel AT91SAM9G35-EK")
		name="at91sam9g35ek"
		;;
	*"Atmel AT91SAM9M10G45-EK")
		name="at91sam9m10g45ek"
		;;
	*"Atmel AT91SAM9X25-EK")
		name="at91sam9x25ek"
		;;
	*"Atmel AT91SAM9X35-EK")
		name="at91sam9x35ek"
		;;
	*"SAMA5D3 Xplained")
		name="sama5d3_xplained"
		;;
	*"CalAmp LMU5000")
		name="lmu5000"
		;;
	*"Calao TNY A9260")
		name="tny_a9260"
		;;
	*"Calao TNY A9263")
		name="tny_a9263"
		;;
	*"Calao TNY A9G20")
		name="tny_a9g20"
		;;
	*"Calao USB A9260")
		name="usb_a9260"
		;;
	*"Calao USB A9263")
		name="usb_a9263"
		;;
	*"Calao USB A9G20")
		name="usb_a9g20"
		;;
	*"Ethernut 5")
		name="ethernut5"
		;;
	esac

	[ -z "$name" ] && name="unknown"

	[ -z "$AT91_BOARD_NAME" ] && AT91_BOARD_NAME="$name"
	[ -z "$AT91_MODEL" ] && AT91_MODEL="$machine"

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

	echo "$AT91_BOARD_NAME" > /tmp/sysinfo/board_name
	echo "$AT91_MODEL" > /tmp/sysinfo/model
}