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