| 1 | #!/bin/sh |
| 2 | |
| 3 | set_preinit_iface() { |
| 4 | ifname=eth0 |
| 5 | |
| 6 | insmod diag |
| 7 | |
| 8 | # hardware specific overrides |
| 9 | case "$(cat /proc/diag/model)" in |
| 10 | "Linksys WAP54G V1") ifname=eth1;; |
| 11 | "ASUS WL-HDD") ifname=eth1;; |
| 12 | "ASUS WL-300g") ifname=eth1;; |
| 13 | "ASUS (unknown, BCM4702)") ifname=eth1;; |
| 14 | "Sitecom WL-105b") ifname=eth1;; |
| 15 | esac |
| 16 | ifconfig $ifname 0.0.0.0 up |
| 17 | } |
| 18 | |
| 19 | check_module () { |
| 20 | module="$1"; shift; params="$*" |
| 21 | |
| 22 | insmod "$module" "$params" |
| 23 | sleep 1 |
| 24 | grep -q ^"$module " /proc/modules |
| 25 | return $? |
| 26 | } |
| 27 | |
| 28 | init_iface() { |
| 29 | check_module hwmon |
| 30 | check_module tg3 |
| 31 | insmod switch-core |
| 32 | check_module switch-robo || check_module switch-adm || { |
| 33 | check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*" |
| 34 | } || rmmod switch-core |
| 35 | } |
| 36 | |
| 37 | boot_hook_add preinit_main set_preinit_iface |
| 38 | boot_hook_add preinit_main init_iface |
| 39 | |