platform.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #
  2. # Copyright (C) 2010 OpenWrt.org
  3. #
  4. . /lib/ramips.sh
  5. PART_NAME=firmware
  6. RAMFS_COPY_DATA=/lib/ramips.sh
  7. platform_check_image() {
  8. local board=$(ramips_board_name)
  9. local magic="$(get_magic_long "$1")"
  10. [ "$#" -gt 1 ] && return 1
  11. case "$board" in
  12. 3g-6200n | \
  13. 3g-6200nl | \
  14. 3g150b | \
  15. 3g300m | \
  16. a5-v11 | \
  17. air3gii | \
  18. ai-br100 |\
  19. all0239-3g | \
  20. all0256n | \
  21. all5002 | \
  22. all5003 | \
  23. ar725w | \
  24. asl26555 | \
  25. awapn2403 | \
  26. awm002-evb | \
  27. awm003-evb | \
  28. bc2 | \
  29. broadway | \
  30. carambola | \
  31. cf-wr800n | \
  32. d105 | \
  33. dap-1350 | \
  34. dcs-930 | \
  35. dcs-930l-b1 | \
  36. dir-300-b1 | \
  37. dir-300-b7 | \
  38. dir-320-b1 | \
  39. dir-600-b1 | \
  40. dir-600-b2 | \
  41. dir-615-d | \
  42. dir-615-h1 | \
  43. dir-620-a1 | \
  44. dir-620-d1 | \
  45. dir-810l | \
  46. e1700 | \
  47. ex2700 |\
  48. esr-9753 | \
  49. f7c027 | \
  50. fonera20n | \
  51. freestation5 | \
  52. firewrt |\
  53. pbr-m1 |\
  54. hg255d | \
  55. hlk-rm04 | \
  56. ht-tm02 | \
  57. hw550-3g | \
  58. ip2202 | \
  59. linkits7688 | \
  60. linkits7688d | \
  61. m2m | \
  62. m3 | \
  63. m4 | \
  64. microwrt | \
  65. mlw221 | \
  66. mlwg2 | \
  67. mofi3500-3gn | \
  68. mpr-a1 | \
  69. mpr-a2 | \
  70. mr-102n | \
  71. mzk-w300nh2 | \
  72. nbg-419n | \
  73. nw718 | \
  74. omni-emb | \
  75. omni-emb-hpm | \
  76. omni-plug | \
  77. olinuxino-rt5350f | \
  78. olinuxino-rt5350f-evb | \
  79. psr-680w | \
  80. px4885 | \
  81. re6500 | \
  82. rp-n53 | \
  83. rt-g32-b1 | \
  84. rt-n10-plus | \
  85. rt-n13u | \
  86. rt-n14u | \
  87. rt-n15 | \
  88. rt-n56u | \
  89. rut5xx | \
  90. sl-r7205 | \
  91. tew-691gr | \
  92. tew-692gr | \
  93. ur-326n4g |\
  94. ur-336un |\
  95. v22rw-2x2 | \
  96. vocore | \
  97. w150m | \
  98. w306r-v20 |\
  99. w502u |\
  100. whr-g300n |\
  101. whr-300hp2 |\
  102. whr-600d |\
  103. whr-1166d |\
  104. wizfi630a |\
  105. wsr-600 |\
  106. wl-330n | \
  107. wl-330n3g | \
  108. wl-351 | \
  109. wl341v3 | \
  110. wli-tx4-ag300n | \
  111. wzr-agl300nh | \
  112. wmr300 |\
  113. wnce2001 | \
  114. wr512-3gn |\
  115. wr6202 |\
  116. wr8305rt |\
  117. wrtnode |\
  118. wt1520 |\
  119. wt3020 |\
  120. x5 |\
  121. x8 |\
  122. xiaomi-miwifi-mini |\
  123. y1 |\
  124. y1s |\
  125. zbt-wa05 |\
  126. zbt-wg2626 |\
  127. zte-q7)
  128. [ "$magic" != "27051956" ] && {
  129. echo "Invalid image type."
  130. return 1
  131. }
  132. return 0
  133. ;;
  134. wsr-1166)
  135. [ "$magic" != "48445230" ] && {
  136. echo "Invalid image type."
  137. return 1
  138. }
  139. return 0
  140. ;;
  141. ar670w)
  142. [ "$magic" != "6d000080" ] && {
  143. echo "Invalid image type."
  144. return 1
  145. }
  146. return 0
  147. ;;
  148. cy-swr1100 |\
  149. dir-610-a1 |\
  150. dir-645 |\
  151. dir-860l-b1)
  152. [ "$magic" != "5ea3a417" ] && {
  153. echo "Invalid image type."
  154. return 1
  155. }
  156. return 0
  157. ;;
  158. br-6475nd)
  159. [ "$magic" != "43535953" ] && {
  160. echo "Invalid image type."
  161. return 1
  162. }
  163. return 0
  164. ;;
  165. c20i)
  166. [ "$magic" != "03000000" ] && {
  167. echo "Invalid image type."
  168. return 1
  169. }
  170. return 0
  171. ;;
  172. esac
  173. echo "Sysupgrade is not yet supported on $board."
  174. return 1
  175. }
  176. platform_do_upgrade() {
  177. local board=$(ramips_board_name)
  178. case "$board" in
  179. *)
  180. default_do_upgrade "$ARGV"
  181. ;;
  182. esac
  183. }
  184. disable_watchdog() {
  185. killall watchdog
  186. ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
  187. echo 'Could not disable watchdog'
  188. return 1
  189. }
  190. }
  191. blink_led() {
  192. . /etc/diag.sh; set_state upgrade
  193. }
  194. append sysupgrade_pre_upgrade disable_watchdog
  195. append sysupgrade_pre_upgrade blink_led