ipq40xx: add support for Aruba AP-365
[openwrt/openwrt.git] / target / linux / ipq40xx / base-files / lib / upgrade / platform.sh
1 PART_NAME=firmware
2 REQUIRE_IMAGE_METADATA=1
3
4 RAMFS_COPY_BIN='fw_printenv fw_setenv'
5 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
6
7 platform_check_image() {
8 case "$(board_name)" in
9 asus,rt-ac58u)
10 CI_UBIPART="UBI_DEV"
11 local ubidev=$(nand_find_ubi $CI_UBIPART)
12 local asus_root=$(nand_find_volume $ubidev jffs2)
13
14 [ -n "$asus_root" ] || return 0
15
16 cat << EOF
17 jffs2 partition is still present.
18 There's probably no space left
19 to install the filesystem.
20
21 You need to delete the jffs2 partition first:
22 # ubirmvol /dev/ubi0 --name=jffs2
23
24 Once this is done. Retry.
25 EOF
26 return 1
27 ;;
28 esac
29 return 0;
30 }
31
32 askey_do_upgrade() {
33 local tar_file="$1"
34
35 local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
36 board_dir=${board_dir%/}
37
38 tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs
39
40 nand_do_upgrade "$1"
41 }
42
43 zyxel_do_upgrade() {
44 local tar_file="$1"
45
46 local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
47 board_dir=${board_dir%/}
48
49 tar Oxf $tar_file ${board_dir}/kernel | mtd write - kernel
50
51 if [ -n "$UPGRADE_BACKUP" ]; then
52 tar Oxf $tar_file ${board_dir}/root | mtd -j "$UPGRADE_BACKUP" write - rootfs
53 else
54 tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs
55 fi
56 }
57
58 platform_do_upgrade() {
59 case "$(board_name)" in
60 8dev,jalapeno |\
61 aruba,ap-303 |\
62 aruba,ap-303h |\
63 aruba,ap-365 |\
64 avm,fritzbox-7530 |\
65 avm,fritzrepeater-1200 |\
66 avm,fritzrepeater-3000 |\
67 cilab,meshpoint-one |\
68 engenius,eap2200 |\
69 mobipromo,cm520-79f |\
70 qxwlan,e2600ac-c2)
71 nand_do_upgrade "$1"
72 ;;
73 alfa-network,ap120c-ac)
74 part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
75 if [ "$part" = "rootfs1" ]; then
76 fw_setenv active 2 || exit 1
77 CI_UBIPART="rootfs2"
78 else
79 fw_setenv active 1 || exit 1
80 CI_UBIPART="rootfs1"
81 fi
82 nand_do_upgrade "$1"
83 ;;
84 asus,map-ac2200)
85 CI_KERNPART="linux"
86 nand_do_upgrade "$1"
87 ;;
88 asus,rt-ac58u)
89 CI_UBIPART="UBI_DEV"
90 CI_KERNPART="linux"
91 nand_do_upgrade "$1"
92 ;;
93 cellc,rtl30vw)
94 CI_UBIPART="ubifs"
95 askey_do_upgrade "$1"
96 ;;
97 compex,wpj419)
98 nand_do_upgrade "$1"
99 ;;
100 linksys,ea6350v3 |\
101 linksys,ea8300)
102 platform_do_upgrade_linksys "$1"
103 ;;
104 meraki,mr33)
105 CI_KERNPART="part.safe"
106 nand_do_upgrade "$1"
107 ;;
108 openmesh,a42 |\
109 openmesh,a62)
110 PART_NAME="inactive"
111 platform_do_upgrade_openmesh "$1"
112 ;;
113 zyxel,nbg6617)
114 zyxel_do_upgrade "$1"
115 ;;
116 *)
117 default_do_upgrade "$1"
118 ;;
119 esac
120 }