2
0

platform.sh 14 KB

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