octeon: n821: add Cisco vEdge 1000 base
[openwrt/openwrt.git] / target / linux / octeon / base-files / lib / preinit / 01_sysinfo
1 do_sysinfo_octeon() {
2 local machine
3 local name
4
5 machine=$(grep "^system type" /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g")
6 of_machine=$(head -n1 /sys/firmware/devicetree/base/compatible)
7
8 # Sadly for whatever reason the N821 (Cisco Viptela vEdge 1000) uses the
9 # same supposedly unique board ID as the EdgeRouter. This is bad, so
10 # we override what cpuinfo gives us using the device tree as a hint.
11 case "$of_machine" in
12 "cisco,vedge1000"*)
13 return 0
14 esac
15
16 case "$machine" in
17 "UBNT_E100"*)
18 name="erlite"
19 ;;
20
21 "UBNT_E200"*)
22 name="er"
23 ;;
24
25 "UBNT_E220"*)
26 name="erpro"
27 ;;
28
29 "UBNT_E300"*|\
30 "UBNT_USG"*)
31 # let generic 02_sysinfo handle it since device has its own device tree
32 return 0
33 ;;
34
35 "ITUS_SHIELD"*)
36 name="itus,shield-router"
37 ;;
38
39 *)
40 name="generic"
41 ;;
42 esac
43
44 [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
45
46 echo "$name" > /tmp/sysinfo/board_name
47 echo "$machine" > /tmp/sysinfo/model
48 }
49
50 boot_hook_add preinit_main do_sysinfo_octeon