mirror of https://github.com/hak5/openwrt.git
parent
51590a03b5
commit
77f30d9fb6
|
@ -1,3 +1,4 @@
|
|||
#!/bin/sh
|
||||
# NVRAM setup
|
||||
#
|
||||
# This file handles the NVRAM quirks of various hardware.
|
||||
|
@ -19,6 +20,50 @@ nvram_default() {
|
|||
[ -z "$(nvram get $1)" ] && nvram set "$1=$2"
|
||||
}
|
||||
|
||||
nvram_set() { # for the linksys fixup part
|
||||
[ "$(nvram get "$1")" = "$2" ] || {
|
||||
COMMIT=1
|
||||
nvram set "$1=$2"
|
||||
}
|
||||
}
|
||||
|
||||
# work around braindead CFE defaults in linksys routers
|
||||
boardtype=$(nvram get boardtype)
|
||||
boardflags=$(($(nvram get boardflags)))
|
||||
[ "$boardtype" = "bcm4710dev" ] && boardtype="0xdeadbeef"
|
||||
adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
|
||||
case "$(( $boardtype ))" in
|
||||
"$((0x708))")
|
||||
if [ "$adm_switch" = 0 ]; then
|
||||
nvram_set sdram_init 0x010b
|
||||
[ "$COMMIT" = 1 ] && {
|
||||
nvram_set sdram_config 0x0062
|
||||
nvram_set clkfreq 216
|
||||
nvram_set sdram_ncdl 0x0
|
||||
nvram_set pa0itssit 62
|
||||
nvram_set pa0b0 0x15eb
|
||||
nvram_set pa0b1 0xfa82
|
||||
nvram_set pa0b2 0xfe66
|
||||
nvram_set pa0maxpwr 0x4e
|
||||
}
|
||||
fi
|
||||
;;
|
||||
"$((0x467))")
|
||||
nvram_set sdram_init 0x010c
|
||||
[ "$COMMIT" = 1 ] && {
|
||||
nvram_set sdram_config 0x0062
|
||||
nvram_set sdram_ncdl 0x0
|
||||
nvram_set pa0itssit 62
|
||||
nvram_set pa0b0 0x168b
|
||||
nvram_set pa0b1 0xfabf
|
||||
nvram_set pa0b2 0xfeaf
|
||||
nvram_set pa0maxpwr 0x4e
|
||||
}
|
||||
;;
|
||||
esac
|
||||
[ "$COMMIT" = "1" ] && nvram commit
|
||||
|
||||
|
||||
# linksys bug; remove when not using static configuration for lan
|
||||
nvram set lan_proto="static"
|
||||
|
||||
|
@ -47,19 +92,19 @@ nvram set lan_proto="static"
|
|||
nvram_default vlan1ports "0 5"
|
||||
}
|
||||
|
||||
# hacks for asus wl-300g
|
||||
[ "$(nvram get productid)" = "WL300g" ] && {
|
||||
# hacks for asus
|
||||
case "$(nvram get productid)" in
|
||||
WL300g)
|
||||
debug "### wl-300g hacks ###"
|
||||
nvram set lan_ifnames="eth0 eth2"
|
||||
nvram set wan_ifname="none"
|
||||
}
|
||||
|
||||
# hacks for asus wl-hdd
|
||||
[ "$(nvram get productid)" = "WLHDD" ] && {
|
||||
;;
|
||||
WLHDD)
|
||||
debug "### wl-hdd hacks ###"
|
||||
nvram set lan_ifnames="eth1 eth2"
|
||||
nvram set wan_ifname="none"
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
# hacks for wap54g hardware
|
||||
[ "$(nvram get boardnum)" = "2" \
|
||||
|
@ -79,7 +124,17 @@ nvram set lan_proto="static"
|
|||
|
||||
# needed at least for wrt54gs v1.1 and wrt54g v2.0, v2.2
|
||||
[ \! -z "$(nvram get boardrev)" ] && {
|
||||
nvram set wl0id=0x4320
|
||||
nvram_default wl0id 0x4320
|
||||
}
|
||||
|
||||
WAN_PROTO="$(nvram get wan_proto)"
|
||||
[ "$WAN_PROTO" = "pptp" \
|
||||
-o "$WAN_PROTO" = "pppoe" ] && {
|
||||
WAN_IFNAME="$(nvram get wan_ifname)"
|
||||
[ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] || {
|
||||
nvram set wan_ifname=ppp0
|
||||
nvram set ${WAN_PROTO}_ifname="$WAN_IFNAME"
|
||||
}
|
||||
}
|
||||
|
||||
# defaults
|
||||
|
|
Loading…
Reference in New Issue