brcm2708: fix Hifiberry DAC+DSP package definition
[openwrt/openwrt.git] / target / linux / ramips / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions.sh
4 . /lib/functions/uci-defaults.sh
5 . /lib/functions/system.sh
6
7 ramips_setup_rt3x5x_vlans()
8 {
9 if [ ! -x /sbin/swconfig ]; then
10 # legacy default
11 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
12 return
13 fi
14 local wanports=""
15 local lanports=""
16 for port in 5 4 3 2 1 0; do
17 if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
18 continue
19 fi
20 if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
21 wanports="$port:wan $wanports"
22 else
23 lanports="$port:lan $lanports"
24 fi
25 done
26 ucidef_add_switch "rt305x" $lanports $wanports "6t@eth0"
27 }
28
29 ramips_setup_interfaces()
30 {
31 local board="$1"
32
33 case $board in
34 accton,wr6202|\
35 alfa-network,w502u|\
36 netcore,nw718|\
37 petatel,psr-680w|\
38 skyline,sl-r7205|\
39 upvel,ur-336un)
40 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
41 ;;
42 adslr,g7|\
43 afoundry,ew1200|\
44 aigale,ai-br100|\
45 alfa-network,ac1200rm|\
46 asus,rt-n12p|\
47 buffalo,whr-g300n|\
48 d-team,pbr-m1|\
49 dlink,dir-300-b7|\
50 dlink,dir-320-b1|\
51 dlink,dir-610-a1|\
52 dlink,dir-810l|\
53 dlink,dwr-116-a1|\
54 dlink,dwr-921-c1|\
55 dlink,dwr-922-e2|\
56 edimax,3g-6200n|\
57 firefly,firewrt|\
58 hilink,hlk-rm04|\
59 hiwifi,hc5661a|\
60 hiwifi,hc5761a|\
61 hiwifi,hc5962|\
62 mediatek,ap-mt7621a-v60|\
63 mediatek,mt7621-eval-board|\
64 mediatek,mt7628an-eval-board|\
65 mercury,mac1200r-v2|\
66 mqmaker,witi|\
67 mtc,wr1201|\
68 netis,wf-2881|\
69 nixcore,x1-16m|\
70 nixcore,x1-8m|\
71 ohyeah,oy-0001|\
72 phicomm,k2p|\
73 phicomm,psg1208|\
74 phicomm,psg1218a|\
75 planex,db-wrt01|\
76 planex,mzk-750dhp|\
77 planex,mzk-w300nh2|\
78 planex,vr500|\
79 samknows,whitebox-v8|\
80 sanlinking,d240|\
81 storylink,sap-g3200u3|\
82 telco-electronics,x1|\
83 totolink,a7000r|\
84 totolink,lr1200|\
85 unielec,u7621-06-256m-16m|\
86 unielec,u7621-06-512m-64m|\
87 wavlink,wl-wn570ha1|\
88 wavlink,wl-wn575a3|\
89 xiaomi,miwifi-mini|\
90 xiaomi,miwifi-nano|\
91 xzwifi,creativebox-v1|\
92 youku,yk-l2|\
93 youku,yk1|\
94 zbtlink,zbt-ape522ii|\
95 zbtlink,zbt-we1326|\
96 zbtlink,zbt-we3526|\
97 zbtlink,zbt-we826-16m|\
98 zbtlink,zbt-we826-32m|\
99 zbtlink,zbt-we826-e|\
100 zbtlink,zbt-wg2626|\
101 zbtlink,zbt-wg3526-16m|\
102 zbtlink,zbt-wg3526-32m|\
103 zbtlink,zbt-wr8305rt|\
104 zyxel,keenetic|\
105 zyxel,keenetic-omni)
106 ucidef_add_switch "switch0" \
107 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
108 ;;
109 airlink101,ar670w|\
110 airlink101,ar725w|\
111 asus,rt-ac51u|\
112 rakwireless,rak633)
113 ucidef_add_switch "switch0" \
114 "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
115 ;;
116 alfa-network,awusfree1|\
117 alfa-network,tube-e4g|\
118 buffalo,wli-tx4-ag300n|\
119 buffalo,wmr-300|\
120 dlink,dap-1522-a1|\
121 dlink,dch-m225|\
122 d-team,pbr-d1|\
123 elecom,wrh-300cr|\
124 huawei,d105|\
125 kimax,u25awf-h1|\
126 loewe,wmdr-143n|\
127 netgear,ex2700|\
128 netgear,ex3700|\
129 netgear,wn3000rp-v3|\
130 omnima,hpm|\
131 planex,cs-qr10|\
132 planex,mzk-ex300np|\
133 planex,mzk-ex750np|\
134 ravpower,wd03|\
135 sercomm,na930|\
136 tama,w06|\
137 tplink,tl-mr3020-v3|\
138 tplink,tl-wr802n-v4)
139 ucidef_set_interface_lan "eth0"
140 ;;
141 allnet,all0256n-4m|\
142 allnet,all0256n-8m|\
143 allnet,all5002|\
144 allnet,all5003|\
145 dlink,dcs-930l-b1|\
146 dlink,dcs-930|\
147 edimax,ew-7476rpc|\
148 edimax,ew-7478ac|\
149 hame,mpr-a2|\
150 hauppauge,broadway|\
151 hootoo,ht-tm02|\
152 intenso,memory2move|\
153 kimax,u35wf|\
154 mediatek,linkit-smart-7688|\
155 microduino,microwrt|\
156 mikrotik,rbm11g|\
157 netgear,wnce2001|\
158 onion,omega2p|\
159 onion,omega2|\
160 tenda,3g150b|\
161 tenda,3g300m|\
162 tenda,w150m|\
163 thunder,timecloud|\
164 tplink,tl-wa801nd-v5|\
165 unbranded,a5-v11|\
166 wansview,ncs601w|\
167 widora,neo-16m|\
168 widora,neo-32m|\
169 yukai,bocco|\
170 zbtlink,zbt-cpe102|\
171 zorlik,zl5900v2|\
172 zte,q7)
173 ucidef_add_switch "switch0"
174 ucidef_add_switch_attr "switch0" "enable" "false"
175 ucidef_set_interface_lan "eth0"
176 ;;
177 alphanetworks,asl26555-8m|\
178 alphanetworks,asl26555-16m|\
179 asus,rp-n53)
180 ucidef_add_switch "switch0" \
181 "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0"
182 ;;
183 argus,atp-52b|\
184 asiarf,awm002-evb-4m|\
185 asiarf,awm002-evb-8m|\
186 asus,rt-ac57u|\
187 asus,rt-n14u|\
188 bdcom,wap2100-sk|\
189 dlink,dir-645|\
190 glinet,gl-mt300a|\
191 glinet,gl-mt300n|\
192 glinet,gl-mt750|\
193 hilink,hlk-7628n|\
194 hiwifi,hc5661|\
195 hiwifi,hc5861b|\
196 jcg,jhr-n805r|\
197 jcg,jhr-n825r|\
198 jcg,jhr-n926r|\
199 mikrotik,rb750gr3|\
200 mikrotik,rbm33g|\
201 planex,mzk-wdpr|\
202 skylab,skw92a|\
203 tplink,archer-c20-v4|\
204 tplink,archer-c20i|\
205 tplink,archer-c50-v3|\
206 tplink,archer-c50-v4|\
207 tplink,tl-mr3420-v5|\
208 tplink,tl-wr840n-v4|\
209 tplink,tl-wr840n-v5|\
210 tplink,tl-wr841n-v13|\
211 tplink,tl-wr841n-v14|\
212 tplink,tl-wr842n-v5|\
213 unielec,u7628-01-128m-16m|\
214 ubiquiti,edgerouterx|\
215 ubiquiti,edgerouterx-sfp|\
216 upvel,ur-326n4g|\
217 wrtnode,wrtnode|\
218 wrtnode,wrtnode2p|\
219 wrtnode,wrtnode2r|\
220 youhua,wr1200js|\
221 zbtlink,zbt-wa05|\
222 zyxel,keenetic-extra-ii)
223 ucidef_add_switch "switch0" \
224 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
225 ;;
226 asiarf,ap7621-001)
227 ucidef_add_switch "switch0" "0:lan" "4:wan" "6@eth0"
228 ;;
229 asiarf,awapn2403)
230 ucidef_add_switch "switch0" \
231 "0:lan" "1:wan" "6@eth0"
232 ;;
233 asus,rt-n15|\
234 belkin,f9k1109v1|\
235 sitecom,wl-351)
236 ucidef_add_switch "switch0" \
237 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
238 ;;
239 asus,rt-n56u)
240 ucidef_add_switch "switch0" \
241 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8@eth0"
242 ;;
243 asus,wl-330n|\
244 easyacc,wizard-8800|\
245 kingston,mlwg2)
246 ucidef_set_interface_lan "eth0.1"
247 ;;
248 aximcom,mr-102n|\
249 kingston,mlw221)
250 ucidef_set_interface_lan "eth0.2"
251 ;;
252 belkin,f5d8235-v1|\
253 belkin,f5d8235-v2|\
254 buffalo,wzr-agl300nh|\
255 ralink,v11st-fe|\
256 trendnet,tew-714tru)
257 ucidef_add_switch "switch0" \
258 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
259 ;;
260 buffalo,wcr-1166ds)
261 ucidef_add_switch "switch0" \
262 "3:lan" "4:wan" "6@eth0"
263 ;;
264 buffalo,whr-300hp2|\
265 buffalo,whr-600d|\
266 buffalo,wsr-1166dhp|\
267 buffalo,wsr-600dhp)
268 ucidef_add_switch "switch0" \
269 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan:5" "6@eth0"
270 ;;
271 buffalo,whr-1166d)
272 ucidef_add_switch "switch0" \
273 "0:lan" "1:lan" "2:lan" "3:lan" "5:wan" "6@eth0"
274 ;;
275 comfast,cf-wr800n|\
276 hnet,c108)
277 ucidef_add_switch "switch0" \
278 "4:lan" "6t@eth0"
279 ;;
280 cudy,wr1000)
281 ucidef_add_switch "switch0" \
282 "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
283 ;;
284 dlink,dir-510l|\
285 glinet,vixmini|\
286 netgear,ex6150|\
287 tplink,re350-v1|\
288 tplink,re650-v1)
289 ucidef_add_switch "switch0" \
290 "0:lan" "6@eth0"
291 ;;
292 dlink,dir-615-h1|\
293 d-team,newifi-d2|\
294 wevo,11acnas|\
295 wevo,w2914ns-v2|\
296 zbtlink,zbt-we2026)
297 ucidef_add_switch "switch0" \
298 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
299 ;;
300 dlink,dir-860l-b1|\
301 elecom,wrc-1167ghbk2-s|\
302 elecom,wrc-1900gst|\
303 elecom,wrc-2533gst|\
304 huawei,hg255d|\
305 iodata,wn-ax1167gr|\
306 iodata,wn-gx300gr|\
307 iptime,a604m)
308 ucidef_add_switch "switch0" \
309 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
310 ;;
311 dlink,dwr-118-a1)
312 ucidef_add_switch "switch0" \
313 "1:lan:2" "2:lan:3" "3:lan:1" "4:lan:0" "5:wan" "6@eth0"
314 ;;
315 dlink,dwr-118-a2)
316 ucidef_add_switch "switch0" \
317 "1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0"
318 ;;
319 duzun,dm06)
320 ucidef_add_switch "switch0" \
321 "1:lan" "0:wan" "6@eth0"
322 ;;
323 edimax,br-6475nd)
324 ucidef_add_switch "switch0" \
325 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
326 ;;
327 edimax,br-6478ac-v2|\
328 tplink,archer-c2-v1)
329 ucidef_add_switch "switch1" \
330 "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
331 ;;
332 fon,fon2601)
333 ucidef_add_switch "switch0" \
334 "0:lan" "4:wan" "6@eth0"
335 ;;
336 gehua,ghl-r-001)
337 ucidef_add_switch "switch0" \
338 "0:lan" "1:lan" "2:lan" "4:wan" "6@eth0"
339 ;;
340 glinet,gl-mt300n-v2)
341 ucidef_add_switch "switch0" \
342 "1:lan" "0:wan" "6@eth0"
343 ;;
344 gnubee,gb-pc1|\
345 gnubee,gb-pc2)
346 ucidef_add_switch "switch0" \
347 "0:lan" "4:lan" "6@eth0"
348 ;;
349 head-weblink,hdrm200)
350 ucidef_add_switch "switch0" \
351 "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
352 ;;
353 hiwifi,hc5761)
354 ucidef_add_switch "switch0" \
355 "1:lan" "4:lan" "0:wan" "6@eth0"
356 ;;
357 hiwifi,hc5861)
358 ucidef_add_switch "switch0" \
359 "0:lan" "1:lan" "5:wan" "6@eth0"
360 ;;
361 iodata,wn-ac1167gr|\
362 iodata,wn-ac733gr3)
363 ucidef_add_switch "switch1" \
364 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
365 ;;
366 lava,lr-25g001|\
367 sitecom,wlr-6000|\
368 trendnet,tew-691gr|\
369 trendnet,tew-692gr)
370 ucidef_add_switch "switch0" \
371 "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
372 ;;
373 lenovo,newifi-d1)
374 ucidef_add_switch "switch0" \
375 "1:lan:2" "2:lan:1" "4:wan" "6@eth0"
376 ;;
377 lenovo,newifi-y1|\
378 zbtlink,zbt-we1226)
379 ucidef_add_switch "switch0" \
380 "0:lan:2" "1:lan:1" "4:wan" "6@eth0"
381 ;;
382 lenovo,newifi-y1s)
383 ucidef_add_switch "switch0" \
384 "1:lan:4" "2:lan:3" "4:lan:2" "5:lan:1" "0:wan" "6@eth0"
385 ;;
386 linksys,e1700|\
387 ralink,mt7620a-mt7530-evb)
388 ucidef_add_switch "switch1" \
389 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
390 ;;
391 linksys,re6500)
392 ucidef_add_switch "switch0" \
393 "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "6@eth0"
394 ;;
395 netgear,r6120|\
396 netgear,r6220|\
397 netgear,r6260|\
398 netgear,r6350|\
399 netgear,r6850|\
400 netgear,wndr3700-v5)
401 ucidef_add_switch "switch0" \
402 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
403 ;;
404 nexx,wt1520-4m|\
405 nexx,wt1520-8m|\
406 vonets,var11n-300)
407 ucidef_add_switch "switch0" \
408 "0:lan" "4:wan" "6@eth0"
409 ;;
410 nexx,wt3020-4m|\
411 nexx,wt3020-8m)
412 ucidef_add_switch "switch0" \
413 "4:lan" "0:wan" "6@eth0"
414 ;;
415 phicomm,k2g)
416 ucidef_add_switch "switch0" \
417 "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5:wan" "6@eth0"
418 ;;
419 phicomm,psg1218b)
420 ucidef_add_switch "switch0" \
421 "0:lan:3" "1:lan:2" "2:lan:1" "3:wan" "6@eth0"
422 ;;
423 planex,mzk-dp150n|\
424 vocore,vocore-8m|\
425 vocore,vocore-16m)
426 ucidef_add_switch "switch0" \
427 "0:lan" "4:lan" "6t@eth0"
428 ;;
429 samsung,cy-swr1100)
430 ucidef_add_switch "switch0" \
431 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
432 ;;
433 sparklan,wcr-150gn|\
434 zbtlink,we1026-5g-16m)
435 ucidef_add_switch "switch0" \
436 "0:lan" "6t@eth0"
437 ;;
438 tplink,archer-c20-v1|\
439 tplink,archer-c50-v1)
440 ucidef_add_switch "switch0" \
441 "1:lan:3" "2:lan:4" "3:lan:1" "4:lan:2" "0:wan" "6@eth0"
442 ;;
443 tplink,archer-mr200)
444 ucidef_add_switch "switch0" \
445 "0:lan" "1:lan" "2:lan" "3:lan" "6t@eth0"
446 ucidef_set_interface_wan "usb0"
447 ;;
448 tplink,tl-wr902ac-v3)
449 ucidef_add_switch "switch0" \
450 "4:lan" "6@eth0"
451 ;;
452 trendnet,tew-638apb-v2)
453 ucidef_add_switch "switch0" \
454 "4:lan" "6@eth0"
455 ;;
456 vocore,vocore2|\
457 vocore,vocore2-lite)
458 ucidef_add_switch "switch0" \
459 "0:lan" "2:lan" "6t@eth0"
460 ;;
461 wiznet,wizfi630a)
462 ucidef_add_switch "switch0" \
463 "0:lan" "1:lan" "2:wan" "6@eth0"
464 ;;
465 wiznet,wizfi630s)
466 ucidef_add_switch "switch0" \
467 "0:wan" "3:lan" "4:lan" "6@eth0"
468 ;;
469 xiaomi,mir3g)
470 ucidef_add_switch "switch0" \
471 "2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
472 ;;
473 xiaomi,mir3p)
474 ucidef_add_switch "switch0" \
475 "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
476 ;;
477 xiaomi,mir4a-100m)
478 ucidef_add_switch "switch0" \
479 "4:lan:1" "2:lan:2" "0:wan" "6@eth0"
480 ;;
481 zyxel,keenetic-omni-ii)
482 ucidef_add_switch "switch0" \
483 "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6@eth0"
484 ;;
485 zyxel,keenetic-start)
486 ucidef_add_switch "switch0" \
487 "0:lan:3" "1:lan:2" "2:lan:1" "3:lan:0" "4:wan" "6@eth0"
488 ;;
489 zyxel,keenetic-viva)
490 ucidef_add_switch "switch1" \
491 "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "7t@eth0"
492 ;;
493 *)
494 RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
495 if [ -n "${RT3X5X}" ]; then
496 ramips_setup_rt3x5x_vlans
497 else
498 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
499 fi
500 ;;
501 esac
502 }
503
504 ramips_setup_macs()
505 {
506 local board="$1"
507 local lan_mac=""
508 local wan_mac=""
509
510 case $board in
511 8devices,carambola|\
512 alfa-network,w502u|\
513 arcwireless,freestation5|\
514 lenovo,newifi-y1|\
515 lenovo,newifi-y1s|\
516 netgear,wnce2001|\
517 ohyeah,oy-0001|\
518 phicomm,k2g|\
519 skylab,skw92a|\
520 totolink,lr1200)
521 wan_mac=$(mtd_get_mac_binary factory 0x2e)
522 ;;
523 dlink,dir-300-b7|\
524 dlink,dir-320-b1|\
525 dlink,dir-620-a1|\
526 engenius,esr-9753|\
527 hame,mpr-a1|\
528 hauppauge,broadway|\
529 huawei,d105|\
530 hilink,hlk-7628n|\
531 hilink,hlk-rm04|\
532 nexaira,bc2|\
533 petatel,psr-680w|\
534 skyline,sl-r7205)
535 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
536 wan_mac=$(macaddr_add "$lan_mac" 1)
537 ;;
538 asus,rt-ac57u|\
539 d-team,newifi-d2|\
540 d-team,pbr-m1|\
541 elecom,wrc-1167ghbk2-s|\
542 elecom,wrc-1900gst|\
543 elecom,wrc-2533gst|\
544 lenovo,newifi-d1|\
545 phicomm,k2p|\
546 planex,vr500|\
547 samknows,whitebox-v8|\
548 youku,yk-l2|\
549 zbtlink,zbt-we3526)
550 wan_mac=$(mtd_get_mac_binary factory 0xe006)
551 ;;
552 asus,rt-n56u)
553 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
554 wan_mac=$(mtd_get_mac_binary factory 0x8004)
555 ;;
556 belkin,f9k1109v1)
557 wan_mac=$(mtd_get_mac_ascii uboot-env HW_WAN_MAC)
558 lan_mac=$(mtd_get_mac_ascii uboot-env HW_LAN_MAC)
559 label_mac=$wan_mac
560 ;;
561 buffalo,wcr-1166ds|\
562 buffalo,wsr-1166dhp)
563 local index="$(find_mtd_index "board_data")"
564 wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
565 lan_mac=$wan_mac
566 ;;
567 buffalo,whr-1166d|\
568 buffalo,whr-300hp2|\
569 buffalo,whr-600d|\
570 buffalo,whr-g300n|\
571 buffalo,wsr-600dhp|\
572 glinet,gl-mt300n-v2|\
573 zyxel,keenetic-start)
574 # This empty case has to be kept for devices without any MAC address adjustments
575 ;;
576 cudy,wr1000)
577 wan_mac=$(mtd_get_mac_binary factory 0x2e)
578 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
579 ;;
580 dlink,dch-m225|\
581 samsung,cy-swr1100)
582 lan_mac=$(mtd_get_mac_ascii factory lanmac)
583 ;;
584 dlink,dir-510l|\
585 dlink,dwr-116-a1|\
586 dlink,dwr-118-a1|\
587 dlink,dwr-118-a2|\
588 dlink,dwr-921-c1|\
589 dlink,dwr-922-e2|\
590 lava,lr-25g001)
591 wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
592 lan_mac=$(macaddr_add "$wan_mac" 1)
593 label_mac=$wan_mac
594 ;;
595 dlink,dir-615-d|\
596 dlink,dir-615-h1|\
597 glinet,gl-mt300a|\
598 glinet,gl-mt300n|\
599 glinet,gl-mt750|\
600 zbtlink,zbt-wg3526-16m|\
601 zbtlink,zbt-wg3526-32m)
602 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
603 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
604 ;;
605 dlink,dir-645)
606 lan_mac=$(mtd_get_mac_ascii nvram lanmac)
607 wan_mac=$(mtd_get_mac_ascii nvram wanmac)
608 ;;
609 dlink,dir-860l-b1)
610 lan_mac=$(mtd_get_mac_ascii factory lanmac)
611 wan_mac=$(mtd_get_mac_ascii factory wanmac)
612 label_mac=$(cat /sys/class/ieee80211/phy1/macaddress)
613 ;;
614 dovado,tiny-ac)
615 lan_mac=$(mtd_get_mac_ascii u-boot-env LAN_MAC_ADDR)
616 wan_mac=$(mtd_get_mac_ascii u-boot-env WAN_MAC_ADDR)
617 ;;
618 edimax,br-6475nd)
619 wan_mac=$(mtd_get_mac_binary devdata 0x7)
620 ;;
621 edimax,br-6478ac-v2|\
622 netgear,r6260|\
623 netgear,r6350|\
624 netgear,r6850)
625 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
626 ;;
627 hiwifi,hc5661|\
628 hiwifi,hc5661a|\
629 hiwifi,hc5761|\
630 hiwifi,hc5761a|\
631 hiwifi,hc5861|\
632 hiwifi,hc5861b|\
633 hiwifi,hc5962)
634 lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
635 label_mac=$lan_mac
636 [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
637 wan_mac=$(macaddr_add "$lan_mac" 1)
638 ;;
639 iodata,wn-ac1167gr|\
640 iodata,wn-ac733gr3)
641 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -1)
642 ;;
643 iodata,wn-ax1167gr|\
644 iodata,wn-gx300gr|\
645 trendnet,tew-692gr)
646 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
647 ;;
648 iptime,a604m)
649 wan_mac=$(mtd_get_mac_binary u-boot 0x1fc40)
650 ;;
651 linksys,e1700)
652 wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
653 ;;
654 mediatek,linkit-smart-7688|\
655 onion,omega2|\
656 onion,omega2p)
657 wan_mac=$(mtd_get_mac_binary factory 0x4)
658 lan_mac=$(mtd_get_mac_binary factory 0x2e)
659 ;;
660 mercury,mac1200r-v2)
661 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory_info 0xd)" 1)
662 ;;
663 poray,m3|\
664 poray,m4-4m|\
665 poray,m4-8m|\
666 poray,x5|\
667 poray,x8)
668 lan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" -2)
669 ;;
670 sitecom,wlr-6000)
671 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x8004)" 2)
672 ;;
673 sparklan,wcr-150gn|\
674 wiznet,wizfi630a|\
675 zyxel,keenetic-omni|\
676 zyxel,keenetic-omni-ii|\
677 zyxel,keenetic-viva)
678 wan_mac=$(mtd_get_mac_binary factory 0x28)
679 ;;
680 tenda,w306r-v2)
681 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 5)
682 ;;
683 trendnet,tew-691gr)
684 wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3)
685 ;;
686 vocore,vocore2|\
687 vocore,vocore2-lite)
688 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
689 ;;
690 xiaomi,mir3g)
691 lan_mac=$(mtd_get_mac_binary factory 0xe006)
692 ;;
693 xiaomi,mir3p)
694 lan_mac=$(mtd_get_mac_binary factory 0xe006)
695 label_mac=$lan_mac
696 ;;
697 xiaomi,miwifi-mini)
698 lan_mac=$(macaddr_setbit_la "$(cat /sys/class/net/eth0/address)")
699 ;;
700 zbtlink,zbt-we1326)
701 wan_mac=$(mtd_get_mac_binary factory 0xe006)
702 label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
703 ;;
704 *)
705 wan_mac=$(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
706 ;;
707 esac
708
709 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
710 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
711 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
712 }
713
714 board_config_update
715 board=$(board_name)
716 ramips_setup_interfaces $board
717 ramips_setup_macs $board
718 board_config_flush
719
720 exit 0