2 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
3 mount none
/proc
-t proc
5 echo 0x01 > /proc
/sys
/diag
9 insmod switch-robo || insmod switch-adm || rmmod switch-core
11 case "$(nvram get boardtype)" in
12 0x0467) failsafe_vlan
="0 1 2 3 5u*";;
13 *) failsafe_vlan
="1 2 3 4 5u*";;
15 # save the boot loader's vlan config
16 # we need it on some routers that have no vlan*ports set
17 [ -d /proc
/switch
/eth0
] && {
18 v0p
="$(cat /proc/switch/eth0/vlan/0/ports)"
19 v1p
="$(cat /proc/switch/eth0/vlan/1/ports)"
20 v2p
="$(cat /proc/switch/eth0/vlan/2/ports)"
21 echo 1 > /proc
/switch
/eth
0/reset
22 echo "$failsafe_vlan" > /proc
/switch
/eth
0/vlan
/0/ports
25 # this delay is apparently necessary because the link isn't up yet
26 ifconfig eth0
192.168.1.1 netmask
255.255.255.0 broadcast
192.168.1.255 up
27 netmsg
192.168.1.0 "(dummy message)" # b44 eats the first packet
28 netmsg
192.168.1.255 "Press reset now, to enter Failsafe!"
32 if [ $
(cat /proc
/sys
/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then
34 [ "$(nvram get boot_wait)" != "on" ] && {
35 nvram
set boot_wait
=on
38 while :; do { echo $
(((X
=(X
+1)%8)%2)) > /proc
/sys
/diag
; sleep $
((X
==0)); } done &
39 netmsg
192.168.1.255 "Entering Failsafe!"
41 netmsg
192.168.1.255 "Normal startup."
44 mount_root
${FAILSAFE:+failsafe}
46 # revert to the boot loader's vlan config
47 # required for at least WRT54G v1.1
48 [ -d /proc
/switch
/eth0
] && {
49 echo "$v0p" > /proc
/switch
/eth
0/vlan
/0/ports
50 echo "$v1p" > /proc
/switch
/eth
0/vlan
/1/ports
51 echo "$v2p" > /proc
/switch
/eth
0/vlan
/2/ports
54 # remove the drivers for now