platform.sh 13 KB

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