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