454af2c3e6b808230b3300945a593b62d856aa15
[librecmc/librecmc.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 [ -x /usr/sbin/nandwrite ] && RAMFS_COPY_BIN=/usr/sbin/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_nand_board_name() {
187         local board=$(ar71xx_board_name)
188
189         case "$board" in
190         rb*) echo "routerboard";;
191         *) echo "$board";;
192         esac
193 }
194
195 platform_check_image() {
196         local board=$(ar71xx_board_name)
197         local magic="$(get_magic_word "$1")"
198         local magic_long="$(get_magic_long "$1")"
199
200         [ "$#" -gt 1 ] && return 1
201
202         case "$board" in
203         airgatewaypro|\
204         airgateway|\
205         airrouter|\
206         ap132|\
207         ap531b0|\
208         ap90q|\
209         archer-c25-v1|\
210         archer-c59-v1|\
211         archer-c60-v1|\
212         bullet-m|\
213         c-55|\
214         carambola2|\
215         cf-e316n-v2|\
216         cf-e320n-v2|\
217         cf-e380ac-v1|\
218         cf-e380ac-v2|\
219         cf-e520n|\
220         cf-e530n|\
221         cpe505n|\
222         cpe830|\
223         cpe870|\
224         dgl-5500-a1|\
225         dhp-1565-a1|\
226         dir-505-a1|\
227         dir-600-a1|\
228         dir-615-c1|\
229         dir-615-e1|\
230         dir-615-e4|\
231         dir-615-i1|\
232         dir-825-c1|\
233         dir-835-a1|\
234         dlan-hotspot|\
235         dlan-pro-1200-ac|\
236         dlan-pro-500-wp|\
237         dr531|\
238         dragino2|\
239         ebr-2310-c1|\
240         ens202ext|\
241         epg5000|\
242         esr1750|\
243         esr900|\
244         ew-dorin-router|\
245         ew-dorin|\
246         gl-ar150|\
247         gl-ar300m|\
248         gl-ar300|\
249         gl-domino|\
250         gl-mifi|\
251         hiwifi-hc6361|\
252         hornet-ub-x2|\
253         jwap230|\
254         lima|\
255         loco-m-xw|\
256         mzk-w04nu|\
257         mzk-w300nh|\
258         nanostation-m-xw|\
259         nanostation-m|\
260         nbg460n_550n_550nh|\
261         pqi-air-pen|\
262         r602n|\
263         rocket-m-ti|\
264         rocket-m-xw|\
265         rocket-m|\
266         rw2458n|\
267         sc1750|\
268         sc300m|\
269         sc450|\
270         sr3200|\
271         tew-632brp|\
272         tew-712br|\
273         tew-732br|\
274         tew-823dru|\
275         tl-wr942n-v1|\
276         unifi-outdoor|\
277         unifiac-lite|\
278         unifiac-pro|\
279         unifi|\
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         wpj563|\
290         wrt400n|\
291         wrtnode2q|\
292         wzr-450hp2|\
293         wzr-hp-ag300h|\
294         wzr-hp-g300nh2|\
295         wzr-hp-g300nh|\
296         wzr-hp-g450h|\
297         xd3200)
298                 [ "$magic" != "2705" ] && {
299                         echo "Invalid image type."
300                         return 1
301                 }
302
303                 return 0
304                 ;;
305         alfa-ap96|\
306         alfa-nx|\
307         ap121-mini|\
308         ap121|\
309         ap135-020|\
310         ap136-010|\
311         ap136-020|\
312         ap147-010|\
313         ap152|\
314         ap96|\
315         arduino-yun|\
316         bhr-4grv2|\
317         bxu2000n-2-a1|\
318         db120|\
319         dr344|\
320         dw33d|\
321         f9k1115v2|\
322         hornet-ub|\
323         mr12|\
324         mr16|\
325         wpj558|\
326         zbt-we1526|\
327         zcn-1523h-2|\
328         zcn-1523h-5)
329                 [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
330                         echo "Invalid image type."
331                         return 1
332                 }
333
334                 return 0
335                 ;;
336         all0258n|\
337         all0315n|\
338         cap324|\
339         cap4200ag|\
340         cr3000|\
341         cr5000)
342                 platform_check_image_allnet "$1" && return 0
343                 return 1
344                 ;;
345         all0305|\
346         eap300v2|\
347         eap7660d|\
348         ja76pf2|\
349         ja76pf|\
350         jwap003|\
351         ls-sr71|\
352         pb42|\
353         pb44|\
354         routerstation-pro|\
355         routerstation|\
356         wp543|\
357         wpe72)
358                 [ "$magic" != "4349" ] && {
359                         echo "Invalid image. Use *-sysupgrade.bin files on this board"
360                         return 1
361                 }
362
363                 local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null)
364                 local md5_chk=$(dd if="$1" bs=$CI_BLKSZ skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}"
365
366                 if [ -n "$md5_img" -a -n "$md5_chk" ] && [ "$md5_img" = "$md5_chk" ]; then
367                         return 0
368                 else
369                         echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)"
370                         return 1
371                 fi
372
373                 return 0
374                 ;;
375         antminer-s1|\
376         antminer-s3|\
377         antrouter-r1|\
378         archer-c5|\
379         archer-c7|\
380         el-m150|\
381         el-mini|\
382         gl-inet|\
383         mc-mac1200r|\
384         minibox-v1|\
385         omy-g1|\
386         omy-x1|\
387         onion-omega|\
388         oolite|\
389         re450|\
390         smart-300|\
391         som9331|\
392         tellstick-znet-lite|\
393         tl-mr10u|\
394         tl-mr11u|\
395         tl-mr12u|\
396         tl-mr13u|\
397         tl-mr3020|\
398         tl-mr3040-v2|\
399         tl-mr3040|\
400         tl-mr3220-v2|\
401         tl-mr3220|\
402         tl-mr3420-v2|\
403         tl-mr3420|\
404         tl-mr6400|\
405         tl-wa701nd-v2|\
406         tl-wa7210n-v2|\
407         tl-wa750re|\
408         tl-wa7510n|\
409         tl-wa801nd-v2|\
410         tl-wa801nd-v3|\
411         tl-wa830re-v2|\
412         tl-wa850re|\
413         tl-wa850re-v2|\
414         tl-wa855re-v1|\
415         tl-wa860re|\
416         tl-wa901nd-v2|\
417         tl-wa901nd-v3|\
418         tl-wa901nd-v4|\
419         tl-wa901nd|\
420         tl-wdr3320-v2|\
421         tl-wdr3500|\
422         tl-wdr4300|\
423         tl-wdr4900-v2|\
424         tl-wdr6500-v2|\
425         tl-wpa8630|\
426         tl-wr1041n-v2|\
427         tl-wr1043nd-v2|\
428         tl-wr1043nd-v4|\
429         tl-wr1043nd|\
430         tl-wr2543n|\
431         tl-wr703n|\
432         tl-wr710n|\
433         tl-wr720n-v3|\
434         tl-wr740n-v6|\
435         tl-wr741nd-v4|\
436         tl-wr741nd|\
437         tl-wr802n-v1|\
438         tl-wr802n-v2|\
439         tl-wr810n|\
440         tl-wr840n-v2|\
441         tl-wr840n-v3|\
442         tl-wr841n-v11|\
443         tl-wr841n-v1|\
444         tl-wr841n-v7|\
445         tl-wr841n-v8|\
446         tl-wr841n-v9|\
447         tl-wr842n-v2|\
448         tl-wr842n-v3|\
449         tl-wr941nd-v5|\
450         tl-wr941nd-v6|\
451         tl-wr940n-v4|\
452         tl-wr941nd)
453                 local magic_ver="0100"
454
455                 case "$board" in
456                 tl-wdr6500-v2)
457                         magic_ver="0200"
458                         ;;
459                 esac
460
461                 [ "$magic" != "$magic_ver" ] && {
462                         echo "Invalid image type."
463                         return 1
464                 }
465
466                 local hwid
467                 local mid
468                 local imagehwid
469                 local imagemid
470
471                 hwid=$(tplink_get_hwid)
472                 mid=$(tplink_get_mid)
473                 imagehwid=$(tplink_get_image_hwid "$1")
474                 imagemid=$(tplink_get_image_mid "$1")
475
476                 [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && {
477                         echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid."
478                         return 1
479                 }
480
481                 local boot_size
482
483                 boot_size=$(tplink_get_image_boot_size "$1")
484                 [ "$boot_size" != "00000000" ] && {
485                         echo "Invalid image, it contains a bootloader."
486                         return 1
487                 }
488
489                 return 0
490                 ;;
491         bsb|\
492         dir-825-b1|\
493         tew-673gru)
494                 dir825b_check_image "$1" && return 0
495                 ;;
496         rb-411|\
497         rb-411u|\
498         rb-433|\
499         rb-433u|\
500         rb-435g|\
501         rb-450|\
502         rb-450g|\
503         rb-493|\
504         rb-493g|\
505         rb-750|\
506         rb-750gl|\
507         rb-751|\
508         rb-751g|\
509         rb-911g-2hpnd|\
510         rb-911g-5hpnd|\
511         rb-911g-5hpacd|\
512         rb-912uag-2hpnd|\
513         rb-912uag-5hpnd|\
514         rb-951g-2hnd|\
515         rb-951ui-2hnd|\
516         rb-2011l|\
517         rb-2011il|\
518         rb-2011uas|\
519         rb-2011uias|\
520         rb-2011uas-2hnd|\
521         rb-2011uias-2hnd|\
522         rb-sxt2n|\
523         rb-sxt5n)
524                 nand_do_platform_check routerboard $1
525                 return $?
526                 ;;
527         c-60|\
528         hiveap-121|\
529         nbg6716|\
530         r6100|\
531         rambutan|\
532         wndr3700v4|\
533         wndr4300)
534                 nand_do_platform_check $board $1
535                 return $?
536                 ;;
537         cpe210|\
538         cpe510|\
539         eap120|\
540         wbs210|\
541         wbs510)
542                 tplink_pharos_check_image "$1" && return 0
543                 return 1
544                 ;;
545         a40|\
546         a60|\
547         mr1750v2|\
548         mr1750|\
549         mr600v2|\
550         mr600|\
551         mr900v2|\
552         mr900|\
553         om2p-hsv2|\
554         om2p-hsv3|\
555         om2p-hsv4|\
556         om2p-hs|\
557         om2p-lc|\
558         om2pv2|\
559         om2pv4|\
560         om2p|\
561         om5p-acv2|\
562         om5p-ac|\
563         om5p-an|\
564         om5p)
565                 platform_check_image_openmesh "$magic_long" "$1" && return 0
566                 return 1
567                 ;;
568         mr18|\
569         z1)
570                 merakinand_do_platform_check $board $1
571                 return $?
572                 ;;
573         dir-869-a1|\
574         mynet-n600|\
575         mynet-n750|\
576         qihoo-c301)
577                 [ "$magic_long" != "5ea3a417" ] && {
578                         echo "Invalid image, bad magic: $magic_long"
579                         return 1
580                 }
581
582                 local typemagic=$(seama_get_type_magic "$1")
583                 [ "$typemagic" != "6669726d" ] && {
584                         echo "Invalid image, bad type: $typemagic"
585                         return 1
586                 }
587
588                 return 0
589                 ;;
590         e2100l|\
591         mynet-rext|\
592         wrt160nl)
593                 cybertan_check_image "$1" && return 0
594                 return 1
595                 ;;
596         nbg6616|\
597         uap-pro|\
598         unifi-outdoor-plus)
599                 [ "$magic_long" != "19852003" ] && {
600                         echo "Invalid image type."
601                         return 1
602                 }
603
604                 return 0
605                 ;;
606         tube2h)
607                 alfa_check_image "$1" && return 0
608                 return 1
609                 ;;
610         wndr3700|\
611         wnr1000-v2|\
612         wnr2000-v3|\
613         wnr612-v2|\
614         wpn824n)
615                 local hw_magic
616
617                 hw_magic="$(ar71xx_get_mtd_part_magic firmware)"
618                 [ "$magic_long" != "$hw_magic" ] && {
619                         echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long."
620                         return 1
621                 }
622
623                 return 0
624                 ;;
625         wnr2000-v4)
626                 [ "$magic_long" != "32303034" ] && {
627                         echo "Invalid image type."
628                         return 1
629                 }
630
631                 return 0
632                 ;;
633         wnr2200)
634                 [ "$magic_long" != "32323030" ] && {
635                         echo "Invalid image type."
636                         return 1
637                 }
638
639                 return 0
640                 ;;
641         dap-2695-a1)
642                 local magic=$(wrgg_get_image_magic "$1")
643                 [ "$magic" != "21030820" ] && {
644                         echo "Invalid image, bad type: $magic"
645                         return 1
646                 }
647
648                 return 0;
649                 ;;
650         # these boards use metadata images
651         fritz300e|\
652         rb-750-r2|\
653         rb-750up-r2|\
654         rb-941-2nd|\
655         rb-951ui-2nd|\
656         rb-952ui-5ac2nd|\
657         rb-962uigs-5hact2hnt|\
658         rb-lhg-5nd|\
659         rb-mapl-2nd)
660                 return 0
661                 ;;
662         esac
663
664         echo "Sysupgrade is not yet supported on $board."
665         return 1
666 }
667
668 platform_pre_upgrade() {
669         local board=$(ar71xx_board_name)
670
671         case "$board" in
672         c-60|\
673         hiveap-121|\
674         nbg6716|\
675         r6100|\
676         rambutan|\
677         rb-411|\
678         rb-411u|\
679         rb-433|\
680         rb-433u|\
681         rb-435g|\
682         rb-450|\
683         rb-450g|\
684         rb-493|\
685         rb-493g|\
686         rb-750|\
687         rb-750gl|\
688         rb-751|\
689         rb-751g|\
690         rb-911g-2hpnd|\
691         rb-911g-5hpnd|\
692         rb-911g-5hpacd|\
693         rb-912uag-2hpnd|\
694         rb-912uag-5hpnd|\
695         rb-951g-2hnd|\
696         rb-951ui-2hnd|\
697         rb-2011il|\
698         rb-2011l|\
699         rb-2011uas|\
700         rb-2011uias|\
701         rb-2011uas-2hnd|\
702         rb-2011uias-2hnd|\
703         rb-sxt2n|\
704         rb-sxt5n|\
705         wndr3700v4|\
706         wndr4300)
707                 nand_do_upgrade "$1"
708                 ;;
709         rb-750-r2|\
710         rb-750up-r2|\
711         rb-941-2nd|\
712         rb-951ui-2nd|\
713         rb-952ui-5ac2nd|\
714         rb-962uigs-5hact2hnt|\
715         rb-lhg-5nd|\
716         rb-mapl-2nd)
717                 # erase firmware if booted from initramfs
718                 [ -z "$(rootfs_type)" ] && mtd erase firmware
719                 ;;
720         mr18|\
721         z1)
722                 merakinand_do_upgrade "$1"
723                 ;;
724         esac
725 }
726
727 platform_nand_pre_upgrade() {
728         local board=$(ar71xx_board_name)
729
730         case "$board" in
731         rb*)
732                 CI_KERNPART=none
733                 local fw_mtd=$(find_mtd_part kernel)
734                 fw_mtd="${fw_mtd/block/}"
735                 [ -n "$fw_mtd" ] || return
736                 mtd erase kernel
737                 tar xf "$1" sysupgrade-routerboard/kernel -O | nandwrite -o "$fw_mtd" -
738                 ;;
739         esac
740 }
741
742 platform_do_upgrade() {
743         local board=$(ar71xx_board_name)
744
745         case "$board" in
746         all0258n)
747                 platform_do_upgrade_allnet "0x9f050000" "$ARGV"
748                 ;;
749         all0305|\
750         eap7660d|\
751         ja76pf2|\
752         ja76pf|\
753         jwap003|\
754         ls-sr71|\
755         pb42|\
756         pb44|\
757         routerstation-pro|\
758         routerstation)
759                 platform_do_upgrade_combined "$ARGV"
760                 ;;
761         all0315n)
762                 platform_do_upgrade_allnet "0x9f080000" "$ARGV"
763                 ;;
764         cap4200ag|\
765         eap300v2|\
766         ens202ext)
767                 platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
768                 ;;
769         dir-825-b1|\
770         tew-673gru)
771                 platform_do_upgrade_dir825b "$ARGV"
772                 ;;
773         a40|\
774         a60|\
775         mr1750v2|\
776         mr1750|\
777         mr600v2|\
778         mr600|\
779         mr900v2|\
780         mr900|\
781         om2p-hsv2|\
782         om2p-hsv3|\
783         om2p-hsv4|\
784         om2p-hs|\
785         om2p-lc|\
786         om2pv2|\
787         om2pv4|\
788         om2p|\
789         om5p-acv2|\
790         om5p-ac|\
791         om5p-an|\
792         om5p)
793                 platform_do_upgrade_openmesh "$ARGV"
794                 ;;
795         uap-pro|\
796         unifi-outdoor-plus)
797                 MTD_CONFIG_ARGS="-s 0x180000"
798                 default_do_upgrade "$ARGV"
799                 ;;
800         wp543|\
801         wpe72)
802                 platform_do_upgrade_compex "$ARGV"
803                 ;;
804         *)
805                 default_do_upgrade "$ARGV"
806                 ;;
807         esac
808 }
809
810 disable_watchdog() {
811         killall watchdog
812         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
813                 echo 'Could not disable watchdog'
814                 return 1
815         }
816 }
817
818 append sysupgrade_pre_upgrade disable_watchdog