2
0

ramips.sh 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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. *"11AC NAS Router")
  13. name="11acnas"
  14. ;;
  15. *"3G150B")
  16. name="3g150b"
  17. ;;
  18. *"3G300M")
  19. name="3g300m"
  20. ;;
  21. *"3g-6200n")
  22. name="3g-6200n"
  23. ;;
  24. *"3g-6200nl")
  25. name="3g-6200nl"
  26. ;;
  27. *"A5-V11")
  28. name="a5-v11"
  29. ;;
  30. *"Ai-BR100")
  31. name="ai-br100"
  32. ;;
  33. *"Air3GII")
  34. name="air3gii"
  35. ;;
  36. *"ALL0239-3G")
  37. name="all0239-3g"
  38. ;;
  39. *"ALL0256N (4M)")
  40. name="all0256n-4M"
  41. ;;
  42. *"ALL0256N (8M)")
  43. name="all0256n-8M"
  44. ;;
  45. *"ALL5002")
  46. name="all5002"
  47. ;;
  48. *"ALL5003")
  49. name="all5003"
  50. ;;
  51. *"AR670W")
  52. name="ar670w"
  53. ;;
  54. *"AR725W")
  55. name="ar725w"
  56. ;;
  57. *"ASL26555 (8M)")
  58. name="asl26555-8M"
  59. ;;
  60. *"ASL26555 (16M)")
  61. name="asl26555-16M"
  62. ;;
  63. *"ATP-52B")
  64. name="atp-52b"
  65. ;;
  66. *"AWAPN2403")
  67. name="awapn2403"
  68. ;;
  69. *"AWM002 EVB (4M)")
  70. name="awm002-evb-4M"
  71. ;;
  72. *"AWM002 EVB (8M)")
  73. name="awm002-evb-8M"
  74. ;;
  75. *"AWM003 EVB")
  76. name="awm003-evb"
  77. ;;
  78. *"BC2")
  79. name="bc2"
  80. ;;
  81. *"BR-6425")
  82. name="br-6425"
  83. ;;
  84. *"BR-6475nD")
  85. name="br-6475nd"
  86. ;;
  87. *"Broadway")
  88. name="broadway"
  89. ;;
  90. *"C20i")
  91. name="c20i"
  92. ;;
  93. *"C50")
  94. name="c50"
  95. ;;
  96. *"Carambola")
  97. name="carambola"
  98. ;;
  99. *"CF-WR800N")
  100. name="cf-wr800n"
  101. ;;
  102. *"CS-QR10")
  103. name="cs-qr10"
  104. ;;
  105. *"CY-SWR1100")
  106. name="cy-swr1100"
  107. ;;
  108. *"D105")
  109. name="d105"
  110. ;;
  111. *"DAP-1350")
  112. name="dap-1350"
  113. ;;
  114. *"DB-WRT01")
  115. name="db-wrt01"
  116. ;;
  117. *"DCH-M225")
  118. name="dch-m225"
  119. ;;
  120. *"DCS-930")
  121. name="dcs-930"
  122. ;;
  123. *"DCS-930L B1")
  124. name="dcs-930l-b1"
  125. ;;
  126. *"Digineo AC1200 Pro")
  127. name="ac1200pro"
  128. ;;
  129. *"DIR-300 B1")
  130. name="dir-300-b1"
  131. ;;
  132. *"DIR-300 B7")
  133. name="dir-300-b7"
  134. ;;
  135. *"DIR-320 B1")
  136. name="dir-320-b1"
  137. ;;
  138. *"DIR-600 B1")
  139. name="dir-600-b1"
  140. ;;
  141. *"DIR-610 A1")
  142. name="dir-610-a1"
  143. ;;
  144. *"DIR-615 D")
  145. name="dir-615-d"
  146. ;;
  147. *"DIR-615 H1")
  148. name="dir-615-h1"
  149. ;;
  150. *"DIR-620 A1")
  151. name="dir-620-a1"
  152. ;;
  153. *"DIR-620 D1")
  154. name="dir-620-d1"
  155. ;;
  156. *"DIR-645")
  157. name="dir-645"
  158. ;;
  159. *"DIR-810L")
  160. name="dir-810l"
  161. ;;
  162. *"DIR-860L B1")
  163. name="dir-860l-b1"
  164. ;;
  165. *"Dovado Tiny AC")
  166. name="tiny-ac"
  167. ;;
  168. *"DuZun DM06")
  169. name="duzun-dm06"
  170. ;;
  171. *"DWR-512 B")
  172. name="dwr-512-b"
  173. ;;
  174. *"E1700")
  175. name="e1700"
  176. ;;
  177. *"ESR-9753")
  178. name="esr-9753"
  179. ;;
  180. *"EX2700")
  181. name="ex2700";
  182. ;;
  183. *"F5D8235 v1")
  184. name="f5d8235-v1"
  185. ;;
  186. *"F5D8235 v2")
  187. name="f5d8235-v2"
  188. ;;
  189. *"F7C027")
  190. name="f7c027"
  191. ;;
  192. *"FireWRT")
  193. name="firewrt"
  194. ;;
  195. *"Fonera 2.0N")
  196. name="fonera20n"
  197. ;;
  198. *"FreeStation5")
  199. name="freestation5"
  200. ;;
  201. *"GB-PC1")
  202. name="gb-pc1"
  203. ;;
  204. *"GL-MT300A")
  205. name="gl-mt300a"
  206. ;;
  207. *"GL-MT300N")
  208. name="gl-mt300n"
  209. ;;
  210. *"GL-MT750")
  211. name="gl-mt750"
  212. ;;
  213. *"HC5661")
  214. name="hc5661"
  215. ;;
  216. *"HC5761")
  217. name="hc5761"
  218. ;;
  219. *"HC5861")
  220. name="hc5861"
  221. ;;
  222. *"HG255D")
  223. name="hg255d"
  224. ;;
  225. *"HLK-RM04")
  226. name="hlk-rm04"
  227. ;;
  228. *"HPM")
  229. name="hpm"
  230. ;;
  231. *"HT-TM02")
  232. name="ht-tm02"
  233. ;;
  234. *"HW550-3G")
  235. name="hw550-3g"
  236. ;;
  237. *"IP2202")
  238. name="ip2202"
  239. ;;
  240. *"JHR-N805R")
  241. name="jhr-n805r"
  242. ;;
  243. *"JHR-N825R")
  244. name="jhr-n825r"
  245. ;;
  246. *"JHR-N926R")
  247. name="jhr-n926r"
  248. ;;
  249. *"M3")
  250. name="m3"
  251. ;;
  252. *"M4 (4M)")
  253. name="m4-4M"
  254. ;;
  255. *"M4 (8M)")
  256. name="m4-8M"
  257. ;;
  258. *"MediaTek LinkIt Smart 7688")
  259. linkit="$(dd bs=1 skip=1024 count=12 if=/dev/mtd2 2> /dev/null)"
  260. if [ "${linkit}" = "LINKITS7688D" ]; then
  261. name="linkits7688d"
  262. RAMIPS_MODEL="${machine} DUO"
  263. else
  264. name="linkits7688"
  265. fi
  266. ;;
  267. *"Memory 2 Move")
  268. name="m2m"
  269. ;;
  270. *"Mercury MAC1200R v2")
  271. name="mac1200r-v2"
  272. ;;
  273. *"MicroWRT")
  274. name="microwrt"
  275. ;;
  276. *"MiniEMBPlug")
  277. name="miniembplug"
  278. ;;
  279. *"MiniEMBWiFi")
  280. name="miniembwifi"
  281. ;;
  282. *"MiWiFi Mini")
  283. name="miwifi-mini"
  284. ;;
  285. *"MiWiFi Nano")
  286. name="miwifi-nano"
  287. ;;
  288. *"MLW221")
  289. name="mlw221"
  290. ;;
  291. *"MLWG2")
  292. name="mlwg2"
  293. ;;
  294. *"MOFI3500-3GN")
  295. name="mofi3500-3gn"
  296. ;;
  297. *"MPR-A1")
  298. name="mpr-a1"
  299. ;;
  300. *"MPR-A2")
  301. name="mpr-a2"
  302. ;;
  303. *"MR-102N")
  304. name="mr-102n"
  305. ;;
  306. *"MR200")
  307. name="mr200"
  308. ;;
  309. *"MT7620a + MT7530 evaluation"*)
  310. name="mt7620a_mt7530"
  311. ;;
  312. *"MT7620a V22SG"*)
  313. name="mt7620a_v22sg"
  314. ;;
  315. *"MT7621 evaluation"*)
  316. name="mt7621"
  317. ;;
  318. *"MT7628AN evaluation"*)
  319. name="mt7628"
  320. ;;
  321. *"MT7688 evaluation"*)
  322. name="mt7688"
  323. ;;
  324. *"MZK-750DHP")
  325. name="mzk-750dhp"
  326. ;;
  327. *"MZK-DP150N")
  328. name="mzk-dp150n"
  329. ;;
  330. *"MZK-EX300NP")
  331. name="mzk-ex300np"
  332. ;;
  333. *"MZK-EX750NP")
  334. name="mzk-ex750np"
  335. ;;
  336. *"MZK-W300NH2"*)
  337. name="mzk-w300nh2"
  338. ;;
  339. *"MZK-WDPR"*)
  340. name="mzk-wdpr"
  341. ;;
  342. *"NA930")
  343. name="na930"
  344. ;;
  345. *"NBG-419N")
  346. name="nbg-419n"
  347. ;;
  348. *"NBG-419N v2")
  349. name="nbg-419n2"
  350. ;;
  351. *"Newifi-D1")
  352. name="newifi-d1"
  353. ;;
  354. *"NCS601W")
  355. name="ncs601w"
  356. ;;
  357. *"NixcoreX1 (8M)")
  358. name="nixcore-x1-8M"
  359. ;;
  360. *"NixcoreX1 (16M)")
  361. name="nixcore-x1-16M"
  362. ;;
  363. *"NW718")
  364. name="nw718"
  365. ;;
  366. *"OY-0001")
  367. name="oy-0001"
  368. ;;
  369. *"PBR-D1")
  370. name="pbr-d1"
  371. ;;
  372. *"PBR-M1")
  373. name="pbr-m1"
  374. ;;
  375. *"PSG1208")
  376. name="psg1208"
  377. ;;
  378. *"PSG1218")
  379. name="psg1218"
  380. ;;
  381. *"PSR-680W"*)
  382. name="psr-680w"
  383. ;;
  384. *"PWH2004")
  385. name="pwh2004"
  386. ;;
  387. *"PX-4885 (4M)")
  388. name="px-4885-4M"
  389. ;;
  390. *"PX-4885 (8M)")
  391. name="px-4885-8M"
  392. ;;
  393. *"Q7")
  394. name="zte-q7"
  395. ;;
  396. *"RB750Gr3")
  397. name="rb750gr3"
  398. ;;
  399. *"RE6500")
  400. name="re6500"
  401. ;;
  402. *"RN502J")
  403. name="xdxrn502j"
  404. ;;
  405. *"RP-N53")
  406. name="rp-n53"
  407. ;;
  408. *"RT5350F-OLinuXino")
  409. name="rt5350f-olinuxino"
  410. ;;
  411. *"RT5350F-OLinuXino-EVB")
  412. name="rt5350f-olinuxino-evb"
  413. ;;
  414. *"RT-G32 B1")
  415. name="rt-g32-b1"
  416. ;;
  417. *"RT-N10+")
  418. name="rt-n10-plus"
  419. ;;
  420. *"RT-N13U")
  421. name="rt-n13u"
  422. ;;
  423. *"RT-N14U")
  424. name="rt-n14u"
  425. ;;
  426. *"RT-N15")
  427. name="rt-n15"
  428. ;;
  429. *"RT-N56U")
  430. name="rt-n56u"
  431. ;;
  432. *"RUT5XX")
  433. name="rut5xx"
  434. ;;
  435. *"SamKnows Whitebox 8")
  436. name="sk-wb8"
  437. ;;
  438. *"SAP-G3200U3")
  439. name="sap-g3200u3"
  440. ;;
  441. *"SL-R7205"*)
  442. name="sl-r7205"
  443. ;;
  444. *"TEW-691GR")
  445. name="tew-691gr"
  446. ;;
  447. *"TEW-692GR")
  448. name="tew-692gr"
  449. ;;
  450. *"TEW-714TRU")
  451. name="tew-714tru"
  452. ;;
  453. *"Timecloud")
  454. name="timecloud"
  455. ;;
  456. *"UBNT-ERX")
  457. name="ubnt-erx"
  458. ;;
  459. *"UR-326N4G")
  460. name="ur-326n4g"
  461. ;;
  462. *"UR-336UN")
  463. name="ur-336un"
  464. ;;
  465. *"V11ST-FE")
  466. name="v11st-fe"
  467. ;;
  468. *"V22RW-2X2")
  469. name="v22rw-2x2"
  470. ;;
  471. *"VoCore (8M)")
  472. name="vocore-8M"
  473. ;;
  474. *"VoCore (16M)")
  475. name="vocore-16M"
  476. ;;
  477. *"VR500")
  478. name="vr500"
  479. ;;
  480. *"W150M")
  481. name="w150m"
  482. ;;
  483. *"W2914NS v2")
  484. name="w2914nsv2"
  485. ;;
  486. *"W306R V2.0")
  487. name="w306r-v20"
  488. ;;
  489. *"W502U")
  490. name="w502u"
  491. ;;
  492. *"WCR-150GN")
  493. name="wcr-150gn"
  494. ;;
  495. *"WF-2881")
  496. name="wf-2881"
  497. ;;
  498. *"WHR-1166D")
  499. name="whr-1166d"
  500. ;;
  501. *"WHR-300HP2")
  502. name="whr-300hp2"
  503. ;;
  504. *"WHR-600D")
  505. name="whr-600d"
  506. ;;
  507. *"WHR-G300N")
  508. name="whr-g300n"
  509. ;;
  510. *"Widora-NEO")
  511. name="widora-neo"
  512. ;;
  513. *"WiTi")
  514. name="witi"
  515. ;;
  516. *"WIZARD 8800")
  517. name="wizard8800"
  518. ;;
  519. *"WizFi630A")
  520. name="wizfi630a"
  521. ;;
  522. *"WL-330N")
  523. name="wl-330n"
  524. ;;
  525. *"WL-330N3G")
  526. name="wl-330n3g"
  527. ;;
  528. *"WL-341 v3")
  529. name="wl-341v3"
  530. ;;
  531. *"WL-351 v1 002")
  532. name="wl-351"
  533. ;;
  534. *"WL-WN575A3")
  535. name="wl-wn575a3"
  536. ;;
  537. *"WLI-TX4-AG300N")
  538. name="wli-tx4-ag300n"
  539. ;;
  540. *"WLR-6000")
  541. name="wlr-6000"
  542. ;;
  543. *"WMR-300")
  544. name="wmr-300"
  545. ;;
  546. *"WNCE2001")
  547. name="wnce2001"
  548. ;;
  549. *"WNDR3700v5")
  550. name="wndr3700v5"
  551. ;;
  552. *"WR512-3GN (4M)")
  553. name="wr512-3gn-4M"
  554. ;;
  555. *"WR512-3GN (8M)")
  556. name="wr512-3gn-8M"
  557. ;;
  558. *"WR6202")
  559. name="wr6202"
  560. ;;
  561. *"WRH-300CR")
  562. name="wrh-300cr"
  563. ;;
  564. *"WRTNODE")
  565. name="wrtnode"
  566. ;;
  567. *"WRTnode2R")
  568. name="wrtnode2r"
  569. ;;
  570. *"WRTnode2P")
  571. name="wrtnode2p"
  572. ;;
  573. *"WSR-1166DHP")
  574. name="wsr-1166"
  575. ;;
  576. *"WSR-600DHP")
  577. name="wsr-600"
  578. ;;
  579. *"WT1520 (4M)")
  580. name="wt1520-4M"
  581. ;;
  582. *"WT1520 (8M)")
  583. name="wt1520-8M"
  584. ;;
  585. *"WT3020 (4M)")
  586. name="wt3020-4M"
  587. ;;
  588. *"WT3020 (8M)")
  589. name="wt3020-8M"
  590. ;;
  591. *"WZR-AGL300NH")
  592. name="wzr-agl300nh"
  593. ;;
  594. *"X5")
  595. name="x5"
  596. ;;
  597. *"X8")
  598. name="x8"
  599. ;;
  600. *"Y1")
  601. name="y1"
  602. ;;
  603. *"Y1S")
  604. name="y1s"
  605. ;;
  606. *"ZBT-APE522II")
  607. name="zbt-ape522ii"
  608. ;;
  609. *"ZBT-CPE102")
  610. name="zbt-cpe102"
  611. ;;
  612. *"ZBT-WA05")
  613. name="zbt-wa05"
  614. ;;
  615. *"ZBT-WE826")
  616. name="zbt-we826"
  617. ;;
  618. *"ZBT-WG2626")
  619. name="zbt-wg2626"
  620. ;;
  621. *"ZBT-WG3526")
  622. name="zbt-wg3526"
  623. ;;
  624. *"ZBT-WR8305RT")
  625. name="zbt-wr8305rt"
  626. ;;
  627. *"ZyXEL Keenetic Omni")
  628. name="kn_rc"
  629. ;;
  630. *"ZyXEL Keenetic Omni II")
  631. name="kn_rf"
  632. ;;
  633. *"ZyXEL Keenetic Viva")
  634. name="kng_rc"
  635. ;;
  636. *"YK1")
  637. name="youku-yk1"
  638. ;;
  639. *)
  640. name="generic"
  641. ;;
  642. esac
  643. [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name"
  644. [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine"
  645. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  646. echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name
  647. echo "$RAMIPS_MODEL" > /tmp/sysinfo/model
  648. }
  649. ramips_board_name() {
  650. local name
  651. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  652. [ -z "$name" ] && name="unknown"
  653. echo "${name%-[0-9]*M}"
  654. }