ipq40xx: Add support for Linksys MR8300 (Dallas)
[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 buffalo,wtr-m2133hp |\
68 cilab,meshpoint-one |\
69 edgecore,ecw5211 |\
70 edgecore,oap100 |\
71 engenius,eap2200 |\
72 luma,wrtq-329acn |\
73 mobipromo,cm520-79f |\
74 qxwlan,e2600ac-c2)
75 nand_do_upgrade "$1"
76 ;;
77 alfa-network,ap120c-ac)
78 part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
79 if [ "$part" = "rootfs1" ]; then
80 fw_setenv active 2 || exit 1
81 CI_UBIPART="rootfs2"
82 else
83 fw_setenv active 1 || exit 1
84 CI_UBIPART="rootfs1"
85 fi
86 nand_do_upgrade "$1"
87 ;;
88 asus,map-ac2200)
89 CI_KERNPART="linux"
90 nand_do_upgrade "$1"
91 ;;
92 asus,rt-ac58u)
93 CI_UBIPART="UBI_DEV"
94 CI_KERNPART="linux"
95 nand_do_upgrade "$1"
96 ;;
97 cellc,rtl30vw)
98 CI_UBIPART="ubifs"
99 askey_do_upgrade "$1"
100 ;;
101 compex,wpj419)
102 nand_do_upgrade "$1"
103 ;;
104 linksys,ea6350v3 |\
105 linksys,ea8300 |\
106 linksys,mr8300)
107 platform_do_upgrade_linksys "$1"
108 ;;
109 meraki,mr33)
110 CI_KERNPART="part.safe"
111 nand_do_upgrade "$1"
112 ;;
113 openmesh,a42 |\
114 openmesh,a62)
115 PART_NAME="inactive"
116 platform_do_upgrade_openmesh "$1"
117 ;;
118 zyxel,nbg6617)
119 zyxel_do_upgrade "$1"
120 ;;
121 *)
122 default_do_upgrade "$1"
123 ;;
124 esac
125 }