support for Asus WL-500g
[openwrt.git] / openwrt / target / default / target_skeleton / etc / nvram.overrides
1 # NVRAM overrides
2 #
3 # This file handles the NVRAM quirks of various hardware.
4 # THIS FILE IS NOT A REPLACEMENT FOR NVRAM
5
6 [ "$(nvram get boardnum)" = "asusX" ] && \
7 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
8 asus=1
9 }
10
11 # linksys bug; remove when not using static configuration for lan
12 NVRAM_lan_proto="static"
13
14 # hacks for wrt54g 1.x hardware
15 [ "$(nvram get boardnum)" = "42" ] && \
16 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
17
18 # remap eth0 => vlan2, eth1 => vlan1
19 # for all *_ifname(s)
20
21 debug "### wrt54g 1.x hack ###"
22 NVRAM_vlan1hwname="et0"
23 NVRAM_vlan2hwname="et0"
24 FAILSAFE_ifnames="vlan1 vlan2 eth2"
25
26 remap () {
27 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
28 }
29
30 for type in lan wifi wan pppoe
31 do
32 remap ${type}_ifname
33 remap ${type}_ifnames
34 done
35 }
36
37 # hacks for wap54g hardware
38 [ "$(nvram get boardnum)" = "2" ] || \
39 [ "$(nvram get boardnum)" = "1024" ] && {
40 debug "### wap54g hack ###"
41 NVRAM_wan_ifname="none"
42 FAILSAFE_ifnames="eth0 eth1"
43 }
44
45 # hack for asus wl-500g hardware
46 [ $asus ] && {
47 FAILSAFE_lan_ifnames="eth0 eth2"
48 }
49
50 # defaults if lan_ifname is missing
51 [ -z "$(nvram get lan_ifname)" ] && {
52 NVRAM_lan_ifname="br0"
53 NVRAM_lan_ifnames=${FAILSAFE_lan_ifnames:-"vlan0 vlan2 eth1 eth2 eth3"}
54 }
55
56 # defaults if wan_ifname is missing
57 [ -z "$(nvram get wan_ifname)" ] && {
58 NVRAM_wan_ifname="vlan1"
59 NVRAM_wan_proto="dhcp"
60 [ "$asus" ] && {
61 NVRAM_wan_ifname="eth1"
62 }
63 }
64
65 # failsafe if reset is held
66 [ "$FAILSAFE" = "true" ] && {
67 echo "### YOU ARE IN FAILSAFE MODE ####"
68 NVRAM_lan_ifname="br0"
69 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
70 NVRAM_lan_ipaddr="192.168.1.1"
71 NVRAM_lan_netmask="255.255.255.0"
72 NVRAM_lan_hwaddr="00:0B:AD:0A:DD:00"
73 NVRAM_wan_ifname="none"
74 NVRAM_wifi_ifname="none"
75 }
This page took 0.042514 seconds and 5 git commands to generate.