108c90b1fea22dafe079b3b0493a32517a829c40
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4
5 . /lib/functions/system.sh
6 . /lib/ar71xx.sh
7
8 PART_NAME=firmware
9 RAMFS_COPY_DATA=/lib/ar71xx.sh
10 RAMFS_COPY_BIN='nandwrite'
11
12 CI_BLKSZ=65536
13 CI_LDADR=0x80060000
14
15 PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=0
16
17 platform_find_partitions() {
18 local first dev size erasesize name
19 while read dev size erasesize name; do
20 name=${name#'"'}; name=${name%'"'}
21 case "$name" in
22 vmlinux.bin.l7|vmlinux|kernel|linux|linux.bin|rootfs|filesystem)
23 if [ -z "$first" ]; then
24 first="$name"
25 else
26 echo "$erasesize:$first:$name"
27 break
28 fi
29 ;;
30 esac
31 done < /proc/mtd
32 }
33
34 platform_find_kernelpart() {
35 local part
36 for part in "${1%:*}" "${1#*:}"; do
37 case "$part" in
38 vmlinux.bin.l7|vmlinux|kernel|linux|linux.bin)
39 echo "$part"
40 break
41 ;;
42 esac
43 done
44 }
45
46 platform_find_rootfspart() {
47 local part
48 for part in "${1%:*}" "${1#*:}"; do
49 [ "$part" != "$2" ] && echo "$part" && break
50 done
51 }
52
53 platform_do_upgrade_combined() {
54 local partitions=$(platform_find_partitions)
55 local kernelpart=$(platform_find_kernelpart "${partitions#*:}")
56 local erase_size=$((0x${partitions%%:*})); partitions="${partitions#*:}"
57 local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null)
58 local kern_blocks=$(($kern_length / $CI_BLKSZ))
59 local root_blocks=$((0x$(dd if="$1" bs=2 skip=5 count=4 2>/dev/null) / $CI_BLKSZ))
60
61 if [ -n "$partitions" ] && [ -n "$kernelpart" ] && \
62 [ ${kern_blocks:-0} -gt 0 ] && \
63 [ ${root_blocks:-0} -gt 0 ] && \
64 [ ${erase_size:-0} -gt 0 ];
65 then
66 local rootfspart=$(platform_find_rootfspart "$partitions" "$kernelpart")
67 local append=""
68 [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
69
70 if [ "$PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD" -ne 1 ]; then
71 ( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \
72 dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \
73 mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions
74 elif [ -n "$rootfspart" ]; then
75 dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null | \
76 mtd write - $kernelpart
77 dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null | \
78 mtd -r $append write - $rootfspart
79 fi
80 fi
81 PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=0
82 }
83
84 tplink_get_image_hwid() {
85 get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
86 }
87
88 tplink_get_image_mid() {
89 get_image "$@" | dd bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
90 }
91
92 tplink_get_image_boot_size() {
93 get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
94 }
95
96 tplink_pharos_check_image() {
97 local magic_long="$(get_magic_long "$1")"
98 [ "$magic_long" != "7f454c46" ] && {
99 echo "Invalid image magic '$magic_long'"
100 return 1
101 }
102
103 local model_string="$(tplink_pharos_get_model_string)"
104 local line
105
106 # Here $1 is given to dd directly instead of get_image as otherwise the skip
107 # will take almost a second (as dd can't seek then)
108 #
109 # This will fail if the image isn't local, but that's fine: as the
110 # read loop won't be executed at all, it will return true, so the image
111 # is accepted (loading the first 1.5M of a remote image for this check seems
112 # a bit extreme)
113 dd if="$1" bs=1 skip=1511432 count=1024 2>/dev/null | while read line; do
114 [ "$line" = "$model_string" ] && break
115 done || {
116 echo "Unsupported image (model not in support-list)"
117 return 1
118 }
119
120 return 0
121 }
122
123 seama_get_type_magic() {
124 get_image "$@" | dd bs=1 count=4 skip=53 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
125 }
126
127 wrgg_get_image_magic() {
128 get_image "$@" | dd bs=4 count=1 skip=8 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
129 }
130
131 cybertan_get_image_magic() {
132 get_image "$@" | dd bs=8 count=1 skip=0 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
133 }
134
135 cybertan_check_image() {
136 local magic="$(cybertan_get_image_magic "$1")"
137 local fw_magic="$(cybertan_get_hw_magic)"
138
139 [ "$fw_magic" != "$magic" ] && {
140 echo "Invalid image, ID mismatch, got:$magic, but need:$fw_magic"
141 return 1
142 }
143
144 return 0
145 }
146
147 platform_do_upgrade_compex() {
148 local fw_file=$1
149 local fw_part=$PART_NAME
150 local fw_mtd=$(find_mtd_part $fw_part)
151 local fw_length=0x$(dd if="$fw_file" bs=2 skip=1 count=4 2>/dev/null)
152 local fw_blocks=$(($fw_length / 65536))
153
154 if [ -n "$fw_mtd" ] && [ ${fw_blocks:-0} -gt 0 ]; then
155 local append=""
156 [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
157
158 sync
159 dd if="$fw_file" bs=64k skip=1 count=$fw_blocks 2>/dev/null | \
160 mtd $append write - "$fw_part"
161 fi
162 }
163
164 alfa_check_image() {
165 local magic_long="$(get_magic_long "$1")"
166 local fw_part_size=$(mtd_get_part_size firmware)
167
168 case "$magic_long" in
169 "27051956")
170 [ "$fw_part_size" != "16318464" ] && {
171 echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
172 return 1
173 }
174 ;;
175 "68737173")
176 [ "$fw_part_size" != "7929856" ] && {
177 echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
178 return 1
179 }
180 ;;
181 esac
182
183 return 0
184 }
185
186 platform_check_image() {
187 local board=$(board_name)
188 local magic="$(get_magic_word "$1")"
189 local magic_long="$(get_magic_long "$1")"
190
191 [ "$#" -gt 1 ] && return 1
192
193 case "$board" in
194 airgateway|\
195 airgatewaypro|\
196 airrouter|\
197 ap121f|\
198 ap132|\
199 ap531b0|\
200 ap90q|\
201 archer-c25-v1|\
202 archer-c58-v1|\
203 archer-c59-v1|\
204 archer-c60-v1|\
205 archer-c7-v4|\
206 bullet-m|\
207 c-55|\
208 carambola2|\
209 cf-e316n-v2|\
210 cf-e320n-v2|\
211 cf-e355ac|\
212 cf-e380ac-v1|\
213 cf-e380ac-v2|\
214 cf-e520n|\
215 cf-e530n|\
216 cpe505n|\
217 cpe830|\
218 cpe870|\
219 dgl-5500-a1|\
220 dhp-1565-a1|\
221 dir-505-a1|\
222 dir-600-a1|\
223 dir-615-c1|\
224 dir-615-e1|\
225 dir-615-e4|\
226 dir-615-i1|\
227 dir-825-c1|\
228 dir-835-a1|\
229 dlan-hotspot|\
230 dlan-pro-1200-ac|\
231 dlan-pro-500-wp|\
232 dr342|\
233 dr531|\
234 dragino2|\
235 ebr-2310-c1|\
236 ens202ext|\
237 epg5000|\
238 esr1750|\
239 esr900|\
240 ew-dorin|\
241 ew-dorin-router|\
242 gl-ar150|\
243 gl-ar300m|\
244 gl-ar300|\
245 gl-domino|\
246 gl-mifi|\
247 gl-usb150|\
248 hiwifi-hc6361|\
249 hornet-ub-x2|\
250 jwap230|\
251 lima|\
252 loco-m-xw|\
253 mzk-w04nu|\
254 mzk-w300nh|\
255 n5q|\
256 nanostation-m|\
257 nanostation-m-xw|\
258 nbg460n_550n_550nh|\
259 pqi-air-pen|\
260 r36a|\
261 r602n|\
262 rocket-m|\
263 rocket-m-ti|\
264 rocket-m-xw|\
265 rw2458n|\
266 sc1750|\
267 sc300m|\
268 sc450|\
269 sr3200|\
270 tew-632brp|\
271 tew-712br|\
272 tew-732br|\
273 tew-823dru|\
274 tl-wr1043n-v5|\
275 tl-wr942n-v1|\
276 unifi|\
277 unifi-outdoor|\
278 unifiac-lite|\
279 unifiac-pro|\
280 weio|\
281 whr-g301n|\
282 whr-hp-g300n|\
283 whr-hp-gn|\
284 wlae-ag300n|\
285 wndap360|\
286 wpj342|\
287 wpj344|\
288 wpj531|\
289 wpj558|\
290 wpj563|\
291 wrt400n|\
292 wrtnode2q|\
293 wzr-450hp2|\
294 wzr-hp-ag300h|\
295 wzr-hp-g300nh|\
296 wzr-hp-g300nh2|\
297 wzr-hp-g450h|\
298 xd3200)
299 [ "$magic" != "2705" ] && {
300 echo "Invalid image type."
301 return 1
302 }
303
304 return 0
305 ;;
306 alfa-ap96|\
307 alfa-nx|\
308 ap121|\
309 ap121-mini|\
310 ap135-020|\
311 ap136-010|\
312 ap136-020|\
313 ap147-010|\
314 ap152|\
315 ap91-5g|\
316 ap96|\
317 arduino-yun|\
318 bhr-4grv2|\
319 bxu2000n-2-a1|\
320 db120|\
321 dr344|\
322 dw33d|\
323 f9k1115v2|\
324 hornet-ub|\
325 mr12|\
326 mr16|\
327 zbt-we1526|\
328 zcn-1523h-2|\
329 zcn-1523h-5)
330 [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
331 echo "Invalid image type."
332 return 1
333 }
334
335 return 0
336 ;;
337 all0258n|\
338 all0315n|\
339 cap324|\
340 cap4200ag|\
341 cr3000|\
342 cr5000)
343 platform_check_image_allnet "$1" && return 0
344 return 1
345 ;;
346 all0305|\
347 eap300v2|\
348 eap7660d|\
349 ja76pf|\
350 ja76pf2|\
351 jwap003|\
352 ls-sr71|\
353 pb42|\
354 pb44|\
355 routerstation|\
356 routerstation-pro|\
357 wp543|\
358 wpe72)
359 [ "$magic" != "4349" ] && {
360 echo "Invalid image. Use *-sysupgrade.bin files on this board"
361 return 1
362 }
363
364 local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null)
365 local md5_chk=$(dd if="$1" bs=$CI_BLKSZ skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}"
366
367 if [ -n "$md5_img" -a -n "$md5_chk" ] && [ "$md5_img" = "$md5_chk" ]; then
368 return 0
369 else
370 echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)"
371 return 1
372 fi
373
374 return 0
375 ;;
376 antminer-s1|\
377 antminer-s3|\
378 antrouter-r1|\
379 archer-c5|\
380 archer-c7|\
381 el-m150|\
382 el-mini|\
383 gl-inet|\
384 mc-mac1200r|\
385 minibox-v1|\
386 omy-g1|\
387 omy-x1|\
388 onion-omega|\
389 oolite|\
390 re450|\
391 rut900|\
392 smart-300|\
393 som9331|\
394 tellstick-znet-lite|\
395 tl-mr10u|\
396 tl-mr11u|\
397 tl-mr12u|\
398 tl-mr13u|\
399 tl-mr3020|\
400 tl-mr3040|\
401 tl-mr3040-v2|\
402 tl-mr3220|\
403 tl-mr3220-v2|\
404 tl-mr3420|\
405 tl-mr3420-v2|\
406 tl-mr6400|\
407 tl-wa701nd-v2|\
408 tl-wa7210n-v2|\
409 tl-wa750re|\
410 tl-wa7510n|\
411 tl-wa801nd-v2|\
412 tl-wa801nd-v3|\
413 tl-wa830re-v2|\
414 tl-wa850re|\
415 tl-wa850re-v2|\
416 tl-wa855re-v1|\
417 tl-wa860re|\
418 tl-wa901nd|\
419 tl-wa901nd-v2|\
420 tl-wa901nd-v3|\
421 tl-wa901nd-v4|\
422 tl-wa901nd-v5|\
423 tl-wdr3320-v2|\
424 tl-wdr3500|\
425 tl-wdr4300|\
426 tl-wdr4900-v2|\
427 tl-wdr6500-v2|\
428 tl-wpa8630|\
429 tl-wr1041n-v2|\
430 tl-wr1043nd|\
431 tl-wr1043nd-v2|\
432 tl-wr1043nd-v4|\
433 tl-wr2543n|\
434 tl-wr703n|\
435 tl-wr710n|\
436 tl-wr720n-v3|\
437 tl-wr740n-v6|\
438 tl-wr741nd|\
439 tl-wr741nd-v4|\
440 tl-wr802n-v1|\
441 tl-wr802n-v2|\
442 tl-wr810n|\
443 tl-wr810n-v2|\
444 tl-wr840n-v2|\
445 tl-wr840n-v3|\
446 tl-wr841n-v1|\
447 tl-wr841n-v7|\
448 tl-wr841n-v8|\
449 tl-wr841n-v9|\
450 tl-wr841n-v11|\
451 tl-wr842n-v2|\
452 tl-wr842n-v3|\
453 tl-wr902ac-v1|\
454 tl-wr940n-v4|\
455 tl-wr941nd|\
456 tl-wr941nd-v5|\
457 tl-wr941nd-v6)
458 local magic_ver="0100"
459
460 case "$board" in
461 tl-wdr6500-v2)
462 magic_ver="0200"
463 ;;
464 esac
465
466 [ "$magic" != "$magic_ver" ] && {
467 echo "Invalid image type."
468 return 1
469 }
470
471 local hwid
472 local mid
473 local imagehwid
474 local imagemid
475
476 hwid=$(tplink_get_hwid)
477 mid=$(tplink_get_mid)
478 imagehwid=$(tplink_get_image_hwid "$1")
479 imagemid=$(tplink_get_image_mid "$1")
480
481 [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && {
482 echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid."
483 return 1
484 }
485
486 local boot_size
487
488 boot_size=$(tplink_get_image_boot_size "$1")
489 [ "$boot_size" != "00000000" ] && {
490 echo "Invalid image, it contains a bootloader."
491 return 1
492 }
493
494 return 0
495 ;;
496 bsb|\
497 dir-825-b1|\
498 tew-673gru)
499 dir825b_check_image "$1" && return 0
500 ;;
501 rb-411|\
502 rb-411u|\
503 rb-433|\
504 rb-433u|\
505 rb-435g|\
506 rb-450|\
507 rb-450g|\
508 rb-493|\
509 rb-493g|\
510 rb-750|\
511 rb-750gl|\
512 rb-751|\
513 rb-751g|\
514 rb-911g-2hpnd|\
515 rb-911g-5hpnd|\
516 rb-911g-5hpacd|\
517 rb-912uag-2hpnd|\
518 rb-912uag-5hpnd|\
519 rb-921gs-5hpacd-r2|\
520 rb-951g-2hnd|\
521 rb-951ui-2hnd|\
522 rb-2011l|\
523 rb-2011il|\
524 rb-2011uas|\
525 rb-2011uas-2hnd|\
526 rb-2011uias|\
527 rb-2011uias-2hnd|\
528 rb-sxt2n|\
529 rb-sxt5n)
530 nand_do_platform_check routerboard $1
531 return $?
532 ;;
533 c-60|\
534 hiveap-121|\
535 nbg6716|\
536 r6100|\
537 rambutan|\
538 wi2a-ac200i|\
539 wndr3700v4|\
540 wndr4300)
541 nand_do_platform_check $board $1
542 return $?
543 ;;
544 cpe210|\
545 cpe510|\
546 eap120|\
547 wbs210|\
548 wbs510)
549 tplink_pharos_check_image "$1" && return 0
550 return 1
551 ;;
552 a40|\
553 a60|\
554 mr1750|\
555 mr1750v2|\
556 mr600|\
557 mr600v2|\
558 mr900|\
559 mr900v2|\
560 om2p|\
561 om2p-hs|\
562 om2p-hsv2|\
563 om2p-hsv3|\
564 om2p-hsv4|\
565 om2p-lc|\
566 om2pv2|\
567 om2pv4|\
568 om5p|\
569 om5p-ac|\
570 om5p-acv2|\
571 om5p-an)
572 platform_check_image_openmesh "$magic_long" "$1" && return 0
573 return 1
574 ;;
575 mr18|\
576 z1)
577 merakinand_do_platform_check $board $1
578 return $?
579 ;;
580 dir-869-a1|\
581 mynet-n600|\
582 mynet-n750|\
583 qihoo-c301)
584 [ "$magic_long" != "5ea3a417" ] && {
585 echo "Invalid image, bad magic: $magic_long"
586 return 1
587 }
588
589 local typemagic=$(seama_get_type_magic "$1")
590 [ "$typemagic" != "6669726d" ] && {
591 echo "Invalid image, bad type: $typemagic"
592 return 1
593 }
594
595 return 0
596 ;;
597 e2100l|\
598 mynet-rext|\
599 wrt160nl)
600 cybertan_check_image "$1" && return 0
601 return 1
602 ;;
603 nbg6616|\
604 uap-pro|\
605 unifi-outdoor-plus)
606 [ "$magic_long" != "19852003" ] && {
607 echo "Invalid image type."
608 return 1
609 }
610
611 return 0
612 ;;
613 tube2h)
614 alfa_check_image "$1" && return 0
615 return 1
616 ;;
617 wndr3700|\
618 wnr1000-v2|\
619 wnr2000-v3|\
620 wnr612-v2|\
621 wpn824n)
622 local hw_magic
623
624 hw_magic="$(ar71xx_get_mtd_part_magic firmware)"
625 [ "$magic_long" != "$hw_magic" ] && {
626 echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long."
627 return 1
628 }
629
630 return 0
631 ;;
632 wnr2000-v4)
633 [ "$magic_long" != "32303034" ] && {
634 echo "Invalid image type."
635 return 1
636 }
637
638 return 0
639 ;;
640 wnr2200)
641 [ "$magic_long" != "32323030" ] && {
642 echo "Invalid image type."
643 return 1
644 }
645
646 return 0
647 ;;
648 dap-2695-a1)
649 local magic=$(wrgg_get_image_magic "$1")
650 [ "$magic" != "21030820" ] && {
651 echo "Invalid image, bad type: $magic"
652 return 1
653 }
654
655 return 0;
656 ;;
657 # these boards use metadata images
658 fritz300e|\
659 rb-750-r2|\
660 rb-750p-pbr2|\
661 rb-750up-r2|\
662 rb-941-2nd|\
663 rb-951ui-2nd|\
664 rb-952ui-5ac2nd|\
665 rb-962uigs-5hact2hnt|\
666 rb-lhg-5nd|\
667 rb-map-2nd|\
668 rb-mapl-2nd|\
669 rb-wap-2nd)
670 return 0
671 ;;
672 esac
673
674 echo "Sysupgrade is not yet supported on $board."
675 return 1
676 }
677
678 platform_pre_upgrade() {
679 local board=$(board_name)
680
681 case "$board" in
682 c-60|\
683 hiveap-121|\
684 nbg6716|\
685 r6100|\
686 rambutan|\
687 rb-411|\
688 rb-411u|\
689 rb-433|\
690 rb-433u|\
691 rb-435g|\
692 rb-450|\
693 rb-450g|\
694 rb-493|\
695 rb-493g|\
696 rb-750|\
697 rb-750gl|\
698 rb-751|\
699 rb-751g|\
700 rb-911g-2hpnd|\
701 rb-911g-5hpacd|\
702 rb-911g-5hpnd|\
703 rb-912uag-2hpnd|\
704 rb-912uag-5hpnd|\
705 rb-921gs-5hpacd-r2|\
706 rb-951g-2hnd|\
707 rb-951ui-2hnd|\
708 rb-2011il|\
709 rb-2011l|\
710 rb-2011uas|\
711 rb-2011uas-2hnd|\
712 rb-2011uias|\
713 rb-2011uias-2hnd|\
714 rb-sxt2n|\
715 rb-sxt5n|\
716 wi2a-ac200i|\
717 wndr3700v4|\
718 wndr4300)
719 nand_do_upgrade "$1"
720 ;;
721 rb-750-r2|\
722 rb-750p-pbr2|\
723 rb-750up-r2|\
724 rb-941-2nd|\
725 rb-951ui-2nd|\
726 rb-952ui-5ac2nd|\
727 rb-962uigs-5hact2hnt|\
728 rb-lhg-5nd|\
729 rb-map-2nd|\
730 rb-mapl-2nd|\
731 rb-wap-2nd)
732 # erase firmware if booted from initramfs
733 [ -z "$(rootfs_type)" ] && mtd erase firmware
734 ;;
735 mr18|\
736 z1)
737 merakinand_do_upgrade "$1"
738 ;;
739 esac
740 }
741
742 platform_nand_pre_upgrade() {
743 local board=$(board_name)
744
745 case "$board" in
746 rb*)
747 CI_KERNPART=none
748 local fw_mtd=$(find_mtd_part kernel)
749 fw_mtd="${fw_mtd/block/}"
750 [ -n "$fw_mtd" ] || return
751 mtd erase kernel
752 tar xf "$1" sysupgrade-routerboard/kernel -O | nandwrite -o "$fw_mtd" -
753 ;;
754 wi2a-ac200i)
755 case "$(fw_printenv -n dualPartition)" in
756 imgA)
757 fw_setenv dualPartition imgB
758 fw_setenv ActImg NokiaImageB
759 ;;
760 imgB)
761 fw_setenv dualPartition imgA
762 fw_setenv ActImg NokiaImageA
763 ;;
764 esac
765 ubiblock -r /dev/ubiblock0_0 2>/dev/null >/dev/null
766 rm -f /dev/ubiblock0_0
767 ubidetach -d 0 2>/dev/null >/dev/null
768 CI_UBIPART=ubi_alt
769 CI_KERNPART=kernel_alt
770 ;;
771 esac
772 }
773
774 platform_do_upgrade() {
775 local board=$(board_name)
776
777 case "$board" in
778 all0258n)
779 platform_do_upgrade_allnet "0x9f050000" "$ARGV"
780 ;;
781 all0305|\
782 eap7660d|\
783 ja76pf|\
784 ja76pf2|\
785 jwap003|\
786 ls-sr71|\
787 pb42|\
788 pb44|\
789 routerstation|\
790 routerstation-pro)
791 platform_do_upgrade_combined "$ARGV"
792 ;;
793 all0315n)
794 platform_do_upgrade_allnet "0x9f080000" "$ARGV"
795 ;;
796 cap4200ag|\
797 eap300v2|\
798 ens202ext)
799 platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
800 ;;
801 dir-825-b1|\
802 tew-673gru)
803 platform_do_upgrade_dir825b "$ARGV"
804 ;;
805 a40|\
806 a60|\
807 mr1750|\
808 mr1750v2|\
809 mr600|\
810 mr600v2|\
811 mr900|\
812 mr900v2|\
813 om2p|\
814 om2p-hs|\
815 om2p-hsv2|\
816 om2p-hsv3|\
817 om2p-hsv4|\
818 om2p-lc|\
819 om2pv2|\
820 om2pv4|\
821 om5p|\
822 om5p-ac|\
823 om5p-acv2|\
824 om5p-an)
825 platform_do_upgrade_openmesh "$ARGV"
826 ;;
827 uap-pro|\
828 unifi-outdoor-plus)
829 MTD_CONFIG_ARGS="-s 0x180000"
830 default_do_upgrade "$ARGV"
831 ;;
832 wp543|\
833 wpe72)
834 platform_do_upgrade_compex "$ARGV"
835 ;;
836 *)
837 default_do_upgrade "$ARGV"
838 ;;
839 esac
840 }
841
842 disable_watchdog() {
843 killall watchdog
844 ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
845 echo 'Could not disable watchdog'
846 return 1
847 }
848 }
849
850 append sysupgrade_pre_upgrade disable_watchdog