openwrt root filesystem
[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 # linksys bug; remove when not using static configuration for lan
7 NVRAM_lan_proto="static"
8
9 # hacks for wrt54g 1.x hardware
10 [ "$(nvram get boardnum)" = "42" ] && \
11 [ "$(nvram get boardtype)" = "bcm94710dev" ] && {
12
13 # remap eth0 => vlan2, eth1 => vlan1
14 # for all *_ifname(s)
15
16 debug "### wrt54g 1.x hack ###"
17 NVRAM_vlan1hwname="et0"
18 NVRAM_vlan2hwname="et0"
19 FAILSAFE_ifnames="vlan1 vlan2 eth2"
20
21 remap () {
22 eval NVRAM_$1=\"$(nvram get $1 | awk 'gsub("eth0","vlan2") gsub("eth1","vlan1")')\"
23 }
24
25 for type in lan wifi wan pppoe
26 do
27 remap ${type}_ifname
28 remap ${type}_ifnames
29 done
30 }
31
32 # hacks for wap54g hardware
33 [ "$(nvram get boardnum)" = "2" ] || \
34 [ "$(nvram get boardnum)" = "1024" ] && {
35 debug "### wap54g hack ###"
36 NVRAM_wan_ifname="none"
37 FAILSAFE_ifnames="eth0 eth1"
38 }
39
40 # defaults if lan_ifname is missing
41 [ -z "$(nvram get lan_ifname)" ] && {
42 NVRAM_lan_ifname="br0"
43 NVRAM_lan_ifnames="vlan0 vlan2 eth1 eth2 eth3"
44 }
45
46 # defaults if wan_ifname is missing
47 [ -z "$(nvram get wan_ifname)" ] && {
48 NVRAM_wan_ifname="vlan1"
49 NVRAM_wan_proto="dhcp"
50 }
51
52 # failsafe if reset is held
53 [ "$FAILSAFE" = "true" ] && {
54 echo "### YOU ARE IN FAILSAFE MODE ####"
55 NVRAM_lan_ifname="br0"
56 NVRAM_lan_ifnames=${FAILSAFE_ifnames:-"vlan0 vlan1 eth1"}
57 NVRAM_lan_ipaddr="192.168.1.1"
58 NVRAM_lan_netmask="255.255.255.0"
59 NVRAM_lan_hwaddr="00:0B:AD:0A:DD:00"
60 NVRAM_wan_ifname="none"
61 NVRAM_wifi_ifname="none"
62 }
This page took 0.047989 seconds and 5 git commands to generate.