From 7619fe0848dc5f31d5c4c4cadd2ec067bd5c55d1 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 17 Jul 2005 22:52:59 +0000 Subject: move target/default/target_skeleton into package/base-files, put all the default files in ipkg packages, cleanup some junk in toolchain/, toolchain/ no longer changes build_mipsel/root git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1494 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/etc/init.d/rcS | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 package/base-files/default/etc/init.d/rcS (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS new file mode 100755 index 0000000000..e6daddc593 --- /dev/null +++ b/package/base-files/default/etc/init.d/rcS @@ -0,0 +1,8 @@ +#!/bin/sh +syslogd -C 16 +klogd +${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit} + +for i in /etc/init.d/S*; do + $i start 2>&1 +done | logger -s -p 6 -t '' & -- cgit v1.2.3 From a44985f42c551baae99a2c6f461c94ec86d9e310 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 20 Jul 2005 19:58:40 +0000 Subject: updates from whiterussian git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1504 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/etc/firewall.user | 2 +- package/base-files/default/etc/init.d/S10boot | 5 +++-- package/base-files/default/etc/init.d/S45firewall | 1 + package/base-files/default/etc/init.d/rcS | 7 ++++--- package/base-files/default/etc/preinit | 11 ++++++----- package/base-files/default/sbin/ifup | 4 +++- package/base-files/default/sbin/mount_root | 14 ++++++++------ 7 files changed, 26 insertions(+), 18 deletions(-) (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/default/etc/firewall.user b/package/base-files/default/etc/firewall.user index 1781bd4ea0..7a13141623 100755 --- a/package/base-files/default/etc/firewall.user +++ b/package/base-files/default/etc/firewall.user @@ -14,7 +14,7 @@ iptables -t nat -F postrouting_rule ### The "-i $WAN" literally means packets that came in over the $WAN interface; ### this WILL NOT MATCH packets sent from the LAN to the WAN address. -### Allow SSH from WAN +### Allow SSH on the WAN interface # iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT # iptables -A input_rule -i $WAN -p tcp --dport 22 -j ACCEPT diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index 22096d5fbb..ead73521b1 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -16,7 +16,8 @@ touch /var/log/lastlog # if they don't already exist [ "$(nvram get boardtype)" = "bcm95365r" \ -a "$(nvram get boardnum)" = "45" \ --a -z "$(nvram get vlan0ports)$(nvram get vlan1ports)" ] && { +-a -z "$(nvram get vlan0ports)" +-a -z "$(nvram get vlan1ports)" ] && { nvram set vlan0ports="1 2 3 4 5*" nvram set vlan1ports="0 5" } @@ -33,6 +34,6 @@ echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname vconfig set_name_type VLAN_PLUS_VID_NO_PAD # automagically run firstboot -[ -z "$FAILSAFE" ] && { +[ -z "$FAILSAFE" -a -z "$(nvram get no_root_swap)" ] && { { mount|grep "on / type jffs2" 1>&-; } || firstboot } diff --git a/package/base-files/default/etc/init.d/S45firewall b/package/base-files/default/etc/init.d/S45firewall index 8350ccbfef..cb779792d5 100755 --- a/package/base-files/default/etc/init.d/S45firewall +++ b/package/base-files/default/etc/init.d/S45firewall @@ -1,6 +1,7 @@ #!/bin/sh ## Please make changes in /etc/firewall.user +${FAILSAFE:+exit} . /etc/functions.sh WAN=$(nvram get wan_ifname) diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index e6daddc593..706585801c 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -1,8 +1,9 @@ #!/bin/sh -syslogd -C 16 +syslog_ip=$(nvram get log_ipaddr) +ipcalc -s "$syslog_ip" || syslog_ip="" +syslogd -C 16 ${syslog_ip:+-L -R $syslog_ip} klogd -${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit} - +#${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit} for i in /etc/init.d/S*; do $i start 2>&1 done | logger -s -p 6 -t '' & diff --git a/package/base-files/default/etc/preinit b/package/base-files/default/etc/preinit index 0c59893f75..b23f8833ef 100755 --- a/package/base-files/default/etc/preinit +++ b/package/base-files/default/etc/preinit @@ -1,17 +1,18 @@ #!/bin/sh +export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc insmod diag echo 0x01 > /proc/sys/diag sleep 1 -if [ $(cat /proc/sys/reset) = 1 ] || [ "$(/usr/sbin/nvram get failsafe)" = 1 ]; then +if [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then export FAILSAFE=true - [ "$(/usr/sbin/nvram get boot_wait)" != "on" ] && { - /usr/sbin/nvram set boot_wait=on - /usr/sbin/nvram commit + [ "$(nvram get boot_wait)" != "on" ] && { + nvram set boot_wait=on + nvram commit } while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done & fi -/sbin/mount_root ${FAILSAFE:+failsafe} +mount_root ${FAILSAFE:+failsafe} exec /sbin/init diff --git a/package/base-files/default/sbin/ifup b/package/base-files/default/sbin/ifup index 3d81364d08..5dac3f9987 100755 --- a/package/base-files/default/sbin/ifup +++ b/package/base-files/default/sbin/ifup @@ -12,6 +12,9 @@ if_valid $if || exit mac=$(nvram get ${type}_hwaddr) $DEBUG ifconfig $if down 2>&- +pidfile=/var/run/${if}.pid +[ -f $pidfile ] && $DEBUG kill $(cat $pidfile) + if [ "${if%%[0-9]}" = "br" ]; then stp=$(nvram get ${type}_stp) $DEBUG brctl delbr $if 2>&- @@ -47,7 +50,6 @@ case "$if_proto" in ;; dhcp) ip=$(nvram get ${type}_ipaddr) - [ -f $pidfile ] && $DEBUG kill $(cat $pidfile) ${DEBUG:-eval} "udhcpc -R -i $if ${ip:+-r $ip} -b -p $pidfile &" ;; none|"") diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index b4ec2ca563..29c5126ba1 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -12,12 +12,14 @@ if [ "$1" != "failsafe" ]; then mount -o remount,rw /dev/root / fi else - mtd unlock OpenWrt - mount -t jffs2 /dev/mtdblock/4 /jffs - pivot_root /jffs /jffs/rom - mount none /proc -t proc - mount none /dev -t devfs - umount /rom/proc rom/dev >&- + if [ -z "$(nvram get no_root_swap)" ]; then + mtd unlock OpenWrt + mount -t jffs2 /dev/mtdblock/4 /jffs + pivot_root /jffs /jffs/rom + mount none /proc -t proc + mount none /dev -t devfs + umount /rom/proc rom/dev >&- + fi fi fi mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% -- cgit v1.2.3 From 6dc988729c78347c590675fe4bfdb9bb408fffc7 Mon Sep 17 00:00:00 2001 From: wbx Date: Sat, 10 Sep 2005 18:28:33 +0000 Subject: add nvram.sh to all startup scripts, no errors on wgt634u git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1892 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/default/etc/functions.sh | 16 +--------------- package/base-files/default/etc/init.d/S10boot | 5 ++++- package/base-files/default/etc/init.d/rcS | 1 + package/base-files/default/etc/nvram.sh | 17 +++++++++++++++++ package/base-files/default/etc/preinit | 1 + package/base-files/default/sbin/mount_root | 1 + 6 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 package/base-files/default/etc/nvram.sh (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh index 14f5011db7..c813e39a61 100755 --- a/package/base-files/default/etc/functions.sh +++ b/package/base-files/default/etc/functions.sh @@ -1,22 +1,8 @@ #!/bin/ash +. /etc/nvram.sh alias debug=${DEBUG:-:} -# allow env to override nvram -nvram () { - if [ -x /usr/sbin/nvram ]; then - case $1 in - get) eval "echo \${$2:-\$(command nvram get $2)}";; - *) command nvram $*;; - esac - else - case $1 in - get) eval "echo \${$2:-\${DEFAULT_$2}}";; - *);; - esac - fi -} - # valid interface? if_valid () ( ifconfig "$1" >&- 2>&- || diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index 37eb7b3cc7..3ec41b1190 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -1,5 +1,8 @@ #!/bin/sh -echo "S" > /proc/jffs2_bbc +. /etc/nvram.sh +if [ "$(uname -r|grep 2.4)" = "0" ];do + echo "S" > /proc/jffs2_bbc +done mkdir -p /var/run mkdir -p /var/log diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index 706585801c..10079c5932 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh syslog_ip=$(nvram get log_ipaddr) ipcalc -s "$syslog_ip" || syslog_ip="" syslogd -C 16 ${syslog_ip:+-L -R $syslog_ip} diff --git a/package/base-files/default/etc/nvram.sh b/package/base-files/default/etc/nvram.sh new file mode 100644 index 0000000000..f1170ac470 --- /dev/null +++ b/package/base-files/default/etc/nvram.sh @@ -0,0 +1,17 @@ +#!/bin/ash + +# allow env to override nvram +nvram () { + if [ -x /usr/sbin/nvram ]; then + case $1 in + get) eval "echo \${$2:-\$(command nvram get $2)}";; + *) command nvram $*;; + esac + else + case $1 in + get) eval "echo \${$2:-\${DEFAULT_$2}}";; + *);; + esac + fi +} + diff --git a/package/base-files/default/etc/preinit b/package/base-files/default/etc/preinit index b23f8833ef..34de88c602 100755 --- a/package/base-files/default/etc/preinit +++ b/package/base-files/default/etc/preinit @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc insmod diag diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 29c5126ba1..ae78ee4881 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh if [ "$1" != "failsafe" ]; then mount | grep jffs2 >&- if [ $? = 0 ] ; then -- cgit v1.2.3 From 676c017ecfced2e37aeec176f8aa6b9df90024f3 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 5 Apr 2006 02:09:22 +0000 Subject: large init script cleanup and merge of whiterussian changes, new dnsmasq config handling git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3588 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/Config.in | 3 - package/Sysconf.in | 31 ---- package/base-files/Makefile | 12 +- package/base-files/default/bin/firstboot | 134 ++++++++++------- package/base-files/default/bin/ipcalc | 32 ++++ package/base-files/default/bin/login | 12 +- package/base-files/default/etc/firewall.user | 29 ---- package/base-files/default/etc/functions.sh | 26 ---- .../base-files/default/etc/hotplug.d/net/10-net | 85 +++++------ package/base-files/default/etc/init.d/S10boot | 9 +- package/base-files/default/etc/init.d/S40network | 16 -- package/base-files/default/etc/init.d/S45firewall | 96 ------------ package/base-files/default/etc/init.d/S50telnet | 2 +- package/base-files/default/etc/init.d/S60cron | 8 +- package/base-files/default/etc/init.d/S98done | 9 ++ package/base-files/default/etc/init.d/S99done | 4 - package/base-files/default/etc/init.d/rcS | 10 +- package/base-files/default/etc/inittab | 1 - package/base-files/default/etc/preinit | 23 +-- package/base-files/default/sbin/halt | 3 - package/base-files/default/sbin/hotplug | 10 +- package/base-files/default/sbin/ifdown | 16 +- package/base-files/default/sbin/ifup | 22 +-- package/base-files/default/sbin/mount_root | 40 +++-- package/base-files/default/usr/lib/common.awk | 66 ++++++++ .../base-files/default/usr/lib/parse-config.awk | 40 +++++ .../default/usr/share/udhcpc/default.script | 37 +++-- package/busybox/config/miscutils/Config.in | 6 + package/busybox/config/networking/Config.in | 4 +- package/busybox/patches/220-awk_bitops.patch | 61 ++++++++ package/busybox/patches/230-passwd_salt.patch | 13 ++ package/busybox/patches/340-lock_util.patch | 167 +++++++++++++++++++++ package/dnsmasq/Makefile | 2 +- package/dnsmasq/files/S50dnsmasq | 30 ---- package/dnsmasq/files/dnsmasq.conf | 8 +- package/dnsmasq/files/dnsmasq.init | 45 ++++++ package/ez-ipupdate/files/ez-ipupdate.hotplug | 6 +- package/iptables/Makefile | 7 + package/iptables/files/firewall.awk | 64 ++++++++ package/iptables/files/firewall.config | 46 ++++++ package/iptables/files/firewall.init | 95 ++++++++++++ package/iptables/files/firewall.user | 31 ++++ package/linux-atm/files/br2684.init | 8 +- package/mtd/mtd.c | 17 ++- package/ntpclient/files/ntpclient.init | 3 +- package/parprouted/files/parprouted.default | 4 +- package/ppp/files/ifup.pppoa | 29 ++-- package/ppp/files/ifup.pppoe | 27 ++-- package/pptp/files/ifup.pptp | 41 ++--- .../base-files/files/ar7-2.4/etc/network.overrides | 28 ---- .../files/aruba-2.6/etc/network.overrides | 26 ---- .../base-files/files/brcm-2.4/etc/init.d/S04nvram | 66 ++++++++ .../files/brcm-2.4/etc/init.d/S05netconfig | 4 +- .../base-files/files/brcm-2.4/etc/init.d/S05nvram | 166 -------------------- .../files/brcm-2.4/etc/network.overrides | 41 ----- .../files/brcm-2.6/etc/init.d/S05netconfig | 4 +- .../files/brcm-2.6/etc/network.overrides | 31 ---- .../base-files/files/x86-2.4/etc/network.overrides | 26 ---- .../base-files/files/x86-2.6/etc/network.overrides | 26 ---- 59 files changed, 1022 insertions(+), 886 deletions(-) delete mode 100644 package/Sysconf.in create mode 100755 package/base-files/default/bin/ipcalc delete mode 100755 package/base-files/default/etc/firewall.user delete mode 100755 package/base-files/default/etc/init.d/S40network delete mode 100755 package/base-files/default/etc/init.d/S45firewall create mode 100755 package/base-files/default/etc/init.d/S98done delete mode 100755 package/base-files/default/etc/init.d/S99done delete mode 100755 package/base-files/default/sbin/halt create mode 100644 package/base-files/default/usr/lib/common.awk create mode 100644 package/base-files/default/usr/lib/parse-config.awk create mode 100644 package/busybox/patches/220-awk_bitops.patch create mode 100644 package/busybox/patches/230-passwd_salt.patch create mode 100644 package/busybox/patches/340-lock_util.patch delete mode 100755 package/dnsmasq/files/S50dnsmasq create mode 100644 package/dnsmasq/files/dnsmasq.init create mode 100644 package/iptables/files/firewall.awk create mode 100644 package/iptables/files/firewall.config create mode 100755 package/iptables/files/firewall.init create mode 100755 package/iptables/files/firewall.user delete mode 100644 target/linux/package/base-files/files/ar7-2.4/etc/network.overrides delete mode 100644 target/linux/package/base-files/files/aruba-2.6/etc/network.overrides create mode 100755 target/linux/package/base-files/files/brcm-2.4/etc/init.d/S04nvram delete mode 100755 target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05nvram delete mode 100644 target/linux/package/base-files/files/brcm-2.4/etc/network.overrides delete mode 100644 target/linux/package/base-files/files/brcm-2.6/etc/network.overrides delete mode 100644 target/linux/package/base-files/files/x86-2.4/etc/network.overrides delete mode 100644 target/linux/package/base-files/files/x86-2.6/etc/network.overrides (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/Config.in b/package/Config.in index 55fdba073a..619578024e 100644 --- a/package/Config.in +++ b/package/Config.in @@ -333,6 +333,3 @@ config BR2_PACKAGE_IMAGEBUILDER endmenu -source "package/Sysconf.in" - - diff --git a/package/Sysconf.in b/package/Sysconf.in deleted file mode 100644 index 6c0cac3cd8..0000000000 --- a/package/Sysconf.in +++ /dev/null @@ -1,31 +0,0 @@ -# - -menu "Runtime Configuration" - choice - bool "Telnet access" - default BR2_SYSCONF_TELNET_FAILSAFE_ONLY - - config BR2_SYSCONF_TELNET_FAILSAFE_ONLY - bool "open, failsafe only" - - config BR2_SYSCONF_TELNET_OPEN - bool "open" - - endchoice - - menu "Failsafe configuration" - - config BR2_SYSCONF_FAILSAFE_IP - string "IP Address" - default "192.168.1.1" - - config BR2_SYSCONF_FAILSAFE_NETMASK - string "Netmask" - default "255.255.255.0" - - config BR2_SYSCONF_FAILSAFE_MAC - string "MAC Address" - default "00:00:BA:DC:0D:ED" - - endmenu -endmenu diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 1fb0c14498..8517dcc685 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -55,23 +55,25 @@ $(IPKG_BASE): $(CP) ./default/* $(IDIR_BASE) $(SED) 's,$$R,r$(REV),g' $(IDIR_BASE)/etc/banner $(SED) 's,$$S,$(BOARD)-$(KERNEL),g' $(IDIR_BASE)/etc/ipkg.conf - mkdir -p $(IDIR_BASE)/sys - mkdir -p $(IDIR_BASE)/jffs mkdir -p $(IDIR_BASE)/dev + mkdir -p $(IDIR_BASE)/etc/crontabs + mkdir -p $(IDIR_BASE)/jffs + mkdir -p $(IDIR_BASE)/lib + mkdir -p $(IDIR_BASE)/mnt mkdir -p $(IDIR_BASE)/proc mkdir -p $(IDIR_BASE)/tmp - mkdir -p $(IDIR_BASE)/lib mkdir -p $(IDIR_BASE)/usr/lib mkdir -p $(IDIR_BASE)/usr/bin + mkdir -p $(IDIR_BASE)/sys + mkdir -p $(IDIR_BASE)/www ln -sf /tmp/resolv.conf $(IDIR_BASE)/etc/resolv.conf ln -sf /proc/mounts $(IDIR_BASE)/etc/mtab - rm -rf $(IDIR_BASE)/var + rm -f $(IDIR_BASE)/var ln -sf /tmp $(IDIR_BASE)/var -find $(IDIR_BASE) -type d -name CVS | xargs rm -rf -find $(IDIR_BASE) -type d -name .svn | xargs rm -rf -find $(IDIR_BASE) -name '.#*' | xargs rm -f mkdir -p $(IDIR_BASE)/etc - -grep \^BR2_SYSCONF $(TOPDIR)/.config > $(IDIR_BASE)/etc/sysconf $(IPKG_BUILD) $(IDIR_BASE) $(PACKAGE_DIR) $(IPKG_UCLIBC): diff --git a/package/base-files/default/bin/firstboot b/package/base-files/default/bin/firstboot index eff7063b1c..1d9b658b69 100755 --- a/package/base-files/default/bin/firstboot +++ b/package/base-files/default/bin/firstboot @@ -1,62 +1,88 @@ #!/bin/sh # $Id$ -mount | grep squashfs >&- || { - echo "You do not have a squashfs partition; aborting" - echo "(firstboot cannot be run on jffs2 based firmwares)" - return +rom=$(awk '/squashfs/ {print $2}' /proc/mounts) +jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) + +dupe() { # + cd $1 + echo -n "creating directories... " + { + cd $2 + find . -xdev -type d + echo "./dev ./jffs ./mnt ./proc ./tmp ./sys" + # xdev skips mounted directories + cd $1 + } | xargs mkdir -p + echo "done" + + echo -n "setting up symlinks... " + for file in $(cd $2; find . -xdev -type f;); do + case "$file" in + "./rom/note") ;; #nothing + "./etc/config"|\ + "./etc/resolv.conf"|\ + "./usr/lib/ipkg/info") cp -af $2/$file $file;; + *) ln -sf /rom/${file#./*} $file;; + esac + done + for file in $(cd $2; find . -xdev -type l;); do + cp -af $2/${file#./*} $file + done + echo "done" } -[ -f "/tmp/.firstboot" ] && { - echo "firstboot is already running" - return +pivot() { # + mount -o move /proc $1/proc && \ + pivot_root $1 $1$2 && { + mount -o move $2/dev /dev + mount -o move $2/tmp /tmp + } } -touch /tmp/.firstboot -jdev=$(mount | awk '/jffs2/ {print $3}') +mountdp() { # + dev=$1; mnt=$2; shift 2; opt=$* + mount $dev $mnt $opt + dupe $mnt $rom + pivot $mnt /rom +} -if [ -z "$jdev" ]; then - echo -n "Creating jffs2 partition... " - mtd erase OpenWrt >&- 2>&- - mount -t jffs2 /dev/mtdblock/4 /jffs - echo "done" - cd /jffs -else - echo "firstboot has already been run" - echo "jffs2 partition is mounted, only resetting files" - cd $jdev -fi - -exec 2>/dev/null - -mount /dev/mtdblock/2 /rom -o ro - -echo -n "creating directories... " -{ - cd /rom - find . -type d - cd - -} | xargs mkdir -echo "done" - -echo -n "setting up symlinks... " -for file in $(cd /rom; find * -type f; find * -type l;) -do { - case "${file%/*}" in - "usr/lib/ipkg/info"|"etc/config") cp -f /rom/$file $file;; - *) ln -sf /rom/$file $file;; - esac -} done -echo "done" - -touch /tmp/resolv.conf -ln -s /tmp/resolv.conf /etc/resolv.conf - -umount /rom -mount none /jffs/proc -t proc -pivot_root /jffs /jffs/rom -mount none /dev -t devfs -mount none /tmp -t ramfs -umount /rom/proc -umount /rom/tmp -umount /rom/dev +ramoverlay() { + mkdir -p /tmp/root + mountdp /tmp/root /mnt -o bind +} + +[ "${0##*/}" = "firstboot" ] && { + [ -z "$rom" ] && { + echo "You do not have a squashfs partition; aborting" + echo "(firstboot cannot be run on jffs2 based firmwares)" + exit 1 + } + + [ "$1" = "switch2jffs" ] && { + mtd erase OpenWrt + mount -o remount,ro none / # try to avoid fs changing while copying + mount -o bind / /mnt + mount /dev/mtdblock/4 /rom/jffs -t jffs2 + echo -n "copying files ... " + cp -a /mnt/* /rom/jffs + umount /mnt + echo "done" + pivot /rom /mnt + mount -o move /mnt /tmp/root + pivot /jffs /rom + jffs2root --clean + exit 0 + } + + # script run manually + [ \! -z "$jffs" ] && { + echo "firstboot has already been run" + echo "jffs2 partition is mounted, only resetting files" + dupe $jffs $rom + exit 0 + } + + mtd erase OpenWrt + mountdp /dev/mtdblock/4 /jffs -t jffs2 +} diff --git a/package/base-files/default/bin/ipcalc b/package/base-files/default/bin/ipcalc new file mode 100755 index 0000000000..318980e5a2 --- /dev/null +++ b/package/base-files/default/bin/ipcalc @@ -0,0 +1,32 @@ +#!/bin/sh + +awk -f /usr/lib/common.awk -f - $* <limit) end=limit + + print "IP="int2ip(ipaddr) + print "NETMASK="int2ip(netmask) + print "BROADCAST="int2ip(broadcast) + print "NETWORK="int2ip(network) + print "PREFIX="32-bitcount(compl(netmask)) + + # range calculations: + # ipcalc + + if (ARGC > 3) { + print "START="int2ip(start) + print "END="int2ip(end) + } +} +EOF diff --git a/package/base-files/default/bin/login b/package/base-files/default/bin/login index bb065e54a1..8f9281726d 100755 --- a/package/base-files/default/bin/login +++ b/package/base-files/default/bin/login @@ -1,20 +1,16 @@ #!/bin/sh -. /etc/sysconf 2>&- - -[ "$FAILSAFE" != "true" ] && -[ "$BR2_SYSCONF_TELNET_FAILSAFE_ONLY" = "y" ] && +grep '^root:[^!]' /etc/passwd >&- 2>&- +[ "$?" = "0" -a -z "$FAILSAFE" ] && { - grep '^root:[^!]' /etc/passwd >&- 2>&- && - { echo "Login failed." exit 0 - } || { +} || { cat << EOF === IMPORTANT ============================ Use 'passwd' to set your login password this will disable telnet and enable SSH ------------------------------------------ EOF - } } + exec /bin/ash --login diff --git a/package/base-files/default/etc/firewall.user b/package/base-files/default/etc/firewall.user deleted file mode 100755 index 5774f0c64a..0000000000 --- a/package/base-files/default/etc/firewall.user +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -. /etc/functions.sh -. /etc/network.overrides -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network - -WAN=$(nvram get wan_ifname) -LAN=$(nvram get lan_ifname) - -iptables -F input_rule -iptables -F output_rule -iptables -F forwarding_rule -iptables -t nat -F prerouting_rule -iptables -t nat -F postrouting_rule - -### BIG FAT DISCLAIMER -### The "-i $WAN" literally means packets that came in over the $WAN interface; -### this WILL NOT MATCH packets sent from the LAN to the WAN address. - -### Allow SSH on the WAN interface -# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT -# iptables -A input_rule -i $WAN -p tcp --dport 22 -j ACCEPT - -### Port forwarding -# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j DNAT --to 192.168.1.2 -# iptables -A forwarding_rule -i $WAN -p tcp --dport 22 -d 192.168.1.2 -j ACCEPT - -### DMZ (should be placed after port forwarding / accept rules) -# iptables -t nat -A prerouting_rule -i $WAN -j DNAT --to 192.168.1.2 -# iptables -A forwarding_rule -i $WAN -d 192.168.1.2 -j ACCEPT diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh index e7126473f4..526ca52dda 100755 --- a/package/base-files/default/etc/functions.sh +++ b/package/base-files/default/etc/functions.sh @@ -1,6 +1,4 @@ #!/bin/sh -. /etc/nvram.sh - alias debug=${DEBUG:-:} # valid interface? @@ -13,27 +11,3 @@ if_valid () ( hotplug_dev() { env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug net } - -bitcount () { - local c=$1 - echo $(( - c=((c>> 1)&0x55555555)+(c&0x55555555), - c=((c>> 2)&0x33333333)+(c&0x33333333), - c=((c>> 4)&0x0f0f0f0f)+(c&0x0f0f0f0f), - c=((c>> 8)&0x00ff00ff)+(c&0x00ff00ff), - c=((c>>16)&0x0000ffff)+(c&0x0000ffff) - )) -} - -valid_netmask () { - return $((-($1)&~$1)) -} - -ip2int () ( - set $(echo $1 | tr '\.' ' ') - echo $(($1<<24|$2<<16|$3<<8|$4)) -) - -int2ip () { - echo $(($1>>24&255)).$(($1>>16&255)).$(($1>>8&255)).$(($1&255)) -} diff --git a/package/base-files/default/etc/hotplug.d/net/10-net b/package/base-files/default/etc/hotplug.d/net/10-net index 0f384ec46b..4bb69378ff 100644 --- a/package/base-files/default/etc/hotplug.d/net/10-net +++ b/package/base-files/default/etc/hotplug.d/net/10-net @@ -1,32 +1,28 @@ #!/bin/sh -setup_eth() -{ - for part in $(nvram get unused_ifnames); do - [ "$part" = "$INTERFACE" ] && exit 0 - done - ifconfig "$INTERFACE" up 2>&- >&- -} - find_name() { - pppoa_ifname="atm0" # hack for ppp over atm, which has no ${proto}_ifname - interfaces="lan wan wifi $(nvram get ifnames)" - for ifname in $interfaces; do + for ifname in lan wan wifi ${ifnames}; do IFTYPE="${ifname}" - IFPROTO="$(nvram get ${IFTYPE}_proto)" - IFACE="$(nvram get ${IFTYPE}_ifname)" + eval "IFPROTO=\"\${${IFTYPE}_proto}\"" + eval "IFACE=\"\${${IFTYPE}_ifname}\"" case "$IFPROTO" in ""|none);; static|dhcp) [ "${IFACE}" = "$INTERFACE" ] && return 0 [ "${IFACE%%[0-9]*}" = "br" ] && { - for part in $(nvram get ${IFTYPE}_ifnames); do + eval "ifs=\"\${${IFTYPE}_ifnames}\"" + for part in $ifs; do [ "$part" = "$INTERFACE" ] && return 0 done } ;; + pppoa) + [ "$INTERFACE" = "atm0" \ + -a -x /sbin/ifup.${IFPROTO} ] && return 0 + ;; *) - [ "$(nvram get ${IFTYPE}_device)" = "$INTERFACE" \ + eval "device=\"\${${IFTYPE}_device}\"" + [ "$device" = "$INTERFACE" \ -a -x /sbin/ifup.${IFPROTO} ] && return 0 ;; esac @@ -39,17 +35,18 @@ find_name() do_ifup() { if="$3" - if_proto="$(nvram get ${2}_proto)" + eval "if_proto=\"\${${2}_proto}\"" pidfile=/var/run/${if}.pid [ -f $pidfile ] && $DEBUG kill $(cat $pidfile) case "$1" in static) - ip=$(nvram get ${2}_ipaddr) - ip6=$(nvram get ${2}_ip6addr) - netmask=$(nvram get ${2}_netmask) - gateway=$(nvram get ${2}_gateway) + eval "ip=\"\${${2}_ipaddr}\"" + eval "ip6=\"\${${2}_ip6addr}\"" + eval "netmask=\"\${${2}_netmask}\"" + eval "gateway=\"\${${2}_gateway}\"" + eval "dns=\"\${${2}_dns}\"" $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up [ -n "$ip6" ] && $DEBUG ifconfig $if add $ip6 @@ -58,24 +55,25 @@ do_ifup() { [ -f /tmp/resolv.conf ] || { debug "# --- creating /tmp/resolv.conf ---" - for dns in $(nvram get ${2}_dns); do - echo "nameserver $dns" >> /tmp/resolv.conf + for ns in $dns; do + echo "nameserver $ns" >> /tmp/resolv.conf done } env -i ACTION="ifup" INTERFACE="${2}" PROTO=static /sbin/hotplug "iface" & ;; dhcp) - DHCP_IP=$(nvram get ${2}_ipaddr) - DHCP_NETMASK=$(nvram get ${2}_netmask) + eval "ip=\"\${${2}_ipaddr}\"" + eval "netmask=\"\${${2}_netmask}\"" + eval "hostname=\"\${${2}_hostname}\"" + $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up - DHCP_ARGS="-i $if ${DHCP_IP:+-r $DHCP_IP} -b -p $pidfile" - DHCP_HOSTNAME=$(nvram get ${2}_hostname) - DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*} - [ -z $DHCP_HOSTNAME ] || DHCP_ARGS="$DHCP_ARGS -H $DHCP_HOSTNAME" - [ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &" - ${DEBUG:-eval} "udhcpc $DHCP_ARGS" + args="-i $if ${ip:+-r $ip} -b -p $pidfile" + hostname="${hostname%%.*}" + args="$args${hostname:+ -H $hostname}" + [ "$if_proto" = "pptp" ] && args="$args -n -q" || args="$args -R &" + ${DEBUG:-eval} "udhcpc $args" # hotplug events are handled by /usr/share/udhcpc/default.script ;; *) @@ -88,25 +86,23 @@ do_ifup() { do_register() { - case "${INTERFACE%%[0-9]*}" in - eth) setup_eth;; - esac - [ -z "$IFTYPE" -o -z "$IFPROTO" ] && { find_name || { case "${INTERFACE%%[0-9]*}" in wds) - for tmp in lan wifi; do - [ -z "$IFPROTO" ] && [ "$(nvram get ${tmp}_ifname)" = "br0" ] && { - IFPROTO="$(nvram get ${tmp}_proto)" + for ifname in lan wifi; do + eval "if=\"\${${ifname}_ifname}\"" + [ -z "$IFPROTO" ] && [ "$if" = "br0" ] && { + eval "IFPROTO=\"\${${2}_proto}\"" IFTYPE="${tmp}" } done [ -z "$IFPROTO" ] && return 0 ;; atm) - for tmp in lan wan wifi $(nvram get ifnames); do - [ "$(nvram get ${tmp}_proto)" = "pppoa" ] && { + for tmp in lan wan wifi ${ifnames}; do + eval "if_proto=\"\${${2}_proto}\"" + [ "$if_proto" = "pppoa" ] && { do_ifup "pppoa" "$tmp" "$INTERFACE" return 0 } @@ -122,16 +118,16 @@ do_register() case "${INTERFACE%%[0-9]*}" in ppp|atm);; *) - mac=$(nvram get ${IFTYPE}_hwaddr) + eval "mac=\"\${${IFTYPE}_hwaddr}\"" ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac} ;; esac - if="$(nvram get ${IFTYPE}_ifname)" + eval "if=\"\${${IFTYPE}_ifname}\"" if [ "${if%%[0-9]}" = "br" ]; then if_valid "$INTERFACE" && { ifconfig "$if" 2>&- >&- || { - stp=$(nvram get ${IFTYPE}_stp) + eval "stp=\"\${${IFTYPE}_stp}\"" $DEBUG brctl addbr "$if" $DEBUG brctl setfd "$if" 0 $DEBUG brctl stp "$if" "${stp:-0}" @@ -151,8 +147,9 @@ do_register() } do_unregister() { - [ -z "$IFTYPE" -o -z "$IFPROTO" ] && find_name - [ -z "$IFTYPE" -o -z "$IFPROTO" ] && return 0 + [ -z "$IFTYPE" -o -z "$IFPROTO" ] && { + find_name || return 0 + } [ "${IFACE%%[0-9]*}" = "br" ] && { if [ "$INTERFACE" != "$IFACE" ]; then diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index 02fddee7ba..0cc519d8eb 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -1,14 +1,9 @@ #!/bin/sh -. /etc/nvram.sh - -[ "$(uname -r|grep -c 2.4)" = "1" ] && { - echo "S" > /proc/jffs2_bbc -} +[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc vconfig set_name_type VLAN_PLUS_VID_NO_PAD -HOSTNAME=$(nvram get wan_hostname) -HOSTNAME=${HOSTNAME%%.*} +HOSTNAME=${wan_hostname%%.*} echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname mkdir -p /var/run diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/S40network deleted file mode 100755 index 168fd2979b..0000000000 --- a/package/base-files/default/etc/init.d/S40network +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -. /etc/functions.sh -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network -case "$1" in - start|restart) -# ifup lan -# ifup wan -# ifup wifi -# wifi up - - for route in $(nvram get static_route); do { - eval "set $(echo $route | sed 's/:/ /g')" - $DEBUG route add -net $1 netmask $2 gw $3 metric $4 dev $5 - } done - ;; -esac diff --git a/package/base-files/default/etc/init.d/S45firewall b/package/base-files/default/etc/init.d/S45firewall deleted file mode 100755 index 8c67d82b18..0000000000 --- a/package/base-files/default/etc/init.d/S45firewall +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -## Please make changes in /etc/firewall.user -${FAILSAFE:+exit} - -. /etc/functions.sh -. /etc/network.overrides -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network - -WAN=$(nvram get wan_ifname) -LAN=$(nvram get lan_ifname) - -## CLEAR TABLES -for T in filter nat; do - iptables -t $T -F - iptables -t $T -X -done - -iptables -N input_rule -iptables -N output_rule -iptables -N forwarding_rule - -iptables -t nat -N prerouting_rule -iptables -t nat -N postrouting_rule - -### INPUT -### (connections with the router as destination) - - # base case - iptables -P INPUT DROP - iptables -A INPUT -m state --state INVALID -j DROP - iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A INPUT -j input_rule - - # allow - iptables -A INPUT ${WAN:+-i \! $WAN} -j ACCEPT # allow from lan/wifi interfaces - iptables -A INPUT -p icmp -j ACCEPT # allow ICMP - iptables -A INPUT -p gre -j ACCEPT # allow GRE - - # reject (what to do with anything not allowed earlier) - iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset - iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable - -### OUTPUT -### (connections with the router as source) - - # base case - iptables -P OUTPUT DROP - iptables -A OUTPUT -m state --state INVALID -j DROP - iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A OUTPUT -j output_rule - - # allow - iptables -A OUTPUT -j ACCEPT #allow everything out - - # reject (what to do with anything not allowed earlier) - iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset - iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable - -### FORWARDING -### (connections routed through the router) - - # base case - iptables -P FORWARD DROP - iptables -A FORWARD -m state --state INVALID -j DROP - iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu - iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A FORWARD -j forwarding_rule - - # allow - iptables -A FORWARD -i br0 -o br0 -j ACCEPT - [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT - - # reject (what to do with anything not allowed earlier) - # uses the default -P DROP - -### MASQ - iptables -t nat -A PREROUTING -j prerouting_rule - iptables -t nat -A POSTROUTING -j postrouting_rule - [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE - -## USER RULES -[ -f /etc/firewall.user ] && . /etc/firewall.user diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/S50telnet index ff5659ed47..fb9687c8aa 100755 --- a/package/base-files/default/etc/init.d/S50telnet +++ b/package/base-files/default/etc/init.d/S50telnet @@ -1,2 +1,2 @@ #!/bin/sh -if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null || test $FAILSAFE; then telnetd -l /bin/login; fi +if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/S60cron index 6069b8177e..1752734267 100755 --- a/package/base-files/default/etc/init.d/S60cron +++ b/package/base-files/default/etc/init.d/S60cron @@ -1,6 +1,4 @@ #!/bin/sh -[ -d /etc/crontabs ] || mkdir -p /etc/crontabs -[ -e /var/spool/cron/crontabs ] || { - mkdir -p /var/spool/cron - ln -s /etc/crontabs /var/spool/cron/crontabs -} && crond -c /etc/crontabs +mkdir -p /var/spool/cron +ln -s /etc/crontabs /var/spool/cron/crontabs +crond -c /etc/crontabs diff --git a/package/base-files/default/etc/init.d/S98done b/package/base-files/default/etc/init.d/S98done new file mode 100755 index 0000000000..5d5ab49ce3 --- /dev/null +++ b/package/base-files/default/etc/init.d/S98done @@ -0,0 +1,9 @@ +#!/bin/sh +sysctl -p >&- + +# automagically run firstboot +{ mount|grep "on / type tmpfs" 1>&-; } && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs +} diff --git a/package/base-files/default/etc/init.d/S99done b/package/base-files/default/etc/init.d/S99done deleted file mode 100755 index a260ac3d6f..0000000000 --- a/package/base-files/default/etc/init.d/S99done +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# set leds to normal state -[ -f /proc/sys/diag ] && echo "0x00" > /proc/sys/diag -sysctl -p >&- diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index 10079c5932..b38e449781 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -1,8 +1,10 @@ #!/bin/sh -. /etc/nvram.sh -syslog_ip=$(nvram get log_ipaddr) -ipcalc -s "$syslog_ip" || syslog_ip="" -syslogd -C 16 ${syslog_ip:+-L -R $syslog_ip} +${FAILSAFE:+exit} + +[ -f /etc/config/network ] && . /etc/config/network +eval $(ipcalc "$log_ipaddr") +[ "$log_ipaddr" = "$IP" ] || log_ipaddr="" +syslogd -C 16 ${log_ipaddr:+-L -R $log_ipaddr} klogd #${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit} for i in /etc/init.d/S*; do diff --git a/package/base-files/default/etc/inittab b/package/base-files/default/etc/inittab index 5916311e17..39e134cb16 100644 --- a/package/base-files/default/etc/inittab +++ b/package/base-files/default/etc/inittab @@ -1,4 +1,3 @@ ::sysinit:/etc/init.d/rcS -::shutdown:/sbin/halt tts/0::askfirst:/bin/ash --login #tts/1::askfirst:/bin/ash --login diff --git a/package/base-files/default/etc/preinit b/package/base-files/default/etc/preinit index ac9039ca71..5b676ca3ac 100755 --- a/package/base-files/default/etc/preinit +++ b/package/base-files/default/etc/preinit @@ -1,24 +1,11 @@ #!/bin/sh -. /etc/nvram.sh export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc -insmod diag -[ -f /proc/sys/diag ] && echo 0x01 > /proc/sys/diag -sleep 1 -if [ -f /proc/sys/reset ] && [ $(cat /proc/sys/reset) = 1 -o "$(nvram get failsafe)" = 1 ]; then - export FAILSAFE=true - [ -x /usr/sbin/nvram -a "$(nvram get boot_wait)" != "on" ] && { - nvram set boot_wait=on - nvram commit - } - while :; do { echo $(((X=(X+1)%8)%2)) > /proc/sys/diag; sleep $((X==0)); } done & -fi -mount_root ${FAILSAFE:+failsafe} - -# automagically run firstboot -[ -z "$FAILSAFE" -a -z "$(nvram get no_root_swap)" ] && { - { mount|grep "on / type jffs2" 1>&-; } || firstboot +[ -f /etc/preinit.arch ] && . /etc/preinit.arch +[ -z "$FAILSAFE" ] || { + echo /bin/true > /proc/sys/kernel/hotplug + telnetd -l /bin/login <> /dev/null 2>&1 } - +mount_root ${FAILSAFE:+failsafe} exec /sbin/init diff --git a/package/base-files/default/sbin/halt b/package/base-files/default/sbin/halt deleted file mode 100755 index 39eed2612e..0000000000 --- a/package/base-files/default/sbin/halt +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -/usr/bin/killall5 -9 -#umount -ar diff --git a/package/base-files/default/sbin/hotplug b/package/base-files/default/sbin/hotplug index 3500f75201..106299343a 100755 --- a/package/base-files/default/sbin/hotplug +++ b/package/base-files/default/sbin/hotplug @@ -1,4 +1,7 @@ #!/bin/sh + +# bypass the normal hotplug path for firmware loading +# would otherwise cause problems with drivers like bcm43xx [ "$1" = "firmware" -a "$ACTION" = "add" ] && { [ -f "/lib/firmware/$FIRMWARE" ] && { echo 1 > "/sys$DEVPATH/loading" @@ -8,13 +11,8 @@ exit 0 } -[ -e /tmp/.failsafe ] && { - export FAILSAFE=true -} || { - [ -e /etc/config/network ] && . /etc/config/network -} . /etc/functions.sh -. /etc/network.overrides +. /etc/config/network PATH=/bin:/sbin:/usr/bin:/usr/sbin LOGNAME=root diff --git a/package/base-files/default/sbin/ifdown b/package/base-files/default/sbin/ifdown index d0120dcbe8..0d85ca8eab 100755 --- a/package/base-files/default/sbin/ifdown +++ b/package/base-files/default/sbin/ifdown @@ -1,26 +1,18 @@ #!/bin/sh [ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh -. /etc/network.overrides -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network +. /etc/config/network debug "### ifdown $type ###" type=$1 -if_proto=$(nvram get ${type}_proto) -if=$(nvram get ${type}_ifname) +eval "if_proto=\"\${${type}_proto}\"" +eval "if=\"\${${type}_ifname}\"" +[ "${if%%[0-9]}" = "ppp" ] && eval "if=\"\${${type}_device}\"" case "$if_proto" in pppoa) hotplug_dev unregister atm0; exit 0 ;; ""|none) exit 0;; esac -[ "${if%%[0-9]*}" = "ppp" ] && if="$(nvram get ${type}_device)" - -if [ "${if%%[0-9]}" = "br" ]; then - for sif in $(nvram get ${type}_ifnames); do - hotplug_dev unregister "$sif" - done -fi - hotplug_dev unregister "$if" diff --git a/package/base-files/default/sbin/ifup b/package/base-files/default/sbin/ifup index 8ae6416685..a86a7671e8 100755 --- a/package/base-files/default/sbin/ifup +++ b/package/base-files/default/sbin/ifup @@ -1,32 +1,34 @@ #!/bin/sh [ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh -. /etc/network.overrides -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network +. /etc/config/network ifdown $1 debug "### ifup $type ###" type=$1 -if_proto=$(nvram get ${type}_proto) -if=$(nvram get ${type}_ifname) +eval "if_proto=\"\${${type}_proto}\"" +eval "if=\"\${${type}_ifname}\"" +[ "${if%%[0-9]}" = "ppp" ] && eval "if=\"\${${type}_device}\"" case "$if_proto" in pppoa) hotplug_dev register atm0; exit 0 ;; pppoe) - ifconfig nas0 2>&- >&- || { - hotplug_dev register atm0 - exit 0 + # PPPoE over ATM + [ "$if" = "nas0" ] && { + ifconfig nas0 2>&- >&- || { + hotplug_dev register atm0 + exit 0 + } } ;; none|"") exit 0;; esac -[ "${if%%[0-9]*}" = "ppp" ] && if="$(nvram get ${type}_device)" - if [ "${if%%[0-9]}" = "br" ]; then - for sif in $(nvram get ${type}_ifnames); do + eval "ifnames=\"\${${type}_ifnames}\"" + for sif in $ifnames; do hotplug_dev register "$sif" done else diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 427ff0444f..38252e83fe 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,40 +1,34 @@ #!/bin/sh -. /etc/nvram.sh -is_clean() { - grep Broadcom /proc/cpuinfo 2>&- >&- || return 0 - OFFSET="$((0x$(dd if=/dev/mtdblock/1 bs=1 skip=$((0x14)) count=2 2>&- | hexdump | grep 0000000 | cut -d ' ' -f 2) - 1))" - dd if=/dev/mtdblock/1 bs=1 skip=$OFFSET count=1 2>&- | hexdump -v | grep ' 0000' > /dev/null && return 255 || return 0 +is_dirty() { + grep Broadcom /proc/cpuinfo >&- || return 1 + OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" + return $(hexdump -v /dev/mtdblock/1 -s $OFFSET -n 1 -e '"%d"') } +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- if [ $? = 0 ] ; then if [ $(cat /proc/mtd | wc -l) = 6 ]; then - echo 5 > /proc/sys/diag - mtd unlock linux mtd erase OpenWrt jffs2root --move else - mtd unlock rootfs mount -o remount,rw /dev/root / fi else - if [ -z "$(nvram get no_root_swap)" ]; then - is_clean || { - mtd erase OpenWrt - mtd unlock linux - jffs2root --clean - } - mtd unlock OpenWrt - mount -t jffs2 /dev/mtdblock/4 /jffs - pivot_root /jffs /jffs/rom - mount none /proc -t proc - mount none /dev -t devfs - umount /rom/proc /rom/dev >&- - fi + . /bin/firstboot + is_dirty + [ $? != 0 ] && { + mount /dev/mtdblock/4 /jffs + pivot /jffs /rom + } || ramoverlay fi fi -mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50% + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 mkdir -p /dev/pts mount none /dev/pts -t devpts -grep sysfs /proc/filesystems >&- && mount -t sysfs none /sys +mount -t sysfs none /sys 2>&- diff --git a/package/base-files/default/usr/lib/common.awk b/package/base-files/default/usr/lib/common.awk new file mode 100644 index 0000000000..63a8cf23d8 --- /dev/null +++ b/package/base-files/default/usr/lib/common.awk @@ -0,0 +1,66 @@ +function portstr(type, str) { + gsub(/-/, ":", str) + if (insmod_mport != 1) { + print "insmod ipt_multiport >&- 2>&-" + insmod_mport = 1 + } + if (type == "src") return " -m multiport --sports " str + else return " -m multiport --dports " str +} + +function str2ipt(str) { + str2data(str) + _cmd = "" + if (_l["src"] != "") _cmd = _cmd " -s " _l["src"] + if (_l["dest"] != "") _cmd = _cmd " -d " _l["dest"] + if (_l["proto"] != "") { + _cmd = _cmd " -p " _l["proto"] + } + # scripts need to check for proto="" and emit two rules in that case + if ((_l["proto"] == "") || (_l["proto"] == "tcp") || (_l["proto"] == "udp")) { + if (_l["sport"] != "") _cmd = _cmd portstr("src", _l["sport"]) + if (_l["dport"] != "") _cmd = _cmd portstr("dest", _l["dport"]) + } + if (_l["layer7"] != "") { + if (insmod_l7 != 1) { + print "insmod ipt_layer7 >&- 2>&-" + insmod_l7 = 1 + } + _cmd = _cmd " -m layer7 --l7proto " _l["layer7"] + } + return _cmd +} + +function str2data(str) { + delete _l + _n = split(str, _o, "[\t ]") + for (_i = 1; _i <= _n; _i++) { + _n2 = split(_o[_i], _c, "=") + if (_n2 == 2) _l[_c[1]] = _c[2] + } +} + +function bitcount(c) { + c=and(rshift(c, 1),0x55555555)+and(c,0x55555555) + c=and(rshift(c, 2),0x33333333)+and(c,0x33333333) + c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f) + c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff) + c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff) + return c +} + +function validate_netmask(nm) { + return and(-nm,compl(nm)) +} + +function ip2int(ip) { + for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x]) + return ret +} + +function int2ip(ip,ret,x) { + ret=and(ip,255) + ip=rshift(ip,8) + for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++); + return ret +} diff --git a/package/base-files/default/usr/lib/parse-config.awk b/package/base-files/default/usr/lib/parse-config.awk new file mode 100644 index 0000000000..bde5c0072b --- /dev/null +++ b/package/base-files/default/usr/lib/parse-config.awk @@ -0,0 +1,40 @@ +{ + line=$0 + gsub(/^[ \t]*/, "") + gsub(/[ \t]*$/, "") +} + +$1 == "@define" { + v[$2] = $3 +} + +$1 == "@ifdef" { + if_open = 1 + if (v[$2] != "") noprint = 0 + else noprint = 1 +} + +$1 == "@ifndef" { + if_open = 1 + if (v[$2] != "") noprint = 1 + else noprint = 0 +} + +$1 == "@else" { + if (noprint == 1) noprint = 0 + else noprint = 1 +} + +($1 !~ /^@/) && (noprint != 1) { + n=split(line "@@", a, /@@/) + for (i=1; i<=n; i++) { + if ((i % 2) == 1) printf a[i] + else printf v[a[i]] + } + print "" +} + +$1 == "@endif" { + if_open = 0 + noprint = 0 +} diff --git a/package/base-files/default/usr/share/udhcpc/default.script b/package/base-files/default/usr/share/udhcpc/default.script index 42d3eaf0c2..4604648e6b 100755 --- a/package/base-files/default/usr/share/udhcpc/default.script +++ b/package/base-files/default/usr/share/udhcpc/default.script @@ -1,18 +1,17 @@ #!/bin/sh [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 +. /etc/config/network RESOLV_CONF="/tmp/resolv.conf" hotplug_event() { - nvram show 2>&- | grep _proto=dhcp | { - while :; do - read FOO - [ -z "$FOO" ] && break - FOO="${FOO%%_*}" - [ "$(nvram get ${FOO}_ifname)" = "${interface}" ] || continue - env -i ACTION="$1" INTERFACE="${FOO}" PROTO=dhcp /sbin/hotplug iface - done - } + for ifname in lan wan wifi ${ifnames}; do + eval "proto=\"\${${ifname}_proto}\"" + eval "if=\"\${${ifname}_ifname}\"" + [ "$proto" = "dhcp" ] || continue + [ "$if" = "$interface" ] || continue + env -i ACTION="$1" INTERFACE="$ifname" PROTO=dhcp /sbin/hotplug iface + done } case "$1" in @@ -26,22 +25,20 @@ case "$1" in broadcast ${broadcast:-+} if [ -n "$router" ] ; then - - if [ "$router" != "$(route -n | grep '^0.0.0.0' | grep $interface | awk '{ print $2 }')" ] ; then - while route del default gw 0.0.0.0 dev $interface 2>&- ; do - echo "removing old default route" - done - for i in $router ; do - route add default gw $i dev $interface - done - fi + echo "deleting routers" + while route del default gw 0.0.0.0 dev $interface >&- 2>&- ; do :; done + + for i in $router ; do + echo "adding router $i" + route add default gw $i dev $interface + done fi echo -n > $RESOLV_CONF ${domain:+echo search $domain} >> $RESOLV_CONF for i in $dns ; do - echo adding dns $i - echo nameserver $i >> $RESOLV_CONF + echo "adding dns $i" + echo "nameserver $i" >> $RESOLV_CONF done hotplug_event ifup diff --git a/package/busybox/config/miscutils/Config.in b/package/busybox/config/miscutils/Config.in index 1ffb8c6536..404170188e 100644 --- a/package/busybox/config/miscutils/Config.in +++ b/package/busybox/config/miscutils/Config.in @@ -209,6 +209,12 @@ config BUSYBOX_CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA Enables the 'hdparm -d' option to get/set using_dma flag. This is dangerous stuff, so you should probably say N. +config BUSYBOX_CONFIG_LOCK + bool "lock" + default y + help + Small utility for using locks in scripts + config BUSYBOX_CONFIG_MAKEDEVS bool "makedevs" default n diff --git a/package/busybox/config/networking/Config.in b/package/busybox/config/networking/Config.in index 14e6b5f79a..7e280b76e2 100644 --- a/package/busybox/config/networking/Config.in +++ b/package/busybox/config/networking/Config.in @@ -395,14 +395,14 @@ endif config BUSYBOX_CONFIG_IPCALC bool "ipcalc" - default y + default n help ipcalc takes an IP address and netmask and calculates the resulting broadcast, network, and host range. config BUSYBOX_CONFIG_FEATURE_IPCALC_FANCY bool " Fancy IPCALC, more options, adds 1 kbyte" - default y + default n depends on BUSYBOX_CONFIG_IPCALC help Adds the options hostname, prefix and silent to the output of "ipcalc". diff --git a/package/busybox/patches/220-awk_bitops.patch b/package/busybox/patches/220-awk_bitops.patch new file mode 100644 index 0000000000..2b85729135 --- /dev/null +++ b/package/busybox/patches/220-awk_bitops.patch @@ -0,0 +1,61 @@ +--- busybox-1.00/editors/awk.c.orig 2004-09-24 05:24:27 -04:00 ++++ busybox-1.00/editors/awk.c 2006-03-08 02:16:52 -05:00 +@@ -271,7 +271,8 @@ + /* builtins */ + enum { + B_a2=0, B_ix, B_ma, B_sp, B_ss, B_ti, B_lo, B_up, +- B_ge, B_gs, B_su ++ B_ge, B_gs, B_su, ++ B_an, B_co, B_ls, B_or, B_rs, B_xo, + }; + + /* tokens and their corresponding info values */ +@@ -311,6 +312,8 @@ + "\5while" NTC + "\4else" NTC + ++ "\3and" "\5compl" "\6lshift" "\2or" ++ "\6rshift" "\3xor" + "\5close" "\6system" "\6fflush" "\5atan2" /* BUILTIN */ + "\3cos" "\3exp" "\3int" "\3log" + "\4rand" "\3sin" "\4sqrt" "\5srand" +@@ -364,6 +367,8 @@ + ST_WHILE, + 0, + ++ OC_B|B_an|P(0x83), OC_B|B_co|P(0x41), OC_B|B_ls|P(0x83), OC_B|B_or|P(0x83), ++ OC_B|B_rs|P(0x83), OC_B|B_xo|P(0x83), + OC_FBLTIN|Sx|F_cl, OC_FBLTIN|Sx|F_sy, OC_FBLTIN|Sx|F_ff, OC_B|B_a2|P(0x83), + OC_FBLTIN|Nx|F_co, OC_FBLTIN|Nx|F_ex, OC_FBLTIN|Nx|F_in, OC_FBLTIN|Nx|F_lg, + OC_FBLTIN|F_rn, OC_FBLTIN|Nx|F_si, OC_FBLTIN|Nx|F_sq, OC_FBLTIN|Nx|F_sr, +@@ -1942,6 +1947,30 @@ + strncpy(s, as[0]+i, n); + s[n] = '\0'; + setvar_p(res, s); ++ break; ++ ++ case B_an: ++ setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1])); ++ break; ++ ++ case B_co: ++ setvar_i(res, ~(long)getvar_i(av[0])); ++ break; ++ ++ case B_ls: ++ setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1])); ++ break; ++ ++ case B_or: ++ setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1])); ++ break; ++ ++ case B_rs: ++ setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1]))); ++ break; ++ ++ case B_xo: ++ setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1])); + break; + + case B_lo: diff --git a/package/busybox/patches/230-passwd_salt.patch b/package/busybox/patches/230-passwd_salt.patch new file mode 100644 index 0000000000..0322a98439 --- /dev/null +++ b/package/busybox/patches/230-passwd_salt.patch @@ -0,0 +1,13 @@ +--- busybox-1.00/loginutils/passwd.c 2006-03-26 06:07:37 -05:00 ++++ busybox-1.00/loginutils/passwd.c 2006-03-26 06:09:03 -05:00 +@@ -386,7 +386,9 @@ + bzero(orig, sizeof(orig)); + + if (algo == 1) { +- cp = pw_encrypt(pass, "$1$"); ++ char salt[6]="$1$\0\0\0"; ++ memcpy(salt+3,crypt_make_salt(),3); ++ cp = pw_encrypt(pass, salt); + } else + cp = pw_encrypt(pass, crypt_make_salt()); + bzero(pass, sizeof pass); diff --git a/package/busybox/patches/340-lock_util.patch b/package/busybox/patches/340-lock_util.patch new file mode 100644 index 0000000000..f5c0c2e89e --- /dev/null +++ b/package/busybox/patches/340-lock_util.patch @@ -0,0 +1,167 @@ +diff -urN busybox.old/include/applets.h busybox.dev/include/applets.h +--- busybox.old/include/applets.h 2006-04-05 01:06:29.000000000 +0200 ++++ busybox.dev/include/applets.h 2006-04-05 01:19:09.000000000 +0200 +@@ -167,6 +167,7 @@ + USE_LN(APPLET(ln, ln_main, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_LOADFONT(APPLET(loadfont, loadfont_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_LOADKMAP(APPLET(loadkmap, loadkmap_main, _BB_DIR_SBIN, _BB_SUID_NEVER)) ++USE_LOCK(APPLET_NOUSAGE(lock, lock_main, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_LOGGER(APPLET(logger, logger_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_LOGIN(APPLET(login, login_main, _BB_DIR_BIN, _BB_SUID_ALWAYS)) + USE_LOGNAME(APPLET(logname, logname_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +diff -urN busybox.old/miscutils/Config.in busybox.dev/miscutils/Config.in +--- busybox.old/miscutils/Config.in 2006-03-22 22:16:24.000000000 +0100 ++++ busybox.dev/miscutils/Config.in 2006-04-05 01:07:12.000000000 +0200 +@@ -209,6 +209,12 @@ + Enables the 'hdparm -d' option to get/set using_dma flag. + This is dangerous stuff, so you should probably say N. + ++config CONFIG_LOCK ++ bool "lock" ++ default y ++ help ++ Small utility for using locks in scripts ++ + config CONFIG_MAKEDEVS + bool "makedevs" + default n +diff -urN busybox.old/miscutils/Makefile.in busybox.dev/miscutils/Makefile.in +--- busybox.old/miscutils/Makefile.in 2006-03-22 22:16:24.000000000 +0100 ++++ busybox.dev/miscutils/Makefile.in 2006-04-05 01:10:50.000000000 +0200 +@@ -20,6 +20,7 @@ + MISCUTILS-$(CONFIG_EJECT) += eject.o + MISCUTILS-$(CONFIG_HDPARM) += hdparm.o + MISCUTILS-$(CONFIG_LAST) += last.o ++MISCUTILS-$(CONFIG_LOCK) += lock.o + MISCUTILS-${CONFIG_LESS} += less.o + MISCUTILS-$(CONFIG_MAKEDEVS) += makedevs.o + MISCUTILS-$(CONFIG_MOUNTPOINT) += mountpoint.o +diff -urN busybox.old/miscutils/lock.c busybox.dev/miscutils/lock.c +--- busybox.old/miscutils/lock.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox.dev/miscutils/lock.c 2006-04-05 01:07:12.000000000 +0200 +@@ -0,0 +1,125 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "busybox.h" ++ ++static int unlock = 0; ++static int shared = 0; ++static int waitonly = 0; ++static int fd; ++static char *file; ++ ++static void usage(char *name) ++{ ++ fprintf(stderr, "Usage: %s [-suw] \n" ++ " -s Use shared locking\n" ++ " -u Unlock\n" ++ " -w Wait for the lock to become free, don't acquire lock\n" ++ "\n", name); ++ exit(1); ++} ++ ++static void exit_unlock(int sig) ++{ ++ flock(fd, LOCK_UN); ++ unlink(file); ++ exit(0); ++} ++ ++static int do_unlock(void) ++{ ++ FILE *f; ++ int i; ++ ++ f = fopen(file, "r"); ++ fscanf(f, "%d", &i); ++ if (i > 0) ++ kill(i, SIGTERM); ++ fclose(f); ++ ++ return 0; ++} ++ ++static int do_lock(void) ++{ ++ int pid; ++ char pidstr[8]; ++ ++ if ((fd = open(file, O_RDWR | O_CREAT, 0700)) < 0) { ++ fprintf(stderr, "Can't open %s\n", file); ++ return 1; ++ } ++ ++ if (flock(fd, (shared ? LOCK_SH : LOCK_EX)) < 0) { ++ fprintf(stderr, "Can't lock %s\n", file); ++ return 1; ++ } ++ ++ pid = fork(); ++ ++ if (pid < 0) ++ return -1; ++ ++ if (pid == 0) { ++ signal(SIGKILL, exit_unlock); ++ signal(SIGTERM, exit_unlock); ++ signal(SIGINT, exit_unlock); ++ if (waitonly) ++ exit_unlock(0); ++ else ++ while (1) ++ sleep(1); ++ } else { ++ if (!waitonly) { ++ lseek(fd, 0, SEEK_SET); ++ ftruncate(fd, 0); ++ sprintf(pidstr, "%d\n", pid); ++ write(fd, pidstr, strlen(pidstr)); ++ close(fd); ++ } ++ ++ return 0; ++ } ++} ++ ++#ifndef CONFIG_LOCK ++int main(int argc, char **argv) ++#else ++int lock_main(int argc, char **argv) ++#endif ++{ ++ char **args = &argv[1]; ++ int c = argc - 1; ++ ++ while ((*args != NULL) && (*args)[0] == '-') { ++ char *ch = *args; ++ while (*(++ch) > 0) { ++ switch(*ch) { ++ case 'w': ++ waitonly = 1; ++ break; ++ case 's': ++ shared = 1; ++ break; ++ case 'u': ++ unlock = 1; ++ break; ++ } ++ } ++ c--; ++ args++; ++ } ++ ++ if (c != 1) ++ usage(argv[0]); ++ ++ file = *args; ++ if (unlock) ++ return do_unlock(); ++ else ++ return do_lock(); ++} diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile index 393f0f014d..88bd9f21b9 100644 --- a/package/dnsmasq/Makefile +++ b/package/dnsmasq/Makefile @@ -31,6 +31,6 @@ $(IPKG_DNSMASQ): $(STRIP) $(IDIR_DNSMASQ)/usr/sbin/* install -d -m0755 $(IDIR_DNSMASQ)/etc/init.d/ install -m0644 ./files/dnsmasq.conf $(IDIR_DNSMASQ)/etc/dnsmasq.conf - install -m0755 ./files/S50dnsmasq $(IDIR_DNSMASQ)/etc/init.d/S50dnsmasq + install -m0755 ./files/dnsmasq.init $(IDIR_DNSMASQ)/etc/init.d/S50dnsmasq $(IPKG_BUILD) $(IDIR_DNSMASQ) $(PACKAGE_DIR) diff --git a/package/dnsmasq/files/S50dnsmasq b/package/dnsmasq/files/S50dnsmasq deleted file mode 100755 index 17e331fac8..0000000000 --- a/package/dnsmasq/files/S50dnsmasq +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -. /etc/functions.sh -. /etc/network.overrides -[ "$FAILSAFE" != "true" -a -e /etc/config/network ] && . /etc/config/network - -# interface to use for DHCP -iface=lan - -ifname=$(nvram get ${iface}_ifname) -ipaddr=$(nvram get ${iface}_ipaddr) -netmask=$(nvram get ${iface}_netmask) - -# check for existing DHCP server -udhcpc -n -q -R -s /bin/true -i $ifname >&- || { - - ipaddr=$(ip2int $ipaddr) - netmask=$(ip2int ${netmask:-255.255.255.0}) - network=$((ipaddr&netmask)) - - start=$(nvram get dhcp_start) - start=$((network+${start:-100})) - end=$(nvram get dhcp_num) - end=$((start+${end:-150})) - - wanproto=$(nvram get wan_proto) - [ -z "$wanproto" -o "$wanproto" = "none" ] || wanif=$(nvram get wan_ifname) - - args="-K -F $(int2ip $start),$(int2ip $end),$(int2ip $netmask),12h ${wanif:+-I ${wanif} }" -} -dnsmasq ${args} diff --git a/package/dnsmasq/files/dnsmasq.conf b/package/dnsmasq/files/dnsmasq.conf index d4a9f082ca..7aed3a3da4 100644 --- a/package/dnsmasq/files/dnsmasq.conf +++ b/package/dnsmasq/files/dnsmasq.conf @@ -9,9 +9,15 @@ local=/lan/ domain=lan expand-hosts +@ifdef dhcp_enable +dhcp-range=@@start@@,@@end@@,@@netmask@@,@@lease@@ +@endif +@ifdef wan_ifname +except-interface=@@wan_ifname@@ +@endif + # enable dhcp (start,end,netmask,leasetime) dhcp-authoritative -#dhcp-range=192.168.1.100,192.168.1.250,255.255.255.0,12h dhcp-leasefile=/tmp/dhcp.leases # use /etc/ethers for static hosts; same format as --dhcp-host diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init new file mode 100644 index 0000000000..17ef43c3d5 --- /dev/null +++ b/package/dnsmasq/files/dnsmasq.init @@ -0,0 +1,45 @@ +#!/bin/sh +. /etc/config/network + +# The following is to automatically configure the DHCP settings +# based on config settings. Feel free to replace all this crap +# with a simple "dnsmasq" and manage everything via the +# /etc/dnsmasq.conf config file + +[ -f /etc/dnsmasq.conf ] || exit + +args="" +iface=lan +eval "ifname=\${${iface}_ifname}" + +dhcp_enable="${dhcp_enable:-1}" +dhcp_start="${dhcp_start:-100}" +dhcp_num="${dhcp_num:-50}" +dhcp_lease="${dhcp_lease:-12h}" + +# if dhcp_enable is unset and there is a dhcp server on the network already, default to dhcp_enable=0 +[ -z "$dhcp_enable" ] && udhcpc -n -q -R -s /bin/true -i $ifname >&- && dhcp_enable="${dhcp_enable:-0}" + +# dhcp_enable=0 disables the dhcp server +( + [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && { + # no existing DHCP server? + + # calculate settings + eval "ipaddr=\${${iface}_ipaddr}" + eval "netmask=\${${iface}_netmask}" + eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150}) + + # and pass the args via config parser defines + echo "@define dhcp_enable 1" + echo "@define netmask $NETMASK" + echo "@define start $START" + echo "@define end $END" + echo "@define lease ${dhcp_lease:-12h}" + } + + # ignore requests from wan interface + [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname" + + cat /etc/dnsmasq.conf +) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0 diff --git a/package/ez-ipupdate/files/ez-ipupdate.hotplug b/package/ez-ipupdate/files/ez-ipupdate.hotplug index eb7ab326c4..c305458b1a 100644 --- a/package/ez-ipupdate/files/ez-ipupdate.hotplug +++ b/package/ez-ipupdate/files/ez-ipupdate.hotplug @@ -1,10 +1,10 @@ -. /etc/functions.sh NAME=ez-ipupdate CONFIG=/etc/$NAME.conf COMMAND=/usr/sbin/$NAME + [ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && { [ -x $COMMAND ] && [ -r $CONFIG ] && { - IFNAME=$(nvram get ${INTERFACE}_ifname) - $COMMAND -c $CONFIG -i $IFNAME 2>&1 | logger -t $NAME + eval "ifname=\"\${${INTERFACE}_ifname}\"" + $COMMAND -c $CONFIG -i $ifname 2>&1 | logger -t $NAME } & } diff --git a/package/iptables/Makefile b/package/iptables/Makefile index 298a9a9e0f..f16ac8be48 100644 --- a/package/iptables/Makefile +++ b/package/iptables/Makefile @@ -72,6 +72,13 @@ $(PKG_BUILD_DIR)/.built: touch $@ $(IPKG_IPTABLES): + install -d -m0755 $(IDIR_IPTABLES)/etc/config + install -m0644 ./files/firewall.config $(IDIR_IPTABLES)/etc/config/firewall + install -d -m0755 $(IDIR_IPTABLES)/etc/init.d + install -m0755 ./files/firewall.init $(IDIR_IPTABLES)/etc/init.d/S45firewall + install -m0755 ./files/firewall.user $(IDIR_IPTABLES)/etc/ + install -d -m0755 $(IDIR_IPTABLES)/usr/lib + install -m0644 ./files/firewall.awk $(IDIR_IPTABLES)/usr/lib install -d -m0755 $(IDIR_IPTABLES)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/ install -d -m0755 $(IDIR_IPTABLES)/usr/lib/iptables diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk new file mode 100644 index 0000000000..1b63f83862 --- /dev/null +++ b/package/iptables/files/firewall.awk @@ -0,0 +1,64 @@ +BEGIN { + print "proto=\"$wan_proto\"" + print "[ -z \"$proto\" -o \"$proto\" = \"none\" ] && exit" + print "ifname=\"$wan_ifname\"" + print "[ -z \"$ifname\" ] && exit" + print "" + print "iptables -X input_$ifname 2>&- >&-" + print "iptables -N input_$ifname" + print "iptables -X forward_$ifname 2>&- >&-" + print "iptables -N forward_$ifname" + print "iptables -t nat -X prerouting_$ifname 2>&- >&-" + print "iptables -t nat -N prerouting_$ifname" + print "" + print "iptables -A input_rule -i \"$ifname\" -j input_$ifname" + print "iptables -A forwarding_rule -i \"$ifname\" -j forward_$ifname" + print "iptables -t nat -A prerouting_rule -i \"$ifname\" -j prerouting_$ifname" + print "" + FS=":" +} + +($1 == "accept") || ($1 == "drop") || ($1 == "forward") { + delete _opt + str2data($2) + if ((_l["proto"] == "") && (_l["sport"] _l["dport"] != "")) { + _opt[0] = " -p tcp" + _opt[1] = " -p udp" + } else { + _opt[0] = "" + } +} + +($1 == "accept") { + target = " -j ACCEPT" + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target + print "iptables -A input_$ifname " _opt[o] str2ipt($2) target + print "" + } +} + +($1 == "drop") { + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) " -j DROP" + print "" + } +} + +($1 == "forward") { + target = " -j DNAT --to " $3 + fwopts = "" + if ($4 != "") { + if ((_l["proto"] == "tcp") || (_l["proto"] == "udp") || (_l["proto"] == "")) { + if (_l["proto"] != "") fwopts = " -p " _l["proto"] + fwopts = fwopts " --dport " $4 + target = target ":" $4 + } + else fwopts = "" + } + for (o in _opt) { + print "iptables -t nat -A prerouting_$ifname" _opt[o] str2ipt($2) target + print "iptables -A forward_$ifname " _opt[o] " -d " $3 fwopts " -j ACCEPT" + print "" + } +} diff --git a/package/iptables/files/firewall.config b/package/iptables/files/firewall.config new file mode 100644 index 0000000000..7edd4ba4e4 --- /dev/null +++ b/package/iptables/files/firewall.config @@ -0,0 +1,46 @@ +# RULE SYNTAX: +# +# forward::[:] +# - forwards all packets matched by to , +# optionally changing the port to +# +# accept: +# - accepts all traffic matched by +# +# drop: +# - drops all traffic matched by +# +# +# MATCHING OPTIONS: +# +# src= +# - match the source ip +# +# dest= +# - match the destination ip +# +# proto= +# - match the protocol by name or number +# +# sport= +# - match the source port(s), see below for syntax +# +# dport= +# - match the destination port(s), see below for syntax +# +# +# +# PORT SYNTAX: +# +# You can enter an arbitrary list of ports and port ranges in the following format: +# - 22,53,993,1000-1024 +# +# If you don't set the protocol to tcp or udp, it will apply to both +# +# +# +# EXAMPLES: +# +# drop:dport=22 src=1.3.3.7 +# accept:proto=tcp dport=22 +# forward:dport=60168:192.168.1.2:60169 diff --git a/package/iptables/files/firewall.init b/package/iptables/files/firewall.init new file mode 100755 index 0000000000..3804d044f8 --- /dev/null +++ b/package/iptables/files/firewall.init @@ -0,0 +1,95 @@ +#!/bin/sh + +## Please make changes in /etc/firewall.user + +. /etc/config/network +WAN="$wan_ifname" +LAN="$lan_ifname" + +## CLEAR TABLES +for T in filter nat; do + iptables -t $T -F + iptables -t $T -X +done + +iptables -N input_rule +iptables -N output_rule +iptables -N forwarding_rule + +iptables -t nat -N prerouting_rule +iptables -t nat -N postrouting_rule + +### INPUT +### (connections with the router as destination) + + # base case + iptables -P INPUT DROP + iptables -A INPUT -m state --state INVALID -j DROP + iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A INPUT -j input_rule + + # allow + [ -z "$WAN" ] || iptables -A INPUT -i \! $WAN -j ACCEPT # allow from lan/wifi interfaces + iptables -A INPUT -p icmp -j ACCEPT # allow ICMP + iptables -A INPUT -p gre -j ACCEPT # allow GRE + + # reject (what to do with anything not allowed earlier) + iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable + +### OUTPUT +### (connections with the router as source) + + # base case + iptables -P OUTPUT DROP + iptables -A OUTPUT -m state --state INVALID -j DROP + iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A OUTPUT -j output_rule + + # allow + iptables -A OUTPUT -j ACCEPT #allow everything out + + # reject (what to do with anything not allowed earlier) + iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable + +### FORWARDING +### (connections routed through the router) + + # base case + iptables -P FORWARD DROP + iptables -A FORWARD -m state --state INVALID -j DROP + iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu + iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A FORWARD -j forwarding_rule + + # allow + iptables -A FORWARD -i br0 -o br0 -j ACCEPT + [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT + + # reject (what to do with anything not allowed earlier) + # uses the default -P DROP + +### MASQ + iptables -t nat -A PREROUTING -j prerouting_rule + iptables -t nat -A POSTROUTING -j postrouting_rule + [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE + +## USER RULES +[ -f /etc/firewall.user ] && . /etc/firewall.user +[ -n "$WAN" -a -e /etc/config/firewall ] && { + awk -f /usr/lib/common.awk -f /usr/lib/firewall.awk /etc/config/firewall | ash +} diff --git a/package/iptables/files/firewall.user b/package/iptables/files/firewall.user new file mode 100755 index 0000000000..f13f50bf66 --- /dev/null +++ b/package/iptables/files/firewall.user @@ -0,0 +1,31 @@ +#!/bin/sh +. /etc/config/network + +WAN="$wan_ifname" +LAN="$lan_ifname" + +iptables -F input_rule +iptables -F output_rule +iptables -F forwarding_rule +iptables -t nat -F prerouting_rule +iptables -t nat -F postrouting_rule + +### BIG FAT DISCLAIMER +## The "-i $WAN" is used to match packets that come in via the $WAN interface. +## it WILL NOT MATCH packets sent from the $WAN ip address -- you won't be able +## to see the effects from within the LAN. + +### Open port to WAN +## -- This allows port 22 to be answered by (dropbear on) the router +# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT +# iptables -A input_rule -i $WAN -p tcp --dport 22 -j ACCEPT + +### Port forwarding +## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2 +# iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80 +# iptables -A forwarding_rule -i $WAN -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT + +### DMZ +## -- Connections to ports not handled above will be forwarded to 192.168.1.2 +# iptables -t nat -A prerouting_rule -i $WAN -j DNAT --to 192.168.1.2 +# iptables -A forwarding_rule -i $WAN -d 192.168.1.2 -j ACCEPT diff --git a/package/linux-atm/files/br2684.init b/package/linux-atm/files/br2684.init index 88f40e76b6..242e7e5152 100644 --- a/package/linux-atm/files/br2684.init +++ b/package/linux-atm/files/br2684.init @@ -1,16 +1,14 @@ [ "${INTERFACE%%[0-9]*}" = "atm" ] && { case "$ACTION" in register) - [ "$(nvram get pppoe_atm)" = 1 ] && { - VPI=$(nvram get atm_vpi) - VCI=$(nvram get atm_vci) - case "$(nvram get atm_encaps)" in + [ "$pppoe_atm" = 1 ] && { + case "$atm_encaps" in 0|vc) ENCAPS=0 ;; 1|llc) ENCAPS=1 ;; *) ENCAPS=0 ;; esac insmod br2684 2>&- >&- - br2684ctl -c0 -e${ENCAPS} -a${VPI:-8}.${VCI:-35} & + br2684ctl -c0 -e${ENCAPS} -a${atm_vpi:-8}.${atm_vci:-35} & } ;; unregister) diff --git a/package/mtd/mtd.c b/package/mtd/mtd.c index 78d38fb6a9..23e99160a1 100644 --- a/package/mtd/mtd.c +++ b/package/mtd/mtd.c @@ -96,7 +96,7 @@ image_check_bcom(int imagefd, const char *mtd) } /* check if image fits to mtd device */ - fd = mtd_open(mtd, O_RDWR); + fd = mtd_open(mtd, O_RDWR | O_SYNC); if(fd < 0) { fprintf(stderr, "Could not open mtd device: %s\n", mtd); exit(1); @@ -113,6 +113,7 @@ image_check_bcom(int imagefd, const char *mtd) return 0; } + close(fd); return 1; } @@ -148,7 +149,7 @@ int mtd_check(char *mtd) struct mtd_info_user mtdInfo; int fd; - fd = mtd_open(mtd, O_RDWR); + fd = mtd_open(mtd, O_RDWR | O_SYNC); if(fd < 0) { fprintf(stderr, "Could not open mtd device: %s\n", mtd); return 0; @@ -171,7 +172,7 @@ mtd_unlock(const char *mtd) struct mtd_info_user mtdInfo; struct erase_info_user mtdLockInfo; - fd = mtd_open(mtd, O_RDWR); + fd = mtd_open(mtd, O_RDWR | O_SYNC); if(fd < 0) { fprintf(stderr, "Could not open mtd device: %s\n", mtd); exit(1); @@ -222,7 +223,7 @@ mtd_erase(const char *mtd) struct mtd_info_user mtdInfo; struct erase_info_user mtdEraseInfo; - fd = mtd_open(mtd, O_RDWR); + fd = mtd_open(mtd, O_RDWR | O_SYNC); if(fd < 0) { fprintf(stderr, "Could not open mtd device: %s\n", mtd); exit(1); @@ -260,8 +261,9 @@ mtd_write(int imagefd, const char *mtd, int quiet) size_t r, w, e; struct mtd_info_user mtdInfo; struct erase_info_user mtdEraseInfo; + int ret = 0; - fd = mtd_open(mtd, O_RDWR); + fd = mtd_open(mtd, O_RDWR | O_SYNC); if(fd < 0) { fprintf(stderr, "Could not open mtd device: %s\n", mtd); exit(1); @@ -318,7 +320,8 @@ mtd_write(int imagefd, const char *mtd, int quiet) } if (!quiet) fprintf(stderr, "\b\b\b\b"); - + + close(fd); return 0; } @@ -463,6 +466,8 @@ int main (int argc, char **argv) break; } + sync(); + if (boot) kill(1, 15); // send SIGTERM to init for reboot diff --git a/package/ntpclient/files/ntpclient.init b/package/ntpclient/files/ntpclient.init index c8505c5cad..a8944c60eb 100644 --- a/package/ntpclient/files/ntpclient.init +++ b/package/ntpclient/files/ntpclient.init @@ -1,9 +1,8 @@ #!/bin/sh -server=$(nvram get ntp_server) case "$ACTION" in ifup) ps x | grep '[n]tpclient' >&- || { - route -n 2>&- | grep '^0.0.0.0' >&- && /usr/sbin/ntpclient -c 1 -s -h ${server:-pool.ntp.org} & + route -n 2>&- | grep '^0.0.0.0' >&- && /usr/sbin/ntpclient -c 1 -s -h ${ntp_server:-pool.ntp.org} & } ;; ifdown) diff --git a/package/parprouted/files/parprouted.default b/package/parprouted/files/parprouted.default index 17169c4b37..7128a56a74 100755 --- a/package/parprouted/files/parprouted.default +++ b/package/parprouted/files/parprouted.default @@ -1,3 +1 @@ -LAN_IF=$(nvram get lan_ifname) -WIFI_IF=$(nvram get wifi_ifname) -OPTIONS="$LAN_IF $WIFI_IF" +OPTIONS="$lan_ifname $wifi_ifname" diff --git a/package/ppp/files/ifup.pppoa b/package/ppp/files/ifup.pppoa index baea25ebf2..277266c0f5 100644 --- a/package/ppp/files/ifup.pppoa +++ b/package/ppp/files/ifup.pppoa @@ -1,11 +1,10 @@ #!/bin/sh [ $# = 0 ] && { echo " $0 "; exit; } -. /etc/functions.sh -. /etc/network.overrides -[ -e /etc/config/network ] && . /etc/config/network +. /etc/config/network type=$1 -[ "$(nvram get ${type}_proto)" = "pppoa" ] || { +eval "proto=\"\${${type}_proto}\"" +[ "$proto" = "pppoa" ] || { echo "$0: ${type}_proto isn't pppoa" exit } @@ -14,32 +13,24 @@ for module in slhc ppp_generic pppoatm; do /sbin/insmod $module 2>&- >&- done -VPI=$(nvram get atm_vpi) -VCI=$(nvram get atm_vci) -USERNAME=$(nvram get ppp_username) -PASSWORD=$(nvram get ppp_passwd) -KEEPALIVE=$(nvram get ppp_redialperiod) -KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 1 lcp-echo-failure $KEEPALIVE} -DEMAND=$(nvram get ppp_demand) -case "$DEMAND" in +KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} +case "$ppp_demand" in on|1|enabled) - DEMAND=$(nvram get ppp_idletime) - DEMAND=${IDLETIME:+demand idle $IDLETIME} + DEMAND=${ppp_idletime:+demand idle $ppp_idletime} [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} ;; *) DEMAND="persist";; esac -MTU=$(nvram get ppp_mtu) -MTU=${MTU:-1500} +MTU=${ppp_mtu:-1500} /usr/sbin/pppd \ - plugin pppoatm.so ${VPI:-8}.${VCI:-35} \ + plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \ usepeerdns \ defaultroute \ linkname $type \ ipparam $type \ - user "$USERNAME" \ - password "$PASSWORD" \ + user "$ppp_username" \ + password "$ppp_passwd" \ mtu $MTU mru $MTU \ $DEMAND \ $KEEPALIVE diff --git a/package/ppp/files/ifup.pppoe b/package/ppp/files/ifup.pppoe index 1f9cd739c3..0f3c14ed0d 100644 --- a/package/ppp/files/ifup.pppoe +++ b/package/ppp/files/ifup.pppoe @@ -1,11 +1,10 @@ #!/bin/sh [ $# = 0 ] && { echo " $0 "; exit; } -. /etc/functions.sh -. /etc/network.overrides -[ -e /etc/config/network ] && . /etc/config/network +. /etc/config/network type=$1 -[ "$(nvram get ${type}_proto)" = "pppoe" ] || { +eval "proto=\"\${${type}_proto}\"" +[ "$proto" = "pppoe" ] || { echo "$0: ${type}_proto isn't pppoe" exit } @@ -14,22 +13,16 @@ for module in slhc ppp_generic pppox pppoe; do /sbin/insmod $module 2>&- >&- done -IFNAME=$(nvram get ${type}_device) -USERNAME=$(nvram get ppp_username) -PASSWORD=$(nvram get ppp_passwd) -KEEPALIVE=$(nvram get ppp_redialperiod) -KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 1 lcp-echo-failure $KEEPALIVE} -DEMAND=$(nvram get ppp_demand) -case "$DEMAND" in +eval "IFNAME=\"\${${type}_device}\"" +KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} +case "$ppp_demand" in on|1|enabled) - DEMAND=$(nvram get ppp_idletime) - DEMAND=${IDLETIME:+demand idle $IDLETIME} + DEMAND=${ppp_idletime:+demand idle $ppp_idletime} [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} ;; *) DEMAND="persist";; esac -MTU=$(nvram get ppp_mtu) -MTU=${MTU:-1492} +MTU=${ppp_mtu:-1492} ifconfig $IFNAME up /usr/sbin/pppd \ @@ -39,8 +32,8 @@ ifconfig $IFNAME up defaultroute \ linkname $type \ ipparam $type \ - user "$USERNAME" \ - password "$PASSWORD" \ + user "$ppp_username" \ + password "$ppp_passwd" \ mtu $MTU mru $MTU \ $DEMAND \ $KEEPALIVE \ diff --git a/package/pptp/files/ifup.pptp b/package/pptp/files/ifup.pptp index 9b1ac07c26..a9bc579b56 100644 --- a/package/pptp/files/ifup.pptp +++ b/package/pptp/files/ifup.pptp @@ -1,8 +1,13 @@ #!/bin/sh -. /etc/functions.sh +[ $# = 0 ] && { echo " $0 "; exit; } +. /etc/config/network type=$1 -[ "$(nvram get ${type}_proto)" = "pptp" ] || exit +eval "proto=\"\${${type}_proto}\"" +[ "$proto" = "pptp" ] || { + echo "$0: ${type}_proto isn't pptp" + exit +} [ -d "/var/lock" ] || mkdir -p /var/lock || exit 1 @@ -10,35 +15,21 @@ for module in slhc ppp_generic ppp_async ip_gre; do /sbin/insmod $module 2>&- >&- done -PPTP_PROTO="$(nvram get pptp_proto)" -[ "$PPTP_PROTO" = "static" ] || PPTP_PROTO="" -PPTP_PROTO="${PPTP_PROTO:-dhcp}" -IP=$(nvram get pptp_server_ip) -USERNAME=$(nvram get ppp_username) -PASSWORD=$(nvram get ppp_passwd) -KEEPALIVE=$(nvram get ppp_redialperiod) -KEEPALIVE=${KEEPALIVE:+lcp-echo-interval 10 lcp-echo-failure $KEEPALIVE} -DEMAND=$(nvram get ppp_demand) -case "$DEMAND" in +KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} +case "$ppp_demand" in on|1|enabled) - DEMAND=$(nvram get ppp_idletime) - DEMAND=${IDLETIME:+demand idle $IDLETIME} + DEMAND=${ppp_idletime:+demand idle $ppp_idletime} [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} ;; *) DEMAND="persist";; esac -MTU=$(nvram get ppp_mtu) -MTU=${MTU:-1452} +MTU=${ppp_mtu:-1452} -do_ifup $PPTP_PROTO $type - -# hack for some buggy ISPs -NETMASK=$(nvram get ${type}_netmask) -IFNAME=$(nvram get ${type}_device) -[ -z "$NETMASK" -o -z "$IFNAME" ] || ifconfig $IFNAME netmask $NETMASK +[ "$pptp_proto" = "static" ] || pptp_proto="dhcp" +do_ifup $pptp_proto $type /usr/sbin/pppd \ - pty "/usr/sbin/pptp $IP --loglevel 0 --nolaunchpppd" \ + pty "/usr/sbin/pptp $pptp_server_ip --loglevel 0 --nolaunchpppd" \ file /etc/ppp/options.pptp \ connect /bin/true \ usepeerdns \ @@ -46,8 +37,8 @@ IFNAME=$(nvram get ${type}_device) replacedefaultroute \ linkname "$type" \ ipparam "$type" \ - user "$USERNAME" \ - password "$PASSWORD" \ + user "$ppp_username" \ + password "$ppp_passwd" \ mtu $MTU mru $MTU \ $DEMAND \ $KEEPALIVE diff --git a/target/linux/package/base-files/files/ar7-2.4/etc/network.overrides b/target/linux/package/base-files/files/ar7-2.4/etc/network.overrides deleted file mode 100644 index 9aa74aa934..0000000000 --- a/target/linux/package/base-files/files/ar7-2.4/etc/network.overrides +++ /dev/null @@ -1,28 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -DEFAULT_lan_proto="static" -DEFAULT_lan_ifname="br0" -DEFAULT_lan_ifnames="eth0" -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -DEFAULT_lan_hwaddr=`echo $(strings /dev/mtdblock/3 | grep -A1 maca | grep :)` -DEFAULT_lan_hwaddr=${DEFAULT_lan_hwaddr##* } -DEFAULT_lan_hwaddr=${DEFAULT_lan_hwaddr:-${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}} - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname=${DEFAULT_lan_proto} - lan_ifnames=${FAILSAFE_ifnames:-${DEFAULT_lan_ifnames}} - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} diff --git a/target/linux/package/base-files/files/aruba-2.6/etc/network.overrides b/target/linux/package/base-files/files/aruba-2.6/etc/network.overrides deleted file mode 100644 index 2df6acdd3d..0000000000 --- a/target/linux/package/base-files/files/aruba-2.6/etc/network.overrides +++ /dev/null @@ -1,26 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -DEFAULT_lan_proto="static" -DEFAULT_lan_ifname="br0" -DEFAULT_lan_ifnames="eth0" -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -# DEFAULT_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"} - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname=${DEFAULT_lan_proto} - lan_ifnames=${FAILSAFE_ifnames:-${DEFAULT_lan_ifnames}} - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} diff --git a/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S04nvram b/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S04nvram new file mode 100755 index 0000000000..4de124735b --- /dev/null +++ b/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S04nvram @@ -0,0 +1,66 @@ +#!/bin/sh +# NVRAM setup +# +# This file handles the NVRAM quirks of various hardware. + +# WGT634u +grep 'mtd0: 00060000' /proc/mtd 2>&- >&- && exit + +alias debug=${DEBUG:-:} + +nvram_default() { + [ -z "$(nvram get $1)" ] && nvram set "$1=$2" +} + +nvram_set() { # for the linksys fixup part + [ "$(nvram get "$1")" = "$2" -a "$2" != "" ] || { + COMMIT=1 + /usr/sbin/nvram set "$1=$2" + } +} + +# work around braindead CFE defaults in linksys routers +boardtype=$(nvram get boardtype) +boardnum=$(nvram get boardnum) +boardflags=$(($(nvram get boardflags))) +adm_switch="$(( ($boardflags & 0x80) >> 7 ))" + +case "$(( $boardtype ))" in + "1800") #0x708 + if [ "$adm_switch" = 0 ]; then + nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" + [ "$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 + ;; + "1127") #0x467 + nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" + [ "$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 + +# hack for some motorola routers +nvram unset wl0gpio0 + +[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && { + # if default wifi mac, set two higher than the lan mac + nvram set il0macaddr=$(nvram get et0macaddr| + awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') +} diff --git a/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05netconfig b/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05netconfig index 51be73b5ba..6a626f54a5 100755 --- a/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05netconfig +++ b/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05netconfig @@ -50,7 +50,7 @@ END { c["vlan1ports"] = "4 5" c["lan_ifnames"] = "vlan0 ath0" } - if (nvram["boardtype"] == "0x0467") { + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { c["vlan0ports"] = "0 1 2 3 5*" c["vlan1ports"] = "4 5" } @@ -101,6 +101,8 @@ END { print "" print "## PPP over Ethernet and PPTP" print "# wan_ifname=\"ppp0\"" + print "# ppp_username=\"my_username\"" + print "# ppp_passwd=\"my_password\"" print "# pptp_server_ip=\"192.168.0.1\"" } ' > /etc/config/network diff --git a/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05nvram b/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05nvram deleted file mode 100755 index b985948d78..0000000000 --- a/target/linux/package/base-files/files/brcm-2.4/etc/init.d/S05nvram +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/sh -# NVRAM setup -# -# This file handles the NVRAM quirks of various hardware. - -. /etc/network.overrides -alias debug=${DEBUG:-:} - -# WGT634u -grep 'mtd0: 00060000' /proc/mtd 2>&- >&- && exit - -remap () { - for type in lan wifi wan pppoe - do - for s in '' s - do - eval nvram set ${type}_ifname$s=\"$(nvram get ${type}_ifname$s|sed s/$1/$2/g)\" - done - done -} - -nvram_default() { - [ -z "$(nvram get $1)" ] && nvram set "$1=$2" -} - -nvram_set() { # for the linksys fixup part - [ "$(nvram get "$1")" = "$2" -a "$2" != "" ] || { - COMMIT=1 - /usr/sbin/nvram set "$1=$2" - } -} - -# work around braindead CFE defaults in linksys routers -boardtype=$(nvram get boardtype) -boardflags=$(($(nvram get boardflags))) -[ "$boardtype" = "bcm94710dev" ] && boardtype="0xdeadbeef" -adm_switch="$(( ($boardflags & 0x80) >> 7 ))" -case "$(( $boardtype ))" in - "$((0x708))") - if [ "$adm_switch" = 0 ]; then - nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" - [ "$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 "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" - [ "$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" - -# hacks for wrt54g 1.x hardware -[ "$(nvram get boardnum)" = "42" \ --a "$(nvram get boardtype)" = "bcm94710dev" ] && { - debug "### wrt54g 1.x hack ###" - nvram set vlan1hwname="et0" - nvram set vlan2hwname="et0" - remap eth0 vlan2 - remap eth1 vlan1 -} - -# hacks for asus wl-500g deluxe -[ "$(nvram get boardtype)" = "bcm95365r" \ --a "$(nvram get boardnum)" = "45" ] && { - debug "### wl-500g deluxe hacks ###" - nvram set vlan0hwname="et0" - nvram set vlan1hwname="et0" - remap eth0.1 vlan0 - remap eth0 vlan1 - - # set up the vlan*ports variables for the asus wl-500g deluxe - # if they don't already exist - nvram_default vlan0ports "1 2 3 4 5*" - nvram_default vlan1ports "0 5" -} - -# hacks for asus -case "$(nvram get productid)" in - WL300g) - debug "### wl-300g hacks ###" - nvram set lan_ifnames="eth0 eth2" - nvram set wan_ifname="none" - ;; - WLHDD) - debug "### wl-hdd hacks ###" - nvram set lan_ifnames="eth1 eth2" - nvram set wan_ifname="none" - ;; - *) - # wl-500g defaults. these are placed here, because WL-HDD and WL-300g - # might have the same nvram settings. - [ "$(nvram get boardnum)" = "asusX" \ - -a "$(nvram get boardtype)" = "bcm94710dev" ] && { - nvram_default wan_device "eth1" - } - ;; -esac - -# hacks for wap54g hardware -[ "$(nvram get boardnum)" = "2" \ --o "$(nvram get boardnum)" = "1024" ] && { - debug "### wap54g hack ###" - nvram set wan_ifname="none" -} - -# hacks for buffalo wla2-g54l -[ "$(nvram get boardnum)" = "00" \ --a "$(nvram get product_name)" = "Product_name" \ --o "$(nvram get product_name)" = "WLA2-G54L" ] && { - debug "### wla2-g54l hacks ###" - nvram set wan_ifname="none" - nvram set lan_ifnames="vlan0" -} - -# needed at least for wrt54gs v1.1 and wrt54g v2.0, v2.2 -[ \! -z "$(nvram get boardrev)" ] && { - nvram_default wl0id 0x4320 -} - -# defaults -nvram_default lan_ifname "br0" -nvram_default lan_ifnames "$FAILSAFE_ifnames" - -nvram_default wan_ifname "vlan1" -nvram_default wan_device "vlan1" -nvram_default wan_proto "dhcp" - -nvram_default wl0_ssid OpenWrt -nvram_default wl0_mode ap -nvram_default wl0_infra 1 -nvram_default wl0_radio 1 - -WAN_PROTO="$(nvram get wan_proto)" -WAN_IFNAME="$(nvram get wan_ifname)" -case "$WAN_PROTO" in - pp*) [ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] || nvram set wan_ifname=ppp0;; - *) [ "${WAN_IFNAME%%[0-9]*}" = "ppp" ] && nvram set wan_ifname="$(nvram get wan_device)";; -esac - -[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && { - # if default wifi mac, set two higher than the lan mac - nvram set il0macaddr=$(nvram get et0macaddr| - awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') -} - diff --git a/target/linux/package/base-files/files/brcm-2.4/etc/network.overrides b/target/linux/package/base-files/files/brcm-2.4/etc/network.overrides deleted file mode 100644 index 72ef012653..0000000000 --- a/target/linux/package/base-files/files/brcm-2.4/etc/network.overrides +++ /dev/null @@ -1,41 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -# hacks for wrt54g 1.x hardware -[ "$(nvram get boardnum)" = "42" \ --a "$(nvram get boardtype)" = "bcm94710dev" ] && FAILSAFE_ifnames="vlan0 vlan2 eth2" - -# hacks for asus wl-500g deluxe -[ "$(nvram get boardtype)" = "bcm95365r" \ --a "$(nvram get boardnum)" = "45" ] && FAILSAFE_ifnames="vlan0 eth1" - -# hacks for wap54g hardware -[ "$(nvram get boardnum)" = "2" \ --o "$(nvram get boardnum)" = "1024" ] && FAILSAFE_ifnames="eth0 eth1" - -# hack for asus wl-500g hardware -[ "$(nvram get boardnum)" = "asusX" \ --a "$(nvram get boardtype)" = "bcm94710dev" ] && FAILSAFE_ifnames="eth0 eth1 eth2" - -FAILSAFE_ifnames=${FAILSAFE_ifnames:-"vlan0 eth1 eth2"} - -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -DEFAULT_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"} - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname="br0" - lan_ifnames=$FAILSAFE_ifnames - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} diff --git a/target/linux/package/base-files/files/brcm-2.6/etc/init.d/S05netconfig b/target/linux/package/base-files/files/brcm-2.6/etc/init.d/S05netconfig index 51be73b5ba..6a626f54a5 100755 --- a/target/linux/package/base-files/files/brcm-2.6/etc/init.d/S05netconfig +++ b/target/linux/package/base-files/files/brcm-2.6/etc/init.d/S05netconfig @@ -50,7 +50,7 @@ END { c["vlan1ports"] = "4 5" c["lan_ifnames"] = "vlan0 ath0" } - if (nvram["boardtype"] == "0x0467") { + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { c["vlan0ports"] = "0 1 2 3 5*" c["vlan1ports"] = "4 5" } @@ -101,6 +101,8 @@ END { print "" print "## PPP over Ethernet and PPTP" print "# wan_ifname=\"ppp0\"" + print "# ppp_username=\"my_username\"" + print "# ppp_passwd=\"my_password\"" print "# pptp_server_ip=\"192.168.0.1\"" } ' > /etc/config/network diff --git a/target/linux/package/base-files/files/brcm-2.6/etc/network.overrides b/target/linux/package/base-files/files/brcm-2.6/etc/network.overrides deleted file mode 100644 index ded748b260..0000000000 --- a/target/linux/package/base-files/files/brcm-2.6/etc/network.overrides +++ /dev/null @@ -1,31 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -DEFAULT_lan_proto="static" -DEFAULT_lan_ifname="br0" -DEFAULT_lan_ifnames="vlan0 ath0" -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -DEFAULT_lan_hwaddr=${DEFAULT_lan_hwaddr:-${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"}} -DEFAULT_vlan0hwname="et0" -DEFAULT_vlan1hwname="et0" -DEFAULT_et0macaddr=$(ifconfig eth0| awk '/eth0/ {print $5 }') -DEFAULT_wan_proto="dhcp" -DEFAULT_wan_ifname="vlan1" - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname=${DEFAULT_lan_proto} - lan_ifnames=${FAILSAFE_ifnames:-${DEFAULT_lan_ifnames}} - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} diff --git a/target/linux/package/base-files/files/x86-2.4/etc/network.overrides b/target/linux/package/base-files/files/x86-2.4/etc/network.overrides deleted file mode 100644 index e857d5b5f1..0000000000 --- a/target/linux/package/base-files/files/x86-2.4/etc/network.overrides +++ /dev/null @@ -1,26 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -DEFAULT_lan_proto="static" -DEFAULT_lan_ifname="br0" -DEFAULT_lan_ifnames="eth0" -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -DEFAULT_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"} - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname=${DEFAULT_lan_proto} - lan_ifnames=${FAILSAFE_ifnames:-${DEFAULT_lan_ifnames}} - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} diff --git a/target/linux/package/base-files/files/x86-2.6/etc/network.overrides b/target/linux/package/base-files/files/x86-2.6/etc/network.overrides deleted file mode 100644 index e857d5b5f1..0000000000 --- a/target/linux/package/base-files/files/x86-2.6/etc/network.overrides +++ /dev/null @@ -1,26 +0,0 @@ -# NVRAM overrides -# -# This file handles the NVRAM quirks of various hardware. -# THIS FILE IS NOT A REPLACEMENT FOR NVRAM - -# Load sysconf defaults -[ -f /etc/sysconf ] && . /etc/sysconf - -DEFAULT_lan_proto="static" -DEFAULT_lan_ifname="br0" -DEFAULT_lan_ifnames="eth0" -DEFAULT_lan_ipaddr=${BR2_SYSCONF_FAILSAFE_IP:-"192.168.1.1"} -DEFAULT_lan_netmask=${BR2_SYSCONF_FAILSAFE_NETMASK:-"255.255.255.0"} -DEFAULT_lan_hwaddr=${BR2_SYSCONF_FAILSAFE_MAC:-"00:0B:AD:0A:DD:00"} - -# failsafe if reset is held -[ "$FAILSAFE" = "true" ] && { - echo "### YOU ARE IN FAILSAFE MODE ####" - lan_ifname=${DEFAULT_lan_proto} - lan_ifnames=${FAILSAFE_ifnames:-${DEFAULT_lan_ifnames}} - lan_ipaddr=$DEFAULT_lan_ipaddr - lan_netmask=$DEFAULT_lan_netmask - lan_hwaddr=$DEFAULT_lan_hwaddr - wan_ifname="none" - wifi_ifname="none" -} -- cgit v1.2.3 From ed5ef674d100ca0ffa8bc00160718f69af5515c3 Mon Sep 17 00:00:00 2001 From: nbd Date: Tue, 27 Jun 2006 00:36:13 +0000 Subject: add copyright headers to base-files scripts and config files git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4090 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/ar7-2.4/bin/firstboot | 2 +- package/base-files/aruba-2.6/etc/config/network | 2 ++ package/base-files/au1000-2.6/etc/config/network | 1 + package/base-files/au1000-2.6/sbin/mount_root | 2 ++ package/base-files/brcm-2.4/bin/firstboot | 2 +- package/base-files/brcm-2.4/etc/config/wireless | 2 ++ package/base-files/brcm-2.4/etc/hotplug.d/net/09-net | 2 ++ package/base-files/brcm-2.4/etc/init.d/S05netconfig | 2 ++ package/base-files/brcm-2.4/etc/preinit | 2 ++ package/base-files/brcm-2.4/sbin/mount_root | 2 ++ package/base-files/brcm-2.6/bin/firstboot | 2 +- package/base-files/brcm-2.6/etc/hotplug.d/net/09-net | 2 ++ package/base-files/brcm-2.6/etc/init.d/S05netconfig | 2 ++ package/base-files/brcm-2.6/etc/preinit | 2 ++ package/base-files/brcm-2.6/sbin/mount_root | 2 ++ package/base-files/default/bin/ipcalc | 1 + package/base-files/default/bin/login | 2 ++ package/base-files/default/etc/functions.sh | 2 ++ package/base-files/default/etc/hotplug.d/net/10-net | 2 ++ package/base-files/default/etc/hotplug.d/usb/01-mount | 3 +++ package/base-files/default/etc/init.d/S10boot | 2 ++ package/base-files/default/etc/init.d/S50httpd | 2 ++ package/base-files/default/etc/init.d/S50telnet | 2 ++ package/base-files/default/etc/init.d/S60cron | 2 ++ package/base-files/default/etc/init.d/S98done | 2 ++ package/base-files/default/etc/init.d/rcS | 2 ++ package/base-files/default/etc/nvram.sh | 2 ++ package/base-files/default/sbin/hotplug | 1 + package/base-files/default/sbin/ifdown | 2 ++ package/base-files/default/sbin/ifup | 2 ++ package/base-files/default/sbin/mount_root | 2 ++ package/base-files/default/sbin/wifi | 2 ++ package/base-files/default/usr/lib/common.awk | 2 ++ package/base-files/default/usr/lib/parse-config.awk | 2 ++ package/base-files/rb532-2.6/etc/config/network | 1 + package/base-files/sibyte-2.6/etc/config/network | 1 + package/base-files/sibyte-2.6/etc/inittab | 2 ++ package/base-files/x86-2.4/etc/config/network | 1 + package/base-files/x86-2.6/etc/config/network | 1 + package/base-files/xscale-2.6/etc/config/network | 1 + 40 files changed, 70 insertions(+), 3 deletions(-) (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/ar7-2.4/bin/firstboot b/package/base-files/ar7-2.4/bin/firstboot index 955423be09..774bbc754b 100755 --- a/package/base-files/ar7-2.4/bin/firstboot +++ b/package/base-files/ar7-2.4/bin/firstboot @@ -1,5 +1,5 @@ #!/bin/sh -# $Id$ +# Copyright (C) 2006 OpenWrt.org rom=$(awk '/squashfs/ {print $2}' /proc/mounts) jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) diff --git a/package/base-files/aruba-2.6/etc/config/network b/package/base-files/aruba-2.6/etc/config/network index f60332cd8c..65797797ee 100644 --- a/package/base-files/aruba-2.6/etc/config/network +++ b/package/base-files/aruba-2.6/etc/config/network @@ -1,4 +1,6 @@ # Network configuration file +# Copyright (C) 2006 OpenWrt.org + ## LAN configuration lan_ifname="eth0" diff --git a/package/base-files/au1000-2.6/etc/config/network b/package/base-files/au1000-2.6/etc/config/network index 2cc9e26717..576677bf7c 100644 --- a/package/base-files/au1000-2.6/etc/config/network +++ b/package/base-files/au1000-2.6/etc/config/network @@ -1,4 +1,5 @@ # Network configuration file +# Copyright (C) 2006 OpenWrt.org ## LAN configuration lan_ifname="br0" diff --git a/package/base-files/au1000-2.6/sbin/mount_root b/package/base-files/au1000-2.6/sbin/mount_root index bc4165ca30..718394ca4c 100755 --- a/package/base-files/au1000-2.6/sbin/mount_root +++ b/package/base-files/au1000-2.6/sbin/mount_root @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + mount none /proc -t proc size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- || return 1 OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" diff --git a/package/base-files/brcm-2.6/bin/firstboot b/package/base-files/brcm-2.6/bin/firstboot index 28189780bd..d37ce4f90b 100755 --- a/package/base-files/brcm-2.6/bin/firstboot +++ b/package/base-files/brcm-2.6/bin/firstboot @@ -1,5 +1,5 @@ #!/bin/sh -# $Id$ +# Copyright (C) 2006 OpenWrt.org rom=$(awk '/squashfs/ {print $2}' /proc/mounts) jffs=$(awk '/jffs2/ {print $2}' /proc/mounts) diff --git a/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net b/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net index 8bbf604df8..90a92bd2b0 100644 --- a/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net +++ b/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + setup_eth() { [ -d /proc/switch ] || { diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/S05netconfig index 6a626f54a5..0f53c0c9c9 100755 --- a/package/base-files/brcm-2.6/etc/init.d/S05netconfig +++ b/package/base-files/brcm-2.6/etc/init.d/S05netconfig @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + [ -e /etc/config/network ] && exit 0 mkdir -p /etc/config diff --git a/package/base-files/brcm-2.6/etc/preinit b/package/base-files/brcm-2.6/etc/preinit index 5b676ca3ac..fb13e107e5 100755 --- a/package/base-files/brcm-2.6/etc/preinit +++ b/package/base-files/brcm-2.6/etc/preinit @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc diff --git a/package/base-files/brcm-2.6/sbin/mount_root b/package/base-files/brcm-2.6/sbin/mount_root index a3ada58908..e3bdd3655c 100755 --- a/package/base-files/brcm-2.6/sbin/mount_root +++ b/package/base-files/brcm-2.6/sbin/mount_root @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + is_dirty() { grep Broadcom /proc/cpuinfo >&- || return 1 OFFSET="$(($(hexdump -v /dev/mtdblock/1 -s 20 -n 2 -e '"%d"')-1))" diff --git a/package/base-files/default/bin/ipcalc b/package/base-files/default/bin/ipcalc index 318980e5a2..23af6a0c3b 100755 --- a/package/base-files/default/bin/ipcalc +++ b/package/base-files/default/bin/ipcalc @@ -1,4 +1,5 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org awk -f /usr/lib/common.awk -f - $* <&- 2>&- [ "$?" = "0" -a -z "$FAILSAFE" ] && { diff --git a/package/base-files/default/etc/functions.sh b/package/base-files/default/etc/functions.sh index 3010196171..a7f7c42e22 100755 --- a/package/base-files/default/etc/functions.sh +++ b/package/base-files/default/etc/functions.sh @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + alias debug=${DEBUG:-:} # newline diff --git a/package/base-files/default/etc/hotplug.d/net/10-net b/package/base-files/default/etc/hotplug.d/net/10-net index b68ec1be28..f306ae342d 100644 --- a/package/base-files/default/etc/hotplug.d/net/10-net +++ b/package/base-files/default/etc/hotplug.d/net/10-net @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + find_name() { for ifname in lan wan wifi ${ifnames}; do diff --git a/package/base-files/default/etc/hotplug.d/usb/01-mount b/package/base-files/default/etc/hotplug.d/usb/01-mount index c28ada204e..c4d356b0da 100644 --- a/package/base-files/default/etc/hotplug.d/usb/01-mount +++ b/package/base-files/default/etc/hotplug.d/usb/01-mount @@ -1,3 +1,6 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + mount_storage() { cd /dev/discs for dev in disc*; do diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index e0d15db0e0..cb5c6ac4a7 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + . /etc/functions.sh [ -f /proc/mounts ] || /sbin/mount_root diff --git a/package/base-files/default/etc/init.d/S50httpd b/package/base-files/default/etc/init.d/S50httpd index a1b883d0a8..d278519e98 100755 --- a/package/base-files/default/etc/init.d/S50httpd +++ b/package/base-files/default/etc/init.d/S50httpd @@ -1,2 +1,4 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + [ -d /www ] && httpd -p 80 -h /www -r OpenWrt diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/S50telnet index fb9687c8aa..25242bdef8 100755 --- a/package/base-files/default/etc/init.d/S50telnet +++ b/package/base-files/default/etc/init.d/S50telnet @@ -1,2 +1,4 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/S60cron index 1752734267..6df9b7dee9 100755 --- a/package/base-files/default/etc/init.d/S60cron +++ b/package/base-files/default/etc/init.d/S60cron @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + mkdir -p /var/spool/cron ln -s /etc/crontabs /var/spool/cron/crontabs crond -c /etc/crontabs diff --git a/package/base-files/default/etc/init.d/S98done b/package/base-files/default/etc/init.d/S98done index 5d5ab49ce3..a1ea5ad438 100755 --- a/package/base-files/default/etc/init.d/S98done +++ b/package/base-files/default/etc/init.d/S98done @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + sysctl -p >&- # automagically run firstboot diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index b38e449781..dad989fe09 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + ${FAILSAFE:+exit} [ -f /etc/config/network ] && . /etc/config/network diff --git a/package/base-files/default/etc/nvram.sh b/package/base-files/default/etc/nvram.sh index 4d39a10204..ddbd88b52f 100644 --- a/package/base-files/default/etc/nvram.sh +++ b/package/base-files/default/etc/nvram.sh @@ -1,4 +1,6 @@ #!/bin/ash +# Copyright (C) 2006 OpenWrt.org + # allow env to override nvram nvram () { diff --git a/package/base-files/default/sbin/hotplug b/package/base-files/default/sbin/hotplug index 106299343a..afe52a446f 100755 --- a/package/base-files/default/sbin/hotplug +++ b/package/base-files/default/sbin/hotplug @@ -1,4 +1,5 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org # bypass the normal hotplug path for firmware loading # would otherwise cause problems with drivers like bcm43xx diff --git a/package/base-files/default/sbin/ifdown b/package/base-files/default/sbin/ifdown index 0d85ca8eab..50ffee5304 100755 --- a/package/base-files/default/sbin/ifdown +++ b/package/base-files/default/sbin/ifdown @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + [ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh . /etc/config/network diff --git a/package/base-files/default/sbin/ifup b/package/base-files/default/sbin/ifup index a86a7671e8..390f960395 100755 --- a/package/base-files/default/sbin/ifup +++ b/package/base-files/default/sbin/ifup @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + [ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh . /etc/config/network diff --git a/package/base-files/default/sbin/mount_root b/package/base-files/default/sbin/mount_root index 647c25327a..81660f0067 100755 --- a/package/base-files/default/sbin/mount_root +++ b/package/base-files/default/sbin/mount_root @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) 2006 OpenWrt.org + mount none /proc -t proc size=$(awk '/Mem:/ {l=5242880;print((s=$2/2) Date: Sun, 30 Jul 2006 03:09:09 +0000 Subject: rewrite of the network scripts and configuration git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4323 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/ar7-2.4/etc/config/network | 29 +-- package/base-files/aruba-2.6/etc/config/network | 8 +- package/base-files/au1000-2.6/etc/config/network | 17 +- .../base-files/brcm-2.4/etc/hotplug.d/net/09-net | 45 ----- .../base-files/brcm-2.4/etc/init.d/S05netconfig | 70 ++----- .../base-files/brcm-2.6/etc/hotplug.d/net/09-net | 35 ---- .../base-files/brcm-2.6/etc/init.d/S05netconfig | 70 ++----- .../base-files/default/etc/hotplug.d/net/10-net | 201 ++------------------- package/base-files/default/etc/init.d/S10boot | 3 +- package/base-files/default/etc/init.d/S40network | 9 + package/base-files/default/etc/init.d/rcS | 11 +- package/base-files/default/lib/network/config.sh | 147 +++++++++++++++ package/base-files/default/sbin/hotplug | 1 - package/base-files/default/sbin/ifdown | 32 +++- package/base-files/default/sbin/ifup | 42 ++--- package/base-files/default/sbin/wifi | 7 +- .../default/usr/share/udhcpc/default.script | 14 +- package/base-files/rb532-2.6/etc/config/network | 8 +- package/base-files/sibyte-2.6/etc/config/network | 17 +- package/base-files/x86-2.4/etc/config/network | 20 +- package/base-files/x86-2.6/etc/config/network | 20 +- package/base-files/xscale-2.6/etc/config/network | 7 +- package/broadcom-wl/files/lib/wifi/broadcom.sh | 14 +- package/dnsmasq/files/dnsmasq.init | 12 +- package/iptables/files/firewall.awk | 5 +- package/iptables/files/firewall.init | 11 +- package/iptables/files/firewall.user | 5 - package/ppp/Makefile | 10 +- package/ppp/files/ifup.pppoa | 38 ---- package/ppp/files/ifup.pppoe | 43 ----- package/ppp/files/ppp.sh | 27 +++ package/ppp/files/pppoa.sh | 20 ++ package/ppp/files/pppoe.sh | 21 +++ package/ppp/files/pptp.sh | 3 + package/pptp/Makefile | 4 +- package/pptp/files/ifup.pptp | 45 ----- package/pptp/files/pptp.sh | 22 +++ package/switch/Makefile | 4 + package/switch/files/switch.sh | 33 ++++ 39 files changed, 481 insertions(+), 649 deletions(-) delete mode 100644 package/base-files/brcm-2.4/etc/hotplug.d/net/09-net delete mode 100644 package/base-files/brcm-2.6/etc/hotplug.d/net/09-net create mode 100755 package/base-files/default/etc/init.d/S40network create mode 100755 package/base-files/default/lib/network/config.sh mode change 100755 => 100644 package/iptables/files/firewall.user delete mode 100644 package/ppp/files/ifup.pppoa delete mode 100644 package/ppp/files/ifup.pppoe create mode 100644 package/ppp/files/ppp.sh create mode 100644 package/ppp/files/pppoa.sh create mode 100644 package/ppp/files/pppoe.sh create mode 100644 package/ppp/files/pptp.sh delete mode 100644 package/pptp/files/ifup.pptp create mode 100644 package/pptp/files/pptp.sh create mode 100644 package/switch/files/switch.sh (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/ar7-2.4/etc/config/network b/package/base-files/ar7-2.4/etc/config/network index 353538bf49..19a858e163 100644 --- a/package/base-files/ar7-2.4/etc/config/network +++ b/package/base-files/ar7-2.4/etc/config/network @@ -1,27 +1,8 @@ # Network configuration file -# Uncomment the following statements to change the network configuration -## LAN configuration -lan_ifname="eth0" -lan_proto="static" -lan_ipaddr="192.168.1.1" -lan_netmask="255.255.255.0" -# lan_gateway="" -# lan_dns="" - -## WAN configuration -# wan_proto=pppoe -wan_ifname=ppp0 -wan_device=nas0 -atm_vpi=8 -atm_vci=35 -# ppp_username=my_username -# ppp_passwd=my_passwd - -## WAN configuration (pppoe) -pppoe_atm=1 -ppp_mtu=1492 - -## WAN configuration (pppoa) -# ppp_mtu=1500 +config interface lan + option ifname eth0 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/aruba-2.6/etc/config/network b/package/base-files/aruba-2.6/etc/config/network index 65797797ee..aadd4aa8ed 100644 --- a/package/base-files/aruba-2.6/etc/config/network +++ b/package/base-files/aruba-2.6/etc/config/network @@ -1,7 +1,5 @@ # Network configuration file -# Copyright (C) 2006 OpenWrt.org - -## LAN configuration -lan_ifname="eth0" -lan_proto="dhcp" +config interface lan + option ifname eth0 + option proto dhcp diff --git a/package/base-files/au1000-2.6/etc/config/network b/package/base-files/au1000-2.6/etc/config/network index 576677bf7c..95d7575c92 100644 --- a/package/base-files/au1000-2.6/etc/config/network +++ b/package/base-files/au1000-2.6/etc/config/network @@ -1,13 +1,8 @@ -# Network configuration file # Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="br0" -lan_ifnames="eth0 ath0" -lan_proto="static" -lan_ipaddr="192.168.1.1" -lan_netmask="255.255.255.0" - -## WAN configuration -wan_ifname="" -wan_proto="none" +config interface lan + option type bridge + option ifnames "eth0 ath0" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net b/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net deleted file mode 100644 index 48abdf4062..0000000000 --- a/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org - -setup_wl() -{ - [ -f /proc/net/wl0 ] && { - lsmod | grep wlcompat >&- || insmod wlcompat - } - iwconfig "$INTERFACE" 2>&- | grep -v 'no wireless' >&- && { - /sbin/wifi - } -} -setup_eth() -{ - [ -d /proc/switch ] || { - insmod switch-core - insmod switch-robo || insmod switch-adm - } - if="$(echo "$INTERFACE" | sed s,eth,et,)" - ifconfig "$INTERFACE" up 2>&- >&- - [ -d "/proc/switch/$INTERFACE" ] || return 0 - echo "1" > "/proc/switch/$INTERFACE/reset" - echo "1" > "/proc/switch/$INTERFACE/enable_vlan" - for vlan in $(seq 0 15); do - eval "hwname=\"\${vlan${vlan}hwname}\"" - [ "$hwname" = "$if" ] && { - eval "vports=\"\${vlan${vlan}ports}\"" - [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports" - $DEBUG vconfig add "$INTERFACE" "$vlan" - } - done -} - -do_register() -{ - case "${INTERFACE%%[0-9]*}" in - eth) setup_eth;; - wl) setup_wl;; - esac -} - - -case "$ACTION" in - add|register) do_register;; -esac diff --git a/package/base-files/brcm-2.4/etc/init.d/S05netconfig b/package/base-files/brcm-2.4/etc/init.d/S05netconfig index 0f53c0c9c9..82e4ab9986 100755 --- a/package/base-files/brcm-2.4/etc/init.d/S05netconfig +++ b/package/base-files/brcm-2.4/etc/init.d/S05netconfig @@ -13,16 +13,16 @@ mkdir -p /etc/config strings /dev/mtdblock/3 fi ) | awk ' -function p(name) { - if (c[name] != "") print name "=\"" c[name] "\"" +function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" } BEGIN { FS="=" c["lan_ifname"]="br0" - c["lan_ifnames"]="vlan0 eth1" + c["lan_ifnames"]="eth0.0 wl0" c["wan_proto"]="none" - c["wan_ifname"]="vlan1" + c["wan_ifname"]="eth0.1" c["vlan0ports"]="1 2 3 4 5*" c["vlan1ports"]="0 5" } @@ -34,23 +34,16 @@ BEGIN { END { # v1 hardware if (nvram["boardtype"] == "bcm94710dev") { - # Linksys WRT54G v1.x - if (nvram["boardnum"] == "42") { - c["vlan0ports"]="" - c["vlan1ports"]="" - c["lan_ifnames"]="vlan2 eth2" - } - # Asus WL-500g if (nvram["boardnum"] == "asusX") { - c["lan_ifnames"]="eth0 eth1 eth2" # FIXME - # wan_ifname=eth1 + c["lan_ifnames"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" } } if (nvram["boardtype"] == "wgt634u") { c["vlan0ports"] = "0 1 2 3 5*" c["vlan1ports"] = "4 5" - c["lan_ifnames"] = "vlan0 ath0" + c["lan_ifnames"] = "eth0.0 ath0" } if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { c["vlan0ports"] = "0 1 2 3 5*" @@ -60,51 +53,28 @@ END { # WAP54G if ((nvram["boardnum"] == "2") || \ (nvram["boardnum"] == "1024")) { - c["lan_ifnames"]="eth0 eth1" + c["lan_ifnames"]="eth0 wl0" c["wan_ifname"]="" } print "#### VLAN configuration " - print "vlan0hwname=et0" - print "vlan1hwname=et0" - p("vlan0ports") - p("vlan1ports") + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") print "" print "" - print "#### LAN configuration" - print "lan_proto=\"static\"" - p("lan_ifname") - p("lan_ifnames") - print "lan_ipaddr=\"192.168.1.1\"" - print "lan_netmask=\"255.255.255.0\"" - print "# lan_dns=\"192.168.1.1\"" - print "# lan_gateway=\"192.168.1.1\"" - + print "config interface lan" + print " option type bridge" + p("ifnames", "lan_ifnames") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" print "" print "" - print "#### WAN configuration" - print "# wan_proto: WAN protocol, available protocols:" - print "# none: disable" - print "# dhcp: DHCP" - print "# static: Static IP" - print "# pppoe: PPP over Ethernet" - print "# pptp: Point-to-Point tunneling Protocol" - print "# for pppoe and pptp you need to use wan_ifname=\"ppp0\"" - print "" - print "wan_proto=dhcp" - p("wan_ifname") - print "wan_device=\"" c["wan_ifname"] "\"" - print "# wan_ipaddr=\"192.168.0.2\"" - print "# wan_netmask=\"255.255.255.0\"" - print "# wan_gateway=\"192.168.0.1\"" - print "# wan_dns=\"192.168.0.1\"" - print "" - print "## PPP over Ethernet and PPTP" - print "# wan_ifname=\"ppp0\"" - print "# ppp_username=\"my_username\"" - print "# ppp_passwd=\"my_password\"" - print "# pptp_server_ip=\"192.168.0.1\"" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" } ' > /etc/config/network diff --git a/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net b/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net deleted file mode 100644 index 90a92bd2b0..0000000000 --- a/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org - -setup_eth() -{ - [ -d /proc/switch ] || { - insmod switch-core - insmod switch-robo || insmod switch-adm - } - if="$(echo "$INTERFACE" | sed s,eth,et,)" - ifconfig "$INTERFACE" up 2>&- >&- - [ -d "/proc/switch/$INTERFACE" ] || return 0 - echo "1" > "/proc/switch/$INTERFACE/reset" - echo "1" > "/proc/switch/$INTERFACE/enable_vlan" - for vlan in $(seq 0 15); do - eval "hwname=\"\${vlan${vlan}hwname}\"" - [ "$hwname" = "$if" ] && { - eval "vports=\"\${vlan${vlan}ports}\"" - [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports" - $DEBUG vconfig add "$INTERFACE" "$vlan" - } - done -} - -do_register() -{ - case "${INTERFACE%%[0-9]*}" in - eth) setup_eth;; - esac -} - - -case "$ACTION" in - add|register) do_register;; -esac diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/S05netconfig index 0f53c0c9c9..82e4ab9986 100755 --- a/package/base-files/brcm-2.6/etc/init.d/S05netconfig +++ b/package/base-files/brcm-2.6/etc/init.d/S05netconfig @@ -13,16 +13,16 @@ mkdir -p /etc/config strings /dev/mtdblock/3 fi ) | awk ' -function p(name) { - if (c[name] != "") print name "=\"" c[name] "\"" +function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" } BEGIN { FS="=" c["lan_ifname"]="br0" - c["lan_ifnames"]="vlan0 eth1" + c["lan_ifnames"]="eth0.0 wl0" c["wan_proto"]="none" - c["wan_ifname"]="vlan1" + c["wan_ifname"]="eth0.1" c["vlan0ports"]="1 2 3 4 5*" c["vlan1ports"]="0 5" } @@ -34,23 +34,16 @@ BEGIN { END { # v1 hardware if (nvram["boardtype"] == "bcm94710dev") { - # Linksys WRT54G v1.x - if (nvram["boardnum"] == "42") { - c["vlan0ports"]="" - c["vlan1ports"]="" - c["lan_ifnames"]="vlan2 eth2" - } - # Asus WL-500g if (nvram["boardnum"] == "asusX") { - c["lan_ifnames"]="eth0 eth1 eth2" # FIXME - # wan_ifname=eth1 + c["lan_ifnames"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" } } if (nvram["boardtype"] == "wgt634u") { c["vlan0ports"] = "0 1 2 3 5*" c["vlan1ports"] = "4 5" - c["lan_ifnames"] = "vlan0 ath0" + c["lan_ifnames"] = "eth0.0 ath0" } if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { c["vlan0ports"] = "0 1 2 3 5*" @@ -60,51 +53,28 @@ END { # WAP54G if ((nvram["boardnum"] == "2") || \ (nvram["boardnum"] == "1024")) { - c["lan_ifnames"]="eth0 eth1" + c["lan_ifnames"]="eth0 wl0" c["wan_ifname"]="" } print "#### VLAN configuration " - print "vlan0hwname=et0" - print "vlan1hwname=et0" - p("vlan0ports") - p("vlan1ports") + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") print "" print "" - print "#### LAN configuration" - print "lan_proto=\"static\"" - p("lan_ifname") - p("lan_ifnames") - print "lan_ipaddr=\"192.168.1.1\"" - print "lan_netmask=\"255.255.255.0\"" - print "# lan_dns=\"192.168.1.1\"" - print "# lan_gateway=\"192.168.1.1\"" - + print "config interface lan" + print " option type bridge" + p("ifnames", "lan_ifnames") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" print "" print "" - print "#### WAN configuration" - print "# wan_proto: WAN protocol, available protocols:" - print "# none: disable" - print "# dhcp: DHCP" - print "# static: Static IP" - print "# pppoe: PPP over Ethernet" - print "# pptp: Point-to-Point tunneling Protocol" - print "# for pppoe and pptp you need to use wan_ifname=\"ppp0\"" - print "" - print "wan_proto=dhcp" - p("wan_ifname") - print "wan_device=\"" c["wan_ifname"] "\"" - print "# wan_ipaddr=\"192.168.0.2\"" - print "# wan_netmask=\"255.255.255.0\"" - print "# wan_gateway=\"192.168.0.1\"" - print "# wan_dns=\"192.168.0.1\"" - print "" - print "## PPP over Ethernet and PPTP" - print "# wan_ifname=\"ppp0\"" - print "# ppp_username=\"my_username\"" - print "# ppp_passwd=\"my_password\"" - print "# pptp_server_ip=\"192.168.0.1\"" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" } ' > /etc/config/network diff --git a/package/base-files/default/etc/hotplug.d/net/10-net b/package/base-files/default/etc/hotplug.d/net/10-net index f306ae342d..d5b7f6b0fa 100644 --- a/package/base-files/default/etc/hotplug.d/net/10-net +++ b/package/base-files/default/etc/hotplug.d/net/10-net @@ -1,191 +1,28 @@ -#!/bin/sh # Copyright (C) 2006 OpenWrt.org -find_name() -{ - for ifname in lan wan wifi ${ifnames}; do - IFTYPE="${ifname}" - eval "IFPROTO=\"\${${IFTYPE}_proto}\"" - eval "IFACE=\"\${${IFTYPE}_ifname}\"" - case "$IFPROTO" in - ""|none);; - static|dhcp) - [ "${IFACE}" = "$INTERFACE" ] && return 0 - [ "${IFACE%%[0-9]*}" = "br" ] && { - eval "ifs=\"\${${IFTYPE}_ifnames}\"" - for part in $ifs; do - [ "$part" = "$INTERFACE" ] && return 0 - done - } - ;; - pppoa) - [ "$INTERFACE" = "atm0" \ - -a -x /sbin/ifup.${IFPROTO} ] && return 0 - ;; - *) - eval "device=\"\${${IFTYPE}_device}\"" - [ "$device" = "$INTERFACE" \ - -a -x /sbin/ifup.${IFPROTO} ] && return 0 - ;; - esac - done - IFACE="" - IFTYPE="" - IFPROTO="" - return 255 -} - -do_ifup() { - if="$3" - eval "if_proto=\"\${${2}_proto}\"" - - pidfile=/var/run/${if}.pid - [ -f $pidfile ] && $DEBUG kill $(cat $pidfile) - - case "$1" in - static) - eval "ip=\"\${${2}_ipaddr}\"" - eval "ip6=\"\${${2}_ip6addr}\"" - eval "netmask=\"\${${2}_netmask}\"" - eval "gateway=\"\${${2}_gateway}\"" - eval "dns=\"\${${2}_dns}\"" - eval "static_route=\"\${${2}_static_route}\"" - - $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up - [ -n "$ip6" ] && $DEBUG ifconfig $if add $ip6 - - [ -n "$static_route" ] && { - for route in $static_route; do - if [ "$(echo $route | cut -d \/ -f2)" != "32" ]; - then - route add -net $(echo $route | cut -d \/ -f1) netmask $(echo $route | cut -d \/ -f1) dev $if - else - route add -host $(echo $route | cut -d \/ -f1) dev $if - fi - done - } +include network - ${gateway:+$DEBUG route add default gw $gateway} +addif() { + scan_interfaces + setup_interface "$INTERFACE" - [ -f /tmp/resolv.conf ] || { - debug "# --- creating /tmp/resolv.conf ---" - for ns in $dns; do - echo "nameserver $ns" >> /tmp/resolv.conf - done - } - - env -i ACTION="ifup" INTERFACE="${2}" PROTO=static /sbin/hotplug "iface" & - ;; - dhcp) - eval "ip=\"\${${2}_ipaddr}\"" - eval "netmask=\"\${${2}_netmask}\"" - eval "hostname=\"\${${2}_hostname}\"" - - $DEBUG ifconfig $if $ip ${netmask:+netmask $netmask} broadcast + up - - args="-i $if ${ip:+-r $ip} -b -p $pidfile" - hostname="${hostname%%.*}" - args="$args${hostname:+ -H $hostname}" - [ "$if_proto" = "pptp" ] && args="$args -n -q" || args="$args -R &" - ${DEBUG:-eval} "udhcpc $args" - # hotplug events are handled by /usr/share/udhcpc/default.script - ;; - *) - if [ -x "/sbin/ifup.$1" ]; then - ( $DEBUG . /sbin/ifup.$1 ${2} $3 ) - fi - ;; - esac -} - -do_register() -{ - [ -z "$IFTYPE" -o -z "$IFPROTO" ] && { - find_name || { - case "${INTERFACE%%[0-9]*}" in - wds) - for ifname in lan wifi; do - eval "if=\"\${${ifname}_ifname}\"" - [ -z "$IFPROTO" ] && [ "$if" = "br0" ] && { - eval "IFPROTO=\"\${${2}_proto}\"" - IFTYPE="${tmp}" - } - done - [ -z "$IFPROTO" ] && return 0 - ;; - atm) - for tmp in lan wan wifi ${ifnames}; do - eval "if_proto=\"\${${2}_proto}\"" - [ "$if_proto" = "pppoa" ] && { - do_ifup "pppoa" "$tmp" "$INTERFACE" - return 0 - } - done - ;; - *) - return 0 - ;; - esac - } - } - - case "${INTERFACE%%[0-9]*}" in - ppp|atm);; - *) - eval "mac=\"\${${IFTYPE}_hwaddr}\"" - ${mac:+$DEBUG ifconfig $INTERFACE down hw ether $mac} - ;; - esac - - eval "if=\"\${${IFTYPE}_ifname}\"" - if [ "${if%%[0-9]}" = "br" ]; then - if_valid "$INTERFACE" && { - ifconfig "$if" 2>&- >&- || { - eval "stp=\"\${${IFTYPE}_stp}\"" - $DEBUG brctl addbr "$if" - $DEBUG brctl setfd "$if" 0 - $DEBUG brctl stp "$if" "${stp:-0}" + # find all vlan configurations for this interface and set them up as well + for ifc in $interfaces; do + config_get type "$ifc" type + case "$type" in + bridge) config_get ifs "$ifc" ifnames;; + *) config_get ifs "$ifc" ifname;; + esac + for dev in $ifs; do + [ "${dev%%\.*}" = "$INTERFACE" -a "$dev" != "$INTERFACE" ] && { + add_vlan "$dev" } - - if [ "$INTERFACE" != "$if" ]; then - $DEBUG ifconfig "$INTERFACE" 0.0.0.0 up - $DEBUG brctl addif "$if" "$INTERFACE" - $DEBUG ifconfig "$INTERFACE" allmulti - else - do_ifup "$IFPROTO" "$IFTYPE" "$if" - fi - } - else - [ "${INTERFACE%%[0-9]*}" = "ppp" ] || do_ifup "$IFPROTO" "$IFTYPE" "$if" - fi -} - -do_unregister() { - [ -z "$IFTYPE" -o -z "$IFPROTO" ] && { - find_name || return 0 - } - - [ "${IFACE%%[0-9]*}" = "br" ] && { - if [ "$INTERFACE" != "$IFACE" ]; then - brctl delif "$IFACE" "$INTERFACE" 2>&- >&- - else - brctl delbr "$IFACE" 2>&- >&- - fi - } - - case "$IFPROTO" in - pppoe|pppoa|pptp) - killall pppd 2>&- >&- - ;; - dhcp) - [ -f /var/run/${INTERFACE}.pid ] && kill "$(cat /var/run/${INTERFACE}.pid)" 2>&- >&- - ;; - esac - - [ "${INTERFACE%%[0-9]*}" = "atm" ] || ifconfig "$INTERFACE" 0.0.0.0 down 2>&- + done + done } case "$ACTION" in - add|register) do_register;; - remove|unregister) do_unregister;; + add|register) + addif + ;; esac diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index cb5c6ac4a7..19420eda53 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -5,13 +5,14 @@ [ -f /proc/mounts ] || /sbin/mount_root [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc -vconfig set_name_type VLAN_PLUS_VID_NO_PAD +vconfig set_name_type DEV_PLUS_VID_NO_PAD HOSTNAME=${wan_hostname%%.*} echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname mkdir -p /var/run mkdir -p /var/log +mkdir -p /var/lock touch /var/log/wtmp touch /var/log/lastlog [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/S40network new file mode 100755 index 0000000000..20a11845b6 --- /dev/null +++ b/package/base-files/default/etc/init.d/S40network @@ -0,0 +1,9 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.orga + +setup_switch() { return 0; } + +. /etc/functions.sh +include network +setup_switch +/sbin/wifi diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index dad989fe09..2aa70910c3 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -3,12 +3,13 @@ ${FAILSAFE:+exit} -[ -f /etc/config/network ] && . /etc/config/network -eval $(ipcalc "$log_ipaddr") -[ "$log_ipaddr" = "$IP" ] || log_ipaddr="" -syslogd -C 16 ${log_ipaddr:+-L -R $log_ipaddr} +# FIXME: add logging configuration +#[ -f /etc/config/network ] && . /etc/config/network +#eval $(ipcalc "$log_ipaddr") +#[ "$log_ipaddr" = "$IP" ] || log_ipaddr="" +syslogd -C 16 #${log_ipaddr:+-L -R $log_ipaddr} klogd -#${FAILSAFE:+telnetd -l /bin/login; ifup lan; exit} + for i in /etc/init.d/S*; do $i start 2>&1 done | logger -s -p 6 -t '' & diff --git a/package/base-files/default/lib/network/config.sh b/package/base-files/default/lib/network/config.sh new file mode 100755 index 0000000000..59ec84aba8 --- /dev/null +++ b/package/base-files/default/lib/network/config.sh @@ -0,0 +1,147 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +# DEBUG="echo" + +find_config() { + local type iface ifn + for ifn in $interfaces; do + config_get type "$ifn" type + config_get iface "$ifn" ifname + case "$type" in + bridge) + config_get iface "$ifn" ifnames + ;; + esac + for ifc in $iface; do + [ "$ifc" = "$1" ] && { + echo "$ifn" + return 0 + } + done + done + + return 1; +} + +scan_interfaces() { + local mode type iface + interfaces= + config_cb() { + config_get type "$CONFIG_SECTION" TYPE + case "$type" in + interface) + config_get type "$CONFIG_SECTION" type + config_get mode "$CONFIG_SECTION" proto + case "$type" in + bridge) + config_get iface "$CONFIG_SECTION" ifname + iface="${iface:-br-$CONFIG_SECTION}" + config_set "$CONFIG_SECTION" ifname "$iface" + ;; + esac + append interfaces "$CONFIG_SECTION" + ( type "scan_$mode" ) >/dev/null 2>/dev/null && eval "scan_$mode '$CONFIG_SECTION'" + ;; + esac + } + config_load network +} + +add_vlan() { + local vif="${1%\.*}" + + [ "$1" = "$vif" ] || ifconfig "$1" >/dev/null 2>/dev/null || { + ifconfig "$vif" up 2>/dev/null >/dev/null || add_vlan "$vif" + $DEBUG vconfig add "$vif" "${1##*\.}" + } +} + +setup_interface() { + local iface="$1" + local config="$2" + local proto="$3" + + [ -n "$config" ] || { + config=$(find_config "$iface") + [ "$?" = 0 ] || return 1 + } + + [ -n "$proto" ] || { + config_get proto "$config" proto + } + + config_get iftype "$config" type + + # Setup VLAN interfaces + add_vlan "$iface" + + # Setup bridging + case "$iftype" in + bridge) + config_get bridge_ifname "$config" ifname + ifconfig "$iface" up 2>/dev/null >/dev/null + ifconfig "$bridge_ifname" 2>/dev/null >/dev/null && { + $DEBUG brctl addif "$bridge_ifname" "$iface" + return 0 + } || { + $DEBUG brctl addbr "$bridge_ifname" + $DEBUG brctl setfd "$bridge_ifname" 0 + $DEBUG brctl addif "$bridge_ifname" "$iface" + iface="$bridge_ifname" + } + ;; + esac + + # Interface settings + config_get mtu "$config" mtu + $DEBUG ifconfig "$iface" ${mtu:+mtu $mtu} up + + pidfile="/var/run/$iface.pid" + case "$proto" in + static) + config_get ipaddr "$config" ipaddr + config_get netmask "$config" netmask + [ -z "$ipaddr" -o -z "$netmask" ] && return 1 + + config_get ip6addr "$config" ip6addr + config_get gateway "$config" gateway + config_get dns "$config" dns + + $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" + [ -z "$gateway" ] || route add default gw "$gateway" + [ -z "$dns" -o -f /tmp/resolv.conf ] || { + for ns in $dns; do + echo "nameserver $ns" >> /tmp/resolv.conf + done + } + + env -i ACTION="ifup" INTERFACE="config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" & + ;; + dhcp) + pid="$(cat "$pidfile" 2>/dev/null)" + [ -n "$pid" -a -d "/proc/$pid" ] && kill -9 "$pid" + + config_get ipaddr "$config" ipaddr + config_get netmask "$config" netmask + config_get hostname "$config" hostname + config_get proto1 "$config" proto + + [ -z "$ipaddr" ] || \ + $DEBUG ifconfig "$iface" "$ipaddr" ${netmask:+netmask "$netmask"} + + # don't stay running in background if dhcp is not the main proto on the interface (e.g. when using pptp) + [ "$proto1" != "$proto" ] && dhcpopts="-n -q" + $DEBUG udhcpc -i "$iface" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} -b -p "$pidfile" ${dhcpopts:- -R &} + ;; + *) + if ( eval "type setup_interface_$proto" ) >/dev/null 2>/dev/null; then + eval "setup_interface_$proto '$iface' '$config' '$proto'" + else + echo "Interface type $proto not supported." + return 1 + fi + ;; + esac +} + diff --git a/package/base-files/default/sbin/hotplug b/package/base-files/default/sbin/hotplug index afe52a446f..b1b6f97b23 100755 --- a/package/base-files/default/sbin/hotplug +++ b/package/base-files/default/sbin/hotplug @@ -13,7 +13,6 @@ } . /etc/functions.sh -. /etc/config/network PATH=/bin:/sbin:/usr/bin:/usr/sbin LOGNAME=root diff --git a/package/base-files/default/sbin/ifdown b/package/base-files/default/sbin/ifdown index 50ffee5304..7debb9559f 100755 --- a/package/base-files/default/sbin/ifdown +++ b/package/base-files/default/sbin/ifdown @@ -3,18 +3,32 @@ [ $# = 0 ] && { echo " $0 "; exit; } . /etc/functions.sh -. /etc/config/network +include network +scan_interfaces debug "### ifdown $type ###" type=$1 -eval "if_proto=\"\${${type}_proto}\"" -eval "if=\"\${${type}_ifname}\"" -[ "${if%%[0-9]}" = "ppp" ] && eval "if=\"\${${type}_device}\"" +config_get proto "$type" proto +[ -z "$proto" ] && { echo "interface not found."; exit; } -case "$if_proto" in - pppoa) hotplug_dev unregister atm0; exit 0 ;; - ""|none) exit 0;; -esac +# kill active ppp daemon +pid="$(cat /var/run/ppp-${type}.pid 2>/dev/null)" +[ -n "$pid" -a -d "/proc/$pid" ] && { + kill $pid + sleep 1 + [ -d "/proc/$pid" ] && kill -9 $pid +} -hotplug_dev unregister "$if" +# kill any other process associated with the interface +config_get ifname "$type" ifname +pid="$(cat /var/run/${ifname}.pid 2>/dev/null)" +[ -n "$pid" -a -d "/proc/$pid" ] && kill -9 $pid + +config_get ifname "$type" ifname +ifconfig "$ifname" >/dev/null 2>/dev/null && { + ifconfig "$ifname" 0.0.0.0 down + + config_get iftype "$type" type + [ "$iftype" = "bridge" ] && brctl delbr "$ifname" +} diff --git a/package/base-files/default/sbin/ifup b/package/base-files/default/sbin/ifup index 390f960395..c40de38ad8 100755 --- a/package/base-files/default/sbin/ifup +++ b/package/base-files/default/sbin/ifup @@ -1,38 +1,18 @@ #!/bin/sh # Copyright (C) 2006 OpenWrt.org -[ $# = 0 ] && { echo " $0 "; exit; } -. /etc/functions.sh -. /etc/config/network +. /sbin/ifdown "$@" -ifdown $1 - -debug "### ifup $type ###" -type=$1 - -eval "if_proto=\"\${${type}_proto}\"" -eval "if=\"\${${type}_ifname}\"" -[ "${if%%[0-9]}" = "ppp" ] && eval "if=\"\${${type}_device}\"" - -case "$if_proto" in - pppoa) hotplug_dev register atm0; exit 0 ;; - pppoe) - # PPPoE over ATM - [ "$if" = "nas0" ] && { - ifconfig nas0 2>&- >&- || { - hotplug_dev register atm0 - exit 0 - } - } +config_get iftype "$1" type +case "$iftype" in + bridge) + config_get ifname "$1" ifnames + ;; + *) + config_get ifname "$1" ifname ;; - none|"") exit 0;; esac -if [ "${if%%[0-9]}" = "br" ]; then - eval "ifnames=\"\${${type}_ifnames}\"" - for sif in $ifnames; do - hotplug_dev register "$sif" - done -else - hotplug_dev register "$if" -fi +for dev in $ifname; do + setup_interface "$dev" "$1" +done diff --git a/package/base-files/default/sbin/wifi b/package/base-files/default/sbin/wifi index 63b2f121bd..f1ac94fa3a 100755 --- a/package/base-files/default/sbin/wifi +++ b/package/base-files/default/sbin/wifi @@ -30,12 +30,7 @@ config_cb() { } config_load wireless - -[ -d /lib/wifi -a -n "$(ls /lib/wifi/*.sh 2>&-)" ] && { - for script in /lib/wifi/*.sh; do - . $script - done -} +include wifi for device in $DEVICES; do ( config_get type "$device" type diff --git a/package/base-files/default/usr/share/udhcpc/default.script b/package/base-files/default/usr/share/udhcpc/default.script index 4604648e6b..a244e05a15 100755 --- a/package/base-files/default/usr/share/udhcpc/default.script +++ b/package/base-files/default/usr/share/udhcpc/default.script @@ -1,15 +1,19 @@ #!/bin/sh [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 -. /etc/config/network +. /etc/functions.sh +include network RESOLV_CONF="/tmp/resolv.conf" hotplug_event() { - for ifname in lan wan wifi ${ifnames}; do - eval "proto=\"\${${ifname}_proto}\"" - eval "if=\"\${${ifname}_ifname}\"" + scan_interfaces + for ifc in $interfaces; do + config_get ifname $ifc ifname + [ "$ifname" = "$interface" ] || continue + + config_get proto $ifc proto [ "$proto" = "dhcp" ] || continue - [ "$if" = "$interface" ] || continue + env -i ACTION="$1" INTERFACE="$ifname" PROTO=dhcp /sbin/hotplug iface done } diff --git a/package/base-files/rb532-2.6/etc/config/network b/package/base-files/rb532-2.6/etc/config/network index 2bb48b8863..6f089fe992 100644 --- a/package/base-files/rb532-2.6/etc/config/network +++ b/package/base-files/rb532-2.6/etc/config/network @@ -1,6 +1,6 @@ -# Network configuration file # Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="eth0" -lan_proto="dhcp" +config interface lan + option ifname eth0 + option proto dhcp + diff --git a/package/base-files/sibyte-2.6/etc/config/network b/package/base-files/sibyte-2.6/etc/config/network index 576677bf7c..95d7575c92 100644 --- a/package/base-files/sibyte-2.6/etc/config/network +++ b/package/base-files/sibyte-2.6/etc/config/network @@ -1,13 +1,8 @@ -# Network configuration file # Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="br0" -lan_ifnames="eth0 ath0" -lan_proto="static" -lan_ipaddr="192.168.1.1" -lan_netmask="255.255.255.0" - -## WAN configuration -wan_ifname="" -wan_proto="none" +config interface lan + option type bridge + option ifnames "eth0 ath0" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/x86-2.4/etc/config/network b/package/base-files/x86-2.4/etc/config/network index 7bcfd0870a..9f521c05bf 100644 --- a/package/base-files/x86-2.4/etc/config/network +++ b/package/base-files/x86-2.4/etc/config/network @@ -1,13 +1,13 @@ -# Network configuration file # Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="br0" -lan_ifnames="eth1 eth2" -lan_proto="static" -lan_ipaddr="192.168.1.1" -lan_netmask="255.255.255.0" +config interface lan + option type bridge + option ifnames "eth1 eth2" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth0 + option proto dhcp -## WAN configuration -wan_ifname="eth0" -wan_proto="dhcp" diff --git a/package/base-files/x86-2.6/etc/config/network b/package/base-files/x86-2.6/etc/config/network index 7bcfd0870a..9f521c05bf 100644 --- a/package/base-files/x86-2.6/etc/config/network +++ b/package/base-files/x86-2.6/etc/config/network @@ -1,13 +1,13 @@ -# Network configuration file # Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="br0" -lan_ifnames="eth1 eth2" -lan_proto="static" -lan_ipaddr="192.168.1.1" -lan_netmask="255.255.255.0" +config interface lan + option type bridge + option ifnames "eth1 eth2" + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + +config interface wan + option ifname eth0 + option proto dhcp -## WAN configuration -wan_ifname="eth0" -wan_proto="dhcp" diff --git a/package/base-files/xscale-2.6/etc/config/network b/package/base-files/xscale-2.6/etc/config/network index 2bb48b8863..aadd4aa8ed 100644 --- a/package/base-files/xscale-2.6/etc/config/network +++ b/package/base-files/xscale-2.6/etc/config/network @@ -1,6 +1,5 @@ # Network configuration file -# Copyright (C) 2006 OpenWrt.org -## LAN configuration -lan_ifname="eth0" -lan_proto="dhcp" +config interface lan + option ifname eth0 + option proto dhcp diff --git a/package/broadcom-wl/files/lib/wifi/broadcom.sh b/package/broadcom-wl/files/lib/wifi/broadcom.sh index 6cac60c0b7..53d1cf7925 100644 --- a/package/broadcom-wl/files/lib/wifi/broadcom.sh +++ b/package/broadcom-wl/files/lib/wifi/broadcom.sh @@ -1,3 +1,15 @@ +bridge_interface() { + ( + . /etc/functions.sh + include network + scan_interfaces + cfg="$(find_config "$1")" + [ -z "$cfg" ] && return 0 + config_get type "$cfg" type + [ "$type" = bridge ] && config_get "$type" bridge + ) +} + scan_broadcom() { local device="$1" @@ -127,7 +139,7 @@ setup_broadcom() { config_get ifname "$vif" ifname append if_up "ifconfig $ifname up" ";$N" [ -z "$nasopts" ] || { - config_get bridge "$vif" bridge # XXX: integrate with /etc/config/network later + bridge="$(bridge_interface "$ifname")" eval "${vif}_ssid=\"\$ssid\"" mode="-A" [ "$vif" = "$sta_if" ] && mode="-S" diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index 17ef43c3d5..140f727f46 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -1,5 +1,7 @@ #!/bin/sh -. /etc/config/network +. /etc/functions.sh +include network +scan_interfaces # The following is to automatically configure the DHCP settings # based on config settings. Feel free to replace all this crap @@ -10,7 +12,7 @@ args="" iface=lan -eval "ifname=\${${iface}_ifname}" +config_get ifname "$iface" ifname dhcp_enable="${dhcp_enable:-1}" dhcp_start="${dhcp_start:-100}" @@ -26,8 +28,8 @@ dhcp_lease="${dhcp_lease:-12h}" # no existing DHCP server? # calculate settings - eval "ipaddr=\${${iface}_ipaddr}" - eval "netmask=\${${iface}_netmask}" + config_get ipaddr "$iface" ipaddr + config_get netmask "$iface" netmask eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150}) # and pass the args via config parser defines @@ -39,6 +41,8 @@ dhcp_lease="${dhcp_lease:-12h}" } # ignore requests from wan interface + config_get wan_proto wan proto + config_get wan_ifname wan ifname [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname" cat /etc/dnsmasq.conf diff --git a/package/iptables/files/firewall.awk b/package/iptables/files/firewall.awk index 5378330045..902c7b1888 100644 --- a/package/iptables/files/firewall.awk +++ b/package/iptables/files/firewall.awk @@ -1,10 +1,7 @@ # Copyright (C) 2006 OpenWrt.org BEGIN { - print ". /etc/config/network" - print "proto=\"$wan_proto\"" - print "[ -z \"$proto\" -o \"$proto\" = \"none\" ] && exit" - print "ifname=\"$wan_ifname\"" + print "ifname=\"$WAN\"" print "[ -z \"$ifname\" ] && exit" print "" print "iptables -X input_$ifname 2>&- >&-" diff --git a/package/iptables/files/firewall.init b/package/iptables/files/firewall.init index e174d84bb2..a0bd99ef9a 100755 --- a/package/iptables/files/firewall.init +++ b/package/iptables/files/firewall.init @@ -3,9 +3,12 @@ ## Please make changes in /etc/firewall.user -. /etc/config/network -WAN="$wan_ifname" -LAN="$lan_ifname" +. /etc/functions.sh +include network + +scan_interfaces +config_get WAN wan ifname +config_get LAN lan ifname ## CLEAR TABLES for T in filter nat; do @@ -35,7 +38,7 @@ iptables -t nat -N postrouting_rule iptables -A INPUT -j input_rule # allow - [ -z "$WAN" ] || iptables -A INPUT -i \! $WAN -j ACCEPT # allow from lan/wifi interfaces + iptables -A INPUT ${WAN:+-i \! $WAN} -j ACCEPT # allow from lan/wifi interfaces iptables -A INPUT -p icmp -j ACCEPT # allow ICMP iptables -A INPUT -p gre -j ACCEPT # allow GRE diff --git a/package/iptables/files/firewall.user b/package/iptables/files/firewall.user old mode 100755 new mode 100644 index 1fb862e9b0..5f295babf2 --- a/package/iptables/files/firewall.user +++ b/package/iptables/files/firewall.user @@ -1,11 +1,6 @@ #!/bin/sh # Copyright (C) 2006 OpenWrt.org -. /etc/config/network - -WAN="$wan_ifname" -LAN="$lan_ifname" - iptables -F input_rule iptables -F output_rule iptables -F forwarding_rule diff --git a/package/ppp/Makefile b/package/ppp/Makefile index 85d52d0542..e49b610c36 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -95,6 +95,8 @@ define Build/Compile endef define Package/ppp/install + install -d -m0755 $(1)/lib/network + install -m0755 ./files/ppp.sh $(1)/lib/network/ install -d -m0755 $(1)/etc/ppp install -m0600 ./files/etc/ppp/chap-secrets $(1)/etc/ppp/ install -m0644 ./files/etc/ppp/filter $(1)/etc/ppp/ @@ -110,19 +112,19 @@ define Package/ppp/install endef define Package/ppp-mod-pppoa/install + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pppoa.sh $(1)/lib/network/ install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \ $(1)/usr/lib/pppd/$(PKG_VERSION)/ - install -d -m0755 $(1)/sbin - install -m0755 ./files/ifup.pppoa $(1)/sbin/ endef define Package/ppp-mod-pppoe/install + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pppoe.sh $(1)/lib/network/ install -d -m0755 $(1)/usr/lib/pppd/$(PKG_VERSION) install -m0755 $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/rp-pppoe.so \ $(1)/usr/lib/pppd/$(PKG_VERSION)/ - install -d -m0755 $(1)/sbin - install -m0755 ./files/ifup.pppoe $(1)/sbin/ endef define Package/ppp-mod-radius/install diff --git a/package/ppp/files/ifup.pppoa b/package/ppp/files/ifup.pppoa deleted file mode 100644 index f78a162ce5..0000000000 --- a/package/ppp/files/ifup.pppoa +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -[ $# = 0 ] && { echo " $0 "; exit; } -. /etc/config/network -type=$1 - -eval "proto=\"\${${type}_proto}\"" -[ "$proto" = "pppoa" ] || { - echo "$0: ${type}_proto isn't pppoa" - exit -} - -mkdir -p /var/lock - -for module in slhc ppp_generic pppoatm; do - /sbin/insmod $module 2>&- >&- -done - -KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} -case "$ppp_demand" in - on|1|enabled) - DEMAND=${ppp_idletime:+demand idle $ppp_idletime} - [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} - ;; - *) DEMAND="persist";; -esac -MTU=${ppp_mtu:-1500} - -/usr/sbin/pppd \ - plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \ - usepeerdns \ - defaultroute \ - linkname $type \ - ipparam $type \ - user "$ppp_username" \ - password "$ppp_passwd" \ - mtu $MTU mru $MTU \ - $DEMAND \ - $KEEPALIVE diff --git a/package/ppp/files/ifup.pppoe b/package/ppp/files/ifup.pppoe deleted file mode 100644 index c7019fc398..0000000000 --- a/package/ppp/files/ifup.pppoe +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -[ $# = 0 ] && { echo " $0 "; exit; } -. /etc/config/network -type=$1 - -eval "proto=\"\${${type}_proto}\"" -[ "$proto" = "pppoe" ] || { - echo "$0: ${type}_proto isn't pppoe" - exit -} - -mkdir -p /var/lock - -for module in slhc ppp_generic pppox pppoe; do - /sbin/insmod $module 2>&- >&- -done - -eval "IFNAME=\"\${${type}_device}\"" -KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} -case "$ppp_demand" in - on|1|enabled) - DEMAND=${ppp_idletime:+demand idle $ppp_idletime} - [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} - ;; - *) DEMAND="persist";; -esac -MTU=${ppp_mtu:-1492} - -ifconfig $IFNAME up -/usr/sbin/pppd \ - plugin rp-pppoe.so \ - connect /bin/true \ - usepeerdns \ - defaultroute \ - linkname $type \ - ipparam $type \ - user "$ppp_username" \ - password "$ppp_passwd" \ - mtu $MTU mru $MTU \ - $DEMAND \ - $KEEPALIVE \ - nic-$IFNAME - diff --git a/package/ppp/files/ppp.sh b/package/ppp/files/ppp.sh new file mode 100644 index 0000000000..0bb77b8284 --- /dev/null +++ b/package/ppp/files/ppp.sh @@ -0,0 +1,27 @@ +scan_ppp() { + config_get ifname "$1" ifname + pppdev="${pppdev:-0}" + config_set "$1" device "$ifname" + config_set "$1" ifname "ppp$pppdev" + config_set "$1" unit "$pppdev" +} + +start_pppd() { + local cfg="$1"; shift + config_get device "$cfg" device + config_get unit "$cfg" unit + config_get username "$cfg" username + config_get password "$cfg" password + config_get keepalive "$cfg" keepalive + config_get demand "$cfg" demand + [ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp/resolv.conf + /usr/sbin/pppd "$@" \ + ${keepalive:+lcp-echo-interval 5 lcp-echo-failure $keepalive} \ + ${demand:+precompiled-active-filter /etc/ppp/filter demand idle }${demand:-persist} \ + usepeerdns \ + defaultroute \ + replacedefaultroute \ + ${username:+username "$username" password "$password"} \ + linkname "$cfg" \ + ipparam "$cfg" +} diff --git a/package/ppp/files/pppoa.sh b/package/ppp/files/pppoa.sh new file mode 100644 index 0000000000..e6530b073e --- /dev/null +++ b/package/ppp/files/pppoa.sh @@ -0,0 +1,20 @@ +scan_pppoa() { + scan_ppp "$@" +} + +setup_interface_pppoa() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic pppoatm; do + /sbin/insmod $module 2>&- >&- + done + + config_get mtu "$cfg" mtu + mtu=${mtu:-1492} + start_pppd "$config" \ + plugin pppoatm.so ${atm_vpi:-8}.${atm_vci:-35} \ + mtu $mtu mru $mtu +} diff --git a/package/ppp/files/pppoe.sh b/package/ppp/files/pppoe.sh new file mode 100644 index 0000000000..f263caaeef --- /dev/null +++ b/package/ppp/files/pppoe.sh @@ -0,0 +1,21 @@ +scan_pppoe() { + scan_ppp "$@" +} + +setup_interface_pppoe() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic pppox pppoe; do + /sbin/insmod $module 2>&- >&- + done + + config_get mtu "$cfg" mtu + mtu=${mtu:-1480} + start_pppd "$config" \ + plugin rp-pppoe.so \ + mtu $mtu mru $mtu \ + "nic-$device" +} diff --git a/package/ppp/files/pptp.sh b/package/ppp/files/pptp.sh new file mode 100644 index 0000000000..7b33ac1ff7 --- /dev/null +++ b/package/ppp/files/pptp.sh @@ -0,0 +1,3 @@ +scan_pptp() { + scan_ppp "$@" +} diff --git a/package/pptp/Makefile b/package/pptp/Makefile index 061e55395e..b060c12a79 100644 --- a/package/pptp/Makefile +++ b/package/pptp/Makefile @@ -31,8 +31,8 @@ endef define Package/pptp/install install -d -m0755 $(1)/etc/ppp install -m0644 ./files/options.pptp $(1)/etc/ppp/ - install -d -m0755 $(1)/sbin - install -m0755 ./files/ifup.pptp $(1)/sbin/ + install -d -m0755 $(1)/lib/network + install -m0755 ./files/pptp.sh $(1)/lib/network/ install -d -m0755 $(1)/usr/sbin install -m0755 $(PKG_BUILD_DIR)/pptp $(1)/usr/sbin/ endef diff --git a/package/pptp/files/ifup.pptp b/package/pptp/files/ifup.pptp deleted file mode 100644 index f401a36b2f..0000000000 --- a/package/pptp/files/ifup.pptp +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -[ $# = 0 ] && { echo " $0 "; exit; } -. /etc/config/network -type=$1 - -eval "proto=\"\${${type}_proto}\"" -[ "$proto" = "pptp" ] || { - echo "$0: ${type}_proto isn't pptp" - exit -} - -mkdir -p /var/lock - -for module in slhc ppp_generic ppp_async ip_gre; do - /sbin/insmod $module 2>&- >&- -done - -KEEPALIVE=${ppp_redialperiod:+lcp-echo-interval $ppp_redialperiod lcp-echo-failure 5} -case "$ppp_demand" in - on|1|enabled) - DEMAND=${ppp_idletime:+demand idle $ppp_idletime} - [ -f /etc/ppp/filter ] && DEMAND=${DEMAND:+precompiled-active-filter /etc/ppp/filter $DEMAND} - ;; - *) DEMAND="persist";; -esac -MTU=${ppp_mtu:-1452} - -[ "$pptp_proto" = "static" ] || pptp_proto="dhcp" -do_ifup $pptp_proto $type - -/usr/sbin/pppd \ - pty "/usr/sbin/pptp $pptp_server_ip --loglevel 0 --nolaunchpppd" \ - file /etc/ppp/options.pptp \ - connect /bin/true \ - usepeerdns \ - defaultroute \ - replacedefaultroute \ - linkname "$type" \ - ipparam "$type" \ - user "$ppp_username" \ - password "$ppp_passwd" \ - mtu $MTU mru $MTU \ - $DEMAND \ - $KEEPALIVE - diff --git a/package/pptp/files/pptp.sh b/package/pptp/files/pptp.sh new file mode 100644 index 0000000000..7847802041 --- /dev/null +++ b/package/pptp/files/pptp.sh @@ -0,0 +1,22 @@ +scan_pppoe() { + scan_ppp "$@" +} + +setup_interface_pppoe() { + local iface="$1" + local config="$2" + + config_get device "$config" device + + for module in slhc ppp_generic ppp_async ip_gre; do + /sbin/insmod $module 2>&- >&- + done + setup_interface "$iface" "$config" "dhcp" + + config_get mtu "$cfg" mtu + mtu=${mtu:-1452} + start_pppd "$config" \ + plugin rp-pppoe.so \ + mtu $mtu mru $mtu \ + "nic-$device" +} diff --git a/package/switch/Makefile b/package/switch/Makefile index 5513394fd6..860e530c4c 100644 --- a/package/switch/Makefile +++ b/package/switch/Makefile @@ -42,6 +42,10 @@ define Build/Compile endef define Package/kmod-switch/install + install -m0755 -d $(1)/lib/network/ + install -m0755 ./files/switch.sh $(1)/lib/network/ + install -m0755 -d $(1)/etc/modules.d/ + printf 'switch-core\nswitch-robo\nswitch-adm\n' > $(1)/etc/modules.d/20-switch install -m0755 -d $(1)/lib/modules/$(LINUX_VERSION) $(CP) $(PKG_BUILD_DIR)/*.$(LINUX_KMOD_SUFFIX) \ $(1)/lib/modules/$(LINUX_VERSION) diff --git a/package/switch/files/switch.sh b/package/switch/files/switch.sh new file mode 100644 index 0000000000..a787a8cf38 --- /dev/null +++ b/package/switch/files/switch.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +setup_switch_vlan() { + DIR="/proc/switch/$CONFIG_SECTION/vlan/$1" + [ -d "$DIR" ] || return 0 + + config_get ports "$CONFIG_SECTION" "vlan$1" + echo "$ports" > "$DIR/ports" +} + +setup_switch() { + config_cb() { + case "$1" in + switch) + [ -n "$2" -a -d "/proc/switch/$2" ] && { + echo 1 > "/proc/switch/$2/reset" + echo 1 > "/proc/switch/$2/enable" + echo 1 > "/proc/switch/$2/enable_vlan" + option_cb() { + case "$1" in + vlan*) setup_switch_vlan "${1##vlan}";; + esac + } + } + ;; + *) + option_cb() { return 0; } + ;; + esac + } + config_load network +} -- cgit v1.2.3 From cf123d2a166d297712ab7b7221af999a62643f98 Mon Sep 17 00:00:00 2001 From: nbd Date: Wed, 4 Oct 2006 20:05:48 +0000 Subject: add new rc.common for standardized init scripts, convert existing init scripts git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4915 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/ar7-2.4/etc/init.d/S00adam2 | 16 +- .../base-files/brcm-2.4/etc/init.d/S05netconfig | 157 +-- .../base-files/brcm-2.6/etc/init.d/S05netconfig | 161 +-- package/base-files/default/etc/init.d/S10boot | 46 +- package/base-files/default/etc/init.d/S40network | 14 +- package/base-files/default/etc/init.d/S50httpd | 10 +- package/base-files/default/etc/init.d/S50telnet | 10 +- package/base-files/default/etc/init.d/S60cron | 14 +- package/base-files/default/etc/init.d/S98done | 11 - package/base-files/default/etc/init.d/rcS | 17 +- package/base-files/default/etc/rc.common | 77 ++ package/dnsmasq/files/dnsmasq.init | 107 +- package/dropbear/files/dropbear.init | 33 +- package/iptables/files/firewall.init | 206 ++-- package/madwifi/files/madwifi.init | 6 +- target/linux/brcm-2.4/patches/001-bcm47xx.patch | 1117 ++++++++++---------- 16 files changed, 1065 insertions(+), 937 deletions(-) delete mode 100755 package/base-files/default/etc/init.d/S98done create mode 100755 package/base-files/default/etc/rc.common (limited to 'package/base-files/default/etc/init.d/rcS') diff --git a/package/base-files/ar7-2.4/etc/init.d/S00adam2 b/package/base-files/ar7-2.4/etc/init.d/S00adam2 index 0ca4c01453..5f5b3504c2 100755 --- a/package/base-files/ar7-2.4/etc/init.d/S00adam2 +++ b/package/base-files/ar7-2.4/etc/init.d/S00adam2 @@ -1,8 +1,12 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # ADAM2 patcher for Netgear DG834 and compatible -MD5="$(md5sum /dev/mtdblock/0 | awk '{print $1}')" -[ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && { - mtd unlock adam2 - /sbin/adam2patcher /dev/mtdblock/0 +# Copyright (C) 2006 OpenWrt.org + +start() { + MD5="$(md5sum /dev/mtdblock/0 | awk '{print $1}')" + [ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && { + mtd unlock adam2 + /sbin/adam2patcher /dev/mtdblock/0 + } + rm -f /etc/init.d/S00adam2 /sbin/adam2patcher >&- 2>&- } -rm -f /etc/init.d/S00adam2 /sbin/adam2patcher >&- 2>&- diff --git a/package/base-files/brcm-2.4/etc/init.d/S05netconfig b/package/base-files/brcm-2.4/etc/init.d/S05netconfig index 175b9a9836..71092da559 100755 --- a/package/base-files/brcm-2.4/etc/init.d/S05netconfig +++ b/package/base-files/brcm-2.4/etc/init.d/S05netconfig @@ -1,86 +1,87 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -[ -e /etc/config/network ] && exit 0 +start() { + [ -e /etc/config/network ] && exit 0 -mkdir -p /etc/config + mkdir -p /etc/config -( - if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then - # WGT634u - echo boardtype=wgt634u - else - strings /dev/mtdblock/3 - fi -) | awk ' -function p(cfgname, name) { - if (c[name] != "") print " option " cfgname " \"" c[name] "\"" -} - -BEGIN { - FS="=" - c["lan_ifname"]="eth0.0 wl0" - c["wan_ifname"]="eth0.1" - c["vlan0ports"]="1 2 3 4 5*" - c["vlan1ports"]="0 5" -} - -($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { - nvram[$1] = $2 -} - -END { - # v1 hardware - if (nvram["boardtype"] == "bcm94710dev") { - # Asus WL-500g - if (nvram["boardnum"] == "asusX") { - c["lan_ifname"]="eth0 eth1 wl0" # FIXME - c["wan_ifname"]="" - } + ( + if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi + ) | awk ' + function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" } - if (nvram["boardtype"] == "wgt634u") { - c["vlan0ports"] = "0 1 2 3 5*" - c["vlan1ports"] = "4 5" - c["lan_ifname"] = "eth0.0 ath0" + + BEGIN { + FS="=" + c["lan_ifname"]="eth0.0 wl0" + c["wan_ifname"]="eth0.1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" } - if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { - c["vlan0ports"] = "0 1 2 3 5*" - c["vlan1ports"] = "4 5" + + ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 } - - # WAP54G - if ((nvram["boardnum"] == "2") || \ - (nvram["boardnum"] == "1024")) { - c["lan_ifname"]="eth0 wl0" - c["wan_ifname"]="" - } - - print "#### VLAN configuration " - print "config switch eth0" - p("vlan0", "vlan0ports") - p("vlan1", "vlan1ports") - print "" - print "" - print "#### Loopback configuration" - print "config interface loopback" - print " option ifname \"lo\"" - print " option proto static" - print " option ipaddr 127.0.0.1" - print " option netmask 255.0.0.0" - print "" - print "" - print "#### LAN configuration" - print "config interface lan" - print " option type bridge" - p("ifname", "lan_ifname") - print " option proto static" - print " option ipaddr 192.168.1.1" - print " option netmask 255.255.255.0" - print "" - print "" - print "#### WAN configuration" - print "config interface wan" - p("ifname", "wan_ifname") - print " option proto dhcp" + + END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifname"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifname"] = "eth0.0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifname"]="eth0 wl0" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") + print "" + print "" + print "#### Loopback configuration" + print "config interface loopback" + print " option ifname \"lo\"" + print " option proto static" + print " option ipaddr 127.0.0.1" + print " option netmask 255.0.0.0" + print "" + print "" + print "#### LAN configuration" + print "config interface lan" + print " option type bridge" + p("ifname", "lan_ifname") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" + print "" + print "" + print "#### WAN configuration" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" + }' > /etc/config/network } -' > /etc/config/network diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/S05netconfig index 175b9a9836..e37633e18f 100755 --- a/package/base-files/brcm-2.6/etc/init.d/S05netconfig +++ b/package/base-files/brcm-2.6/etc/init.d/S05netconfig @@ -1,86 +1,87 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -[ -e /etc/config/network ] && exit 0 - -mkdir -p /etc/config - -( - if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then - # WGT634u - echo boardtype=wgt634u - else - strings /dev/mtdblock/3 - fi -) | awk ' -function p(cfgname, name) { - if (c[name] != "") print " option " cfgname " \"" c[name] "\"" -} - -BEGIN { - FS="=" - c["lan_ifname"]="eth0.0 wl0" - c["wan_ifname"]="eth0.1" - c["vlan0ports"]="1 2 3 4 5*" - c["vlan1ports"]="0 5" -} - -($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { - nvram[$1] = $2 -} - -END { - # v1 hardware - if (nvram["boardtype"] == "bcm94710dev") { - # Asus WL-500g - if (nvram["boardnum"] == "asusX") { - c["lan_ifname"]="eth0 eth1 wl0" # FIXME - c["wan_ifname"]="" - } - } - if (nvram["boardtype"] == "wgt634u") { - c["vlan0ports"] = "0 1 2 3 5*" - c["vlan1ports"] = "4 5" - c["lan_ifname"] = "eth0.0 ath0" +start() { + [ -e /etc/config/network ] && exit 0 + + mkdir -p /etc/config + + ( + if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi + ) | awk ' + function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" } - if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { - c["vlan0ports"] = "0 1 2 3 5*" - c["vlan1ports"] = "4 5" + + BEGIN { + FS="=" + c["lan_ifname"]="eth0.0 wl0" + c["wan_ifname"]="eth0.1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" } - - # WAP54G - if ((nvram["boardnum"] == "2") || \ - (nvram["boardnum"] == "1024")) { - c["lan_ifname"]="eth0 wl0" - c["wan_ifname"]="" + + ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 } - - print "#### VLAN configuration " - print "config switch eth0" - p("vlan0", "vlan0ports") - p("vlan1", "vlan1ports") - print "" - print "" - print "#### Loopback configuration" - print "config interface loopback" - print " option ifname \"lo\"" - print " option proto static" - print " option ipaddr 127.0.0.1" - print " option netmask 255.0.0.0" - print "" - print "" - print "#### LAN configuration" - print "config interface lan" - print " option type bridge" - p("ifname", "lan_ifname") - print " option proto static" - print " option ipaddr 192.168.1.1" - print " option netmask 255.255.255.0" - print "" - print "" - print "#### WAN configuration" - print "config interface wan" - p("ifname", "wan_ifname") - print " option proto dhcp" + + END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifname"]="eth0 eth1 wl0" # FIXME + c["wan_ifname"]="" + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifname"] = "eth0.0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifname"]="eth0 wl0" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "config switch eth0" + p("vlan0", "vlan0ports") + p("vlan1", "vlan1ports") + print "" + print "" + print "#### Loopback configuration" + print "config interface loopback" + print " option ifname \"lo\"" + print " option proto static" + print " option ipaddr 127.0.0.1" + print " option netmask 255.0.0.0" + print "" + print "" + print "#### LAN configuration" + print "config interface lan" + print " option type bridge" + p("ifname", "lan_ifname") + print " option proto static" + print " option ipaddr 192.168.1.1" + print " option netmask 255.255.255.0" + print "" + print "" + print "#### WAN configuration" + print "config interface wan" + p("ifname", "wan_ifname") + print " option proto dhcp" + }' > /etc/config/network } -' > /etc/config/network diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/S10boot index b361e156fe..77b5ca72d5 100755 --- a/package/base-files/default/etc/init.d/S10boot +++ b/package/base-files/default/etc/init.d/S10boot @@ -1,25 +1,25 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -. /etc/functions.sh - -[ -f /proc/mounts ] || /sbin/mount_root -[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc -vconfig set_name_type DEV_PLUS_VID_NO_PAD - -HOSTNAME=${wan_hostname%%.*} -echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname - -mkdir -p /var/run -mkdir -p /var/log -mkdir -p /var/lock -touch /var/log/wtmp -touch /var/log/lastlog -[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe - -# manually trigger hotplug before loading modules -for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do - /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net -done - -load_modules /etc/modules /etc/modules.d/* +start() { + [ -f /proc/mounts ] || /sbin/mount_root + [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc + vconfig set_name_type DEV_PLUS_VID_NO_PAD + + HOSTNAME=${wan_hostname%%.*} + echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname + + mkdir -p /var/run + mkdir -p /var/log + mkdir -p /var/lock + touch /var/log/wtmp + touch /var/log/lastlog + [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe + + # manually trigger hotplug before loading modules + for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do + /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net + done + + load_modules /etc/modules /etc/modules.d/* +} diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/S40network index f2c3e22859..be045045e7 100755 --- a/package/base-files/default/etc/init.d/S40network +++ b/package/base-files/default/etc/init.d/S40network @@ -1,9 +1,11 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -setup_switch() { return 0; } +start() { + setup_switch() { return 0; } + + include /lib/network + setup_switch + /sbin/wifi +} -. /etc/functions.sh -include /lib/network -setup_switch -/sbin/wifi diff --git a/package/base-files/default/etc/init.d/S50httpd b/package/base-files/default/etc/init.d/S50httpd index d278519e98..a05b10c094 100755 --- a/package/base-files/default/etc/init.d/S50httpd +++ b/package/base-files/default/etc/init.d/S50httpd @@ -1,4 +1,10 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -[ -d /www ] && httpd -p 80 -h /www -r OpenWrt +start() { + [ -d /www ] && httpd -p 80 -h /www -r OpenWrt +} + +stop() { + killall httpd +} diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/S50telnet index 25242bdef8..228eac2b62 100755 --- a/package/base-files/default/etc/init.d/S50telnet +++ b/package/base-files/default/etc/init.d/S50telnet @@ -1,4 +1,10 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi +start() { + if awk -F: '/^root:/ && $2 !~ /\!/ {exit 1}' /etc/passwd 2>/dev/null; then telnetd -l /bin/login; fi +} + +stop() { + killall telnetd +} diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/S60cron index 6df9b7dee9..a450c36dd2 100755 --- a/package/base-files/default/etc/init.d/S60cron +++ b/package/base-files/default/etc/init.d/S60cron @@ -1,6 +1,12 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -mkdir -p /var/spool/cron -ln -s /etc/crontabs /var/spool/cron/crontabs -crond -c /etc/crontabs +start () { + mkdir -p /var/spool/cron + ln -s /etc/crontabs /var/spool/cron/crontabs + crond -c /etc/crontabs +} + +stop() { + killall crond +} diff --git a/package/base-files/default/etc/init.d/S98done b/package/base-files/default/etc/init.d/S98done deleted file mode 100755 index a1ea5ad438..0000000000 --- a/package/base-files/default/etc/init.d/S98done +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org - -sysctl -p >&- - -# automagically run firstboot -{ mount|grep "on / type tmpfs" 1>&-; } && { - lock /tmp/.switch2jffs - firstboot switch2jffs - lock -u /tmp/.switch2jffs -} diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS index 2aa70910c3..7fae7f5b05 100755 --- a/package/base-files/default/etc/init.d/rcS +++ b/package/base-files/default/etc/init.d/rcS @@ -10,6 +10,17 @@ ${FAILSAFE:+exit} syslogd -C 16 #${log_ipaddr:+-L -R $log_ipaddr} klogd -for i in /etc/init.d/S*; do - $i start 2>&1 -done | logger -s -p 6 -t '' & +( + for i in /etc/init.d/S*; do + $i start 2>&1 + done + + sysctl -p >&- + + # automagically run firstboot + { mount|grep "on / type tmpfs" 1>&-; } && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs + } +) | logger -s -p 6 -t '' & diff --git a/package/base-files/default/etc/rc.common b/package/base-files/default/etc/rc.common new file mode 100755 index 0000000000..4a90a25b18 --- /dev/null +++ b/package/base-files/default/etc/rc.common @@ -0,0 +1,77 @@ +#!/bin/sh +. /etc/functions.sh + +start() { + return 0 +} + +stop() { + return 0 +} + +reload() { + return 1 +} + +restart() { + stop + start +} + +boot() { + start +} + +shutdown() { + return 0 +} + +disable() { + rm -f /etc/rc.d/${initscript##*/} +} + +enable() { + disable + ln -s /etc/init.d/${initscript##*/} /etc/rc.d/${initscript##*/} +} + +depends() { + return 0 +} + +help() { + cat <&- && dhcp_enable="${dhcp_enable:-0}" - -# dhcp_enable=0 disables the dhcp server -( - [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && { - # no existing DHCP server? - - # calculate settings - config_get ipaddr "$iface" ipaddr - config_get netmask "$iface" netmask - eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150}) - - # and pass the args via config parser defines - echo "${dhcp_enable:+@define dhcp_enable 1}" - echo "@define netmask $NETMASK" - echo "@define start $START" - echo "@define end $END" - echo "@define lease ${dhcp_lease:-12h}" - } - - # ignore requests from wan interface - config_get wan_proto wan proto - config_get wan_ifname wan ifname - [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname" - - cat /etc/dnsmasq.conf -) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0 +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +start() { + include /lib/network + scan_interfaces + + # The following is to automatically configure the DHCP settings + # based on config settings. Feel free to replace all this crap + # with a simple "dnsmasq" and manage everything via the + # /etc/dnsmasq.conf config file + + [ -f /etc/dnsmasq.conf ] || exit + + args="" + iface=lan + config_get ifname "$iface" ifname + config_get proto "$iface" proto + + [ "$proto" = static ] && dhcp_enable="${dhcp_enable:-1}" + dhcp_start="${dhcp_start:-100}" + dhcp_num="${dhcp_num:-50}" + dhcp_lease="${dhcp_lease:-12h}" + + # if dhcp_enable is unset and there is a dhcp server on the network already, default to dhcp_enable=0 + [ -z "$dhcp_enable" ] && udhcpc -n -q -R -s /bin/true -i $ifname >&- && dhcp_enable="${dhcp_enable:-0}" + + # dhcp_enable=0 disables the dhcp server + ( + [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && { + # no existing DHCP server? + + # calculate settings + config_get ipaddr "$iface" ipaddr + config_get netmask "$iface" netmask + eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150}) + + # and pass the args via config parser defines + echo "${dhcp_enable:+@define dhcp_enable 1}" + echo "@define netmask $NETMASK" + echo "@define start $START" + echo "@define end $END" + echo "@define lease ${dhcp_lease:-12h}" + } + + # ignore requests from wan interface + config_get wan_proto wan proto + config_get wan_ifname wan ifname + [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname" + + cat /etc/dnsmasq.conf + ) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0 +} + +stop() { + killall dnsmasq +} diff --git a/package/dropbear/files/dropbear.init b/package/dropbear/files/dropbear.init index 88fc288491..e0a4481bf9 100755 --- a/package/dropbear/files/dropbear.init +++ b/package/dropbear/files/dropbear.init @@ -1,16 +1,19 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org -for type in rsa dss; do { - # check for keys - key=/etc/dropbear/dropbear_${type}_host_key - [ ! -f $key ] && { - # generate missing keys - mkdir -p /etc/dropbear - [ -x /usr/bin/dropbearkey ] && { - /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* - } & - exit 0 - } -}; done - -/usr/sbin/dropbear +start() { + for type in rsa dss; do { + # check for keys + key=/etc/dropbear/dropbear_${type}_host_key + [ ! -f $key ] && { + # generate missing keys + mkdir -p /etc/dropbear + [ -x /usr/bin/dropbearkey ] && { + /usr/bin/dropbearkey -t $type -f $key 2>&- >&- && exec $0 $* + } & + exit 0 + } + }; done + + /usr/sbin/dropbear +} diff --git a/package/iptables/files/firewall.init b/package/iptables/files/firewall.init index 4acd325a99..731485bcdd 100755 --- a/package/iptables/files/firewall.init +++ b/package/iptables/files/firewall.init @@ -1,103 +1,115 @@ -#!/bin/sh +#!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org ## Please make changes in /etc/firewall.user -. /etc/functions.sh -include /lib/network - -scan_interfaces -config_get WAN wan ifname -config_get LAN lan ifname - -## CLEAR TABLES -for T in filter nat; do - iptables -t $T -F - iptables -t $T -X -done - -iptables -N input_rule -iptables -N output_rule -iptables -N forwarding_rule - -iptables -t nat -N prerouting_rule -iptables -t nat -N postrouting_rule - -iptables -N LAN_ACCEPT -[ -z "$WAN" ] || iptables -A LAN_ACCEPT -i "$WAN" -j RETURN -iptables -A LAN_ACCEPT -j ACCEPT - -### INPUT -### (connections with the router as destination) - - # base case - iptables -P INPUT DROP - iptables -A INPUT -m state --state INVALID -j DROP - iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A INPUT -j input_rule - - # allow - iptables -A INPUT -j LAN_ACCEPT # allow from lan/wifi interfaces - iptables -A INPUT -p icmp -j ACCEPT # allow ICMP - iptables -A INPUT -p gre -j ACCEPT # allow GRE - - # reject (what to do with anything not allowed earlier) - iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset - iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable - -### OUTPUT -### (connections with the router as source) - - # base case - iptables -P OUTPUT DROP - iptables -A OUTPUT -m state --state INVALID -j DROP - iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A OUTPUT -j output_rule - - # allow - iptables -A OUTPUT -j ACCEPT #allow everything out - - # reject (what to do with anything not allowed earlier) - iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset - iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable - -### FORWARDING -### (connections routed through the router) - - # base case - iptables -P FORWARD DROP - iptables -A FORWARD -m state --state INVALID -j DROP - iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu - iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT - - # - # insert accept rule or to jump to new accept-check table here - # - iptables -A FORWARD -j forwarding_rule - - # allow - iptables -A FORWARD -i br0 -o br0 -j ACCEPT - [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT - - # reject (what to do with anything not allowed earlier) - # uses the default -P DROP - -### MASQ - iptables -t nat -A PREROUTING -j prerouting_rule - iptables -t nat -A POSTROUTING -j postrouting_rule - [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE +start() { + include /lib/network + scan_interfaces + + config_get WAN wan ifname + config_get LAN lan ifname + + ## CLEAR TABLES + for T in filter nat; do + iptables -t $T -F + iptables -t $T -X + done + + iptables -N input_rule + iptables -N output_rule + iptables -N forwarding_rule + + iptables -t nat -N prerouting_rule + iptables -t nat -N postrouting_rule + + iptables -N LAN_ACCEPT + [ -z "$WAN" ] || iptables -A LAN_ACCEPT -i "$WAN" -j RETURN + iptables -A LAN_ACCEPT -j ACCEPT + + ### INPUT + ### (connections with the router as destination) + + # base case + iptables -P INPUT DROP + iptables -A INPUT -m state --state INVALID -j DROP + iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + iptables -A INPUT -p tcp --tcp-flags SYN SYN --tcp-option \! 2 -j DROP + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A INPUT -j input_rule + + # allow + iptables -A INPUT -j LAN_ACCEPT # allow from lan/wifi interfaces + iptables -A INPUT -p icmp -j ACCEPT # allow ICMP + iptables -A INPUT -p gre -j ACCEPT # allow GRE + + # reject (what to do with anything not allowed earlier) + iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable + + ### OUTPUT + ### (connections with the router as source) + + # base case + iptables -P OUTPUT DROP + iptables -A OUTPUT -m state --state INVALID -j DROP + iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A OUTPUT -j output_rule + + # allow + iptables -A OUTPUT -j ACCEPT #allow everything out + + # reject (what to do with anything not allowed earlier) + iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset + iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable + + ### FORWARDING + ### (connections routed through the router) + + # base case + iptables -P FORWARD DROP + iptables -A FORWARD -m state --state INVALID -j DROP + iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu + iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT + + # + # insert accept rule or to jump to new accept-check table here + # + iptables -A FORWARD -j forwarding_rule + + # allow + iptables -A FORWARD -i br0 -o br0 -j ACCEPT + [ -z "$WAN" ] || iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT + + # reject (what to do with anything not allowed earlier) + # uses the default -P DROP + + ### MASQ + iptables -t nat -A PREROUTING -j prerouting_rule + iptables -t nat -A POSTROUTING -j postrouting_rule + [ -z "$WAN" ] || iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE + + ## USER RULES + [ -f /etc/firewall.user ] && . /etc/firewall.user + [ -n "$WAN" -a -e /etc/config/firewall ] && { + awk -f /usr/lib/common.awk -f /usr/lib/firewall.awk /etc/config/firewall | ash + } +} -## USER RULES -[ -f /etc/firewall.user ] && . /etc/firewall.user -[ -n "$WAN" -a -e /etc/config/firewall ] && { - awk -f /usr/lib/common.awk -f /usr/lib/firewall.awk /etc/config/firewall | ash +stop() { + iptables -P INPUT ACCEPT + iptables -P OUTPUT ACCEPT + iptables -P FORWARD ACCEPT + iptables -F + iptables -t nat -P PREROUTING ACCEPT + iptables -t nat -P POSTROUTING ACCEPT + iptables -t nat -P OUTPUT ACCEPT + iptables -t nat -F } diff --git a/package/madwifi/files/madwifi.init b/package/madwifi/files/madwifi.init index b1e78c0930..73eb11017e 100644 --- a/package/madwifi/files/madwifi.init +++ b/package/madwifi/files/madwifi.init @@ -1,2 +1,4 @@ -#!/bin/sh -iwpriv ath0 mode 3 +#!/bin/sh /etc/rc.common +start() { + iwpriv ath0 mode 3 +} diff --git a/target/linux/brcm-2.4/patches/001-bcm47xx.patch b/target/linux/brcm-2.4/patches/001-bcm47xx.patch index 557d24ff3f..726eba8061 100644 --- a/target/linux/brcm-2.4/patches/001-bcm47xx.patch +++ b/target/linux/brcm-2.4/patches/001-bcm47xx.patch @@ -1,58 +1,6 @@ -diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile ---- linux.old/arch/mips/Makefile 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/Makefile 2006-04-27 19:24:19.000000000 +0200 -@@ -726,6 +726,19 @@ - endif - - # -+# Broadcom BCM947XX variants -+# -+ifdef CONFIG_BCM947XX -+LIBS += arch/mips/bcm947xx/generic/brcm.o arch/mips/bcm947xx/bcm947xx.o -+SUBDIRS += arch/mips/bcm947xx/generic arch/mips/bcm947xx -+LOADADDR := 0x80001000 -+ -+zImage: vmlinux -+ $(MAKE) -C arch/$(ARCH)/bcm947xx/compressed -+export LOADADDR -+endif -+ -+# - # Choosing incompatible machines durings configuration will result in - # error messages during linking. Select a default linkscript if - # none has been choosen above. -@@ -778,6 +791,7 @@ - $(MAKE) -C arch/$(ARCH)/tools clean - $(MAKE) -C arch/mips/baget clean - $(MAKE) -C arch/mips/lasat clean -+ $(MAKE) -C arch/mips/bcm947xx/compressed clean - - archmrproper: - @$(MAKEBOOT) mrproper -diff -urN linux.old/arch/mips/bcm947xx/Makefile linux.dev/arch/mips/bcm947xx/Makefile ---- linux.old/arch/mips/bcm947xx/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/Makefile 2006-05-02 17:46:22.000000000 +0200 -@@ -0,0 +1,17 @@ -+# -+# Makefile for the BCM947xx specific kernel interface routines -+# under Linux. -+# -+ -+EXTRA_CFLAGS+=-I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER -+ -+O_TARGET := bcm947xx.o -+ -+export-objs := export.o -+obj-y := prom.o setup.o time.o sbmips.o gpio.o -+obj-y += nvram.o nvram_linux.o sflash.o cfe_env.o -+obj-y += sbutils.o bcmutils.o bcmsrom.o hndchipc.o -+obj-$(CONFIG_PCI) += sbpci.o pcibios.o -+obj-y += export.o -+ -+include $(TOPDIR)/Rules.make diff -urN linux.old/arch/mips/bcm947xx/bcmsrom.c linux.dev/arch/mips/bcm947xx/bcmsrom.c --- linux.old/arch/mips/bcm947xx/bcmsrom.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/bcmsrom.c 2006-04-27 20:32:48.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/bcmsrom.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,1212 @@ +/* + * Misc useful routines to access NIC SROM/OTP . @@ -1268,7 +1216,7 @@ diff -urN linux.old/arch/mips/bcm947xx/bcmsrom.c linux.dev/arch/mips/bcm947xx/bc + diff -urN linux.old/arch/mips/bcm947xx/bcmutils.c linux.dev/arch/mips/bcm947xx/bcmutils.c --- linux.old/arch/mips/bcm947xx/bcmutils.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/bcmutils.c 2006-04-28 00:34:02.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/bcmutils.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,247 @@ +/* + * Misc useful OS-independent routines. @@ -1519,7 +1467,7 @@ diff -urN linux.old/arch/mips/bcm947xx/bcmutils.c linux.dev/arch/mips/bcm947xx/b + diff -urN linux.old/arch/mips/bcm947xx/cfe_env.c linux.dev/arch/mips/bcm947xx/cfe_env.c --- linux.old/arch/mips/bcm947xx/cfe_env.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/cfe_env.c 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/cfe_env.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,234 @@ +/* + * NVRAM variable manipulation (Linux kernel half) @@ -1757,7 +1705,7 @@ diff -urN linux.old/arch/mips/bcm947xx/cfe_env.c linux.dev/arch/mips/bcm947xx/cf + diff -urN linux.old/arch/mips/bcm947xx/compressed/Makefile linux.dev/arch/mips/bcm947xx/compressed/Makefile --- linux.old/arch/mips/bcm947xx/compressed/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/compressed/Makefile 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/compressed/Makefile 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,33 @@ +# +# Makefile for Broadcom BCM947XX boards @@ -1794,7 +1742,7 @@ diff -urN linux.old/arch/mips/bcm947xx/compressed/Makefile linux.dev/arch/mips/b + rm -f vmlinuz piggy diff -urN linux.old/arch/mips/bcm947xx/export.c linux.dev/arch/mips/bcm947xx/export.c --- linux.old/arch/mips/bcm947xx/export.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/export.c 2006-04-28 02:57:34.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/export.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,65 @@ +#include + @@ -1861,28 +1809,9 @@ diff -urN linux.old/arch/mips/bcm947xx/export.c linux.dev/arch/mips/bcm947xx/exp +_export(srom_read) +_export(srom_write) + -diff -urN linux.old/arch/mips/bcm947xx/generic/Makefile linux.dev/arch/mips/bcm947xx/generic/Makefile ---- linux.old/arch/mips/bcm947xx/generic/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/generic/Makefile 2006-04-27 19:24:19.000000000 +0200 -@@ -0,0 +1,15 @@ -+# -+# Makefile for the BCM947xx specific kernel interface routines -+# under Linux. -+# -+ -+.S.s: -+ $(CPP) $(AFLAGS) $< -o $*.s -+.S.o: -+ $(CC) $(AFLAGS) -c $< -o $*.o -+ -+O_TARGET := brcm.o -+ -+obj-y := int-handler.o irq.o -+ -+include $(TOPDIR)/Rules.make diff -urN linux.old/arch/mips/bcm947xx/generic/int-handler.S linux.dev/arch/mips/bcm947xx/generic/int-handler.S --- linux.old/arch/mips/bcm947xx/generic/int-handler.S 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/generic/int-handler.S 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/generic/int-handler.S 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,51 @@ +/* + * Generic interrupt handler for Broadcom MIPS boards @@ -1937,7 +1866,7 @@ diff -urN linux.old/arch/mips/bcm947xx/generic/int-handler.S linux.dev/arch/mips + END(brcmIRQ) diff -urN linux.old/arch/mips/bcm947xx/generic/irq.c linux.dev/arch/mips/bcm947xx/generic/irq.c --- linux.old/arch/mips/bcm947xx/generic/irq.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/generic/irq.c 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/generic/irq.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,130 @@ +/* + * Generic interrupt control functions for Broadcom MIPS boards @@ -2069,9 +1998,29 @@ diff -urN linux.old/arch/mips/bcm947xx/generic/irq.c linux.dev/arch/mips/bcm947x + breakpoint(); +#endif +} +diff -urN linux.old/arch/mips/bcm947xx/generic/Makefile linux.dev/arch/mips/bcm947xx/generic/Makefile +--- linux.old/arch/mips/bcm947xx/generic/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux.dev/arch/mips/bcm947xx/generic/Makefile 2006-10-02 21:26:29.000000000 +0200 +@@ -0,0 +1,16 @@ ++# ++# Makefile for the BCM947xx specific kernel interface routines ++# under Linux. ++# ++EXTRA_CFLAGS += -fno-delayed-branch ++ ++.S.s: ++ $(CPP) $(AFLAGS) $< -o $*.s ++.S.o: ++ $(CC) $(AFLAGS) -c $< -o $*.o ++ ++O_TARGET := brcm.o ++ ++obj-y := int-handler.o irq.o ++ ++include $(TOPDIR)/Rules.make diff -urN linux.old/arch/mips/bcm947xx/gpio.c linux.dev/arch/mips/bcm947xx/gpio.c --- linux.old/arch/mips/bcm947xx/gpio.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/gpio.c 2006-04-27 23:09:33.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/gpio.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,159 @@ +/* + * GPIO char driver @@ -2234,7 +2183,7 @@ diff -urN linux.old/arch/mips/bcm947xx/gpio.c linux.dev/arch/mips/bcm947xx/gpio. +module_exit(gpio_exit); diff -urN linux.old/arch/mips/bcm947xx/hndchipc.c linux.dev/arch/mips/bcm947xx/hndchipc.c --- linux.old/arch/mips/bcm947xx/hndchipc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/hndchipc.c 2006-04-28 00:33:05.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/hndchipc.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,158 @@ +/* + * BCM47XX support code for some chipcommon (old extif) facilities (uart) @@ -2396,7 +2345,7 @@ diff -urN linux.old/arch/mips/bcm947xx/hndchipc.c linux.dev/arch/mips/bcm947xx/h + diff -urN linux.old/arch/mips/bcm947xx/include/bcm4710.h linux.dev/arch/mips/bcm947xx/include/bcm4710.h --- linux.old/arch/mips/bcm947xx/include/bcm4710.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcm4710.h 2006-04-27 22:30:01.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcm4710.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,91 @@ +/* + * BCM4710 address space map and definitions @@ -2491,7 +2440,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcm4710.h linux.dev/arch/mips/bcm +#endif /* _bcm4710_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdefs.h linux.dev/arch/mips/bcm947xx/include/bcmdefs.h --- linux.old/arch/mips/bcm947xx/include/bcmdefs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmdefs.h 2006-04-27 20:12:21.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcmdefs.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,106 @@ +/* + * Misc system wide definitions @@ -2599,27 +2548,26 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdefs.h linux.dev/arch/mips/bcm + + +#endif /* _bcmdefs_h_ */ -diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm947xx/include/bcmdevs.h ---- linux.old/arch/mips/bcm947xx/include/bcmdevs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmdevs.h 2006-04-27 22:30:25.000000000 +0200 -@@ -0,0 +1,369 @@ +diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bcm947xx/include/bcmdevs1.h +--- linux.old/arch/mips/bcm947xx/include/bcmdevs1.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux.dev/arch/mips/bcm947xx/include/bcmdevs1.h 2006-10-02 21:19:59.000000000 +0200 +@@ -0,0 +1,391 @@ +/* + * Broadcom device-specific manifest constants. + * -+ * Copyright 2006, Broadcom Corporation -+ * All Rights Reserved. -+ * -+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -+ * $Id: bcmdevs.h,v 1.1.1.17 2006/04/15 01:29:08 michael Exp $ ++ * Copyright 2005, Broadcom Corporation ++ * All Rights Reserved. ++ * ++ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY ++ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM ++ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS ++ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. ++ * $Id$ + */ + +#ifndef _BCMDEVS_H +#define _BCMDEVS_H + -+#include "bcm4710.h" + +/* Known PCI vendor Id's */ +#define VENDOR_EPIGRAM 0xfeda @@ -2659,22 +2607,30 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +#define BCM47XX_ROBO_ID 0x4719 /* 47xx/53xx roboswitch core */ +#define BCM47XX_USB20H_ID 0x471a /* 47xx usb 2.0 host */ +#define BCM47XX_USB20D_ID 0x471b /* 47xx usb 2.0 device */ -+#define BCM47XX_ATA100_ID 0x471d /* 47xx parallel ATA */ -+#define BCM47XX_SATAXOR_ID 0x471e /* 47xx serial ATA & XOR DMA */ -+#define BCM47XX_GIGETH_ID 0x471f /* 47xx GbE (5700) */ + -+#define BCM47XX_SMBUS_EMU_ID 0x47fe /* 47xx emulated SMBus device */ -+#define BCM47XX_XOR_EMU_ID 0x47ff /* 47xx emulated XOR engine */ -+ -+#define BCM4710_CHIP_ID 0x4710 /* 4710 chipid returned by sb_chip() */ +#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */ + -+#define BCM4402_CHIP_ID 0x4402 /* 4402 chipid */ ++#define BCM4610_DEVICE_ID 0x4610 /* 4610 primary function 0 */ ++#define BCM4610_ILINE_ID 0x4611 /* 4610 iline100 */ ++#define BCM4610_V90_ID 0x4612 /* 4610 v90 codec */ ++#define BCM4610_ENET_ID 0x4613 /* 4610 enet */ ++#define BCM4610_EXT_ID 0x4614 /* 4610 external i/f */ ++#define BCM4610_USB_ID 0x4615 /* 4610 usb */ ++ ++#define BCM4402_DEVICE_ID 0x4402 /* 4402 primary function 0 */ +#define BCM4402_ENET_ID 0x4402 /* 4402 enet */ +#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */ +#define BCM4401_ENET_ID 0x170c /* 4401b0 production enet cards */ + -+#define BCM4306_CHIP_ID 0x4306 /* 4306 chipcommon chipid */ ++#define BCM4301_DEVICE_ID 0x4301 /* 4301 primary function 0 */ ++#define BCM4301_D11B_ID 0x4301 /* 4301 802.11b */ ++ ++#define BCM4307_DEVICE_ID 0x4307 /* 4307 primary function 0 */ ++#define BCM4307_V90_ID 0x4305 /* 4307 v90 codec */ ++#define BCM4307_ENET_ID 0x4306 /* 4307 enet */ ++#define BCM4307_D11B_ID 0x4307 /* 4307 802.11b */ ++ ++#define BCM4306_DEVICE_ID 0x4306 /* 4306 chipcommon chipid */ +#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */ +#define BCM4306_D11G_ID2 0x4325 +#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */ @@ -2684,63 +2640,77 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm + +#define BCM4309_PKG_ID 1 /* 4309 package id */ + -+#define BCM4311_CHIP_ID 0x4311 /* 4311 PCIe 802.11a/b/g */ -+#define BCM4311_D11G_ID 0x4311 /* 4311 802.11b/g id */ -+#define BCM4311_D11DUAL_ID 0x4312 /* 4311 802.11a/b/g id */ -+#define BCM4311_D11A_ID 0x4313 /* 4311 802.11a id */ -+ +#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */ +#define BCM4303_PKG_ID 2 /* 4303 package id */ + ++#define BCM4310_DEVICE_ID 0x4310 /* 4310 chipcommon chipid */ ++#define BCM4310_D11B_ID 0x4311 /* 4310 802.11b */ ++#define BCM4310_UART_ID 0x4312 /* 4310 uart */ ++#define BCM4310_ENET_ID 0x4313 /* 4310 enet */ ++#define BCM4310_USB_ID 0x4315 /* 4310 usb */ ++ +#define BCMGPRS_UART_ID 0x4333 /* Uart id used by 4306/gprs card */ +#define BCMGPRS2_UART_ID 0x4344 /* Uart id used by 4306/gprs card */ + -+#define BCM4704_CHIP_ID 0x4704 /* 4704 chipcommon chipid */ ++ ++#define BCM4704_DEVICE_ID 0x4704 /* 4704 chipcommon chipid */ +#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */ + -+#define BCM4318_CHIP_ID 0x4318 /* 4318 chip common chipid */ -+#define BCM4318_D11G_ID 0x4318 /* 4318 802.11b/g id */ -+#define BCM4318_D11DUAL_ID 0x4319 /* 4318 802.11a/b/g id */ -+#define BCM4318_D11A_ID 0x431a /* 4318 802.11a id */ ++#define BCM4317_DEVICE_ID 0x4317 /* 4317 chip common chipid */ + -+#define BCM4321_CHIP_ID 0x4321 /* 4321 chip common chipid */ -+#define BCM4321_D11N_ID 0x4328 /* 4321 802.11n dualband id */ -+#define BCM4321_D11N2G_ID 0x4329 /* 4321 802.11n 2.4Hgz band id */ -+#define BCM4321_D11N5G_ID 0x432a /* 4321 802.11n 5Ghz band id */ ++#define BCM4318_DEVICE_ID 0x4318 /* 4318 chip common chipid */ ++#define BCM4318_D11G_ID 0x4318 /* 4318 801.11b/g id */ ++#define BCM4318_D11DUAL_ID 0x4319 /* 4318 801.11a/b/g id */ ++#define BCM4318_JTAGM_ID 0x4331 /* 4318 jtagm device id */ + -+#define BCM4331_CHIP_ID 0x4331 /* 4331 chip common chipid */ -+#define BCM4331_D11N2G_ID 0x4330 /* 4331 802.11n 2.4Ghz band id */ -+#define BCM4331_D11N_ID 0x4331 /* 4331 802.11n dualband id */ -+#define BCM4331_D11N5G_ID 0x4332 /* 4331 802.11n 5Ghz band id */ ++#define FPGA_JTAGM_ID 0x4330 /* ??? */ + -+#define HDLSIM5350_PKG_ID 1 /* HDL simulator package id for a 5350 */ -+#define HDLSIM_PKG_ID 14 /* HDL simulator package id */ -+#define HWSIM_PKG_ID 15 /* Hardware simulator package id */ ++/* Address map */ ++#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */ ++#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */ ++#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */ ++#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */ ++#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ ++#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */ + -+#define BCM4712_CHIP_ID 0x4712 /* 4712 chipcommon chipid */ -+#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */ -+#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */ -+#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */ -+#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */ ++/* Core register space */ ++#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */ ++#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */ ++#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */ ++#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */ ++#define BCM4710_REG_USB 0x18004000 /* USB core registers */ ++#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */ ++#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */ ++#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */ ++#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */ + -+#define BCM5365_CHIP_ID 0x5365 /* 5365 chipcommon chipid */ -+#define BCM5350_CHIP_ID 0x5350 /* bcm5350 chipcommon chipid */ -+#define BCM5352_CHIP_ID 0x5352 /* bcm5352 chipcommon chipid */ ++#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */ ++#define BCM4710_PCMCIA_MEM 0x1f000000 /* External Interface PCMCIA memory access */ ++#define BCM4710_PCMCIA_IO 0x1f100000 /* PCMCIA I/O access */ ++#define BCM4710_PCMCIA_CONF 0x1f200000 /* PCMCIA configuration */ ++#define BCM4710_PROG 0x1f800000 /* Programable interface */ ++#define BCM4710_FLASH 0x1fc00000 /* Flash */ + -+#define BCM4320_CHIP_ID 0x4320 /* bcm4320 chipcommon chipid */ ++#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ + -+#define BCM4328_CHIP_ID 0x4328 /* bcm4328 chipcommon chipid */ ++#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300) + -+#define FPGA_JTAGM_ID 0x43f0 /* FPGA jtagm device id */ -+#define BCM43XX_JTAGM_ID 0x43f1 /* 43xx jtagm device id */ -+#define BCM43XXOLD_JTAGM_ID 0x4331 /* 43xx old jtagm device id */ ++#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000) ++#define BCM4710_LED (BCM4710_EXTIF + 0x00900000) + -+#define SDIOH_FPGA_ID 0x43f2 /* sdio host fpga */ -+#define SDIOD_FPGA_ID 0x43f4 /* sdio device fpga */ ++#define BCM4712_DEVICE_ID 0x4712 /* 4712 chipcommon chipid */ ++#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */ ++#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */ ++#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */ ++#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */ + -+#define MIMO_FPGA_ID 0x43f8 /* FPGA mimo minimacphy device id */ ++#define SDIOH_FPGA_ID 0x4380 /* sdio host fpga */ + -+#define BCM4785_CHIP_ID 0x4785 /* 4785 chipcommon chipid */ ++#define BCM5365_DEVICE_ID 0x5365 /* 5365 chipcommon chipid */ ++#define BCM5350_DEVICE_ID 0x5350 /* bcm5350 chipcommon chipid */ ++#define BCM5352_DEVICE_ID 0x5352 /* bcm5352 chipcommon chipid */ ++ ++#define BCM4320_DEVICE_ID 0x4320 /* bcm4320 chipcommon chipid */ + +/* PCMCIA vendor Id's */ + @@ -2766,12 +2736,8 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +#define BFL_BTCMOD 0x4000 /* This board' BTCOEXIST is in the alternate gpios */ +#define BFL_ALTIQ 0x8000 /* Alternate I/Q settings */ + -+/* boardflags2 */ -+#define BFL2_RXBB_INT_REG_DIS 0x00000001 /* This board has an external rxbb regulator */ -+#define BFL2_SSWITCH_AVAIL 0x00000002 /* This board has a superswitch for > 2 antennas */ -+#define BFL2_TXPWRCTRL_EN 0x00000004 /* This board permits TX Power Control to be enabled */ -+ +/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */ ++#define BOARD_GPIO_HWRAD_B 0x010 /* bit 4 is HWRAD input on 4301 */ +#define BOARD_GPIO_BTCMOD_IN 0x010 /* bit 4 is the alternate BT Coexistance Input */ +#define BOARD_GPIO_BTCMOD_OUT 0x020 /* bit 5 is the alternate BT Coexistance Out */ +#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistance Input */ @@ -2782,6 +2748,20 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ +#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ + ++/* Bus types */ ++#define SB_BUS 0 /* Silicon Backplane */ ++#define PCI_BUS 1 /* PCI target */ ++#define PCMCIA_BUS 2 /* PCMCIA target */ ++#define SDIO_BUS 3 /* SDIO target */ ++#define JTAG_BUS 4 /* JTAG */ ++ ++/* Allows optimization for single-bus support */ ++#ifdef BCMBUSTYPE ++#define BUSTYPE(bus) (BCMBUSTYPE) ++#else ++#define BUSTYPE(bus) (bus) ++#endif ++ +/* power control defines */ +#define PLL_DELAY 150 /* us pll on delay */ +#define FREF_DELAY 200 /* us fref change delay */ @@ -2794,6 +2774,16 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +#define VSIM4710_BOARD 0x0401 +#define QT4710_BOARD 0x0402 + ++#define BU4610_BOARD 0x0403 ++#define VSIM4610_BOARD 0x0404 ++ ++#define BU4307_BOARD 0x0405 ++#define BCM94301CB_BOARD 0x0406 ++#define BCM94301PC_BOARD 0x0406 /* Pcmcia 5v card */ ++#define BCM94301MP_BOARD 0x0407 ++#define BCM94307MP_BOARD 0x0408 ++#define BCMAP4307_BOARD 0x0409 ++ +#define BU4309_BOARD 0x040a +#define BCM94309CB_BOARD 0x040b +#define BCM94309MP_BOARD 0x040c @@ -2801,6 +2791,12 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm + +#define BCM94302MP_BOARD 0x040e + ++#define VSIM4310_BOARD 0x040f ++#define BU4711_BOARD 0x0410 ++#define BCM94310U_BOARD 0x0411 ++#define BCM94310AP_BOARD 0x0412 ++#define BCM94310MP_BOARD 0x0414 ++ +#define BU4306_BOARD 0x0416 +#define BCM94306CB_BOARD 0x0417 +#define BCM94306MP_BOARD 0x0418 @@ -2810,16 +2806,21 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +#define BCM94710R4_BOARD 0x041c +#define BCM94710AP_BOARD 0x041d + ++ +#define BU2050_BOARD 0x041f + + +#define BCM94309G_BOARD 0x0421 + ++#define BCM94301PC3_BOARD 0x0422 /* Pcmcia 3.3v card */ ++ +#define BU4704_BOARD 0x0423 +#define BU4702_BOARD 0x0424 + +#define BCM94306PC_BOARD 0x0425 /* pcmcia 3.3v 4306 card */ + ++#define BU4317_BOARD 0x0426 ++ + +#define BCM94702MN_BOARD 0x0428 + @@ -2832,6 +2833,9 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +/* cb4306 with SiGe PA */ +#define BCM94306CBSG_BOARD 0x042b + ++/* mp4301 with 2050 radio */ ++#define BCM94301MPL_BOARD 0x042c ++ +/* cb4306 with SiGe PA */ +#define PCSG94306_BOARD 0x042d + @@ -2846,6 +2850,12 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm + + + ++/* BCM94317 boards */ ++#define BCM94317CB_BOARD 0x0440 ++#define BCM94317MP_BOARD 0x0441 ++#define BCM94317PCMCIA_BOARD 0x0442 ++#define BCM94317SDIO_BOARD 0x0443 ++ +#define BU4712_BOARD 0x0444 +#define BU4712SD_BOARD 0x045d +#define BU4712L_BOARD 0x045f @@ -2863,11 +2873,15 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm + +/* BCM63XX boards */ +#define BCM96338_BOARD 0x6338 ++#define BCM96345_BOARD 0x6345 +#define BCM96348_BOARD 0x6348 + +/* Another mp4306 with SiGe */ +#define BCM94306P_BOARD 0x044c + ++/* CF-like 4317 modules */ ++#define BCM94317CF_BOARD 0x044d ++ +/* mp4303 */ +#define BCM94303MP_BOARD 0x044e + @@ -2881,6 +2895,9 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm +/* 4712agr */ +#define BCM94712AGR_BOARD 0x0451 + ++/* The real CF 4317 board */ ++#define CFI4317_BOARD 0x0452 ++ +/* pcmcia 4303 */ +#define PC4303_BOARD 0x0454 + @@ -2916,82 +2933,37 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm + +#define BCM94318MPGH_BOARD 0x0463 + -+#define BU4311_BOARD 0x0464 -+#define BCM94311MC_BOARD 0x0465 -+#define BCM94311MCAG_BOARD 0x0466 + +#define BCM95352GR_BOARD 0x0467 + +/* bcm95351agr */ +#define BCM95351AGR_BOARD 0x0470 + -+/* bcm94704mpcb */ -+#define BCM94704MPCB_BOARD 0x0472 -+ -+/* 4785 boards */ -+#define BU4785_BOARD 0x0478 -+ -+/* 4321 boards */ -+#define BU4321_BOARD 0x046b -+#define BU4321E_BOARD 0x047c -+#define MP4321_BOARD 0x046c -+#define CB2_4321_BOARD 0x046d -+#define MC4321_BOARD 0x046e -+ +/* # of GPIO pins */ +#define GPIO_NUMPINS 16 + -+/* radio ID codes */ -+#define NORADIO_ID 0xe4f5 -+#define NORADIO_IDCODE 0x4e4f5246 -+ -+#define BCM2050_ID 0x2050 -+#define BCM2050_IDCODE 0x02050000 -+#define BCM2050A0_IDCODE 0x1205017f -+#define BCM2050A1_IDCODE 0x2205017f -+#define BCM2050R8_IDCODE 0x8205017f -+ -+#define BCM2055_ID 0x2055 -+#define BCM2055_IDCODE 0x02055000 -+#define BCM2055A0_IDCODE 0x1205517f -+ -+#define BCM2060_ID 0x2060 -+#define BCM2060_IDCODE 0x02060000 -+#define BCM2060WW_IDCODE 0x1206017f -+ -+#define BCM2062_ID 0x2062 -+#define BCM2062_IDCODE 0x02062000 -+#define BCM2062A0_IDCODE 0x0206217f -+ -+/* parts of an idcode: */ -+#define IDCODE_MFG_MASK 0x00000fff -+#define IDCODE_MFG_SHIFT 0 -+#define IDCODE_ID_MASK 0x0ffff000 -+#define IDCODE_ID_SHIFT 12 -+#define IDCODE_REV_MASK 0xf0000000 -+#define IDCODE_REV_SHIFT 28 -+ +#endif /* _BCMDEVS_H */ -diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bcm947xx/include/bcmdevs1.h ---- linux.old/arch/mips/bcm947xx/include/bcmdevs1.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmdevs1.h 2006-05-02 04:32:03.000000000 +0200 -@@ -0,0 +1,391 @@ +diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs.h linux.dev/arch/mips/bcm947xx/include/bcmdevs.h +--- linux.old/arch/mips/bcm947xx/include/bcmdevs.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux.dev/arch/mips/bcm947xx/include/bcmdevs.h 2006-10-02 21:19:59.000000000 +0200 +@@ -0,0 +1,369 @@ +/* + * Broadcom device-specific manifest constants. + * -+ * Copyright 2005, Broadcom Corporation -+ * All Rights Reserved. -+ * -+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -+ * $Id$ ++ * Copyright 2006, Broadcom Corporation ++ * All Rights Reserved. ++ * ++ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY ++ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM ++ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS ++ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. ++ * $Id: bcmdevs.h,v 1.1.1.17 2006/04/15 01:29:08 michael Exp $ + */ + +#ifndef _BCMDEVS_H +#define _BCMDEVS_H + ++#include "bcm4710.h" + +/* Known PCI vendor Id's */ +#define VENDOR_EPIGRAM 0xfeda @@ -3031,30 +3003,22 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +#define BCM47XX_ROBO_ID 0x4719 /* 47xx/53xx roboswitch core */ +#define BCM47XX_USB20H_ID 0x471a /* 47xx usb 2.0 host */ +#define BCM47XX_USB20D_ID 0x471b /* 47xx usb 2.0 device */ ++#define BCM47XX_ATA100_ID 0x471d /* 47xx parallel ATA */ ++#define BCM47XX_SATAXOR_ID 0x471e /* 47xx serial ATA & XOR DMA */ ++#define BCM47XX_GIGETH_ID 0x471f /* 47xx GbE (5700) */ + -+#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */ ++#define BCM47XX_SMBUS_EMU_ID 0x47fe /* 47xx emulated SMBus device */ ++#define BCM47XX_XOR_EMU_ID 0x47ff /* 47xx emulated XOR engine */ + -+#define BCM4610_DEVICE_ID 0x4610 /* 4610 primary function 0 */ -+#define BCM4610_ILINE_ID 0x4611 /* 4610 iline100 */ -+#define BCM4610_V90_ID 0x4612 /* 4610 v90 codec */ -+#define BCM4610_ENET_ID 0x4613 /* 4610 enet */ -+#define BCM4610_EXT_ID 0x4614 /* 4610 external i/f */ -+#define BCM4610_USB_ID 0x4615 /* 4610 usb */ ++#define BCM4710_CHIP_ID 0x4710 /* 4710 chipid returned by sb_chip() */ ++#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */ + -+#define BCM4402_DEVICE_ID 0x4402 /* 4402 primary function 0 */ ++#define BCM4402_CHIP_ID 0x4402 /* 4402 chipid */ +#define BCM4402_ENET_ID 0x4402 /* 4402 enet */ +#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */ +#define BCM4401_ENET_ID 0x170c /* 4401b0 production enet cards */ + -+#define BCM4301_DEVICE_ID 0x4301 /* 4301 primary function 0 */ -+#define BCM4301_D11B_ID 0x4301 /* 4301 802.11b */ -+ -+#define BCM4307_DEVICE_ID 0x4307 /* 4307 primary function 0 */ -+#define BCM4307_V90_ID 0x4305 /* 4307 v90 codec */ -+#define BCM4307_ENET_ID 0x4306 /* 4307 enet */ -+#define BCM4307_D11B_ID 0x4307 /* 4307 802.11b */ -+ -+#define BCM4306_DEVICE_ID 0x4306 /* 4306 chipcommon chipid */ ++#define BCM4306_CHIP_ID 0x4306 /* 4306 chipcommon chipid */ +#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */ +#define BCM4306_D11G_ID2 0x4325 +#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */ @@ -3064,77 +3028,63 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc + +#define BCM4309_PKG_ID 1 /* 4309 package id */ + ++#define BCM4311_CHIP_ID 0x4311 /* 4311 PCIe 802.11a/b/g */ ++#define BCM4311_D11G_ID 0x4311 /* 4311 802.11b/g id */ ++#define BCM4311_D11DUAL_ID 0x4312 /* 4311 802.11a/b/g id */ ++#define BCM4311_D11A_ID 0x4313 /* 4311 802.11a id */ ++ +#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */ +#define BCM4303_PKG_ID 2 /* 4303 package id */ + -+#define BCM4310_DEVICE_ID 0x4310 /* 4310 chipcommon chipid */ -+#define BCM4310_D11B_ID 0x4311 /* 4310 802.11b */ -+#define BCM4310_UART_ID 0x4312 /* 4310 uart */ -+#define BCM4310_ENET_ID 0x4313 /* 4310 enet */ -+#define BCM4310_USB_ID 0x4315 /* 4310 usb */ -+ +#define BCMGPRS_UART_ID 0x4333 /* Uart id used by 4306/gprs card */ +#define BCMGPRS2_UART_ID 0x4344 /* Uart id used by 4306/gprs card */ + -+ -+#define BCM4704_DEVICE_ID 0x4704 /* 4704 chipcommon chipid */ ++#define BCM4704_CHIP_ID 0x4704 /* 4704 chipcommon chipid */ +#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */ + -+#define BCM4317_DEVICE_ID 0x4317 /* 4317 chip common chipid */ -+ -+#define BCM4318_DEVICE_ID 0x4318 /* 4318 chip common chipid */ -+#define BCM4318_D11G_ID 0x4318 /* 4318 801.11b/g id */ -+#define BCM4318_D11DUAL_ID 0x4319 /* 4318 801.11a/b/g id */ -+#define BCM4318_JTAGM_ID 0x4331 /* 4318 jtagm device id */ -+ -+#define FPGA_JTAGM_ID 0x4330 /* ??? */ -+ -+/* Address map */ -+#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */ -+#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */ -+#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */ -+#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */ -+#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ -+#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */ -+ -+/* Core register space */ -+#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */ -+#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */ -+#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */ -+#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */ -+#define BCM4710_REG_USB 0x18004000 /* USB core registers */ -+#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */ -+#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */ -+#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */ -+#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */ -+ -+#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */ -+#define BCM4710_PCMCIA_MEM 0x1f000000 /* External Interface PCMCIA memory access */ -+#define BCM4710_PCMCIA_IO 0x1f100000 /* PCMCIA I/O access */ -+#define BCM4710_PCMCIA_CONF 0x1f200000 /* PCMCIA configuration */ -+#define BCM4710_PROG 0x1f800000 /* Programable interface */ -+#define BCM4710_FLASH 0x1fc00000 /* Flash */ ++#define BCM4318_CHIP_ID 0x4318 /* 4318 chip common chipid */ ++#define BCM4318_D11G_ID 0x4318 /* 4318 802.11b/g id */ ++#define BCM4318_D11DUAL_ID 0x4319 /* 4318 802.11a/b/g id */ ++#define BCM4318_D11A_ID 0x431a /* 4318 802.11a id */ + -+#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ ++#define BCM4321_CHIP_ID 0x4321 /* 4321 chip common chipid */ ++#define BCM4321_D11N_ID 0x4328 /* 4321 802.11n dualband id */ ++#define BCM4321_D11N2G_ID 0x4329 /* 4321 802.11n 2.4Hgz band id */ ++#define BCM4321_D11N5G_ID 0x432a /* 4321 802.11n 5Ghz band id */ + -+#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300) ++#define BCM4331_CHIP_ID 0x4331 /* 4331 chip common chipid */ ++#define BCM4331_D11N2G_ID 0x4330 /* 4331 802.11n 2.4Ghz band id */ ++#define BCM4331_D11N_ID 0x4331 /* 4331 802.11n dualband id */ ++#define BCM4331_D11N5G_ID 0x4332 /* 4331 802.11n 5Ghz band id */ + -+#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000) -+#define BCM4710_LED (BCM4710_EXTIF + 0x00900000) ++#define HDLSIM5350_PKG_ID 1 /* HDL simulator package id for a 5350 */ ++#define HDLSIM_PKG_ID 14 /* HDL simulator package id */ ++#define HWSIM_PKG_ID 15 /* Hardware simulator package id */ + -+#define BCM4712_DEVICE_ID 0x4712 /* 4712 chipcommon chipid */ ++#define BCM4712_CHIP_ID 0x4712 /* 4712 chipcommon chipid */ +#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */ +#define BCM4712LARGE_PKG_ID 0 /* 340pin 4712 package id */ +#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */ +#define BCM4712MID_PKG_ID 2 /* 225pin 4712 package id */ + -+#define SDIOH_FPGA_ID 0x4380 /* sdio host fpga */ ++#define BCM5365_CHIP_ID 0x5365 /* 5365 chipcommon chipid */ ++#define BCM5350_CHIP_ID 0x5350 /* bcm5350 chipcommon chipid */ ++#define BCM5352_CHIP_ID 0x5352 /* bcm5352 chipcommon chipid */ + -+#define BCM5365_DEVICE_ID 0x5365 /* 5365 chipcommon chipid */ -+#define BCM5350_DEVICE_ID 0x5350 /* bcm5350 chipcommon chipid */ -+#define BCM5352_DEVICE_ID 0x5352 /* bcm5352 chipcommon chipid */ ++#define BCM4320_CHIP_ID 0x4320 /* bcm4320 chipcommon chipid */ + -+#define BCM4320_DEVICE_ID 0x4320 /* bcm4320 chipcommon chipid */ ++#define BCM4328_CHIP_ID 0x4328 /* bcm4328 chipcommon chipid */ ++ ++#define FPGA_JTAGM_ID 0x43f0 /* FPGA jtagm device id */ ++#define BCM43XX_JTAGM_ID 0x43f1 /* 43xx jtagm device id */ ++#define BCM43XXOLD_JTAGM_ID 0x4331 /* 43xx old jtagm device id */ ++ ++#define SDIOH_FPGA_ID 0x43f2 /* sdio host fpga */ ++#define SDIOD_FPGA_ID 0x43f4 /* sdio device fpga */ ++ ++#define MIMO_FPGA_ID 0x43f8 /* FPGA mimo minimacphy device id */ ++ ++#define BCM4785_CHIP_ID 0x4785 /* 4785 chipcommon chipid */ + +/* PCMCIA vendor Id's */ + @@ -3160,8 +3110,12 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +#define BFL_BTCMOD 0x4000 /* This board' BTCOEXIST is in the alternate gpios */ +#define BFL_ALTIQ 0x8000 /* Alternate I/Q settings */ + ++/* boardflags2 */ ++#define BFL2_RXBB_INT_REG_DIS 0x00000001 /* This board has an external rxbb regulator */ ++#define BFL2_SSWITCH_AVAIL 0x00000002 /* This board has a superswitch for > 2 antennas */ ++#define BFL2_TXPWRCTRL_EN 0x00000004 /* This board permits TX Power Control to be enabled */ ++ +/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */ -+#define BOARD_GPIO_HWRAD_B 0x010 /* bit 4 is HWRAD input on 4301 */ +#define BOARD_GPIO_BTCMOD_IN 0x010 /* bit 4 is the alternate BT Coexistance Input */ +#define BOARD_GPIO_BTCMOD_OUT 0x020 /* bit 5 is the alternate BT Coexistance Out */ +#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistance Input */ @@ -3172,20 +3126,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ +#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ + -+/* Bus types */ -+#define SB_BUS 0 /* Silicon Backplane */ -+#define PCI_BUS 1 /* PCI target */ -+#define PCMCIA_BUS 2 /* PCMCIA target */ -+#define SDIO_BUS 3 /* SDIO target */ -+#define JTAG_BUS 4 /* JTAG */ -+ -+/* Allows optimization for single-bus support */ -+#ifdef BCMBUSTYPE -+#define BUSTYPE(bus) (BCMBUSTYPE) -+#else -+#define BUSTYPE(bus) (bus) -+#endif -+ +/* power control defines */ +#define PLL_DELAY 150 /* us pll on delay */ +#define FREF_DELAY 200 /* us fref change delay */ @@ -3198,16 +3138,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +#define VSIM4710_BOARD 0x0401 +#define QT4710_BOARD 0x0402 + -+#define BU4610_BOARD 0x0403 -+#define VSIM4610_BOARD 0x0404 -+ -+#define BU4307_BOARD 0x0405 -+#define BCM94301CB_BOARD 0x0406 -+#define BCM94301PC_BOARD 0x0406 /* Pcmcia 5v card */ -+#define BCM94301MP_BOARD 0x0407 -+#define BCM94307MP_BOARD 0x0408 -+#define BCMAP4307_BOARD 0x0409 -+ +#define BU4309_BOARD 0x040a +#define BCM94309CB_BOARD 0x040b +#define BCM94309MP_BOARD 0x040c @@ -3215,12 +3145,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc + +#define BCM94302MP_BOARD 0x040e + -+#define VSIM4310_BOARD 0x040f -+#define BU4711_BOARD 0x0410 -+#define BCM94310U_BOARD 0x0411 -+#define BCM94310AP_BOARD 0x0412 -+#define BCM94310MP_BOARD 0x0414 -+ +#define BU4306_BOARD 0x0416 +#define BCM94306CB_BOARD 0x0417 +#define BCM94306MP_BOARD 0x0418 @@ -3230,21 +3154,16 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +#define BCM94710R4_BOARD 0x041c +#define BCM94710AP_BOARD 0x041d + -+ +#define BU2050_BOARD 0x041f + + +#define BCM94309G_BOARD 0x0421 + -+#define BCM94301PC3_BOARD 0x0422 /* Pcmcia 3.3v card */ -+ +#define BU4704_BOARD 0x0423 +#define BU4702_BOARD 0x0424 + +#define BCM94306PC_BOARD 0x0425 /* pcmcia 3.3v 4306 card */ + -+#define BU4317_BOARD 0x0426 -+ + +#define BCM94702MN_BOARD 0x0428 + @@ -3257,9 +3176,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +/* cb4306 with SiGe PA */ +#define BCM94306CBSG_BOARD 0x042b + -+/* mp4301 with 2050 radio */ -+#define BCM94301MPL_BOARD 0x042c -+ +/* cb4306 with SiGe PA */ +#define PCSG94306_BOARD 0x042d + @@ -3274,12 +3190,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc + + + -+/* BCM94317 boards */ -+#define BCM94317CB_BOARD 0x0440 -+#define BCM94317MP_BOARD 0x0441 -+#define BCM94317PCMCIA_BOARD 0x0442 -+#define BCM94317SDIO_BOARD 0x0443 -+ +#define BU4712_BOARD 0x0444 +#define BU4712SD_BOARD 0x045d +#define BU4712L_BOARD 0x045f @@ -3297,15 +3207,11 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc + +/* BCM63XX boards */ +#define BCM96338_BOARD 0x6338 -+#define BCM96345_BOARD 0x6345 +#define BCM96348_BOARD 0x6348 + +/* Another mp4306 with SiGe */ +#define BCM94306P_BOARD 0x044c + -+/* CF-like 4317 modules */ -+#define BCM94317CF_BOARD 0x044d -+ +/* mp4303 */ +#define BCM94303MP_BOARD 0x044e + @@ -3319,9 +3225,6 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc +/* 4712agr */ +#define BCM94712AGR_BOARD 0x0451 + -+/* The real CF 4317 board */ -+#define CFI4317_BOARD 0x0452 -+ +/* pcmcia 4303 */ +#define PC4303_BOARD 0x0454 + @@ -3357,19 +3260,65 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmdevs1.h linux.dev/arch/mips/bc + +#define BCM94318MPGH_BOARD 0x0463 + ++#define BU4311_BOARD 0x0464 ++#define BCM94311MC_BOARD 0x0465 ++#define BCM94311MCAG_BOARD 0x0466 + +#define BCM95352GR_BOARD 0x0467 + +/* bcm95351agr */ +#define BCM95351AGR_BOARD 0x0470 + ++/* bcm94704mpcb */ ++#define BCM94704MPCB_BOARD 0x0472 ++ ++/* 4785 boards */ ++#define BU4785_BOARD 0x0478 ++ ++/* 4321 boards */ ++#define BU4321_BOARD 0x046b ++#define BU4321E_BOARD 0x047c ++#define MP4321_BOARD 0x046c ++#define CB2_4321_BOARD 0x046d ++#define MC4321_BOARD 0x046e ++ +/* # of GPIO pins */ +#define GPIO_NUMPINS 16 + ++/* radio ID codes */ ++#define NORADIO_ID 0xe4f5 ++#define NORADIO_IDCODE 0x4e4f5246 ++ ++#define BCM2050_ID 0x2050 ++#define BCM2050_IDCODE 0x02050000 ++#define BCM2050A0_IDCODE 0x1205017f ++#define BCM2050A1_IDCODE 0x2205017f ++#define BCM2050R8_IDCODE 0x8205017f ++ ++#define BCM2055_ID 0x2055 ++#define BCM2055_IDCODE 0x02055000 ++#define BCM2055A0_IDCODE 0x1205517f ++ ++#define BCM2060_ID 0x2060 ++#define BCM2060_IDCODE 0x02060000 ++#define BCM2060WW_IDCODE 0x1206017f ++ ++#define BCM2062_ID 0x2062 ++#define BCM2062_IDCODE 0x02062000 ++#define BCM2062A0_IDCODE 0x0206217f ++ ++/* parts of an idcode: */ ++#define IDCODE_MFG_MASK 0x00000fff ++#define IDCODE_MFG_SHIFT 0 ++#define IDCODE_ID_MASK 0x0ffff000 ++#define IDCODE_ID_SHIFT 12 ++#define IDCODE_REV_MASK 0xf0000000 ++#define IDCODE_REV_SHIFT 28 ++ +#endif /* _BCMDEVS_H */ diff -urN linux.old/arch/mips/bcm947xx/include/bcmendian.h linux.dev/arch/mips/bcm947xx/include/bcmendian.h --- linux.old/arch/mips/bcm947xx/include/bcmendian.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmendian.h 2006-04-27 20:08:35.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcmendian.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,198 @@ +/* + * local version of endian.h - byte order defines @@ -3571,7 +3520,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmendian.h linux.dev/arch/mips/b +#endif /* _BCMENDIAN_H_ */ diff -urN linux.old/arch/mips/bcm947xx/include/bcmnvram.h linux.dev/arch/mips/bcm947xx/include/bcmnvram.h --- linux.old/arch/mips/bcm947xx/include/bcmnvram.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmnvram.h 2006-04-27 23:29:18.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcmnvram.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,159 @@ +/* + * NVRAM variable manipulation @@ -3734,7 +3683,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmnvram.h linux.dev/arch/mips/bc +#endif /* _bcmnvram_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/bcmsrom.h linux.dev/arch/mips/bcm947xx/include/bcmsrom.h --- linux.old/arch/mips/bcm947xx/include/bcmsrom.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmsrom.h 2006-04-27 20:27:33.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcmsrom.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,108 @@ +/* + * Misc useful routines to access NIC local SROM/OTP . @@ -3846,7 +3795,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmsrom.h linux.dev/arch/mips/bcm +#endif /* _bcmsrom_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/bcmutils.h linux.dev/arch/mips/bcm947xx/include/bcmutils.h --- linux.old/arch/mips/bcm947xx/include/bcmutils.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/bcmutils.h 2006-05-02 01:52:12.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/bcmutils.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,433 @@ +/* + * Misc useful os-independent macros and functions. @@ -4283,7 +4232,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/bcmutils.h linux.dev/arch/mips/bc +#endif /* _bcmutils_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/hndcpu.h linux.dev/arch/mips/bcm947xx/include/hndcpu.h --- linux.old/arch/mips/bcm947xx/include/hndcpu.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/hndcpu.h 2006-04-27 22:14:38.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/hndcpu.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,28 @@ +/* + * HND SiliconBackplane MIPS/ARM cores software interface. @@ -4315,7 +4264,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/hndcpu.h linux.dev/arch/mips/bcm9 +#endif /* _hndcpu_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/hndmips.h linux.dev/arch/mips/bcm947xx/include/hndmips.h --- linux.old/arch/mips/bcm947xx/include/hndmips.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/hndmips.h 2006-04-27 20:43:42.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/hndmips.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,45 @@ +/* + * HND SiliconBackplane MIPS core software interface. @@ -4364,7 +4313,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/hndmips.h linux.dev/arch/mips/bcm +#endif /* _hndmips_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/hndpci.h linux.dev/arch/mips/bcm947xx/include/hndpci.h --- linux.old/arch/mips/bcm947xx/include/hndpci.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/hndpci.h 2006-04-27 20:36:48.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/hndpci.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,30 @@ +/* + * HND SiliconBackplane PCI core software interface. @@ -4398,7 +4347,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/hndpci.h linux.dev/arch/mips/bcm9 +#endif /* _hndpci_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/linuxver.h linux.dev/arch/mips/bcm947xx/include/linuxver.h --- linux.old/arch/mips/bcm947xx/include/linuxver.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/linuxver.h 2006-04-27 20:10:08.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/linuxver.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,417 @@ +/* + * Linux-specific abstractions to gain some independence from linux kernel versions. @@ -4819,7 +4768,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/linuxver.h linux.dev/arch/mips/bc +#endif /* _linuxver_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/mipsinc.h linux.dev/arch/mips/bcm947xx/include/mipsinc.h --- linux.old/arch/mips/bcm947xx/include/mipsinc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/mipsinc.h 2006-04-27 22:12:20.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/mipsinc.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,541 @@ +/* + * HND Run Time Environment for standalone MIPS programs. @@ -5364,7 +5313,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/mipsinc.h linux.dev/arch/mips/bcm +#endif /* _MISPINC_H */ diff -urN linux.old/arch/mips/bcm947xx/include/osl.h linux.dev/arch/mips/bcm947xx/include/osl.h --- linux.old/arch/mips/bcm947xx/include/osl.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/osl.h 2006-05-02 17:40:43.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/osl.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,179 @@ +#ifndef __osl_h +#define __osl_h @@ -5547,7 +5496,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/osl.h linux.dev/arch/mips/bcm947x +#endif diff -urN linux.old/arch/mips/bcm947xx/include/pcicfg.h linux.dev/arch/mips/bcm947xx/include/pcicfg.h --- linux.old/arch/mips/bcm947xx/include/pcicfg.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/pcicfg.h 2006-04-27 20:31:41.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/pcicfg.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,495 @@ +/* + * pcicfg.h: PCI configuration constants and structures. @@ -6046,7 +5995,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/pcicfg.h linux.dev/arch/mips/bcm9 +#endif /* _h_pcicfg_ */ diff -urN linux.old/arch/mips/bcm947xx/include/sbchipc.h linux.dev/arch/mips/bcm947xx/include/sbchipc.h --- linux.old/arch/mips/bcm947xx/include/sbchipc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbchipc.h 2006-04-27 22:11:01.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbchipc.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,516 @@ +/* + * SiliconBackplane Chipcommon core hardware definitions. @@ -6566,7 +6515,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbchipc.h linux.dev/arch/mips/bcm +#endif /* _SBCHIPC_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbconfig.h linux.dev/arch/mips/bcm947xx/include/sbconfig.h --- linux.old/arch/mips/bcm947xx/include/sbconfig.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbconfig.h 2006-04-27 22:14:11.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbconfig.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,369 @@ +/* + * Broadcom SiliconBackplane hardware register definitions. @@ -6939,7 +6888,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbconfig.h linux.dev/arch/mips/bc +#endif /* _SBCONFIG_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbextif.h linux.dev/arch/mips/bcm947xx/include/sbextif.h --- linux.old/arch/mips/bcm947xx/include/sbextif.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbextif.h 2006-04-27 22:13:03.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbextif.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,243 @@ +/* + * Hardware-specific External Interface I/O core definitions @@ -7186,7 +7135,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbextif.h linux.dev/arch/mips/bcm +#endif /* _SBEXTIF_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbhndmips.h linux.dev/arch/mips/bcm947xx/include/sbhndmips.h --- linux.old/arch/mips/bcm947xx/include/sbhndmips.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbhndmips.h 2006-04-27 20:43:56.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbhndmips.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,47 @@ +/* + * Broadcom SiliconBackplane MIPS definitions @@ -7237,7 +7186,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbhndmips.h linux.dev/arch/mips/b +#endif /* _sbhndmips_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/sbmemc.h linux.dev/arch/mips/bcm947xx/include/sbmemc.h --- linux.old/arch/mips/bcm947xx/include/sbmemc.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbmemc.h 2006-04-27 22:12:41.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbmemc.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,147 @@ +/* + * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions. @@ -7336,177 +7285,59 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbmemc.h linux.dev/arch/mips/bcm9 +#define MEMC_SDR_NCDL 0x00020032 +#define MEMC_SDR1_NCDL 0x0002020f /* For corerev 1 (4712) */ + -+/* For ddr: */ -+#define MEMC_CONFIG_INIT 0x00048000 -+#define MEMC_DRAMTIM2_INIT 0x000754d8 -+#define MEMC_DRAMTIM25_INIT 0x000754d9 -+#define MEMC_RDNCDLCOR_INIT 0x00000000 -+#define MEMC_RDNCDLCOR_SIMINIT 0xf6f6f6f6 /* For hdl sim */ -+#define MEMC_WRNCDLCOR_INIT 0x49351200 -+#define MEMC_1_WRNCDLCOR_INIT 0x14500200 -+#define MEMC_DQSGATENCDL_INIT 0x00030000 -+#define MEMC_MISCDLYCTL_INIT 0x21061c1b -+#define MEMC_1_MISCDLYCTL_INIT 0x21021400 -+#define MEMC_NCDLCTL_INIT 0x00002001 -+#define MEMC_CONTROL_INIT0 0x00000002 -+#define MEMC_CONTROL_INIT1 0x00000008 -+#define MEMC_MODEBUF_INIT0 0x00004000 -+#define MEMC_CONTROL_INIT2 0x00000010 -+#define MEMC_MODEBUF_INIT1 0x00000100 -+#define MEMC_CONTROL_INIT3 0x00000010 -+#define MEMC_CONTROL_INIT4 0x00000008 -+#define MEMC_REFRESH_INIT 0x0000840f -+#define MEMC_CONTROL_INIT5 0x00000004 -+#define MEMC_MODEBUF_INIT2 0x00000000 -+#define MEMC_CONTROL_INIT6 0x00000010 -+#define MEMC_CONTROL_INIT7 0x00000001 -+ -+ -+/* This is for DDRM16X16X2 */ -+#define MEMC_DDR_INIT 0x0009 -+#define MEMC_DDR_MODE 0x62 -+#define MEMC_DDR_NCDL 0x0005050a -+#define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */ -+ -+/* mask for sdr/ddr calibration registers */ -+#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff -+#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff -+#define MEMC_DQSGATENCDL_G_MASK 0x000000ff -+ -+/* masks for miscdlyctl registers */ -+#define MEMC_MISC_SM_MASK 0x30000000 -+#define MEMC_MISC_SM_SHIFT 28 -+#define MEMC_MISC_SD_MASK 0x0f000000 -+#define MEMC_MISC_SD_SHIFT 24 -+ -+/* hw threshhold for calculating wr/rd for sdr memc */ -+#define MEMC_CD_THRESHOLD 128 -+ -+/* Low bit of init register says if memc is ddr or sdr */ -+#define MEMC_CONFIG_DDR 0x00000001 -+ -+#endif /* _SBMEMC_H */ -diff -urN linux.old/arch/mips/bcm947xx/include/sbpci.h linux.dev/arch/mips/bcm947xx/include/sbpci.h ---- linux.old/arch/mips/bcm947xx/include/sbpci.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbpci.h 2006-05-02 17:20:14.000000000 +0200 -@@ -0,0 +1,114 @@ -+/* -+ * HND SiliconBackplane PCI core hardware definitions. -+ * -+ * Copyright 2006, Broadcom Corporation -+ * All Rights Reserved. -+ * -+ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY -+ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM -+ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS -+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. -+ * -+ * $Id: sbpci.h,v 1.1.1.11 2006/02/27 03:43:16 honor Exp $ -+ */ -+ -+#ifndef _sbpci_h_ -+#define _sbpci_h_ -+ -+#ifndef _LANGUAGE_ASSEMBLY -+ -+/* cpp contortions to concatenate w/arg prescan */ -+#ifndef PAD -+#define _PADLINE(line) pad ## line -+#define _XSTR(line) _PADLINE(line) -+#define PAD _XSTR(__LINE__) -+#endif -+ -+/* Sonics side: PCI core and host control registers */ -+typedef struct sbpciregs { -+ uint32 control; /* PCI control */ -+ uint32 PAD[3]; -+ uint32 arbcontrol; /* PCI arbiter control */ -+ uint32 PAD[3]; -+ uint32 intstatus; /* Interrupt status */ -+ uint32 intmask; /* Interrupt mask */ -+ uint32 sbtopcimailbox; /* Sonics to PCI mailbox */ -+ uint32 PAD[9]; -+ uint32 bcastaddr; /* Sonics broadcast address */ -+ uint32 bcastdata; /* Sonics broadcast data */ -+ uint32 PAD[2]; -+ uint32 gpioin; /* ro: gpio input (>=rev2) */ -+ uint32 gpioout; /* rw: gpio output (>=rev2) */ -+ uint32 gpioouten; /* rw: gpio output enable (>= rev2) */ -+ uint32 gpiocontrol; /* rw: gpio control (>= rev2) */ -+ uint32 PAD[36]; -+ uint32 sbtopci0; /* Sonics to PCI translation 0 */ -+ uint32 sbtopci1; /* Sonics to PCI translation 1 */ -+ uint32 sbtopci2; /* Sonics to PCI translation 2 */ -+ uint32 PAD[189]; -+ uint32 pcicfg[4][64]; /* 0x400 - 0x7FF, PCI Cfg Space (>=rev8) */ -+ uint16 sprom[36]; /* SPROM shadow Area */ -+ uint32 PAD[46]; -+} sbpciregs_t; -+ -+#endif /* _LANGUAGE_ASSEMBLY */ -+ -+/* PCI control */ -+#define PCI_RST_OE 0x01 /* When set, drives PCI_RESET out to pin */ -+#define PCI_RST 0x02 /* Value driven out to pin */ -+#define PCI_CLK_OE 0x04 /* When set, drives clock as gated by PCI_CLK out to pin */ -+#define PCI_CLK 0x08 /* Gate for clock driven out to pin */ -+ -+/* PCI arbiter control */ -+#define PCI_INT_ARB 0x01 /* When set, use an internal arbiter */ -+#define PCI_EXT_ARB 0x02 /* When set, use an external arbiter */ -+/* ParkID - for PCI corerev >= 8 */ -+#define PCI_PARKID_MASK 0x1c /* Selects which agent is parked on an idle bus */ -+#define PCI_PARKID_SHIFT 2 -+#define PCI_PARKID_EXT0 0 /* External master 0 */ -+#define PCI_PARKID_EXT1 1 /* External master 1 */ -+#define PCI_PARKID_EXT2 2 /* External master 2 */ -+#define PCI_PARKID_INT 3 /* Internal master */ -+#define PCI_PARKID_LAST 4 /* Last active master */ ++/* For ddr: */ ++#define MEMC_CONFIG_INIT 0x00048000 ++#define MEMC_DRAMTIM2_INIT 0x000754d8 ++#define MEMC_DRAMTIM25_INIT 0x000754d9 ++#define MEMC_RDNCDLCOR_INIT 0x00000000 ++#define MEMC_RDNCDLCOR_SIMINIT 0xf6f6f6f6 /* For hdl sim */ ++#define MEMC_WRNCDLCOR_INIT 0x49351200 ++#define MEMC_1_WRNCDLCOR_INIT 0x14500200 ++#define MEMC_DQSGATENCDL_INIT 0x00030000 ++#define MEMC_MISCDLYCTL_INIT 0x21061c1b ++#define MEMC_1_MISCDLYCTL_INIT 0x21021400 ++#define MEMC_NCDLCTL_INIT 0x00002001 ++#define MEMC_CONTROL_INIT0 0x00000002 ++#define MEMC_CONTROL_INIT1 0x00000008 ++#define MEMC_MODEBUF_INIT0 0x00004000 ++#define MEMC_CONTROL_INIT2 0x00000010 ++#define MEMC_MODEBUF_INIT1 0x00000100 ++#define MEMC_CONTROL_INIT3 0x00000010 ++#define MEMC_CONTROL_INIT4 0x00000008 ++#define MEMC_REFRESH_INIT 0x0000840f ++#define MEMC_CONTROL_INIT5 0x00000004 ++#define MEMC_MODEBUF_INIT2 0x00000000 ++#define MEMC_CONTROL_INIT6 0x00000010 ++#define MEMC_CONTROL_INIT7 0x00000001 + -+/* Interrupt status/mask */ -+#define PCI_INTA 0x01 /* PCI INTA# is asserted */ -+#define PCI_INTB 0x02 /* PCI INTB# is asserted */ -+#define PCI_SERR 0x04 /* PCI SERR# has been asserted (write one to clear) */ -+#define PCI_PERR 0x08 /* PCI PERR# has been asserted (write one to clear) */ -+#define PCI_PME 0x10 /* PCI PME# is asserted */ + -+/* (General) PCI/SB mailbox interrupts, two bits per pci function */ -+#define MAILBOX_F0_0 0x100 /* function 0, int 0 */ -+#define MAILBOX_F0_1 0x200 /* function 0, int 1 */ -+#define MAILBOX_F1_0 0x400 /* function 1, int 0 */ -+#define MAILBOX_F1_1 0x800 /* function 1, int 1 */ -+#define MAILBOX_F2_0 0x1000 /* function 2, int 0 */ -+#define MAILBOX_F2_1 0x2000 /* function 2, int 1 */ -+#define MAILBOX_F3_0 0x4000 /* function 3, int 0 */ -+#define MAILBOX_F3_1 0x8000 /* function 3, int 1 */ ++/* This is for DDRM16X16X2 */ ++#define MEMC_DDR_INIT 0x0009 ++#define MEMC_DDR_MODE 0x62 ++#define MEMC_DDR_NCDL 0x0005050a ++#define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */ + -+/* Sonics broadcast address */ -+#define BCAST_ADDR_MASK 0xff /* Broadcast register address */ ++/* mask for sdr/ddr calibration registers */ ++#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff ++#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff ++#define MEMC_DQSGATENCDL_G_MASK 0x000000ff + -+/* Sonics to PCI translation types */ -+#define SBTOPCI0_MASK 0xfc000000 -+#define SBTOPCI1_MASK 0xfc000000 -+#define SBTOPCI2_MASK 0xc0000000 -+#define SBTOPCI_MEM 0 -+#define SBTOPCI_IO 1 -+#define SBTOPCI_CFG0 2 -+#define SBTOPCI_CFG1 3 -+#define SBTOPCI_PREF 0x4 /* prefetch enable */ -+#define SBTOPCI_BURST 0x8 /* burst enable */ -+#define SBTOPCI_RC_MASK 0x30 /* read command (>= rev11) */ -+#define SBTOPCI_RC_READ 0x00 /* memory read */ -+#define SBTOPCI_RC_READLINE 0x10 /* memory read line */ -+#define SBTOPCI_RC_READMULTI 0x20 /* memory read multiple */ ++/* masks for miscdlyctl registers */ ++#define MEMC_MISC_SM_MASK 0x30000000 ++#define MEMC_MISC_SM_SHIFT 28 ++#define MEMC_MISC_SD_MASK 0x0f000000 ++#define MEMC_MISC_SD_SHIFT 24 + -+/* PCI core index in SROM shadow area */ -+#define SRSH_PI_OFFSET 0 /* first word */ -+#define SRSH_PI_MASK 0xf000 /* bit 15:12 */ -+#define SRSH_PI_SHIFT 12 /* bit 15:12 */ ++/* hw threshhold for calculating wr/rd for sdr memc */ ++#define MEMC_CD_THRESHOLD 128 + -+#endif /* _sbpci_h_ */ ++/* Low bit of init register says if memc is ddr or sdr */ ++#define MEMC_CONFIG_DDR 0x00000001 ++ ++#endif /* _SBMEMC_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbpcie.h linux.dev/arch/mips/bcm947xx/include/sbpcie.h --- linux.old/arch/mips/bcm947xx/include/sbpcie.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbpcie.h 2006-04-27 20:42:22.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbpcie.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,200 @@ +/* + * BCM43XX SiliconBackplane PCIE core hardware definitions. @@ -7708,9 +7539,127 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbpcie.h linux.dev/arch/mips/bcm9 +#define SERDES_RX_CDRBW 7 /* CDR BW */ + +#endif /* _SBPCIE_H */ +diff -urN linux.old/arch/mips/bcm947xx/include/sbpci.h linux.dev/arch/mips/bcm947xx/include/sbpci.h +--- linux.old/arch/mips/bcm947xx/include/sbpci.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux.dev/arch/mips/bcm947xx/include/sbpci.h 2006-10-02 21:19:59.000000000 +0200 +@@ -0,0 +1,114 @@ ++/* ++ * HND SiliconBackplane PCI core hardware definitions. ++ * ++ * Copyright 2006, Broadcom Corporation ++ * All Rights Reserved. ++ * ++ * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY ++ * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM ++ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS ++ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. ++ * ++ * $Id: sbpci.h,v 1.1.1.11 2006/02/27 03:43:16 honor Exp $ ++ */ ++ ++#ifndef _sbpci_h_ ++#define _sbpci_h_ ++ ++#ifndef _LANGUAGE_ASSEMBLY ++ ++/* cpp contortions to concatenate w/arg prescan */ ++#ifndef PAD ++#define _PADLINE(line) pad ## line ++#define _XSTR(line) _PADLINE(line) ++#define PAD _XSTR(__LINE__) ++#endif ++ ++/* Sonics side: PCI core and host control registers */ ++typedef struct sbpciregs { ++ uint32 control; /* PCI control */ ++ uint32 PAD[3]; ++ uint32 arbcontrol; /* PCI arbiter control */ ++ uint32 PAD[3]; ++ uint32 intstatus; /* Interrupt status */ ++ uint32 intmask; /* Interrupt mask */ ++ uint32 sbtopcimailbox; /* Sonics to PCI mailbox */ ++ uint32 PAD[9]; ++ uint32 bcastaddr; /* Sonics broadcast address */ ++ uint32 bcastdata; /* Sonics broadcast data */ ++ uint32 PAD[2]; ++ uint32 gpioin; /* ro: gpio input (>=rev2) */ ++ uint32 gpioout; /* rw: gpio output (>=rev2) */ ++ uint32 gpioouten; /* rw: gpio output enable (>= rev2) */ ++ uint32 gpiocontrol; /* rw: gpio control (>= rev2) */ ++ uint32 PAD[36]; ++ uint32 sbtopci0; /* Sonics to PCI translation 0 */ ++ uint32 sbtopci1; /* Sonics to PCI translation 1 */ ++ uint32 sbtopci2; /* Sonics to PCI translation 2 */ ++ uint32 PAD[189]; ++ uint32 pcicfg[4][64]; /* 0x400 - 0x7FF, PCI Cfg Space (>=rev8) */ ++ uint16 sprom[36]; /* SPROM shadow Area */ ++ uint32 PAD[46]; ++} sbpciregs_t; ++ ++#endif /* _LANGUAGE_ASSEMBLY */ ++ ++/* PCI control */ ++#define PCI_RST_OE 0x01 /* When set, drives PCI_RESET out to pin */ ++#define PCI_RST 0x02 /* Value driven out to pin */ ++#define PCI_CLK_OE 0x04 /* When set, drives clock as gated by PCI_CLK out to pin */ ++#define PCI_CLK 0x08 /* Gate for clock driven out to pin */ ++ ++/* PCI arbiter control */ ++#define PCI_INT_ARB 0x01 /* When set, use an internal arbiter */ ++#define PCI_EXT_ARB 0x02 /* When set, use an external arbiter */ ++/* ParkID - for PCI corerev >= 8 */ ++#define PCI_PARKID_MASK 0x1c /* Selects which agent is parked on an idle bus */ ++#define PCI_PARKID_SHIFT 2 ++#define PCI_PARKID_EXT0 0 /* External master 0 */ ++#define PCI_PARKID_EXT1 1 /* External master 1 */ ++#define PCI_PARKID_EXT2 2 /* External master 2 */ ++#define PCI_PARKID_INT 3 /* Internal master */ ++#define PCI_PARKID_LAST 4 /* Last active master */ ++ ++/* Interrupt status/mask */ ++#define PCI_INTA 0x01 /* PCI INTA# is asserted */ ++#define PCI_INTB 0x02 /* PCI INTB# is asserted */ ++#define PCI_SERR 0x04 /* PCI SERR# has been asserted (write one to clear) */ ++#define PCI_PERR 0x08 /* PCI PERR# has been asserted (write one to clear) */ ++#define PCI_PME 0x10 /* PCI PME# is asserted */ ++ ++/* (General) PCI/SB mailbox interrupts, two bits per pci function */ ++#define MAILBOX_F0_0 0x100 /* function 0, int 0 */ ++#define MAILBOX_F0_1 0x200 /* function 0, int 1 */ ++#define MAILBOX_F1_0 0x400 /* function 1, int 0 */ ++#define MAILBOX_F1_1 0x800 /* function 1, int 1 */ ++#define MAILBOX_F2_0 0x1000 /* function 2, int 0 */ ++#define MAILBOX_F2_1 0x2000 /* function 2, int 1 */ ++#define MAILBOX_F3_0 0x4000 /* function 3, int 0 */ ++#define MAILBOX_F3_1 0x8000 /* function 3, int 1 */ ++ ++/* Sonics broadcast address */ ++#define BCAST_ADDR_MASK 0xff /* Broadcast register address */ ++ ++/* Sonics to PCI translation types */ ++#define SBTOPCI0_MASK 0xfc000000 ++#define SBTOPCI1_MASK 0xfc000000 ++#define SBTOPCI2_MASK 0xc0000000 ++#define SBTOPCI_MEM 0 ++#define SBTOPCI_IO 1 ++#define SBTOPCI_CFG0 2 ++#define SBTOPCI_CFG1 3 ++#define SBTOPCI_PREF 0x4 /* prefetch enable */ ++#define SBTOPCI_BURST 0x8 /* burst enable */ ++#define SBTOPCI_RC_MASK 0x30 /* read command (>= rev11) */ ++#define SBTOPCI_RC_READ 0x00 /* memory read */ ++#define SBTOPCI_RC_READLINE 0x10 /* memory read line */ ++#define SBTOPCI_RC_READMULTI 0x20 /* memory read multiple */ ++ ++/* PCI core index in SROM shadow area */ ++#define SRSH_PI_OFFSET 0 /* first word */ ++#define SRSH_PI_MASK 0xf000 /* bit 15:12 */ ++#define SRSH_PI_SHIFT 12 /* bit 15:12 */ ++ ++#endif /* _sbpci_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/sbpcmcia.h linux.dev/arch/mips/bcm947xx/include/sbpcmcia.h --- linux.old/arch/mips/bcm947xx/include/sbpcmcia.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbpcmcia.h 2006-04-27 20:29:47.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbpcmcia.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,147 @@ +/* + * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions. @@ -7861,7 +7810,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbpcmcia.h linux.dev/arch/mips/bc +#endif /* _SBPCMCIA_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbsdram.h linux.dev/arch/mips/bcm947xx/include/sbsdram.h --- linux.old/arch/mips/bcm947xx/include/sbsdram.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbsdram.h 2006-04-27 20:36:08.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbsdram.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,85 @@ +/* + * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions. @@ -7950,7 +7899,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbsdram.h linux.dev/arch/mips/bcm +#endif /* _SBSDRAM_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbsocram.h linux.dev/arch/mips/bcm947xx/include/sbsocram.h --- linux.old/arch/mips/bcm947xx/include/sbsocram.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbsocram.h 2006-04-27 22:13:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbsocram.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,64 @@ +/* + * BCM47XX Sonics SiliconBackplane embedded ram core @@ -8018,7 +7967,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbsocram.h linux.dev/arch/mips/bc +#endif /* _SBSOCRAM_H */ diff -urN linux.old/arch/mips/bcm947xx/include/sbutils.h linux.dev/arch/mips/bcm947xx/include/sbutils.h --- linux.old/arch/mips/bcm947xx/include/sbutils.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sbutils.h 2006-04-27 23:09:25.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sbutils.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,150 @@ +/* + * Misc utility routines for accessing chip-specific features @@ -8172,7 +8121,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sbutils.h linux.dev/arch/mips/bcm +#endif /* _sbutils_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/sflash.h linux.dev/arch/mips/bcm947xx/include/sflash.h --- linux.old/arch/mips/bcm947xx/include/sflash.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/sflash.h 2006-04-27 22:13:51.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/sflash.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,36 @@ +/* + * Broadcom SiliconBackplane chipcommon serial flash interface @@ -8212,7 +8161,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/sflash.h linux.dev/arch/mips/bcm9 +#endif /* _sflash_h_ */ diff -urN linux.old/arch/mips/bcm947xx/include/trxhdr.h linux.dev/arch/mips/bcm947xx/include/trxhdr.h --- linux.old/arch/mips/bcm947xx/include/trxhdr.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/trxhdr.h 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/trxhdr.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,33 @@ +/* + * TRX image file header format. @@ -8249,7 +8198,7 @@ diff -urN linux.old/arch/mips/bcm947xx/include/trxhdr.h linux.dev/arch/mips/bcm9 +typedef struct trx_header TRXHDR, *PTRXHDR; diff -urN linux.old/arch/mips/bcm947xx/include/typedefs.h linux.dev/arch/mips/bcm947xx/include/typedefs.h --- linux.old/arch/mips/bcm947xx/include/typedefs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/include/typedefs.h 2006-04-27 23:47:30.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/include/typedefs.h 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,361 @@ +/* + * Copyright 2006, Broadcom Corporation @@ -8612,9 +8561,30 @@ diff -urN linux.old/arch/mips/bcm947xx/include/typedefs.h linux.dev/arch/mips/bc +#include "bcmdefs.h" + +#endif /* _TYPEDEFS_H_ */ +diff -urN linux.old/arch/mips/bcm947xx/Makefile linux.dev/arch/mips/bcm947xx/Makefile +--- linux.old/arch/mips/bcm947xx/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux.dev/arch/mips/bcm947xx/Makefile 2006-10-02 21:26:08.000000000 +0200 +@@ -0,0 +1,17 @@ ++# ++# Makefile for the BCM947xx specific kernel interface routines ++# under Linux. ++# ++ ++EXTRA_CFLAGS+=-I$(TOPDIR)/arch/mips/bcm947xx/include -DBCMDRIVER -fno-delayed-branch ++ ++O_TARGET := bcm947xx.o ++ ++export-objs := export.o ++obj-y := prom.o setup.o time.o sbmips.o gpio.o ++obj-y += nvram.o nvram_linux.o sflash.o cfe_env.o ++obj-y += sbutils.o bcmutils.o bcmsrom.o hndchipc.o ++obj-$(CONFIG_PCI) += sbpci.o pcibios.o ++obj-y += export.o ++ ++include $(TOPDIR)/Rules.make diff -urN linux.old/arch/mips/bcm947xx/nvram.c linux.dev/arch/mips/bcm947xx/nvram.c --- linux.old/arch/mips/bcm947xx/nvram.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/nvram.c 2006-04-27 23:11:58.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/nvram.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,315 @@ +/* + * NVRAM variable manipulation (common) @@ -8933,7 +8903,7 @@ diff -urN linux.old/arch/mips/bcm947xx/nvram.c linux.dev/arch/mips/bcm947xx/nvra +} diff -urN linux.old/arch/mips/bcm947xx/nvram_linux.c linux.dev/arch/mips/bcm947xx/nvram_linux.c --- linux.old/arch/mips/bcm947xx/nvram_linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/nvram_linux.c 2006-04-27 23:30:07.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/nvram_linux.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,723 @@ +/* + * NVRAM variable manipulation (Linux kernel half) @@ -9660,7 +9630,7 @@ diff -urN linux.old/arch/mips/bcm947xx/nvram_linux.c linux.dev/arch/mips/bcm947x +module_exit(dev_nvram_exit); diff -urN linux.old/arch/mips/bcm947xx/pcibios.c linux.dev/arch/mips/bcm947xx/pcibios.c --- linux.old/arch/mips/bcm947xx/pcibios.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/pcibios.c 2006-04-27 23:42:50.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/pcibios.c 2006-10-02 21:22:56.000000000 +0200 @@ -0,0 +1,380 @@ +/* + * Low-Level PCI and SB support for BCM47xx (Linux support code) @@ -10044,7 +10014,7 @@ diff -urN linux.old/arch/mips/bcm947xx/pcibios.c linux.dev/arch/mips/bcm947xx/pc + diff -urN linux.old/arch/mips/bcm947xx/prom.c linux.dev/arch/mips/bcm947xx/prom.c --- linux.old/arch/mips/bcm947xx/prom.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/prom.c 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/prom.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,41 @@ +/* + * Early initialization code for BCM94710 boards @@ -10089,7 +10059,7 @@ diff -urN linux.old/arch/mips/bcm947xx/prom.c linux.dev/arch/mips/bcm947xx/prom. +} diff -urN linux.old/arch/mips/bcm947xx/sbmips.c linux.dev/arch/mips/bcm947xx/sbmips.c --- linux.old/arch/mips/bcm947xx/sbmips.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/sbmips.c 2006-05-02 04:43:13.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/sbmips.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,1132 @@ +/* + * BCM47XX Sonics SiliconBackplane MIPS core routines @@ -11225,7 +11195,7 @@ diff -urN linux.old/arch/mips/bcm947xx/sbmips.c linux.dev/arch/mips/bcm947xx/sbm +#endif /* BCMINTERNAL | BCMPERFSTATS */ diff -urN linux.old/arch/mips/bcm947xx/sbpci.c linux.dev/arch/mips/bcm947xx/sbpci.c --- linux.old/arch/mips/bcm947xx/sbpci.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/sbpci.c 2006-05-02 17:37:13.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/sbpci.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,768 @@ +/* + * Low-Level PCI and SB support for BCM47xx @@ -11997,7 +11967,7 @@ diff -urN linux.old/arch/mips/bcm947xx/sbpci.c linux.dev/arch/mips/bcm947xx/sbpc + diff -urN linux.old/arch/mips/bcm947xx/sbutils.c linux.dev/arch/mips/bcm947xx/sbutils.c --- linux.old/arch/mips/bcm947xx/sbutils.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/sbutils.c 2006-05-02 04:33:16.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/sbutils.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,3081 @@ +/* + * Misc utility routines for accessing chip-specific features @@ -15082,7 +15052,7 @@ diff -urN linux.old/arch/mips/bcm947xx/sbutils.c linux.dev/arch/mips/bcm947xx/sb + diff -urN linux.old/arch/mips/bcm947xx/setup.c linux.dev/arch/mips/bcm947xx/setup.c --- linux.old/arch/mips/bcm947xx/setup.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/setup.c 2006-04-27 23:22:53.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/setup.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,241 @@ +/* + * Generic setup routines for Broadcom MIPS boards @@ -15327,7 +15297,7 @@ diff -urN linux.old/arch/mips/bcm947xx/setup.c linux.dev/arch/mips/bcm947xx/setu + diff -urN linux.old/arch/mips/bcm947xx/sflash.c linux.dev/arch/mips/bcm947xx/sflash.c --- linux.old/arch/mips/bcm947xx/sflash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/sflash.c 2006-04-27 22:11:27.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/sflash.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,422 @@ +/* + * Broadcom SiliconBackplane chipcommon serial flash interface @@ -15753,7 +15723,7 @@ diff -urN linux.old/arch/mips/bcm947xx/sflash.c linux.dev/arch/mips/bcm947xx/sfl +} diff -urN linux.old/arch/mips/bcm947xx/time.c linux.dev/arch/mips/bcm947xx/time.c --- linux.old/arch/mips/bcm947xx/time.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/arch/mips/bcm947xx/time.c 2006-04-28 00:45:40.000000000 +0200 ++++ linux.dev/arch/mips/bcm947xx/time.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,104 @@ +/* + * Copyright 2006, Broadcom Corporation @@ -15860,8 +15830,8 @@ diff -urN linux.old/arch/mips/bcm947xx/time.c linux.dev/arch/mips/bcm947xx/time. + setup_irq(7, &bcm947xx_timer_irqaction); +} diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared.in ---- linux.old/arch/mips/config-shared.in 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/config-shared.in 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/config-shared.in 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/config-shared.in 2006-10-02 21:19:59.000000000 +0200 @@ -208,6 +208,14 @@ fi define_bool CONFIG_MIPS_RTC y @@ -15902,7 +15872,7 @@ diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then define_bool CONFIG_ARC32 y define_bool CONFIG_ARC_MEMORY y -@@ -1042,7 +1062,11 @@ +@@ -1042,7 +1061,11 @@ bool 'Are you using a crosscompiler' CONFIG_CROSSCOMPILE bool 'Enable run-time debugging' CONFIG_RUNTIME_DEBUG @@ -15916,8 +15886,8 @@ diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared if [ "$CONFIG_KGDB" = "y" ]; then define_bool CONFIG_DEBUG_INFO y diff -urN linux.old/arch/mips/kernel/cpu-probe.c linux.dev/arch/mips/kernel/cpu-probe.c ---- linux.old/arch/mips/kernel/cpu-probe.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/kernel/cpu-probe.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/kernel/cpu-probe.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/kernel/cpu-probe.c 2006-10-02 21:19:59.000000000 +0200 @@ -162,7 +162,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c) @@ -16038,8 +16008,8 @@ diff -urN linux.old/arch/mips/kernel/cpu-probe.c linux.dev/arch/mips/kernel/cpu- cpu_probe_sibyte(c); break; diff -urN linux.old/arch/mips/kernel/head.S linux.dev/arch/mips/kernel/head.S ---- linux.old/arch/mips/kernel/head.S 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/kernel/head.S 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/kernel/head.S 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/kernel/head.S 2006-10-02 21:19:59.000000000 +0200 @@ -28,12 +28,20 @@ #include #include @@ -16063,8 +16033,8 @@ diff -urN linux.old/arch/mips/kernel/head.S linux.dev/arch/mips/kernel/head.S /* The following two symbols are used for kernel profiling. */ EXPORT(stext) diff -urN linux.old/arch/mips/kernel/proc.c linux.dev/arch/mips/kernel/proc.c ---- linux.old/arch/mips/kernel/proc.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/kernel/proc.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/kernel/proc.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/kernel/proc.c 2006-10-02 21:19:59.000000000 +0200 @@ -78,9 +78,10 @@ [CPU_AU1550] "Au1550", [CPU_24K] "MIPS 24K", @@ -16078,8 +16048,8 @@ diff -urN linux.old/arch/mips/kernel/proc.c linux.dev/arch/mips/kernel/proc.c { unsigned int version = current_cpu_data.processor_id; diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c ---- linux.old/arch/mips/kernel/setup.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/kernel/setup.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/kernel/setup.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/kernel/setup.c 2006-10-02 21:19:59.000000000 +0200 @@ -493,6 +493,7 @@ void swarm_setup(void); void hp_setup(void); @@ -16101,8 +16071,8 @@ diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c panic("Unsupported architecture"); } diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c ---- linux.old/arch/mips/kernel/traps.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/kernel/traps.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/kernel/traps.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/kernel/traps.c 2006-10-02 21:19:59.000000000 +0200 @@ -920,6 +920,7 @@ void __init trap_init(void) { @@ -16132,9 +16102,40 @@ diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c if (cpu_has_fpu && !cpu_has_nofpuex) set_except_vector(15, handle_fpe); +diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile +--- linux.old/arch/mips/Makefile 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/Makefile 2006-10-02 21:19:59.000000000 +0200 +@@ -726,6 +726,19 @@ + endif + + # ++# Broadcom BCM947XX variants ++# ++ifdef CONFIG_BCM947XX ++LIBS += arch/mips/bcm947xx/generic/brcm.o arch/mips/bcm947xx/bcm947xx.o ++SUBDIRS += arch/mips/bcm947xx/generic arch/mips/bcm947xx ++LOADADDR := 0x80001000 ++ ++zImage: vmlinux ++ $(MAKE) -C arch/$(ARCH)/bcm947xx/compressed ++export LOADADDR ++endif ++ ++# + # Choosing incompatible machines durings configuration will result in + # error messages during linking. Select a default linkscript if + # none has been choosen above. +@@ -778,6 +791,7 @@ + $(MAKE) -C arch/$(ARCH)/tools clean + $(MAKE) -C arch/mips/baget clean + $(MAKE) -C arch/mips/lasat clean ++ $(MAKE) -C arch/mips/bcm947xx/compressed clean + + archmrproper: + @$(MAKEBOOT) mrproper diff -urN linux.old/arch/mips/mm/c-r4k.c linux.dev/arch/mips/mm/c-r4k.c ---- linux.old/arch/mips/mm/c-r4k.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/mm/c-r4k.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/mm/c-r4k.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/mm/c-r4k.c 2006-10-02 21:19:59.000000000 +0200 @@ -1166,3 +1166,47 @@ build_clear_page(); build_copy_page(); @@ -16184,8 +16185,8 @@ diff -urN linux.old/arch/mips/mm/c-r4k.c linux.dev/arch/mips/mm/c-r4k.c + + diff -urN linux.old/arch/mips/pci/Makefile linux.dev/arch/mips/pci/Makefile ---- linux.old/arch/mips/pci/Makefile 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/arch/mips/pci/Makefile 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/arch/mips/pci/Makefile 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/arch/mips/pci/Makefile 2006-10-02 21:19:59.000000000 +0200 @@ -13,7 +13,9 @@ obj-$(CONFIG_MIPS_MSC) += ops-msc.o obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o @@ -16197,8 +16198,8 @@ diff -urN linux.old/arch/mips/pci/Makefile linux.dev/arch/mips/pci/Makefile include $(TOPDIR)/Rules.make diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c ---- linux.old/drivers/char/serial.c 2006-04-27 18:04:37.000000000 +0200 -+++ linux.dev/drivers/char/serial.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/drivers/char/serial.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/drivers/char/serial.c 2006-10-02 21:19:59.000000000 +0200 @@ -444,6 +444,10 @@ return inb(info->port+1); #endif @@ -16268,8 +16269,8 @@ diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c #if defined(__powerpc__) || defined(__alpha__) cval >>= 8; diff -urN linux.old/drivers/net/Makefile linux.dev/drivers/net/Makefile ---- linux.old/drivers/net/Makefile 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/drivers/net/Makefile 2006-05-04 01:41:03.000000000 +0200 +--- linux.old/drivers/net/Makefile 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/drivers/net/Makefile 2006-10-02 21:19:59.000000000 +0200 @@ -3,6 +3,8 @@ # Makefile for the Linux network (ethercard) device drivers. # @@ -16280,8 +16281,8 @@ diff -urN linux.old/drivers/net/Makefile linux.dev/drivers/net/Makefile obj-m := obj-n := diff -urN linux.old/drivers/parport/Config.in linux.dev/drivers/parport/Config.in ---- linux.old/drivers/parport/Config.in 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/drivers/parport/Config.in 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/drivers/parport/Config.in 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/drivers/parport/Config.in 2006-10-02 21:19:59.000000000 +0200 @@ -11,6 +11,7 @@ tristate 'Parallel port support' CONFIG_PARPORT if [ "$CONFIG_PARPORT" != "n" ]; then @@ -16291,8 +16292,8 @@ diff -urN linux.old/drivers/parport/Config.in linux.dev/drivers/parport/Config.i if [ "$CONFIG_SERIAL" = "m" ]; then define_tristate CONFIG_PARPORT_PC_CML1 m diff -urN linux.old/drivers/parport/Makefile linux.dev/drivers/parport/Makefile ---- linux.old/drivers/parport/Makefile 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/drivers/parport/Makefile 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/drivers/parport/Makefile 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/drivers/parport/Makefile 2006-10-02 21:19:59.000000000 +0200 @@ -22,6 +22,7 @@ obj-$(CONFIG_PARPORT) += parport.o @@ -16303,7 +16304,7 @@ diff -urN linux.old/drivers/parport/Makefile linux.dev/drivers/parport/Makefile obj-$(CONFIG_PARPORT_MFC3) += parport_mfc3.o diff -urN linux.old/drivers/parport/parport_splink.c linux.dev/drivers/parport/parport_splink.c --- linux.old/drivers/parport/parport_splink.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux.dev/drivers/parport/parport_splink.c 2006-04-27 19:24:19.000000000 +0200 ++++ linux.dev/drivers/parport/parport_splink.c 2006-10-02 21:19:59.000000000 +0200 @@ -0,0 +1,345 @@ +/* Low-level parallel port routines for the ASUS WL-500g built-in port + * @@ -16651,8 +16652,8 @@ diff -urN linux.old/drivers/parport/parport_splink.c linux.dev/drivers/parport/p +module_exit(parport_splink_cleanup) + diff -urN linux.old/include/asm-mips/bootinfo.h linux.dev/include/asm-mips/bootinfo.h ---- linux.old/include/asm-mips/bootinfo.h 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/include/asm-mips/bootinfo.h 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/include/asm-mips/bootinfo.h 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/include/asm-mips/bootinfo.h 2006-10-02 21:19:59.000000000 +0200 @@ -37,6 +37,7 @@ #define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */ #define MACH_GROUP_LASAT 21 @@ -16678,8 +16679,8 @@ diff -urN linux.old/include/asm-mips/bootinfo.h linux.dev/include/asm-mips/booti */ #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */ diff -urN linux.old/include/asm-mips/cpu.h linux.dev/include/asm-mips/cpu.h ---- linux.old/include/asm-mips/cpu.h 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/include/asm-mips/cpu.h 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/include/asm-mips/cpu.h 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/include/asm-mips/cpu.h 2006-10-02 21:19:59.000000000 +0200 @@ -22,6 +22,11 @@ spec. */ @@ -16729,8 +16730,8 @@ diff -urN linux.old/include/asm-mips/cpu.h linux.dev/include/asm-mips/cpu.h /* * ISA Level encodings diff -urN linux.old/include/asm-mips/r4kcache.h linux.dev/include/asm-mips/r4kcache.h ---- linux.old/include/asm-mips/r4kcache.h 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/include/asm-mips/r4kcache.h 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/include/asm-mips/r4kcache.h 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/include/asm-mips/r4kcache.h 2006-10-02 21:19:59.000000000 +0200 @@ -658,4 +658,17 @@ cache128_unroll32(addr|ws,Index_Writeback_Inv_SD); } @@ -16750,8 +16751,8 @@ diff -urN linux.old/include/asm-mips/r4kcache.h linux.dev/include/asm-mips/r4kca + #endif /* __ASM_R4KCACHE_H */ diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial.h ---- linux.old/include/asm-mips/serial.h 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/include/asm-mips/serial.h 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/include/asm-mips/serial.h 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/include/asm-mips/serial.h 2006-10-02 21:19:59.000000000 +0200 @@ -223,6 +223,13 @@ #define TXX927_SERIAL_PORT_DEFNS #endif @@ -16775,8 +16776,8 @@ diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial. DDB5477_SERIAL_PORT_DEFNS \ EV96100_SERIAL_PORT_DEFNS \ diff -urN linux.old/init/do_mounts.c linux.dev/init/do_mounts.c ---- linux.old/init/do_mounts.c 2006-04-27 18:04:38.000000000 +0200 -+++ linux.dev/init/do_mounts.c 2006-04-27 19:24:19.000000000 +0200 +--- linux.old/init/do_mounts.c 2006-10-02 21:23:10.000000000 +0200 ++++ linux.dev/init/do_mounts.c 2006-10-02 21:19:59.000000000 +0200 @@ -254,7 +254,13 @@ { "ftlb", 0x2c08 }, { "ftlc", 0x2c10 }, -- cgit v1.2.3