From 688c9779f41031c05d0682813100b4b19874d6ad Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Jan 2006 20:27:34 +0000 Subject: [PATCH] switch whiterussian over to b44 and kmod-switch, use netmsg to send messages for failsafe mode (should fix #76 and #86) SVN-Revision: 2984 --- openwrt/package/base-files/Makefile | 2 +- .../base-files/default/etc/init.d/S10boot | 10 +++++++ .../base-files/default/etc/nvram.overrides | 3 +-- .../package/base-files/default/etc/preinit | 27 ++++++++++++++++++- openwrt/target/linux/Config.in | 8 +----- .../linux/imagebuilder/lists/default.brcm-2.4 | 2 +- .../linux/imagebuilder/lists/micro.brcm-2.4 | 2 +- .../linux/imagebuilder/lists/pptp.brcm-2.4 | 2 +- openwrt/target/linux/linux-2.4/Makefile | 2 +- openwrt/target/linux/linux-2.4/config/brcm | 2 +- .../linux/linux-2.4/config/brcm.modules | 1 - 11 files changed, 44 insertions(+), 17 deletions(-) diff --git a/openwrt/package/base-files/Makefile b/openwrt/package/base-files/Makefile index 8beff8c3da..09df0abeea 100644 --- a/openwrt/package/base-files/Makefile +++ b/openwrt/package/base-files/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=base-files -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BUILD_DIR:=$(BUILD_DIR)/base-files include $(TOPDIR)/package/rules.mk diff --git a/openwrt/package/base-files/default/etc/init.d/S10boot b/openwrt/package/base-files/default/etc/init.d/S10boot index 86d514d23f..cb8be94b5c 100755 --- a/openwrt/package/base-files/default/etc/init.d/S10boot +++ b/openwrt/package/base-files/default/etc/init.d/S10boot @@ -11,6 +11,16 @@ sed 's/^[^#]/insmod &/' /etc/modules /etc/modules.d/* 2>&-|ash ifconfig lo 127.0.0.1 up ifconfig eth0 promisc +# configure the switch based on nvram if not in failsafe mode +[ -d /proc/switch/eth0 -a -z "$FAILSAFE" ] && { + for nr in `seq 0 15`; do + vp="$(nvram get vlan${nr}ports)" + [ -z "$vp" -o -z "$(nvram get vlan${nr}hwname)" ] || { + echo "$vp" > /proc/switch/eth0/vlan/$nr/ports + } + done +} + HOSTNAME=$(nvram get wan_hostname) HOSTNAME=${HOSTNAME%%.*} echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname diff --git a/openwrt/package/base-files/default/etc/nvram.overrides b/openwrt/package/base-files/default/etc/nvram.overrides index 3b45fa4f25..c965f7d284 100644 --- a/openwrt/package/base-files/default/etc/nvram.overrides +++ b/openwrt/package/base-files/default/etc/nvram.overrides @@ -27,8 +27,7 @@ FAILSAFE_ifnames=${FAILSAFE_ifnames:-"vlan0 eth1 eth2"} # failsafe if reset is held [ "$FAILSAFE" = "true" ] && { echo "### YOU ARE IN FAILSAFE MODE ####" - NVRAM_lan_ifname="br0" - NVRAM_lan_ifnames=$FAILSAFE_ifnames + NVRAM_lan_ifname="eth0" NVRAM_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} NVRAM_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} NVRAM_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"} diff --git a/openwrt/package/base-files/default/etc/preinit b/openwrt/package/base-files/default/etc/preinit index b23f8833ef..575b30ba9c 100755 --- a/openwrt/package/base-files/default/etc/preinit +++ b/openwrt/package/base-files/default/etc/preinit @@ -3,7 +3,23 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc insmod diag echo 0x01 > /proc/sys/diag -sleep 1 + +ifconfig eth0 up +insmod switch-core +insmod switch-robo || insmod switch-adm || rmmod switch-core + +[ -d /proc/switch/eth0 ] && { + echo 1 > /proc/switch/eth0/reset + echo "0 1 2 3 4 5u*" > /proc/switch/eth0/vlan/0/ports +} + +# this delay is apparently necessary because the link isn't up yet +ifconfig eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 up +netmsg 192.168.1.0 "(dummy message)" # b44 eats the first packet +netmsg 192.168.1.255 "Press reset now, to enter Failsafe!" + +sleep 2 + if [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then export FAILSAFE=true [ "$(nvram get boot_wait)" != "on" ] && { @@ -11,8 +27,17 @@ if [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then nvram commit } while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done & + netmsg 192.168.1.255 "Entering Failsafe!" +else + netmsg 192.168.1.255 "Normal startup." fi mount_root ${FAILSAFE:+failsafe} +# remove the drivers for now, just in case the user has newer versions on the jffs2 partition +rmmod switch-robo +rmmod switch-adm +rmmod switch-core +ifconfig eth0 0.0.0.0 + exec /sbin/init diff --git a/openwrt/target/linux/Config.in b/openwrt/target/linux/Config.in index e65c2f017e..98cd3fe5b6 100644 --- a/openwrt/target/linux/Config.in +++ b/openwrt/target/linux/Config.in @@ -32,15 +32,9 @@ config BR2_PACKAGE_KMOD_BRCM_WL config BR2_PACKAGE_KMOD_BRCM_ET tristate "Broadcom Ethernet Driver" depends BR2_LINUX_2_4_BRCM - default y - help - Proprietary driver for Broadcom Ethernet chipsets - -config BR2_PACKAGE_KMOD_B44 - tristate "Broadcom 44XX, 47XX ethernet driver" default m help - Free driver for Broadcom Ethernet chipsets (without switch support) + Proprietary driver for Broadcom Ethernet chipsets config BR2_PACKAGE_KMOD_ARPT tristate "ARP firewalling support" diff --git a/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 index 3de5c09819..37f52710cb 100644 --- a/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/default.brcm-2.4 @@ -8,11 +8,11 @@ haserl ipkg iptables iwlib -kmod-brcm-et kmod-brcm-wl kmod-diag kmod-ppp kmod-pppoe +kmod-switch kmod-wlcompat libgcc mtd diff --git a/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 index f10696f54d..2d696cf359 100644 --- a/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/micro.brcm-2.4 @@ -7,9 +7,9 @@ dropbear ipkg-sh iptables iwlib -kmod-brcm-et kmod-brcm-wl kmod-diag +kmod-switch kmod-wlcompat libgcc mtd diff --git a/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 b/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 index f54b06d980..f035268a0f 100644 --- a/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 +++ b/openwrt/target/linux/imagebuilder/lists/pptp.brcm-2.4 @@ -8,11 +8,11 @@ haserl ipkg iptables iwlib -kmod-brcm-et kmod-brcm-wl kmod-diag kmod-ppp kmod-gre +kmod-switch kmod-wlcompat libgcc mtd diff --git a/openwrt/target/linux/linux-2.4/Makefile b/openwrt/target/linux/linux-2.4/Makefile index fb3e1b9ded..04d817f5e0 100644 --- a/openwrt/target/linux/linux-2.4/Makefile +++ b/openwrt/target/linux/linux-2.4/Makefile @@ -33,7 +33,7 @@ TARGET_MODULES_DIR := $(TARGET_DIR)/lib/modules/$(LINUX_VERSION) IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules -PKG_RELEASE := 2 +PKG_RELEASE := 3 KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg diff --git a/openwrt/target/linux/linux-2.4/config/brcm b/openwrt/target/linux/linux-2.4/config/brcm index ff0513d923..18416e37aa 100644 --- a/openwrt/target/linux/linux-2.4/config/brcm +++ b/openwrt/target/linux/linux-2.4/config/brcm @@ -733,7 +733,7 @@ CONFIG_NET_PCI=y # CONFIG_AMD8111_ETH is not set # CONFIG_ADAPTEC_STARFIRE is not set # CONFIG_APRICOT is not set -CONFIG_B44=m +CONFIG_B44=y CONFIG_ET=m # CONFIG_CS89x0 is not set # CONFIG_TULIP is not set diff --git a/openwrt/target/linux/linux-2.4/config/brcm.modules b/openwrt/target/linux/linux-2.4/config/brcm.modules index e717eae577..cf26dd1bd4 100644 --- a/openwrt/target/linux/linux-2.4/config/brcm.modules +++ b/openwrt/target/linux/linux-2.4/config/brcm.modules @@ -1,2 +1 @@ -et wl -- 2.30.2