1
0

platform.sh 13 KB

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