ramips.sh 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2010-2013 OpenWrt.org
  4. #
  5. RAMIPS_BOARD_NAME=
  6. RAMIPS_MODEL=
  7. ramips_board_detect() {
  8. local machine
  9. local name
  10. machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
  11. case "$machine" in
  12. *"7Links PX-4885")
  13. name="px4885"
  14. ;;
  15. *"8devices Carambola")
  16. name="carambola"
  17. ;;
  18. *"Edimax 3g-6200n")
  19. name="3g-6200n"
  20. ;;
  21. *"Edimax 3g-6200nl")
  22. name="3g-6200nl"
  23. ;;
  24. *"A5-V11")
  25. name="a5-v11"
  26. ;;
  27. *"Aigale Ai-BR100")
  28. name="ai-br100"
  29. ;;
  30. *"Airlink101 AR670W")
  31. name="ar670w"
  32. ;;
  33. *"Airlink101 AR725W")
  34. name="ar725w"
  35. ;;
  36. *"AirLive Air3GII")
  37. name="air3gii"
  38. ;;
  39. *"Edimax BR-6425")
  40. name="br6425"
  41. ;;
  42. *"Allnet ALL0239-3G")
  43. name="all0239-3g"
  44. ;;
  45. *"Allnet ALL0256N")
  46. name="all0256n"
  47. ;;
  48. *"Allnet ALL5002")
  49. name="all5002"
  50. ;;
  51. *"Allnet ALL5003")
  52. name="all5003"
  53. ;;
  54. *"ARC FreeStation5")
  55. name="freestation5"
  56. ;;
  57. *"Archer C20i")
  58. name="c20i"
  59. ;;
  60. *"Argus ATP-52B")
  61. name="argus-atp52b"
  62. ;;
  63. *"AsiaRF AWM002 EVB")
  64. name="awm002-evb"
  65. ;;
  66. *"AsiaRF AWM003 EVB")
  67. name="awm003-evb"
  68. ;;
  69. *"AsiaRF AWAPN2403")
  70. name="awapn2403"
  71. ;;
  72. *"Asus WL-330N")
  73. name="wl-330n"
  74. ;;
  75. *"Asus WL-330N3G")
  76. name="wl-330n3g"
  77. ;;
  78. *"Alpha ASL26555")
  79. name="asl26555"
  80. ;;
  81. *"Aztech HW550-3G")
  82. name="hw550-3g"
  83. ;;
  84. *"AXIMCom MR-102N")
  85. name="mr-102n"
  86. ;;
  87. *"Buffalo WSR-600DHP")
  88. name="wsr-600"
  89. ;;
  90. *"Buffalo WSR-1166DHP")
  91. name="wsr-1166"
  92. ;;
  93. *"Comfast CF-WR800N")
  94. name="cf-wr800n"
  95. ;;
  96. *"Firefly FireWRT")
  97. name="firewrt"
  98. ;;
  99. *"CY-SWR1100")
  100. name="cy-swr1100"
  101. ;;
  102. *"DCS-930")
  103. name="dcs-930"
  104. ;;
  105. *"DCS-930L B1")
  106. name="dcs-930l-b1"
  107. ;;
  108. *"DIR-300 B1")
  109. name="dir-300-b1"
  110. ;;
  111. *"DIR-300 B7")
  112. name="dir-300-b7"
  113. ;;
  114. *"DIR-320 B1")
  115. name="dir-320-b1"
  116. ;;
  117. *"DIR-600 B1")
  118. name="dir-600-b1"
  119. ;;
  120. *"DIR-600 B2")
  121. name="dir-600-b2"
  122. ;;
  123. *"DIR-610 A1")
  124. name="dir-610-a1"
  125. ;;
  126. *"DIR-620 A1")
  127. name="dir-620-a1"
  128. ;;
  129. *"DIR-620 D1")
  130. name="dir-620-d1"
  131. ;;
  132. *"DIR-615 H1")
  133. name="dir-615-h1"
  134. ;;
  135. *"DIR-615 D")
  136. name="dir-615-d"
  137. ;;
  138. *"DIR-645")
  139. name="dir-645"
  140. ;;
  141. *"DIR-810L")
  142. name="dir-810l"
  143. ;;
  144. *"DIR-860L B1")
  145. name="dir-860l-b1"
  146. ;;
  147. *"DAP-1350")
  148. name="dap-1350"
  149. ;;
  150. *"ESR-9753")
  151. name="esr-9753"
  152. ;;
  153. *"EASYACC WI-STOR WIZARD 8800")
  154. name="wizard8800"
  155. ;;
  156. *"Edimax BR-6475nD")
  157. name="br-6475nd"
  158. ;;
  159. *"F7C027")
  160. name="f7c027"
  161. ;;
  162. *"F5D8235 v1")
  163. name="f5d8235-v1"
  164. ;;
  165. *"F5D8235 v2")
  166. name="f5d8235-v2"
  167. ;;
  168. *"Hauppauge Broadway")
  169. name="broadway"
  170. ;;
  171. *"Huawei D105")
  172. name="d105"
  173. ;;
  174. *"La Fonera 2.0N")
  175. name="fonera20n"
  176. ;;
  177. *"Asus RT-N14U")
  178. name="rt-n14u"
  179. ;;
  180. *"Asus RT-N13U")
  181. name="rt-n13u"
  182. ;;
  183. *"MoFi Network MOFI3500-3GN")
  184. name="mofi3500-3gn"
  185. ;;
  186. *"HILINK HLK-RM04")
  187. name="hlk-rm04"
  188. ;;
  189. *"HooToo HT-TM02")
  190. name="ht-tm02"
  191. ;;
  192. *"HAME MPR-A1")
  193. name="mpr-a1"
  194. ;;
  195. *"HAME MPR-A2")
  196. name="mpr-a2"
  197. ;;
  198. *"Kingston MLW221")
  199. name="mlw221"
  200. ;;
  201. *"Kingston MLWG2")
  202. name="mlwg2"
  203. ;;
  204. *"Linksys E1700")
  205. name="e1700"
  206. ;;
  207. *"Linksys RE6500")
  208. name="re6500"
  209. ;;
  210. *"Planex MZK-750DHP")
  211. name="mzk-750dhp"
  212. ;;
  213. *"Microduino MicroWRT")
  214. name="microwrt"
  215. ;;
  216. *"NBG-419N")
  217. name="nbg-419n"
  218. ;;
  219. *"Netgear WNCE2001")
  220. name="wnce2001"
  221. ;;
  222. *"Netgear EX2700")
  223. name="ex2700"
  224. ;;
  225. *"NexAira BC2")
  226. name="bc2"
  227. ;;
  228. *"Nexx WT1520")
  229. name="wt1520"
  230. ;;
  231. *"Nexx WT3020")
  232. name="wt3020"
  233. ;;
  234. *"NW718")
  235. name="nw718"
  236. ;;
  237. *"Intenso Memory 2 Move")
  238. name="m2m"
  239. ;;
  240. *"Omnima EMB HPM")
  241. name="omni-emb-hpm"
  242. ;;
  243. *"Omnima MiniEMBWiFi")
  244. name="omni-emb"
  245. ;;
  246. *"Omnima MiniPlug")
  247. name="omni-plug"
  248. ;;
  249. *"OLinuXino-RT5350F")
  250. name="olinuxino-rt5350f"
  251. ;;
  252. *"OLinuXino-RT5350F-EVB")
  253. name="olinuxino-rt5350f-evb"
  254. ;;
  255. *"PBR-M1")
  256. name="pbr-m1"
  257. ;;
  258. *"Petatel PSR-680W"*)
  259. name="psr-680w"
  260. ;;
  261. *"Planex MZK-W300NH2"*)
  262. name="mzk-w300nh2"
  263. ;;
  264. *"Poray IP2202")
  265. name="ip2202"
  266. ;;
  267. *"Poray M3")
  268. name="m3"
  269. ;;
  270. *"Poray M4")
  271. name="m4"
  272. ;;
  273. *"Poray X5")
  274. name="x5"
  275. ;;
  276. *"Poray X8")
  277. name="x8"
  278. ;;
  279. *"PWH2004")
  280. name="pwh2004"
  281. ;;
  282. *"Asus RP-N53")
  283. name="rp-n53"
  284. ;;
  285. *"Ralink MT7620a + MT7530 evaluation board")
  286. name="mt7620a_mt7530"
  287. ;;
  288. *"RT-G32 B1")
  289. name="rt-g32-b1"
  290. ;;
  291. *"RT-N10+")
  292. name="rt-n10-plus"
  293. ;;
  294. *"RT-N15")
  295. name="rt-n15"
  296. ;;
  297. *"RT-N56U")
  298. name="rt-n56u"
  299. ;;
  300. *"RUT5XX")
  301. name="rut5xx"
  302. ;;
  303. *"Skyline SL-R7205"*)
  304. name="sl-r7205"
  305. ;;
  306. *"Sparklan WCR-150GN")
  307. name="wcr-150gn"
  308. ;;
  309. *"V22RW-2X2")
  310. name="v22rw-2x2"
  311. ;;
  312. *"VoCore")
  313. name="vocore"
  314. ;;
  315. *"W502U")
  316. name="w502u"
  317. ;;
  318. *"WMR-300")
  319. name="wmr300"
  320. ;;
  321. *"WHR-300HP2")
  322. name="whr-300hp2"
  323. ;;
  324. *"WHR-600D")
  325. name="whr-600d"
  326. ;;
  327. *"WHR-1166D")
  328. name="whr-1166d"
  329. ;;
  330. *"WHR-G300N")
  331. name="whr-g300n"
  332. ;;
  333. *"WizFi630A")
  334. name="wizfi630a"
  335. ;;
  336. *"Sitecom WL-341 v3")
  337. name="wl341v3"
  338. ;;
  339. *"Sitecom WL-351 v1 002")
  340. name="wl-351"
  341. ;;
  342. *"Tenda 3G300M")
  343. name="3g300m"
  344. ;;
  345. *"Tenda 3G150B")
  346. name="3g150b"
  347. ;;
  348. *"Tenda W306R V2.0")
  349. name="w306r-v20"
  350. ;;
  351. *"Tenda W150M")
  352. name="w150m"
  353. ;;
  354. *"TEW-691GR")
  355. name="tew-691gr"
  356. ;;
  357. *"TEW-692GR")
  358. name="tew-692gr"
  359. ;;
  360. *"Ralink V11ST-FE")
  361. name="v11st-fe"
  362. ;;
  363. *"WLI-TX4-AG300N")
  364. name="wli-tx4-ag300n"
  365. ;;
  366. *"WZR-AGL300NH")
  367. name="wzr-agl300nh"
  368. ;;
  369. *"WR512-3GN-like router")
  370. name="wr512-3gn"
  371. ;;
  372. *"UR-326N4G Wireless N router")
  373. name="ur-326n4g"
  374. ;;
  375. *"UR-336UN Wireless N router")
  376. name="ur-336un"
  377. ;;
  378. *"AWB WR6202")
  379. name="wr6202"
  380. ;;
  381. *"XDX RN502J")
  382. name="xdxrn502j"
  383. ;;
  384. *"HG255D")
  385. name="hg255d"
  386. ;;
  387. *"V22SG")
  388. name="v22sg"
  389. ;;
  390. *"WRTNODE")
  391. name="wrtnode"
  392. ;;
  393. *"Wansview NCS601W")
  394. name="ncs601w"
  395. ;;
  396. *"Xiaomi MiWiFi Mini")
  397. name="xiaomi-miwifi-mini"
  398. ;;
  399. *"Sercomm NA930")
  400. name="na930"
  401. ;;
  402. *"Zbtlink ZBT-WA05")
  403. name="zbt-wa05"
  404. ;;
  405. *"ZBT-WG2626")
  406. name="zbt-wg2626"
  407. ;;
  408. *"ZBT WR8305RT")
  409. name="wr8305rt"
  410. ;;
  411. *"ZTE Q7")
  412. name="zte-q7"
  413. ;;
  414. *"Lenovo Y1")
  415. name="y1"
  416. ;;
  417. *"Lenovo Y1S")
  418. name="y1s"
  419. ;;
  420. *"Mediatek MT7621 evaluation board")
  421. name="mt7621"
  422. ;;
  423. *"Mediatek MT7628AN evaluation board")
  424. name="mt7628"
  425. ;;
  426. *"MediaTek LinkIt Smart 7688")
  427. linkit="$(dd bs=1 skip=1024 count=12 if=/dev/mtd2 2> /dev/null)"
  428. if [ "${linkit}" = "LINKITS7688D" ]; then
  429. name="linkits7688d"
  430. RAMIPS_MODEL="${machine} DUO"
  431. else
  432. name="linkits7688"
  433. fi
  434. ;;
  435. *)
  436. name="generic"
  437. ;;
  438. esac
  439. [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name"
  440. [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine"
  441. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  442. echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name
  443. echo "$RAMIPS_MODEL" > /tmp/sysinfo/model
  444. }
  445. ramips_board_name() {
  446. local name
  447. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  448. [ -z "$name" ] && name="unknown"
  449. echo "$name"
  450. }