Change order of module startup to force USB2 before USB1.1
[openwrt.git] / target / linux / brcm-2.4 / base-files / etc / preinit.arch
1 . /etc/functions.sh
2
3 failsafe() {
4 lock /tmp/.failsafe
5 failsafe_ip
6
7 echo "0 1 2 3 4 ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/0/ports
8
9 set_state failsafe
10 [ -x "/usr/sbin/nvram" ] && {
11 [ "$(nvram get boot_wait)" != "on" ] && {
12 nvram set boot_wait=on
13 nvram commit
14 }
15 }
16
17 netmsg 192.168.1.255 "Entering Failsafe!"
18 telnetd -l /bin/login <> /dev/null 2>&1
19
20 ash --login
21 }
22
23 mount none /proc -t proc
24
25 insmod diag
26 set_state preinit
27 echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug
28
29 ifname=eth0
30
31 # hardware specific overrides
32 case "$(cat /proc/diag/model)" in
33 "Linksys WAP54G V1") ifname=eth1;;
34 "ASUS WL-HDD") ifname=eth1;;
35 "ASUS WL-300g") ifname=eth1;;
36 "ASUS (unknown, BCM4702)") ifname=eth1;;
37 "Sitecom WL-105b") ifname=eth1;;
38 esac
39
40 failsafe_ip
41
42 check_module () {
43 module="$1"; shift; params="$*"
44
45 insmod "$module" "$params"
46 sleep 1
47 grep "^$module" /proc/modules
48 return $?
49 }
50
51 insmod switch-core
52 check_module switch-robo || check_module switch-adm || {
53 check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*"
54 } || rmmod switch-core
55
56 [ -d /proc/switch/eth0 ] && {
57 echo 1 > /proc/switch/eth0/reset
58
59 # this would be easier if we blasted the message across all ports
60 # but we don't want packets leaking across interfaces
61 for port in $(seq 0 4); do {
62 echo "$port ${cpu_port:-5u*}" > /proc/switch/eth0/vlan/0/ports
63 netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
64 }; done
65 } || netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
66
67 ifconfig $ifname 0.0.0.0 down
68
69 sleep 2
70
This page took 0.044332 seconds and 5 git commands to generate.