oxnas: use ARM BCJ filter for XZ decompression
[openwrt.git] / target / linux / au1000 / base-files / lib / au1000.sh
1 #!/bin/sh
2
3 au1000_yamonenv_getvar()
4 {
5         local varname="$1"
6         local partition
7
8         . /lib/functions.sh
9
10         partition="$( find_mtd_part 'yamon env' )"
11         YAMONENVFILE="$partition" yamonenv "$varname"
12 }
13
14 au1000_detect()
15 {
16         local line board_name model
17
18         while read line; do
19                 case "$line" in
20                         'system type'*)
21                                 break
22                         ;;
23                 esac
24         done <'/proc/cpuinfo'
25
26         case "$line" in
27                 *' MTX-1')
28                         # both models appear nearly similar: the 'InternetBox' has
29                         # the same design but shrinked to 1 PCB and only 1 x miniPCI
30                         # for WiFi/ath5k and 1 x miniPCI for CardBus/UMTS, they differ
31                         # in BogoMIPS but there are old MeshCubes with 330 Mhz instead
32                         # of 400 MHz and no Cube has 'imei' (for UMTS) set in bootloader-env
33
34                         if [ -n "$( au1000_yamonenv_getvar 'imei' )" ]; then
35                                 board_name='internetbox'
36                                 model='T-Mobile InternetBox TMD SB1-S'
37                         else
38                                 board_name='meshcube'
39                                 model='4G Systems AccessCube/MeshCube'
40                         fi
41                 ;;
42                 *)
43                         board_name='unknown'
44                         model='unknown'
45                 ;;
46         esac
47
48         mkdir -p '/tmp/sysinfo'
49         echo "$board_name" >'/tmp/sysinfo/board_name'
50         echo "$model" >'/tmp/sysinfo/model'
51 }
52
53 au1000_board_name()
54 {
55         local file='/tmp/sysinfo/board_name'
56
57         [ -e "$file" ] || au1000_detect
58         cat "$file"
59 }