
OpenWRT support for Compex NP25G
================================
by Eric Lammerts <eric@lammerts.org>


how to apply the diff
---------------------
svn co -q -r9800 https://svn.openwrt.org/openwrt/trunk
cd trunk
patch -p1 < ../openwrt-np25g-r9800.diff
make
ls -l bin/openwrt-np25g.img

You can upload this image using the web interface of the original Compex
firmware, or by holding the reset switch pressed while powering up and then
doing tftp to 192.168.168.1 on the LAN port.


changes
-------
- support for Compex-style firmware images
- support for Compex MTD partitions
- configuration of VLANs on ADM6996F
- added package definition for curl, live555, & strace
- adapt package definition for recent wisoc madwifi support
- misc bugfixes

notes
-----
- wireless has only been tested lightly, in STA mode only.
- ADM6996F configuration is hardcoded in the kernel:
  eth0.1 = LAN (4 ports), eth0.2 = WAN (1 port)
- if you want to use the latest madwifi: they renamed the
  madwifi-hal-2008-08-15 branch to madwifi-hal-testing

diff -urN openwrt-r9800/package/curl/Makefile openwrt-np25g/package/curl/Makefile
--- openwrt-r9800/package/curl/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/curl/Makefile	2008-03-20 19:06:14.000000000 -0400
@@ -0,0 +1,117 @@
+# 
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=curl
+PKG_VERSION:=7.18.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://curl.haxx.se/download/ \
+	http://www.mirrorspace.org/curl/ \
+	http://curl.mirror.internet.tp/download/ \
+	ftp://ftp.sunet.se/pub/www/utilities/curl/ \
+	ftp://ftp.planetmirror.com/pub/curl/ \
+	http://www.mirrormonster.com/curl/download/ \
+	http://curl.mirrors.cyberservers.net/download/
+PKG_MD5SUM:=3e50dd887d6a354be312d874e1d3426c
+
+PKG_FIXUP = libtool
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/curl/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://curl.haxx.se/
+endef
+
+define Package/curl
+  $(call Package/curl/Default)
+  DEPENDS:=+libcurl
+  TITLE:=A client-side URL transfer library
+endef
+
+define Package/libcurl
+  $(call Package/curl/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libopenssl +zlib
+  TITLE:=A client-side URL transfer utility
+endef
+
+CONFIGURE_ARGS += \
+	--enable-shared \
+	--enable-static \
+	--disable-thread \
+	--enable-cookies \
+	--enable-crypto-auth \
+	--enable-nonblocking \
+	--disable-file \
+	--disable-ftp \
+	--enable-http \
+	--enable-ipv6 \
+	--disable-ares \
+	--disable-debug \
+	--disable-dict \
+	--disable-gopher \
+	--disable-ldap \
+	--disable-manual \
+	--disable-sspi \
+	--disable-telnet \
+	--disable-tftp \
+	--disable-verbose \
+	--with-random="/dev/urandom" \
+	--with-ssl="$(STAGING_DIR)/usr" \
+	--without-ca-bundle \
+	--without-gnutls \
+	--without-krb4 \
+	--without-libidn \
+	--without-nss \
+	--with-zlib="$(STAGING_DIR)/usr" \
+
+CONFIGURE_VARS += \
+	LDFLAGS="$$$$LDFLAGS -lcrypto -lssl -lz" \
+	CC="$(filter-out ccache,$(TARGET_CC))"
+
+define Build/Configure
+	$(call Build/Configure/Default,,bash)
+endef
+
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		CC="$(TARGET_CC)" \
+		install
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
+	#$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.a $(1)/usr/lib/
+	$(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
+	$(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
+	$(SED) 's,$(TARGET_LDFLAGS),,g' $(1)/usr/lib/pkgconfig/libcurl.pc
+	ln -sf $(STAGING_DIR)/usr/bin/curl-config $(1)/bin/
+endef
+
+define Package/curl/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
+endef
+
+define Package/libcurl/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	#$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,curl))
+$(eval $(call BuildPackage,libcurl))
diff -urN openwrt-r9800/package/live555/Makefile openwrt-np25g/package/live555/Makefile
--- openwrt-r9800/package/live555/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/live555/Makefile	2007-12-19 11:53:08.000000000 -0500
@@ -0,0 +1,42 @@
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=live555
+PKG_VERSION:=2007.12.07
+PKG_RELEASE:=1
+
+PKG_SOURCE:=live.$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.live555.com/liveMedia/public/
+PKG_MD5SUM:=156353834d2cbb44027ae9a0adaf672a
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_UNPACK:=mkdir -p $(PKG_BUILD_DIR).tmp && \
+	gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR).tmp $(TAR_OPTIONS) && \
+	rm -rf $(PKG_BUILD_DIR) && \
+	mv $(PKG_BUILD_DIR).tmp/live $(PKG_BUILD_DIR) && \
+	rmdir $(PKG_BUILD_DIR).tmp
+
+define Package/live555
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=C++ libraries for multimedia streaming
+  URL:=http://live555.com/liveMedia/
+endef
+
+define Package/live555/description
+ This package contains a set of C++ libraries for multimedia streaming,
+ using open standard protocols (RTP/RTCP, RTSP, SIP).
+endef
+
+define Build/Compile
+	cd $(PKG_BUILD_DIR) && ./genMakefiles uClinux
+	$(MAKE) -C $(PKG_BUILD_DIR) CC="$(TARGET_CC) $(TARGET_CFLAGS)" CXX="$(TARGET_CROSS)g++ $(TARGET_CFLAGS)" LD="$(TARGET_CROSS)ld" AR="$(TARGET_CROSS)ar"
+endef
+
+define Build/InstallDev
+	mkdir -p $(1)/usr/include $(1)/usr/lib
+	cd $(PKG_BUILD_DIR) && $(CP) */include/*.h* $(1)/usr/include/ && $(CP) */*.a $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,live555))
diff -urN openwrt-r9800/package/live555/patches/100-live.patch openwrt-np25g/package/live555/patches/100-live.patch
--- openwrt-r9800/package/live555/patches/100-live.patch	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/live555/patches/100-live.patch	2007-12-19 11:35:04.000000000 -0500
@@ -0,0 +1,14 @@
+diff -urN live.orig/Makefile.tail live/Makefile.tail
+--- live.orig/Makefile.tail	2007-12-06 21:18:54.000000000 -0500
++++ live/Makefile.tail	2007-12-19 10:46:36.000000000 -0500
+@@ -18,9 +18,7 @@
+ ALL =	$(LIVEMEDIA_LIB) \
+ 	$(GROUPSOCK_LIB) \
+ 	$(USAGE_ENVIRONMENT_LIB) \
+-	$(BASIC_USAGE_ENVIRONMENT_LIB) \
+-	$(TESTPROGS_APP) \
+-	$(MEDIA_SERVER_APP)
++	$(BASIC_USAGE_ENVIRONMENT_LIB)
+ all:	$(ALL)
+ 
+ 
diff -urN openwrt-r9800/package/live555/patches/110-noBstatic openwrt-np25g/package/live555/patches/110-noBstatic
--- openwrt-r9800/package/live555/patches/110-noBstatic	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/live555/patches/110-noBstatic	2007-12-19 11:53:08.000000000 -0500
@@ -0,0 +1,14 @@
+--- live/config.uClinux	2007-12-06 21:18:54.000000000 -0500
++++ live555-2007.12.07/config.uClinux	2007-12-19 11:50:59.000000000 -0500
+@@ -11,8 +11,9 @@
+ LINK =			$(CC) -o
+ LINK_OPTS =		-L. $(LDFLAGS)
+ CONSOLE_LINK_OPTS =	$(LINK_OPTS)
+-LIBRARY_LINK =		$(LD) -o
+-LIBRARY_LINK_OPTS =	 -L.  -r -Bstatic
++# append "" because target filename is appended without spaces
++LIBRARY_LINK =		$(AR) rcs ""
++LIBRARY_LINK_OPTS =	
+ LIB_SUFFIX =			a
+ LIBS_FOR_CONSOLE_APPLICATION = $(CXXLIBS)
+ LIBS_FOR_GUI_APPLICATION = $(LIBS_FOR_CONSOLE_APPLICATION)
diff -urN openwrt-r9800/package/madwifi/Makefile openwrt-np25g/package/madwifi/Makefile
--- openwrt-r9800/package/madwifi/Makefile	2007-12-12 23:26:46.000000000 -0500
+++ openwrt-np25g/package/madwifi/Makefile	2008-09-12 16:58:28.000000000 -0400
@@ -10,9 +10,9 @@
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=madwifi
-PKG_REV:=3053
+PKG_REV:=3862
 PKG_VERSION:=r$(PKG_REV)
-PKG_BRANCH:=madwifi-dfs
+PKG_BRANCH:=madwifi-hal-2008-08-15
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=svn
@@ -49,7 +49,7 @@
 
 ifneq ($(CONFIG_TARGET_atheros),)
   BUS:=AHB
-  HAL_TARGET:=ap51
+  HAL_TARGET:=wisoc
 else
   ifneq ($(CONFIG_PCI_SUPPORT),)
     BUS:=PCI
@@ -163,7 +163,7 @@
 	$(INSTALL_DIR) $(1)/lib/wifi
 	$(INSTALL_DATA) ./files/lib/wifi/madwifi.sh $(1)/lib/wifi
 	$(INSTALL_DIR) $(1)/usr/sbin
-	$(CP) $(PKG_BUILD_DIR)/tools/{madwifi_multi,80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
+	$(CP) $(PKG_BUILD_DIR)/tools/{80211stats,athchans,athctrl,athkey,athstats,wlanconfig} $(1)/usr/sbin/
 endef
 
 $(eval $(call KernelPackage,madwifi))
diff -urN openwrt-r9800/package/madwifi/patches/100-kernel_cflags.patch openwrt-np25g/package/madwifi/patches/100-kernel_cflags.patch
--- openwrt-r9800/package/madwifi/patches/100-kernel_cflags.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/100-kernel_cflags.patch	2008-09-12 16:58:28.000000000 -0400
@@ -1,33 +1,9 @@
-Index: madwifi-dfs-r3053/hal/public/mips-be-elf.inc
-===================================================================
---- madwifi-dfs-r3053.orig/hal/public/mips-be-elf.inc	2007-12-13 05:25:10.890246068 +0100
-+++ madwifi-dfs-r3053/hal/public/mips-be-elf.inc	2007-12-13 05:25:10.986251538 +0100
-@@ -71,5 +71,5 @@
+--- madwifi-hal-2008-08-15-r3862/hal/public/wisoc.inc.orig	2008-09-12 09:30:18.178859994 -0400
++++ madwifi-hal-2008-08-15-r3862/hal/public/wisoc.inc	2008-09-12 09:30:31.262656536 -0400
+@@ -48,5 +48,5 @@
+ NM=	${TOOLPREFIX}nm
  
- LDOPTS=	-EB
  COPTS+=	-DAH_BYTE_ORDER=AH_BIG_ENDIAN
--COPTS+=	-G 0 -EB -mno-abicalls -fno-pic -mips2 -Wa,--trap \
-+COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \
+-COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \
++COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap -Wa,-relax-branch \
  	-fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
-Index: madwifi-dfs-r3053/hal/public/mips-le-elf.inc
-===================================================================
---- madwifi-dfs-r3053.orig/hal/public/mips-le-elf.inc	2007-12-13 05:25:10.898246523 +0100
-+++ madwifi-dfs-r3053/hal/public/mips-le-elf.inc	2007-12-13 05:25:10.994251993 +0100
-@@ -68,5 +68,5 @@
- 
- LDOPTS=	-EL
- COPTS+=	-DAH_BYTE_ORDER=AH_LITTLE_ENDIAN
--COPTS+=	-G 0 -EL -mno-abicalls -fno-pic -mips2 -Wa,--trap \
-+COPTS+=	-G 0 -mno-abicalls -fno-pic -mips32 -Wa,--trap \
- 	-fno-strict-aliasing -fno-common -fomit-frame-pointer -mlong-calls
-Index: madwifi-dfs-r3053/hal/public/xscale-be-elf.inc
-===================================================================
---- madwifi-dfs-r3053.orig/hal/public/xscale-be-elf.inc	2007-12-13 05:25:10.906246979 +0100
-+++ madwifi-dfs-r3053/hal/public/xscale-be-elf.inc	2007-12-13 05:25:10.998252222 +0100
-@@ -77,5 +77,5 @@
- 
- LDOPTS=	-EB
- COPTS+=	-DAH_BYTE_ORDER=AH_BIG_ENDIAN
--COPTS+= -march=armv4 -mbig-endian -fno-strict-aliasing -fno-common -mapcs-32 \
-+COPTS+= -march=armv5te -mbig-endian -fno-strict-aliasing -fno-common  \
- 	-mtune=xscale  -mshort-load-bytes
diff -urN openwrt-r9800/package/madwifi/patches/102-multicall_binary.patch openwrt-np25g/package/madwifi/patches/102-multicall_binary.patch
--- openwrt-r9800/package/madwifi/patches/102-multicall_binary.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/102-multicall_binary.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,421 +0,0 @@
-Index: madwifi-dfs-r3053/tools/80211debug.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/80211debug.c	2007-12-13 05:25:10.786240140 +0100
-+++ madwifi-dfs-r3053/tools/80211debug.c	2007-12-13 05:25:11.226265215 +0100
-@@ -49,6 +49,10 @@
- #include <getopt.h>
- #include <err.h>
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- #undef ARRAY_SIZE
- #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
- 
-@@ -184,9 +188,19 @@
- }
- #endif /* __linux__ */
- 
-+#ifdef DOMULTI
-+
-+int
-+a80211debug_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	const char *ifname = "ath0";
- 	const char *cp, *tp;
- 	const char *sep;
-Index: madwifi-dfs-r3053/tools/80211stats.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/80211stats.c	2007-12-13 05:25:10.794240595 +0100
-+++ madwifi-dfs-r3053/tools/80211stats.c	2007-12-13 05:25:11.226265215 +0100
-@@ -60,6 +60,10 @@
- #include "net80211/ieee80211_crypto.h"
- #include "net80211/ieee80211_ioctl.h"
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- #ifndef SIOCG80211STATS
- #define	SIOCG80211STATS	(SIOCDEVPRIVATE + 2)
- #endif
-@@ -239,9 +243,19 @@
- #undef STAT
- }
- 
-+#ifdef DOMULTI
-+
-+int
-+a80211stats_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	int c, len;
- 	struct ieee80211req_sta_info *si;
- 	u_int8_t buf[24*1024], *cp;
-Index: madwifi-dfs-r3053/tools/athchans.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/athchans.c	2007-12-13 05:25:10.798240825 +0100
-+++ madwifi-dfs-r3053/tools/athchans.c	2007-12-13 05:25:11.238265900 +0100
-@@ -59,6 +59,10 @@
- #include "net80211/ieee80211_crypto.h"
- #include "net80211/ieee80211_ioctl.h"
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- static	int s = -1;
- static const char *progname;
- 
-@@ -139,9 +143,20 @@
- }
- 
- #define	MAXCHAN	((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
-+
-+#ifdef DOMULTI
-+
-+int
-+athchans_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	const char *ifname = "wifi0";
- 	struct ieee80211req_chanlist chanlist;
- 	int c;
-Index: madwifi-dfs-r3053/tools/athctrl.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/athctrl.c	2007-12-13 05:25:10.806241280 +0100
-+++ madwifi-dfs-r3053/tools/athctrl.c	2007-12-13 05:25:11.242266126 +0100
-@@ -53,6 +53,10 @@
- 
- #include <net/if.h>
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- static int
- setsysctrl(const char *dev, const char *control , u_long value)
- {
-@@ -87,9 +91,19 @@
- 	exit(1);
- }
- 
-+#ifdef DOMULTI
-+
-+int
-+athctrl_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	char device[IFNAMSIZ + 1];
- 	int distance = -1;
- 	int c;
-Index: madwifi-dfs-r3053/tools/athdebug.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/athdebug.c	2007-12-13 05:25:10.814241735 +0100
-+++ madwifi-dfs-r3053/tools/athdebug.c	2007-12-13 05:25:11.242266126 +0100
-@@ -52,6 +52,10 @@
- #include <getopt.h>
- #include <err.h>
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- #undef ARRAY_SIZE
- #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
- 
-@@ -193,9 +197,20 @@
- }
- #endif /* __linux__ */
- 
-+#ifdef DOMULTI
-+
-+int
-+athdebug_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
-+
- #ifdef __linux__
- 	const char *ifname = "wifi0";
- #else
-Index: madwifi-dfs-r3053/tools/athkey.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/athkey.c	2007-12-13 05:25:10.818241964 +0100
-+++ madwifi-dfs-r3053/tools/athkey.c	2007-12-13 05:25:11.242266126 +0100
-@@ -59,6 +59,10 @@
- #include "net80211/ieee80211_crypto.h"
- #include "net80211/ieee80211_ioctl.h"
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- static int s = -1;
- static const char *progname;
- 
-@@ -212,9 +216,19 @@
- 	exit(-1);
- }
- 
-+#ifdef DOMULTI
-+
-+int
-+athkey_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	const char *ifname = "wifi0";
- 	struct ieee80211req_key setkey;
- 	struct ieee80211req_del_key delkey;
-Index: madwifi-dfs-r3053/tools/athstats.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/athstats.c	2007-12-13 05:25:10.826242419 +0100
-+++ madwifi-dfs-r3053/tools/athstats.c	2007-12-13 05:25:11.242266126 +0100
-@@ -66,6 +66,10 @@
- #undef ARRAY_SIZE
- #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- static const struct {
- 	u_int		phyerr;
- 	const char*	desc;
-@@ -227,9 +231,20 @@
- 	signalled = 1;
- }
- 
-+#ifdef DOMULTI
-+
-+int
-+athstats_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
-+
- #ifdef __linux__
- 	const char *ifname = "wifi0";
- #else
-Index: madwifi-dfs-r3053/tools/do_multi.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ madwifi-dfs-r3053/tools/do_multi.c	2007-12-13 05:25:11.242266126 +0100
-@@ -0,0 +1,32 @@
-+#include <string.h>
-+#include "do_multi.h"
-+
-+int
-+main(int argc, char *argv[])
-+{
-+    char *progname;
-+    int ret = 0;
-+
-+    progname = basename(argv[0]);
-+
-+    if(strcmp(progname, "80211debug") == 0)
-+	ret = a80211debug_init(argc, argv);
-+    if(strcmp(progname, "80211stats") == 0)
-+	ret = a80211stats_init(argc, argv);
-+    if(strcmp(progname, "athchans") == 0)
-+	ret = athchans_init(argc, argv);
-+    if(strcmp(progname, "athctrl") == 0)
-+	ret =  athctrl_init(argc, argv);
-+    if(strcmp(progname, "athdebug") == 0)
-+	ret =  athdebug_init(argc, argv);
-+    if(strcmp(progname, "athkey") == 0)
-+	ret =  athkey_init(argc, argv);
-+    if(strcmp(progname, "athstats") == 0)
-+	ret =  athstats_init(argc, argv);
-+    if(strcmp(progname, "wlanconfig") == 0)
-+	ret =  wlanconfig_init(argc, argv);
-+    if(strcmp(progname, "ath_info") == 0)
-+	ret =  athinfo_init(argc, argv);
-+
-+    return ret;
-+}
-Index: madwifi-dfs-r3053/tools/do_multi.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ madwifi-dfs-r3053/tools/do_multi.h	2007-12-13 05:25:11.246266355 +0100
-@@ -0,0 +1,10 @@
-+
-+int a80211debug_init(int argc, char *argv[]);
-+int a80211stats_init(int argc, char *argv[]);
-+int athchans_init(int argc, char *argv[]);
-+int athctrl_init(int argc, char *argv[]);
-+int athdebug_init(int argc, char *argv[]);
-+int athkey_init(int argc, char *argv[]);
-+int athstats_init(int argc, char *argv[]);
-+int wlanconfig_init(int argc, char *argv[]);
-+int athinfo_init(int argc, char *argv[]);
-Index: madwifi-dfs-r3053/tools/Makefile
-===================================================================
---- madwifi-dfs-r3053.orig/tools/Makefile	2007-12-13 05:25:10.842243330 +0100
-+++ madwifi-dfs-r3053/tools/Makefile	2007-12-13 05:25:11.246266355 +0100
-@@ -47,9 +47,12 @@
- endif
- 
- 
--ALL=	athstats 80211stats athkey athchans athctrl \
-+ALLPROGS=	athstats 80211stats athkey athchans athctrl \
- 	athdebug 80211debug wlanconfig ath_info
- 
-+OBJS=	$(patsubst %,%.o,$(ALLPROGS) do_multi)
-+ALL=	${OBJS} madwifi_multi
-+
- all:	$(ALL)
- 
- INCS=	-I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
-@@ -59,25 +62,31 @@
- 
- all:	$(ALL)
- 
--athstats: athstats.c
--	$(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
--80211stats: 80211stats.c
--	$(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
--athkey: athkey.c
--	$(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
--athchans: athchans.c
--	$(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
--athctrl: athctrl.c
--	$(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
--athdebug: athdebug.c
--	$(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
--wlanconfig: wlanconfig.c
--	$(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
--80211debug: 80211debug.c
--	$(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
--ath_info: ath_info.c
--	$(CC) -o ath_info $(CFLAGS) ath_info.c
--
-+athstats.o: athstats.c
-+	${CC} -c -o athstats.o -DDOMULTI=1 ${ALL_CFLAGS} -I../ath athstats.c
-+80211stats.o: 80211stats.c
-+	${CC} -c -o 80211stats.o -DDOMULTI=1 ${ALL_CFLAGS} 80211stats.c
-+ath_info.o: ath_info.c
-+	${CC} -c -o ath_info.o -DDOMULTI=1 ${ALL_CFLAGS} ath_info.c
-+athkey.o: athkey.c
-+	${CC} -c -o athkey.o -DDOMULTI=1 ${ALL_CFLAGS} athkey.c
-+athchans.o: athchans.c
-+	${CC} -c -o athchans.o -DDOMULTI=1 ${ALL_CFLAGS} athchans.c
-+athctrl.o: athctrl.c
-+	${CC} -c -o athctrl.o -DDOMULTI=1 ${ALL_CFLAGS} athctrl.c
-+athdebug.o: athdebug.c
-+	${CC} -c -o athdebug.o -DDOMULTI=1 ${ALL_CFLAGS} athdebug.c
-+wlanconfig.o: wlanconfig.c
-+	${CC} -c -o wlanconfig.o -DDOMULTI=1 ${ALL_CFLAGS} wlanconfig.c
-+80211debug.o: 80211debug.c
-+	${CC} -c -o 80211debug.o -DDOMULTI=1 ${ALL_CFLAGS} 80211debug.c
-+do_multi.o: do_multi.c
-+	${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c
-+madwifi_multi: $(OBJS)
-+	${CC} -o madwifi_multi ${LDFLAGS} ${OBJS}
-+	for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \
-+	ln -s -f madwifi_multi $$i; \
-+	done
- 
- install: $(ALL) 
- 	install -d $(DESTDIR)$(BINDIR)
-Index: madwifi-dfs-r3053/tools/wlanconfig.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/wlanconfig.c	2007-12-13 05:25:10.850243788 +0100
-+++ madwifi-dfs-r3053/tools/wlanconfig.c	2007-12-13 05:25:11.246266355 +0100
-@@ -62,6 +62,10 @@
- #include "net80211/ieee80211_crypto.h"
- #include "net80211/ieee80211_ioctl.h"
- 
-+#ifdef DOMULTI
-+#include "do_multi.h"
-+#endif
-+
- /*
-  * These are taken from ieee80211_node.h
-  */
-@@ -99,9 +103,19 @@
- 
- static int verbose = 0;
- 
-+#ifdef DOMULTI
-+
-+int
-+wlanconfig_init(int argc, char *argv[])
-+{
-+
-+#else
-+
- int
- main(int argc, char *argv[])
- {
-+
-+#endif
- 	const char *ifname, *cmd;
- 	unsigned char bnounit = 0;
- 	char *if_base = NULL;
-Index: madwifi-dfs-r3053/tools/ath_info.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/ath_info.c	2007-12-13 05:25:10.858244244 +0100
-+++ madwifi-dfs-r3053/tools/ath_info.c	2007-12-13 05:25:11.246266355 +0100
-@@ -738,7 +738,12 @@
- 		"unlawful radio transmissions!\n\n");
- }
- 
-+#ifdef DOMULTI
-+int
-+athinfo_init(int argc, char *argv[])
-+#else
- int main(int argc, char *argv[])
-+#endif
- {
- 	u_int32_t dev_addr;
- 	u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
diff -urN openwrt-r9800/package/madwifi/patches/104-autocreate_none.patch openwrt-np25g/package/madwifi/patches/104-autocreate_none.patch
--- openwrt-r9800/package/madwifi/patches/104-autocreate_none.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/104-autocreate_none.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:10.754238316 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:11.582285503 +0100
-@@ -512,7 +512,7 @@
- 	HAL_STATUS status;
- 	int error = 0;
- 	unsigned int i;
--	int autocreatemode = IEEE80211_M_STA;
-+	int autocreatemode = -1;
- 	u_int8_t csz;
- 
- 	sc->devid = devid;
diff -urN openwrt-r9800/package/madwifi/patches/105-ratectl_attach.patch openwrt-np25g/package/madwifi/patches/105-ratectl_attach.patch
--- openwrt-r9800/package/madwifi/patches/105-ratectl_attach.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/105-ratectl_attach.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,25 +0,0 @@
-Index: madwifi-dfs-r3053/net80211/ieee80211_rate.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_rate.c	2007-12-13 05:25:10.722236492 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_rate.c	2007-12-13 05:25:11.798297814 +0100
-@@ -100,8 +100,18 @@
- 		ieee80211_load_module(buf);
- 
- 	if (!ratectls[id].attach) {
--		printk(KERN_ERR "Error loading module \"%s\"\n", buf);
--		return NULL;
-+		/* pick the first available rate control module */
-+		printk(KERN_INFO "Rate control module \"%s\" not available\n", buf);
-+		for (id = 0; id < IEEE80211_RATE_MAX; id++) {
-+			if (ratectls[id].attach)
-+				break;
-+		}
-+		if (!ratectls[id].attach) {
-+			printk(KERN_ERR "No rate control module available");
-+			return NULL;
-+		} else {
-+			printk(KERN_INFO "Using \"%s\" instead.\n", module_names[id]);
-+		}
- 	}
- 
- 	ctl = ratectls[id].attach(sc);
diff -urN openwrt-r9800/package/madwifi/patches/111-minstrel_crash.patch openwrt-np25g/package/madwifi/patches/111-minstrel_crash.patch
--- openwrt-r9800/package/madwifi/patches/111-minstrel_crash.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/111-minstrel_crash.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-Index: madwifi-dfs-r3053/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath_rate/minstrel/minstrel.c	2007-12-13 05:25:10.690234670 +0100
-+++ madwifi-dfs-r3053/ath_rate/minstrel/minstrel.c	2007-12-13 05:25:12.006309667 +0100
-@@ -393,6 +393,9 @@
- 		struct minstrel_node *sn = ATH_NODE_MINSTREL(an);
- 		int rc1, rc2, rc3;         /* Index into the rate table, so for example, it is  0..11 */
- 
-+		if (sn->num_rates <= 0)
-+			return;
-+
- 		if (sn->is_sampling) {
- 			sn->is_sampling = 0;
- 			if (sn->rs_sample_rate_slower)
diff -urN openwrt-r9800/package/madwifi/patches/113-no_ibss_pwrsave.patch openwrt-np25g/package/madwifi/patches/113-no_ibss_pwrsave.patch
--- openwrt-r9800/package/madwifi/patches/113-no_ibss_pwrsave.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/113-no_ibss_pwrsave.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-Index: madwifi-dfs-r3053/net80211/ieee80211_scan.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_scan.c	2007-12-13 05:25:10.658232846 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_scan.c	2007-12-13 05:25:12.214321521 +0100
-@@ -291,7 +291,8 @@
- 	struct ieee80211com *ic = vap->iv_ic;
- 	int delay;
- 
--	ieee80211_sta_pwrsave(vap, 1);
-+	if (vap->iv_opmode != IEEE80211_M_IBSS)
-+	    ieee80211_sta_pwrsave(vap, 1);
- 	/*
- 	 * Use an initial 1ms delay to ensure the null
- 	 * data frame has a chance to go out.
diff -urN openwrt-r9800/package/madwifi/patches/122-replayfail_workaround.patch openwrt-np25g/package/madwifi/patches/122-replayfail_workaround.patch
--- openwrt-r9800/package/madwifi/patches/122-replayfail_workaround.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/122-replayfail_workaround.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-Index: madwifi-dfs-r3053/net80211/ieee80211_linux.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_linux.c	2007-12-13 05:25:10.626231021 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_linux.c	2007-12-13 05:25:12.422333377 +0100
-@@ -331,6 +331,9 @@
- 		k->wk_cipher->ic_name, k->wk_keyix,
- 		(unsigned long long)rsc );
- 
-+	/* disabled for now due to bogus events for unknown reasons */
-+	return;
-+
- 	/* TODO: needed parameters: count, keyid, key type, src address, TSC */
- 	snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=%s)", tag,
- 		k->wk_keyix,
diff -urN openwrt-r9800/package/madwifi/patches/123-ccmp_checks.patch openwrt-np25g/package/madwifi/patches/123-ccmp_checks.patch
--- openwrt-r9800/package/madwifi/patches/123-ccmp_checks.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/123-ccmp_checks.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,24 +0,0 @@
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto_ccmp.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto_ccmp.c	2007-12-13 05:25:10.594229197 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto_ccmp.c	2007-12-13 05:25:12.634345457 +0100
-@@ -475,6 +475,9 @@
- 	uint8_t *mic, *pos;
- 	u_int space;
- 
-+	if (ctx->cc_tfm == NULL)
-+		return 0;
-+
- 	ctx->cc_vap->iv_stats.is_crypto_ccmp++;
- 
- 	skb = skb0;
-@@ -589,6 +592,9 @@
- 	uint8_t *pos, *mic;
- 	u_int space;
- 
-+	if (ctx->cc_tfm == NULL)
-+		return 0;
-+
- 	ctx->cc_vap->iv_stats.is_crypto_ccmp++;
- 
- 	skb = skb0;
diff -urN openwrt-r9800/package/madwifi/patches/124-linux24_compat.patch openwrt-np25g/package/madwifi/patches/124-linux24_compat.patch
--- openwrt-r9800/package/madwifi/patches/124-linux24_compat.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/124-linux24_compat.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,233 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_athvar.h
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_athvar.h	2007-12-13 05:25:10.534225778 +0100
-+++ madwifi-dfs-r3053/ath/if_athvar.h	2007-12-13 05:25:12.842357313 +0100
-@@ -128,6 +128,11 @@
- #define	NETDEV_TX_BUSY	1
- #endif
- 
-+#ifndef NETDEV_TX_OK
-+#define NETDEV_TX_OK    0
-+#define NETDEV_TX_BUSY  1
-+#endif
-+
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
- static inline struct net_device *_alloc_netdev(int sizeof_priv, const char *mask,
- 					       void (*setup)(struct net_device *))
-Index: madwifi-dfs-r3053/ath/if_ath_radar.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath_radar.c	2007-12-13 05:25:10.538226007 +0100
-+++ madwifi-dfs-r3053/ath/if_ath_radar.c	2007-12-13 05:25:12.850357768 +0100
-@@ -92,6 +92,13 @@
- #define nofloat_pct(_value, _pct) \
- 	( (_value * (1000 + _pct)) / 1000 )
- 
-+#ifndef list_for_each_entry_reverse
-+#define list_for_each_entry_reverse(pos, head, member)			\
-+	for (pos = list_entry((head)->prev, typeof(*pos), member);	\
-+	     prefetch(pos->member.prev), &pos->member != (head); 	\
-+	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-+#endif
-+
- struct radar_pattern_specification {
- 	/* The name of the rule/specification (i.e. what did we detect) */
- 	const char *name;
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:11.582285503 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:12.854357994 +0100
-@@ -4595,6 +4595,46 @@
- #undef USE_SHPREAMBLE
- }
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
-+static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-+{
-+	int ret;
-+	unsigned long flags;
-+
-+	local_irq_save(flags);
-+	ret = v->counter;
-+	if (likely(ret == old))
-+		v->counter = new;
-+	local_irq_restore(flags);
-+
-+	return ret;
-+}
-+
-+/**
-+ * atomic_add_unless - add unless the number is a given value
-+ * @v: pointer of type atomic_t
-+ * @a: the amount to add to v...
-+ * @u: ...unless v is equal to u.
-+ *
-+ * Atomically adds @a to @v, so long as it was not @u.
-+ * Returns non-zero if @v was not @u, and zero otherwise.
-+ */
-+static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
-+{
-+	int c, old;
-+	c = atomic_read(v);
-+	for (;;) {
-+		if (unlikely(c == (u)))
-+			break;
-+		old = atomic_cmpxchg((v), c, c + (a));
-+		if (likely(old == c))
-+			break;
-+		c = old;
-+	}
-+	return c != (u);
-+}
-+#endif
-+
- /*
-  * Generate beacon frame and queue cab data for a VAP.
-  */
-Index: madwifi-dfs-r3053/net80211/ieee80211_scan_ap.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_scan_ap.c	2007-12-13 05:25:10.554226918 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_scan_ap.c	2007-12-13 05:25:12.858358223 +0100
-@@ -46,12 +46,16 @@
- #include <linux/netdevice.h>
- #include <linux/init.h>
- #include <linux/delay.h>
--#include <linux/sort.h>
--
- #include "if_media.h"
- 
- #include <net80211/ieee80211_var.h>
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
-+#include "sort.c"
-+#else
-+#include <linux/sort.h>
-+#endif
-+
- #define	AP_PURGE_SCANS	2		/* age for purging entries (scans) */
- #define RSSI_LPF_LEN	10
- #define	RSSI_EP_MULTIPLIER	(1<<7)	/* pow2 to optimize out * and / */
-Index: madwifi-dfs-r3053/net80211/sort.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ madwifi-dfs-r3053/net80211/sort.c	2007-12-13 05:25:12.862358452 +0100
-@@ -0,0 +1,120 @@
-+/*
-+ * A fast, small, non-recursive O(nlog n) sort for the Linux kernel
-+ *
-+ * Jan 23 2005  Matt Mackall <mpm@selenic.com>
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+
-+static void u32_swap(void *a, void *b, int size)
-+{
-+	u32 t = *(u32 *)a;
-+	*(u32 *)a = *(u32 *)b;
-+	*(u32 *)b = t;
-+}
-+
-+static void generic_swap(void *a, void *b, int size)
-+{
-+	char t;
-+
-+	do {
-+		t = *(char *)a;
-+		*(char *)a++ = *(char *)b;
-+		*(char *)b++ = t;
-+	} while (--size > 0);
-+}
-+
-+/**
-+ * sort - sort an array of elements
-+ * @base: pointer to data to sort
-+ * @num: number of elements
-+ * @size: size of each element
-+ * @cmp: pointer to comparison function
-+ * @swap: pointer to swap function or NULL
-+ *
-+ * This function does a heapsort on the given array. You may provide a
-+ * swap function optimized to your element type.
-+ *
-+ * Sorting time is O(n log n) both on average and worst-case. While
-+ * qsort is about 20% faster on average, it suffers from exploitable
-+ * O(n*n) worst-case behavior and extra memory requirements that make
-+ * it less suitable for kernel use.
-+ */
-+
-+static void sort(void *base, size_t num, size_t size,
-+	  int (*cmp)(const void *, const void *),
-+	  void (*swap)(void *, void *, int size))
-+{
-+	/* pre-scale counters for performance */
-+	int i = (num/2 - 1) * size, n = num * size, c, r;
-+
-+	if (!swap)
-+		swap = (size == 4 ? u32_swap : generic_swap);
-+
-+	/* heapify */
-+	for ( ; i >= 0; i -= size) {
-+		for (r = i; r * 2 + size < n; r  = c) {
-+			c = r * 2 + size;
-+			if (c < n - size && cmp(base + c, base + c + size) < 0)
-+				c += size;
-+			if (cmp(base + r, base + c) >= 0)
-+				break;
-+			swap(base + r, base + c, size);
-+		}
-+	}
-+
-+	/* sort */
-+	for (i = n - size; i >= 0; i -= size) {
-+		swap(base, base + i, size);
-+		for (r = 0; r * 2 + size < i; r = c) {
-+			c = r * 2 + size;
-+			if (c < i - size && cmp(base + c, base + c + size) < 0)
-+				c += size;
-+			if (cmp(base + r, base + c) >= 0)
-+				break;
-+			swap(base + r, base + c, size);
-+		}
-+	}
-+}
-+
-+EXPORT_SYMBOL(sort);
-+
-+#if 0
-+/* a simple boot-time regression test */
-+
-+int cmpint(const void *a, const void *b)
-+{
-+	return *(int *)a - *(int *)b;
-+}
-+
-+static int sort_test(void)
-+{
-+	int *a, i, r = 1;
-+
-+	a = kmalloc(1000 * sizeof(int), GFP_KERNEL);
-+	BUG_ON(!a);
-+
-+	printk("testing sort()\n");
-+
-+	for (i = 0; i < 1000; i++) {
-+		r = (r * 725861) % 6599;
-+		a[i] = r;
-+	}
-+
-+	sort(a, 1000, sizeof(int), cmpint, NULL);
-+
-+	for (i = 0; i < 999; i++)
-+		if (a[i] > a[i+1]) {
-+			printk("sort() failed!\n");
-+			break;
-+		}
-+
-+	kfree(a);
-+
-+	return 0;
-+}
-+
-+module_init(sort_test);
-+#endif
diff -urN openwrt-r9800/package/madwifi/patches/126-rxerr_frames.patch openwrt-np25g/package/madwifi/patches/126-rxerr_frames.patch
--- openwrt-r9800/package/madwifi/patches/126-rxerr_frames.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/126-rxerr_frames.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,15 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:12.854357994 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:13.122373270 +0100
-@@ -6410,8 +6410,9 @@
- 			/*
- 			 * Reject error frames if we have no vaps that
- 			 * are operating in monitor mode.
-+			 * Reject empty frames as well
- 			 */
--			if (sc->sc_nmonvaps == 0)
-+			if ((sc->sc_nmonvaps == 0) || (rs->rs_datalen == 0))
- 				goto rx_next;
- 		}
- rx_accept:
diff -urN openwrt-r9800/package/madwifi/patches/200-no_debug.patch openwrt-np25g/package/madwifi/patches/200-no_debug.patch
--- openwrt-r9800/package/madwifi/patches/200-no_debug.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/200-no_debug.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,178 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:13.122373270 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:13.342385808 +0100
-@@ -42,7 +42,7 @@
-  * This software is derived from work of Atsushi Onoe; his contribution
-  * is greatly appreciated.
-  */
--#define	AR_DEBUG
-+#undef	AR_DEBUG
- #include "if_ath_debug.h"
- #include "opt_ah.h"
- 
-@@ -516,9 +516,11 @@
- 	u_int8_t csz;
- 
- 	sc->devid = devid;
-+#ifdef AR_DEBUG
- 	ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
- 	sc->sc_debug 	 = (ath_debug & ~ATH_DEBUG_GLOBAL);
- 	DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
-+#endif
- 
- 	/*
- 	 * Cache line size is used to size and align various
-@@ -1280,12 +1282,14 @@
- 		/* If no default VAP debug flags are passed, allow a few to
- 		 * transfer down from the driver to new VAPs so we can have load
- 		 * time debugging for VAPs too. */
-+#ifdef AR_DEBUG
- 		vap->iv_debug = 0 |
- 			((sc->sc_debug & ATH_DEBUG_RATE) ? IEEE80211_MSG_XRATE  : 0) | 
- 			((sc->sc_debug & ATH_DEBUG_XMIT) ? IEEE80211_MSG_OUTPUT : 0) | 
- 			((sc->sc_debug & ATH_DEBUG_RECV) ? IEEE80211_MSG_INPUT  : 0) |
- 			0
- 			;
-+#endif
- 	}
- 	ic->ic_debug = (sc->sc_default_ieee80211_debug & IEEE80211_MSG_IC);
- 
-@@ -10308,9 +10312,11 @@
- 				/* XXX validate? */
- 				sc->sc_ledpin = val;
- 				break;
-+#ifdef AR_DEBUG
- 			case ATH_DEBUG:
- 				sc->sc_debug 	 = (val & ~ATH_DEBUG_GLOBAL);
- 				ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
-+#endif
- 				break;
- 			case ATH_TXANTENNA:
- 				/*
-@@ -10721,9 +10727,11 @@
- 	}
- 
- 	/* initialize values */
-+#ifdef AR_DEBUG
- 	ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
- 	sc->sc_debug 	 = (ath_debug & ~ATH_DEBUG_GLOBAL);
- 	sc->sc_default_ieee80211_debug = ieee80211_debug;
-+#endif
- 	sc->sc_txantenna = 0;		/* default to auto-selection */
- 	sc->sc_txintrperiod = ATH_TXQ_INTR_PERIOD;
- }
-Index: madwifi-dfs-r3053/ath_rate/amrr/amrr.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath_rate/amrr/amrr.c	2007-12-13 05:25:10.422219395 +0100
-+++ madwifi-dfs-r3053/ath_rate/amrr/amrr.c	2007-12-13 05:25:13.342385808 +0100
-@@ -70,7 +70,7 @@
- 
- #include "amrr.h"
- 
--#define	AMRR_DEBUG
-+#undef	AMRR_DEBUG
- #ifdef AMRR_DEBUG
- #define	DPRINTF(sc, _fmt, ...) do {					\
- 	if (sc->sc_debug & 0x10)					\
-Index: madwifi-dfs-r3053/ath_rate/minstrel/minstrel.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath_rate/minstrel/minstrel.c	2007-12-13 05:25:12.006309667 +0100
-+++ madwifi-dfs-r3053/ath_rate/minstrel/minstrel.c	2007-12-13 05:25:13.350386263 +0100
-@@ -117,7 +117,7 @@
- 
- #include "minstrel.h"
- 
--#define	MINSTREL_DEBUG
-+#undef	MINSTREL_DEBUG
- #ifdef MINSTREL_DEBUG
- enum {
- 		ATH_DEBUG_RATE		= 0x00000010	/* rate control */
-Index: madwifi-dfs-r3053/ath_rate/onoe/onoe.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath_rate/onoe/onoe.c	2007-12-13 05:25:10.438220308 +0100
-+++ madwifi-dfs-r3053/ath_rate/onoe/onoe.c	2007-12-13 05:25:13.354386489 +0100
-@@ -66,7 +66,7 @@
- 
- #include "onoe.h"
- 
--#define	ONOE_DEBUG
-+#undef	ONOE_DEBUG
- #ifdef ONOE_DEBUG
- enum {
- 	ATH_DEBUG_RATE	= 0x00000010,	/* rate control */
-Index: madwifi-dfs-r3053/ath_rate/sample/sample.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath_rate/sample/sample.c	2007-12-13 05:25:10.446220763 +0100
-+++ madwifi-dfs-r3053/ath_rate/sample/sample.c	2007-12-13 05:25:13.358386718 +0100
-@@ -68,7 +68,7 @@
- 
- #include "sample.h"
- 
--#define	SAMPLE_DEBUG
-+#undef	SAMPLE_DEBUG
- #ifdef SAMPLE_DEBUG
- enum {
- 	ATH_DEBUG_RATE		= 0x00000010,	/* rate control */
-Index: madwifi-dfs-r3053/tools/do_multi.c
-===================================================================
---- madwifi-dfs-r3053.orig/tools/do_multi.c	2007-12-13 05:25:11.242266126 +0100
-+++ madwifi-dfs-r3053/tools/do_multi.c	2007-12-13 05:25:13.362386947 +0100
-@@ -9,16 +9,20 @@
- 
-     progname = basename(argv[0]);
- 
-+#if 0
-     if(strcmp(progname, "80211debug") == 0)
- 	ret = a80211debug_init(argc, argv);
-+#endif
-     if(strcmp(progname, "80211stats") == 0)
- 	ret = a80211stats_init(argc, argv);
-     if(strcmp(progname, "athchans") == 0)
- 	ret = athchans_init(argc, argv);
-     if(strcmp(progname, "athctrl") == 0)
- 	ret =  athctrl_init(argc, argv);
-+#if 0
-     if(strcmp(progname, "athdebug") == 0)
- 	ret =  athdebug_init(argc, argv);
-+#endif
-     if(strcmp(progname, "athkey") == 0)
- 	ret =  athkey_init(argc, argv);
-     if(strcmp(progname, "athstats") == 0)
-Index: madwifi-dfs-r3053/tools/Makefile
-===================================================================
---- madwifi-dfs-r3053.orig/tools/Makefile	2007-12-13 05:25:11.246266355 +0100
-+++ madwifi-dfs-r3053/tools/Makefile	2007-12-13 05:25:13.362386947 +0100
-@@ -48,7 +48,7 @@
- 
- 
- ALLPROGS=	athstats 80211stats athkey athchans athctrl \
--	athdebug 80211debug wlanconfig ath_info
-+	wlanconfig ath_info
- 
- OBJS=	$(patsubst %,%.o,$(ALLPROGS) do_multi)
- ALL=	${OBJS} madwifi_multi
-@@ -84,7 +84,7 @@
- 	${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c
- madwifi_multi: $(OBJS)
- 	${CC} -o madwifi_multi ${LDFLAGS} ${OBJS}
--	for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \
-+	for i in athstats 80211stats athkey athchans athctrl wlanconfig; do \
- 	ln -s -f madwifi_multi $$i; \
- 	done
- 
-Index: madwifi-dfs-r3053/net80211/ieee80211_linux.h
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_linux.h	2007-12-13 05:25:10.470222132 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_linux.h	2007-12-13 05:25:13.362386947 +0100
-@@ -29,8 +29,8 @@
- #ifndef _NET80211_IEEE80211_LINUX_H_
- #define _NET80211_IEEE80211_LINUX_H_
- 
--#define	IEEE80211_DEBUG
--#define	IEEE80211_DEBUG_REFCNT			/* Node reference count debugging */
-+#undef	IEEE80211_DEBUG
-+#undef	IEEE80211_DEBUG_REFCNT			/* Node reference count debugging */
- /* #define ATH_DEBUG_SPINLOCKS */		/* announce before spinlocking */
- 
- #include <linux/wireless.h>
diff -urN openwrt-r9800/package/madwifi/patches/300-napi_polling.patch openwrt-np25g/package/madwifi/patches/300-napi_polling.patch
--- openwrt-r9800/package/madwifi/patches/300-napi_polling.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/300-napi_polling.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,353 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:13.342385808 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:13.662404044 +0100
-@@ -189,7 +189,7 @@
- 	struct sk_buff *, int, int, u_int64_t);
- static void ath_setdefantenna(struct ath_softc *, u_int);
- static struct ath_txq *ath_txq_setup(struct ath_softc *, int, int);
--static void ath_rx_tasklet(TQUEUE_ARG);
-+static int ath_rx_poll(struct net_device *dev, int *budget);
- static int ath_hardstart(struct sk_buff *, struct net_device *);
- static int ath_mgtstart(struct ieee80211com *, struct sk_buff *);
- #ifdef ATH_SUPERG_COMP
-@@ -535,7 +535,6 @@
- 	ATH_TXBUF_LOCK_INIT(sc);
- 	ATH_RXBUF_LOCK_INIT(sc);
- 
--	ATH_INIT_TQUEUE(&sc->sc_rxtq,     ath_rx_tasklet,	dev);
- 	ATH_INIT_TQUEUE(&sc->sc_txtq,     ath_tx_tasklet,	dev);
- 	ATH_INIT_TQUEUE(&sc->sc_bmisstq,  ath_bmiss_tasklet,	dev);
- 	ATH_INIT_TQUEUE(&sc->sc_bstucktq, ath_bstuck_tasklet,	dev);
-@@ -808,6 +807,8 @@
- 	dev->set_mac_address = ath_set_mac_address;
- 	dev->change_mtu = ath_change_mtu;
- 	dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
-+	dev->poll = ath_rx_poll;
-+	dev->weight = 64;
- #ifdef USE_HEADERLEN_RESV
- 	dev->hard_header_len += sizeof(struct ieee80211_qosframe) +
- 				sizeof(struct llc) +
-@@ -2150,6 +2151,7 @@
- 		(status & HAL_INT_RXPHY)   ? " HAL_INT_RXPHY"   : "",
- 		(status & HAL_INT_SWBA)    ? " HAL_INT_SWBA"    : "");
- 
-+	sc->sc_isr = status;
- 	status &= sc->sc_imask;			/* discard unasked for bits */
- 	if (status & HAL_INT_FATAL) {
- 		sc->sc_stats.ast_hardware++;
-@@ -2201,7 +2203,14 @@
- 		}
- 		if (status & (HAL_INT_RX | HAL_INT_RXPHY)) {
- 			ath_uapsd_processtriggers(sc);
--			ATH_SCHEDULE_TQUEUE(&sc->sc_rxtq, &needmark);
-+			sc->sc_isr &= ~HAL_INT_RX;
-+			if (netif_rx_schedule_prep(dev)) {
-+#ifndef ATH_PRECISE_TSF
-+				sc->sc_imask &= ~HAL_INT_RX;
-+				ath_hal_intrset(ah, sc->sc_imask);
-+#endif
-+				__netif_rx_schedule(dev);
-+			}
- 		}
- 		if (status & HAL_INT_TX) {
- #ifdef ATH_SUPERG_DYNTURBO
-@@ -2227,6 +2236,11 @@
- 				}
- 			}
- #endif
-+			/* disable transmit interrupt */
-+			sc->sc_isr &= ~HAL_INT_TX;
-+			ath_hal_intrset(ah, sc->sc_imask & ~HAL_INT_TX);
-+			sc->sc_imask &= ~HAL_INT_TX;
-+
- 			ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, &needmark);
- 		}
- 		if (status & HAL_INT_BMISS) {
-@@ -3904,10 +3918,10 @@
- 	 *
- 	 * XXX Using in_softirq is not right since we might
- 	 * be called from other soft irq contexts than
--	 * ath_rx_tasklet.
-+	 * ath_rx_poll
- 	 */
- 	if (!in_softirq())
--		tasklet_disable(&sc->sc_rxtq);
-+		netif_poll_disable(dev);
- 	netif_stop_queue(dev);
- }
- 
-@@ -3920,7 +3934,7 @@
- 	DPRINTF(sc, ATH_DEBUG_KEYCACHE, "%s:\n", __func__);
- 	netif_start_queue(dev);
- 	if (!in_softirq())		/* NB: see above */
--		tasklet_enable(&sc->sc_rxtq);
-+		netif_poll_enable(dev);
- }
- 
- /*
-@@ -6287,13 +6301,12 @@
- 	sc->sc_rxotherant = 0;
- }
- 
--static void
--ath_rx_tasklet(TQUEUE_ARG data)
-+static int
-+ath_rx_poll(struct net_device *dev, int *budget)
- {
- #define	PA2DESC(_sc, _pa) \
- 	((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
- 		((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
--	struct net_device *dev = (struct net_device *)data;
- 	struct ath_buf *bf;
- 	struct ath_softc *sc = dev->priv;
- 	struct ieee80211com *ic = &sc->sc_ic;
-@@ -6305,8 +6318,11 @@
- 	unsigned int len;
- 	int type;
- 	u_int phyerr;
-+	u_int processed = 0, early_stop = 0;
-+	u_int rx_limit = dev->quota;
- 
- 	DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s\n", __func__);
-+process_rx_again:
- 	do {
- 		bf = STAILQ_FIRST(&sc->sc_rxbuf);
- 		if (bf == NULL) {		/* XXX ??? can this happen */
-@@ -6330,6 +6346,13 @@
- 			/* NB: never process the self-linked entry at the end */
- 			break;
- 		}
-+
-+		processed++;
-+		if (rx_limit-- < 0) {
-+			early_stop = 1;
-+			break;
-+		}
-+
- 		skb = bf->bf_skb;
- 		if (skb == NULL) {
- 			printk("%s: no skbuff (%s)\n", DEV_NAME(dev), __func__);
-@@ -6374,6 +6397,7 @@
- 				sc->sc_stats.ast_rx_phyerr++;
- 				phyerr = rs->rs_phyerr & 0x1f;
- 				sc->sc_stats.ast_rx_phy[phyerr]++;
-+				goto rx_next;
- 			}
- 			if (rs->rs_status & HAL_RXERR_DECRYPT) {
- 				/*
-@@ -6571,9 +6595,33 @@
- 		STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list);
- 		ATH_RXBUF_UNLOCK_IRQ(sc);
- 	} while (ath_rxbuf_init(sc, bf) == 0);
-+	if (!early_stop) {
-+		/* Check if more data is received while we were
-+		 * processing the descriptor chain.
-+		 */
-+#ifndef ATH_PRECISE_TSF
-+		ATH_DISABLE_INTR();
-+		if (sc->sc_isr & HAL_INT_RX) {
-+			sc->sc_isr &= ~HAL_INT_RX;
-+			ATH_ENABLE_INTR();
-+			ath_uapsd_processtriggers(sc);
-+			goto process_rx_again;
-+		}
-+#endif
-+		netif_rx_complete(dev);
-+
-+#ifndef ATH_PRECISE_TSF
-+		sc->sc_imask |= HAL_INT_RX;
-+		ath_hal_intrset(ah, sc->sc_imask);
-+		ATH_ENABLE_INTR();
-+#endif
-+	}
-+
-+	*budget -= processed;
- 
- 	/* rx signal state monitoring */
- 	ath_hal_rxmonitor(ah, &sc->sc_halstats, &sc->sc_curchan);
-+	return early_stop;
- #undef PA2DESC
- }
- 
-@@ -8192,11 +8240,22 @@
- 	struct net_device *dev = (struct net_device *)data;
- 	struct ath_softc *sc = dev->priv;
- 
-+process_tx_again:
- 	if (txqactive(sc->sc_ah, 0))
- 		ath_tx_processq(sc, &sc->sc_txq[0]);
- 	if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
- 		ath_tx_processq(sc, sc->sc_cabq);
- 
-+	ATH_DISABLE_INTR();
-+	if (sc->sc_isr & HAL_INT_TX) {
-+		sc->sc_isr &= ~HAL_INT_TX;
-+		ATH_ENABLE_INTR();
-+		goto process_tx_again;
-+	}
-+	sc->sc_imask |= HAL_INT_TX;
-+	ath_hal_intrset(sc->sc_ah, sc->sc_imask);
-+	ATH_ENABLE_INTR();
-+
- 	netif_wake_queue(dev);
- 
- 	if (sc->sc_softled)
-@@ -8213,6 +8272,7 @@
- 	struct net_device *dev = (struct net_device *)data;
- 	struct ath_softc *sc = dev->priv;
- 
-+process_tx_again:
- 	/*
- 	 * Process each active queue.
- 	 */
-@@ -8233,6 +8293,16 @@
- 	if (sc->sc_uapsdq && txqactive(sc->sc_ah, sc->sc_uapsdq->axq_qnum))
- 		ath_tx_processq(sc, sc->sc_uapsdq);
- 
-+	ATH_DISABLE_INTR();
-+	if (sc->sc_isr & HAL_INT_TX) {
-+		sc->sc_isr &= ~HAL_INT_TX;
-+		ATH_ENABLE_INTR();
-+		goto process_tx_again;
-+	}
-+	sc->sc_imask |= HAL_INT_TX;
-+	ath_hal_intrset(sc->sc_ah, sc->sc_imask);
-+	ATH_ENABLE_INTR();
-+
- 	netif_wake_queue(dev);
- 
- 	if (sc->sc_softled)
-@@ -8250,6 +8320,7 @@
- 	unsigned int i;
- 
- 	/* Process each active queue. */
-+process_tx_again:
- 	for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
- 		if (ATH_TXQ_SETUP(sc, i) && txqactive(sc->sc_ah, i))
- 			ath_tx_processq(sc, &sc->sc_txq[i]);
-@@ -8258,6 +8329,16 @@
- 		ath_tx_processq(sc, sc->sc_xrtxq);
- #endif
- 
-+	ATH_DISABLE_INTR();
-+	if (sc->sc_isr & HAL_INT_TX) {
-+		sc->sc_isr &= ~HAL_INT_TX;
-+		ATH_ENABLE_INTR();
-+		goto process_tx_again;
-+	}
-+	sc->sc_imask |= HAL_INT_TX;
-+	ath_hal_intrset(sc->sc_ah, sc->sc_imask);
-+	ATH_ENABLE_INTR();
-+
- 	netif_wake_queue(dev);
- 
- 	if (sc->sc_softled)
-@@ -8332,6 +8413,7 @@
- ath_draintxq(struct ath_softc *sc)
- {
- 	struct ath_hal *ah = sc->sc_ah;
-+	int npend = 0;
- 	unsigned int i;
- 
- 	/* XXX return value */
-@@ -10095,9 +10177,9 @@
- 	dev->mtu = mtu;
- 	if ((dev->flags & IFF_RUNNING) && !sc->sc_invalid) {
- 		/* NB: the rx buffers may need to be reallocated */
--		tasklet_disable(&sc->sc_rxtq);
-+		netif_poll_disable(dev);
- 		error = ath_reset(dev);
--		tasklet_enable(&sc->sc_rxtq);
-+		netif_poll_enable(dev);
- 	}
- 	ATH_UNLOCK(sc);
- 
-Index: madwifi-dfs-r3053/ath/if_athvar.h
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_athvar.h	2007-12-13 05:25:12.842357313 +0100
-+++ madwifi-dfs-r3053/ath/if_athvar.h	2007-12-13 05:25:13.666404270 +0100
-@@ -50,6 +50,10 @@
- #include <asm/io.h>
- #include <linux/list.h>
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+#define irqs_disabled()			0
-+#endif
-+
- /*
-  * Deduce if tasklets are available.  If not then
-  * fall back to using the immediate work queue.
-@@ -728,7 +732,6 @@
- 	struct ath_buf *sc_rxbufcur;		/* current rx buffer */
- 	u_int32_t *sc_rxlink;			/* link ptr in last RX desc */
- 	spinlock_t sc_rxbuflock;
--	struct ATH_TQ_STRUCT sc_rxtq;		/* rx intr tasklet */
- 	struct ATH_TQ_STRUCT sc_rxorntq;	/* rxorn intr tasklet */
- 	u_int8_t sc_defant;			/* current default antenna */
- 	u_int8_t sc_rxotherant;			/* RXs on non-default antenna */
-@@ -741,6 +744,7 @@
- 	u_int sc_txintrperiod;			/* tx interrupt batching */
- 	struct ath_txq sc_txq[HAL_NUM_TX_QUEUES];
- 	struct ath_txq *sc_ac2q[WME_NUM_AC];	/* WME AC -> h/w qnum */
-+	HAL_INT sc_isr;				/* unmasked ISR state */
- 	struct ATH_TQ_STRUCT sc_txtq;		/* tx intr tasklet */
- 	u_int8_t sc_grppoll_str[GRPPOLL_RATE_STR_LEN];
- 	struct ath_descdma sc_bdma;		/* beacon descriptors */
-@@ -853,6 +857,8 @@
- #define	ATH_TXBUF_LOCK_CHECK(_sc)
- #endif
- 
-+#define ATH_DISABLE_INTR		local_irq_disable
-+#define ATH_ENABLE_INTR 		local_irq_enable
- 
- #define	ATH_RXBUF_LOCK_INIT(_sc)	spin_lock_init(&(_sc)->sc_rxbuflock)
- #define	ATH_RXBUF_LOCK_DESTROY(_sc)
-Index: madwifi-dfs-r3053/net80211/ieee80211_input.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_input.c	2007-12-13 05:25:10.374216660 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_input.c	2007-12-13 05:25:13.674404726 +0100
-@@ -1178,7 +1178,7 @@
- 			/* attach vlan tag */
- 			struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
- 			if (vlan_hwaccel_receive_skb(skb, vap->iv_vlgrp, ni->ni_vlan) == NET_RX_DROP) {
--				/* If netif_rx dropped the packet because 
-+				/* If netif_receive_skb dropped the packet because 
- 				 * device was too busy */
- 				if (ni_tmp != NULL) {
- 					/* node reference was leaked */
-@@ -1189,8 +1189,8 @@
- 			skb = NULL; /* SKB is no longer ours */
- 		} else {
- 			struct ieee80211_node *ni_tmp = SKB_CB(skb)->ni;
--			if (netif_rx(skb) == NET_RX_DROP) {
--				/* If netif_rx dropped the packet because 
-+			if (netif_receive_skb(skb) == NET_RX_DROP) {
-+				/* If netif_receive_skb dropped the packet because 
- 				 * device was too busy */
- 				if (ni_tmp != NULL) {
- 					/* node reference was leaked */
-@@ -2299,8 +2299,8 @@
- 		skb1->protocol = __constant_htons(0x0019);  /* ETH_P_80211_RAW */
- 
- 		ni_tmp = SKB_CB(skb1)->ni;
--		if (netif_rx(skb1) == NET_RX_DROP) {
--			/* If netif_rx dropped the packet because 
-+		if (netif_receive_skb(skb1) == NET_RX_DROP) {
-+			/* If netif_receive_skb dropped the packet because 
- 			 * device was too busy */
- 			if (ni_tmp != NULL) {
- 				/* node reference was leaked */
-Index: madwifi-dfs-r3053/net80211/ieee80211_monitor.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_monitor.c	2007-12-13 05:25:10.386217344 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_monitor.c	2007-12-13 05:25:13.678404955 +0100
-@@ -577,7 +577,7 @@
- 			skb1->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
- 
- 			ni_tmp = SKB_CB(skb1)->ni;
--			if (netif_rx(skb1) == NET_RX_DROP) {
-+			if (netif_receive_skb(skb1) == NET_RX_DROP) {
- 				/* If netif_rx dropped the packet because 
- 				 * device was too busy */
- 				if (ni_tmp != NULL) {
diff -urN openwrt-r9800/package/madwifi/patches/305-pureg_fix.patch openwrt-np25g/package/madwifi/patches/305-pureg_fix.patch
--- openwrt-r9800/package/madwifi/patches/305-pureg_fix.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/305-pureg_fix.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,167 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:13.662404044 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:13.934419543 +0100
-@@ -3973,7 +3973,9 @@
- 		rfilt |= HAL_RX_FILTER_PROM;
- 	if (ic->ic_opmode == IEEE80211_M_STA ||
- 	    sc->sc_opmode == HAL_M_IBSS ||	/* NB: AHDEMO too */
--	    (sc->sc_nostabeacons) || sc->sc_scanning)
-+	    (sc->sc_nostabeacons) || sc->sc_scanning ||
-+		((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
-+		 (ic->ic_protmode != IEEE80211_PROT_NONE)))
- 		rfilt |= HAL_RX_FILTER_BEACON;
- 	if (sc->sc_nmonvaps > 0)
- 		rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
-Index: madwifi-dfs-r3053/net80211/ieee80211_input.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_input.c	2007-12-13 05:25:13.674404726 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_input.c	2007-12-13 05:25:13.938419772 +0100
-@@ -329,11 +329,12 @@
- 				bssid = wh->i_addr3;
- 			}
- 			/*
--			 * Validate the bssid.
-+			 * Validate the bssid. Let beacons get through though for 11g protection mode.
- 			 */
- #ifdef ATH_SUPERG_XR
- 			if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
--			    !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
-+			    !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
-+				(subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
- 				/*
- 				 * allow MGT frames to vap->iv_xrvap.
- 				 * this will allow roaming between  XR and normal vaps
-@@ -352,7 +353,8 @@
- 			}
- #else
- 			if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
--			    !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
-+			    !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
-+				(subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
- 				/* not interested in */
- 				IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
- 					bssid, NULL, "%s", "not to bss");
-@@ -2971,7 +2973,7 @@
- 	u_int8_t *frm, *efrm;
- 	u_int8_t *ssid, *rates, *xrates, *suppchan, *wpa, *rsn, *wme, *ath;
- 	u_int8_t rate;
--	int reassoc, resp, allocbs = 0;
-+	int reassoc, resp, allocbs = 0, has_erp = 0;
- 	u_int8_t qosinfo;
- 
- 	if (ni_or_null == NULL)
-@@ -2996,11 +2998,15 @@
- 		 *    o station mode when associated (to collect state
- 		 *      updates such as 802.11g slot time), or
- 		 *    o adhoc mode (to discover neighbors)
-+		 *    o ap mode in protection mode (beacons only)
- 		 * Frames otherwise received are discarded.
- 		 */
- 		if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
- 		    (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
--		    vap->iv_opmode == IEEE80211_M_IBSS)) {
-+		    (vap->iv_opmode == IEEE80211_M_IBSS) ||
-+			((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
-+			 (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
-+			 (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
- 			vap->iv_stats.is_rx_mgtdiscard++;
- 			return;
- 		}
-@@ -3083,6 +3089,7 @@
- 					break;
- 				}
- 				scan.erp = frm[2];
-+				has_erp = 1;
- 				break;
- 			case IEEE80211_ELEMID_RSN:
- 				scan.rsn = frm;
-@@ -3300,6 +3307,20 @@
- 				ieee80211_bg_scan(vap);
- 			return;
- 		}
-+
-+		/* Update AP protection mode when in 11G mode */
-+		if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
-+			IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
-+
-+			/* Assume no ERP IE == 11b AP */
-+			if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
-+				!(ic->ic_flags & IEEE80211_F_USEPROT)) {
-+
-+				ic->ic_flags |= IEEE80211_F_USEPROT;
-+				ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
-+			}
-+		}
-+
- 		/*
- 		 * If scanning, just pass information to the scan module.
- 		 */
-Index: madwifi-dfs-r3053/net80211/ieee80211_node.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_node.c	2007-12-13 05:25:10.314213240 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_node.c	2007-12-13 05:25:13.938419772 +0100
-@@ -380,10 +380,16 @@
- 	/* Update country ie information */
- 	ieee80211_build_countryie(ic);
- 
--	if (IEEE80211_IS_CHAN_HALF(chan))
-+	if (IEEE80211_IS_CHAN_HALF(chan)) {
- 		ni->ni_rates = ic->ic_sup_half_rates;
--	else if (IEEE80211_IS_CHAN_QUARTER(chan))
-+	} else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
- 		ni->ni_rates = ic->ic_sup_quarter_rates;
-+	}
-+
-+	if ((vap->iv_flags & IEEE80211_F_PUREG) &&
-+		IEEE80211_IS_CHAN_ANYG(chan)) {
-+		ieee80211_setpuregbasicrates(&ni->ni_rates);
-+	}
- 
- 	(void) ieee80211_sta_join1(PASS_NODE(ni));
- }
-Index: madwifi-dfs-r3053/net80211/ieee80211_proto.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_proto.c	2007-12-13 05:25:10.322213696 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_proto.c	2007-12-13 05:25:13.942420001 +0100
-@@ -584,6 +584,28 @@
- 	{ 4, { 2, 4, 11, 22 } },	/* IEEE80211_MODE_TURBO_G (mixed b/g) */
- };
- 
-+static const struct ieee80211_rateset basicpureg[] = {
-+    { 7, {2, 4, 11, 22, 12, 24, 48 } },
-+};
-+
-+/*
-+ * Mark basic rates for the 11g rate table based on the pureg setting
-+ */
-+void
-+ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
-+{
-+	int i, j;
-+
-+	for (i = 0; i < rs->rs_nrates; i++) {
-+		rs->rs_rates[i] &= IEEE80211_RATE_VAL;
-+		for (j = 0; j < basicpureg[0].rs_nrates; j++)
-+			if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
-+				rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
-+				break;
-+			}
-+	}
-+}
-+
- /*
-  * Mark the basic rates for the 11g rate table based on the
-  * specified mode.  For 11b compatibility we mark only 11b
-Index: madwifi-dfs-r3053/net80211/ieee80211_var.h
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_var.h	2007-12-13 05:25:10.330214154 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_var.h	2007-12-13 05:25:13.942420001 +0100
-@@ -668,6 +668,7 @@
- void ieee80211_build_sc_ie(struct ieee80211com *);
- void ieee80211_dfs_action(struct ieee80211com *);
- void ieee80211_expire_channel_non_occupancy_restrictions(struct ieee80211com *);
-+void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
- 
- /*
-  * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
diff -urN openwrt-r9800/package/madwifi/patches/309-micfail_detect.patch openwrt-np25g/package/madwifi/patches/309-micfail_detect.patch
--- openwrt-r9800/package/madwifi/patches/309-micfail_detect.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/309-micfail_detect.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,343 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:13.934419543 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:14.210435274 +0100
-@@ -6322,6 +6322,7 @@
- 	u_int phyerr;
- 	u_int processed = 0, early_stop = 0;
- 	u_int rx_limit = dev->quota;
-+	u_int mic_fail = 0;
- 
- 	DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s\n", __func__);
- process_rx_again:
-@@ -6418,24 +6419,8 @@
- 			}
- 			if (rs->rs_status & HAL_RXERR_MIC) {
- 				sc->sc_stats.ast_rx_badmic++;
--				/*
--				 * Do minimal work required to hand off
--				 * the 802.11 header for notification.
--				 */
--				/* XXX frag's and QoS frames */
--				if (len >= sizeof (struct ieee80211_frame)) {
--					bus_dma_sync_single(sc->sc_bdev,
--					    bf->bf_skbaddr, len,
--					    BUS_DMA_FROMDEVICE);
--#if 0
--/* XXX revalidate MIC, lookup ni to find VAP */
--					ieee80211_notify_michael_failure(ic,
--					    (struct ieee80211_frame *) skb->data,
--					    sc->sc_splitmic ?
--					        rs->rs_keyix - 32 : rs->rs_keyix
--					);
--#endif
--				}
-+				mic_fail = 1;
-+				goto rx_accept;
- 			}
- 			/*
- 			 * Reject error frames if we have no vaps that
-@@ -6494,8 +6479,9 @@
- 		/*
- 		 * Finished monitor mode handling, now reject
- 		 * error frames before passing to other vaps
-+		 * Ignore MIC failures here, as we need to recheck them
- 		 */
--		if (rs->rs_status != 0) {
-+		if (rs->rs_status & ~(HAL_RXERR_MIC | HAL_RXERR_DECRYPT)) {
- 			ieee80211_dev_kfree_skb(&skb);
- 			goto rx_next;
- 		}
-@@ -6503,6 +6489,26 @@
- 		/* remove the CRC */
- 		skb_trim(skb, skb->len - IEEE80211_CRC_LEN);
- 
-+		if (mic_fail) {
-+			/* Ignore control frames which are reported with mic error */
-+		    if ((((struct ieee80211_frame *)skb->data)->i_fc[0] &
-+					IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL)
-+				goto drop_micfail;
-+
-+			ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
-+
-+			if (ni && ni->ni_table) {
-+				ieee80211_check_mic(ni, skb);
-+				ieee80211_unref_node(&ni);
-+			}
-+
-+drop_micfail:
-+			dev_kfree_skb_any(skb);
-+			skb = NULL;
-+			mic_fail = 0;
-+			goto rx_next;
-+		}
-+
- 		/*
- 		 * From this point on we assume the frame is at least
- 		 * as large as ieee80211_frame_min; verify that.
-@@ -6524,6 +6530,7 @@
- 				   sc->sc_hwmap[rs->rs_rate].ieeerate,
- 				   rs->rs_rssi);
- 
-+		/* MIC failure. Drop the packet in any case */
- 		/*
- 		 * Locate the node for sender, track state, and then
- 		 * pass the (referenced) node up to the 802.11 layer
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto_ccmp.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto_ccmp.c	2007-12-13 05:25:12.634345457 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto_ccmp.c	2007-12-13 05:25:14.210435274 +0100
-@@ -73,7 +73,7 @@
- static int ccmp_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
- static int ccmp_decap(struct ieee80211_key *, struct sk_buff *, int);
- static int ccmp_enmic(struct ieee80211_key *, struct sk_buff *, int);
--static int ccmp_demic(struct ieee80211_key *, struct sk_buff *, int);
-+static int ccmp_demic(struct ieee80211_key *, struct sk_buff *, int, int);
- 
- static const struct ieee80211_cipher ccmp = {
- 	.ic_name	= "AES-CCM",
-@@ -308,7 +308,7 @@
-  * Verify and strip MIC from the frame.
-  */
- static int
--ccmp_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
-+ccmp_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
- {
- 	return 1;
- }
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto.h
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto.h	2007-12-13 05:25:10.214207541 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto.h	2007-12-13 05:25:14.210435274 +0100
-@@ -145,7 +145,7 @@
- 	int (*ic_encap)(struct ieee80211_key *, struct sk_buff *, u_int8_t);
- 	int (*ic_decap)(struct ieee80211_key *, struct sk_buff *, int);
- 	int (*ic_enmic)(struct ieee80211_key *, struct sk_buff *, int);
--	int (*ic_demic)(struct ieee80211_key *, struct sk_buff *, int);
-+	int (*ic_demic)(struct ieee80211_key *, struct sk_buff *, int, int);
- };
- extern const struct ieee80211_cipher ieee80211_cipher_none;
- 
-@@ -163,10 +163,10 @@
-  */
- static __inline int
- ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,
--	struct sk_buff *skb, int hdrlen)
-+	struct sk_buff *skb, int hdrlen, int force)
- {
- 	const struct ieee80211_cipher *cip = k->wk_cipher;
--	return (cip->ic_miclen > 0 ? cip->ic_demic(k, skb, hdrlen) : 1);
-+	return (cip->ic_miclen > 0 ? cip->ic_demic(k, skb, hdrlen, force) : 1);
- }
- 
- /*
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto_none.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto_none.c	2007-12-13 05:25:10.218207770 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto_none.c	2007-12-13 05:25:14.214435503 +0100
-@@ -52,7 +52,7 @@
- static int none_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
- static int none_decap(struct ieee80211_key *, struct sk_buff *, int);
- static int none_enmic(struct ieee80211_key *, struct sk_buff *, int);
--static int none_demic(struct ieee80211_key *, struct sk_buff *, int);
-+static int none_demic(struct ieee80211_key *, struct sk_buff *, int, int);
- 
- const struct ieee80211_cipher ieee80211_cipher_none = {
- 	.ic_name	= "NONE",
-@@ -137,7 +137,7 @@
- }
- 
- static int
--none_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
-+none_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
- {
- 	struct ieee80211vap *vap = k->wk_private;
- 
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto_tkip.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto_tkip.c	2007-12-13 05:25:10.226208226 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto_tkip.c	2007-12-13 05:25:14.214435503 +0100
-@@ -57,7 +57,7 @@
- static int tkip_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
- static int tkip_enmic(struct ieee80211_key *, struct sk_buff *, int);
- static int tkip_decap(struct ieee80211_key *, struct sk_buff *, int);
--static int tkip_demic(struct ieee80211_key *, struct sk_buff *, int);
-+static int tkip_demic(struct ieee80211_key *, struct sk_buff *, int, int);
- 
- static const struct ieee80211_cipher tkip  = {
- 	.ic_name	= "TKIP",
-@@ -339,7 +339,7 @@
-  * Verify and strip MIC from the frame.
-  */
- static int
--tkip_demic(struct ieee80211_key *k, struct sk_buff *skb0, int hdrlen)
-+tkip_demic(struct ieee80211_key *k, struct sk_buff *skb0, int hdrlen, int force)
- {
- 	struct tkip_ctx *ctx = k->wk_private;
- 	struct sk_buff *skb;
-@@ -355,7 +355,7 @@
- 	}
- 	wh = (struct ieee80211_frame *) skb0->data;
- 	/* NB: skb left pointing at last in chain */
--	if (k->wk_flags & IEEE80211_KEY_SWMIC) {
-+	if ((k->wk_flags & IEEE80211_KEY_SWMIC) || force) {
- 		struct ieee80211vap *vap = ctx->tc_vap;
- 		u8 mic[IEEE80211_WEP_MICLEN];
- 		u8 mic0[IEEE80211_WEP_MICLEN];
-Index: madwifi-dfs-r3053/net80211/ieee80211_crypto_wep.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_crypto_wep.c	2007-12-13 05:25:10.234208681 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_crypto_wep.c	2007-12-13 05:25:14.214435503 +0100
-@@ -54,7 +54,7 @@
- static int wep_encap(struct ieee80211_key *, struct sk_buff *, u_int8_t);
- static int wep_decap(struct ieee80211_key *, struct sk_buff *, int);
- static int wep_enmic(struct ieee80211_key *, struct sk_buff *, int);
--static int wep_demic(struct ieee80211_key *, struct sk_buff *, int);
-+static int wep_demic(struct ieee80211_key *, struct sk_buff *, int, int);
- 
- static const struct ieee80211_cipher wep = {
- 	.ic_name	= "WEP",
-@@ -244,7 +244,7 @@
-  * Verify and strip MIC from the frame.
-  */
- static int
--wep_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen)
-+wep_demic(struct ieee80211_key *k, struct sk_buff *skb, int hdrlen, int force)
- {
- 	return 1;
- }
-Index: madwifi-dfs-r3053/net80211/ieee80211_input.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_input.c	2007-12-13 05:25:13.938419772 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_input.c	2007-12-13 05:25:14.218435729 +0100
-@@ -646,7 +646,7 @@
- 		 * Next strip any MSDU crypto bits.
- 		 */
- 		if (key != NULL &&
--		    !ieee80211_crypto_demic(vap, key, skb, hdrspace)) {
-+		    !ieee80211_crypto_demic(vap, key, skb, hdrspace, 0)) {
- 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
- 				ni->ni_macaddr, "data", "%s", "demic error");
- 			IEEE80211_NODE_STAT(ni, rx_demicfail);
-@@ -4168,6 +4168,47 @@
- }
- #endif
- 
-+/*
-+ * Process a frame w/ hw detected MIC failure.
-+ * The frame will be dropped in any case.
-+ */
-+void
-+ieee80211_check_mic(struct ieee80211_node *ni, struct sk_buff *skb)
-+{
-+	struct ieee80211vap *vap = ni->ni_vap;
-+
-+	struct ieee80211_frame *wh;
-+	struct ieee80211_key *key;
-+	int hdrspace;
-+	struct ieee80211com *ic = vap->iv_ic;
-+
-+	if (skb->len < sizeof(struct ieee80211_frame_min)) {
-+		IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
-+		    ni->ni_macaddr, NULL,
-+		    "too short (1): len %u", skb->len);
-+		vap->iv_stats.is_rx_tooshort++;
-+		return;
-+	}
-+
-+	wh = (struct ieee80211_frame *)skb->data;
-+
-+	hdrspace = ieee80211_hdrspace(ic, wh);
-+	key = ieee80211_crypto_decap(ni, skb, hdrspace);
-+	if (key == NULL) {
-+		/* NB: stats+msgs handled in crypto_decap */
-+		IEEE80211_NODE_STAT(ni, rx_wepfail);
-+		return;
-+	}
-+
-+	if (!ieee80211_crypto_demic(vap, key, skb, hdrspace, 1)) {
-+		IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
-+			ni->ni_macaddr, "data", "%s", "demic error");
-+			IEEE80211_NODE_STAT(ni, rx_demicfail);
-+	}
-+	return;
-+}
-+EXPORT_SYMBOL(ieee80211_check_mic);
-+
- #ifdef IEEE80211_DEBUG
- /*
-  * Debugging support.
-Index: madwifi-dfs-r3053/net80211/ieee80211_proto.h
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_proto.h	2007-12-13 05:25:10.246209365 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_proto.h	2007-12-13 05:25:14.218435729 +0100
-@@ -91,6 +91,7 @@
- void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode);
- enum ieee80211_phymode ieee80211_get11gbasicrates(struct ieee80211_rateset *);
- void ieee80211_send_pspoll(struct ieee80211_node *);
-+void ieee80211_check_mic(struct ieee80211_node *, struct sk_buff *);
- 
- /*
-  * Return the size of the 802.11 header for a management or data frame.
-Index: madwifi-dfs-r3053/net80211/ieee80211_linux.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_linux.c	2007-12-13 05:25:12.422333377 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_linux.c	2007-12-13 05:25:14.218435729 +0100
-@@ -337,8 +337,8 @@
- 	/* TODO: needed parameters: count, keyid, key type, src address, TSC */
- 	snprintf(buf, sizeof(buf), "%s(keyid=%d %scast addr=%s)", tag,
- 		k->wk_keyix,
--		IEEE80211_IS_MULTICAST(wh->i_addr1) ?  "broad" : "uni",
--		ether_sprintf(wh->i_addr1));
-+		IEEE80211_IS_MULTICAST(wh->i_addr2) ?  "broad" : "uni",
-+		ether_sprintf(wh->i_addr2));
- 	memset(&wrqu, 0, sizeof(wrqu));
- 	wrqu.data.length = strlen(buf);
- 	wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
-Index: madwifi-dfs-r3053/net80211/ieee80211_output.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_output.c	2007-12-13 05:25:10.262210276 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_output.c	2007-12-13 05:25:14.222435959 +0100
-@@ -1092,13 +1092,16 @@
- 			cip = (struct ieee80211_cipher *) key->wk_cipher;
- 			ciphdrsize = cip->ic_header;
- 			tailsize += (cip->ic_trailer + cip->ic_miclen);
-+
-+			/* add the 8 bytes MIC length */
-+			if (cip->ic_cipher == IEEE80211_CIPHER_TKIP)
-+				pktlen += IEEE80211_WEP_MICLEN;
- 		}
- 
- 		pdusize = vap->iv_fragthreshold - (hdrsize_nopad + ciphdrsize);
- 		fragcnt = *framecnt =
--			((pktlen - (hdrsize_nopad + ciphdrsize)) / pdusize) +
--			(((pktlen - (hdrsize_nopad + ciphdrsize)) %
--				pdusize == 0) ? 0 : 1);
-+			((pktlen - hdrsize_nopad) / pdusize) +
-+			(((pktlen - hdrsize_nopad) % pdusize == 0) ? 0 : 1);
- 
- 		/*
- 		 * Allocate sk_buff for each subsequent fragment; First fragment
-Index: madwifi-dfs-r3053/net80211/ieee80211_node.c
-===================================================================
---- madwifi-dfs-r3053.orig/net80211/ieee80211_node.c	2007-12-13 05:25:13.938419772 +0100
-+++ madwifi-dfs-r3053/net80211/ieee80211_node.c	2007-12-13 05:25:14.222435959 +0100
-@@ -2236,11 +2236,13 @@
- 	/* From this point onwards we can no longer find the node,
- 	 * so no more references are generated
- 	 */
--	ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
--	ieee80211_del_wds_node(nt, ni);
--	IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
--	node_table_leave_locked(nt, ni);
--	IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
-+	if (nt) {
-+		ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
-+		ieee80211_del_wds_node(nt, ni);
-+		IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
-+		node_table_leave_locked(nt, ni);
-+		IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
-+	}
- 
- 	/*
- 	 * If node wasn't previously associated all
diff -urN openwrt-r9800/package/madwifi/patches/310-noise_get.patch openwrt-np25g/package/madwifi/patches/310-noise_get.patch
--- openwrt-r9800/package/madwifi/patches/310-noise_get.patch	2007-12-12 23:26:55.000000000 -0500
+++ openwrt-np25g/package/madwifi/patches/310-noise_get.patch	1969-12-31 19:00:00.000000000 -0500
@@ -1,36 +0,0 @@
-Index: madwifi-dfs-r3053/ath/if_ath.c
-===================================================================
---- madwifi-dfs-r3053.orig/ath/if_ath.c	2007-12-13 05:25:14.210435274 +0100
-+++ madwifi-dfs-r3053/ath/if_ath.c	2007-12-13 05:25:14.558455106 +0100
-@@ -1648,7 +1648,6 @@
- 	/* XXXAPSD: build in check against max triggers we could see
- 	 *          based on ic->ic_uapsdmaxtriggers. */
- 	hw_tsf = ath_hal_gettsf64(ah);
--	ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
- 
- 	ATH_RXBUF_LOCK_IRQ(sc);
- 	if (sc->sc_rxbufcur == NULL)
-@@ -8815,6 +8814,7 @@
- 		if (ath_calinterval == ATH_LONG_CALINTERVAL)
- 			ath_calinterval = ATH_SHORT_CALINTERVAL;
- 	}
-+	ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
- 
- 	DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: channel %u/%x -- IQ %s.\n",
- 		__func__, sc->sc_curchan.channel, sc->sc_curchan.channelFlags,
-@@ -8869,6 +8869,7 @@
- 	struct ath_softc *sc = dev->priv;
- 
- 	(void) ath_chan_set(sc, ic->ic_curchan);
-+	ic->ic_channoise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
- 	/*
- 	 * If we are returning to our bss channel then mark state
- 	 * so the next recv'd beacon's TSF will be used to sync the
-@@ -9095,6 +9096,7 @@
- 		}
- 
- 		ath_hal_process_noisefloor(ah);
-+		ic->ic_channoise = ath_hal_get_channel_noise(ah, &(sc->sc_curchan));
- 		/*
- 		 * Reset rssi stats; maybe not the best place...
- 		 */
diff -urN openwrt-r9800/package/strace/Makefile openwrt-np25g/package/strace/Makefile
--- openwrt-r9800/package/strace/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/strace/Makefile	2007-12-19 22:38:44.000000000 -0500
@@ -0,0 +1,36 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 6582 2007-03-16 20:21:39Z nbd $
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=strace
+PKG_VERSION:=4.5.15
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/strace
+PKG_MD5SUM:=ef40944118841803391d212cb64d3c5b
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=trace system calls and signals
+endef
+
+MAKE_FLAGS += CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)"
+
+define Package/$(PKG_NAME)/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff -urN openwrt-r9800/package/strace/patches/01-linux_sigcontext.patch openwrt-np25g/package/strace/patches/01-linux_sigcontext.patch
--- openwrt-r9800/package/strace/patches/01-linux_sigcontext.patch	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/strace/patches/01-linux_sigcontext.patch	2007-12-19 22:38:44.000000000 -0500
@@ -0,0 +1,14 @@
+--- strace-4.5.11/signal.c	2005-02-02 05:16:54.000000000 +0100
++++ strace-4.5.11.new/signal.c	2006-11-14 15:33:54.000000000 +0100
+@@ -1422,7 +1422,11 @@
+ 		if (umove(tcp, sp, &sc) < 0)
+ 		  	return 0;
+ 		tcp->u_arg[0] = 1;
++#ifdef LINUX_2_4
+ 		tcp->u_arg[1] = sc.sc_sigset;
++#else
++		tcp->u_arg[1] = sc.sc_hi2;
++#endif
+ 	} else {
+ 	  	tcp->u_rval = tcp->u_error = 0;
+ 		if(tcp->u_arg[0] == 0)
diff -urN openwrt-r9800/package/strace/patches/02-strace-mips-sprintsigmask-fix-buildroot-r17804 openwrt-np25g/package/strace/patches/02-strace-mips-sprintsigmask-fix-buildroot-r17804
--- openwrt-r9800/package/strace/patches/02-strace-mips-sprintsigmask-fix-buildroot-r17804	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/package/strace/patches/02-strace-mips-sprintsigmask-fix-buildroot-r17804	2007-12-19 22:38:44.000000000 -0500
@@ -0,0 +1,12 @@
+diff -ur strace-4.5.15/signal.c strace-4.5.15-patched/signal.c
+--- strace-4.5.15/signal.c	2007-01-11 16:08:38.000000000 -0600
++++ strace-4.5.15-patched/signal.c	2007-02-06 20:49:34.714320249 -0600
+@@ -1440,7 +1440,7 @@
+ 	  	tcp->u_rval = tcp->u_error = 0;
+ 		if(tcp->u_arg[0] == 0)
+ 		  	return 0;
+-		tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1]);
++		tcp->auxstr = sprintsigmask("mask now ", tcp->u_arg[1], 0);
+ 		return RVAL_NONE | RVAL_STR;
+ 	}
+ 	return 0;
diff -urN openwrt-r9800/target/linux/atheros/config-2.6.23 openwrt-np25g/target/linux/atheros/config-2.6.23
--- openwrt-r9800/target/linux/atheros/config-2.6.23	2007-10-21 04:56:10.000000000 -0400
+++ openwrt-np25g/target/linux/atheros/config-2.6.23	2008-09-12 09:53:09.000000000 -0400
@@ -1,18 +1,24 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
 CONFIG_AR2313=y
+CONFIG_AR2313_ADM6996F_MGMT_IFACE_ON_MDIO=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_ARPD is not set
 CONFIG_ATHEROS=y
 CONFIG_ATHEROS_AR5312=y
 CONFIG_ATHEROS_AR5315=y
 # CONFIG_ATM is not set
 CONFIG_BASE_SMALL=0
-CONFIG_BITREVERSE=y
-# CONFIG_BROADCOM_PHY is not set
+# CONFIG_BLOCK is not set
+# CONFIG_BONDING is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_BT is not set
-CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2 init=/etc/preinit"
+# CONFIG_CIFS is not set
+CONFIG_CMDLINE="console=ttyS0,115200"
+# CONFIG_CONFIGFS_FS is not set
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_CPU_HAS_LLSC=y
 CONFIG_CPU_HAS_PREFETCH=y
@@ -42,30 +48,100 @@
 # CONFIG_CPU_TX39XX is not set
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_VR41XX is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC32 is not set
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC_ITU_T is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_HMAC is not set
 # CONFIG_CRYPTO_HW is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TEST is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+# CONFIG_CRYPTO_WP512 is not set
+CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_DM9000 is not set
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
 CONFIG_DMA_NONCOHERENT=y
-# CONFIG_FIXED_PHY is not set
-CONFIG_FS_POSIX_ACL=y
+CONFIG_ELF_CORE=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 # CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
+# CONFIG_HAMRADIO is not set
 CONFIG_HAS_DMA=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
-# CONFIG_HOSTAP is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_I2C is not set
-CONFIG_ICPLUS_PHY=y
-# CONFIG_IDE is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_IKCONFIG is not set
+# CONFIG_IMQ is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
 CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_IPSEC_NAT_TRAVERSAL is not set
+# CONFIG_IPV6 is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_NF_FILTER is not set
+# CONFIG_IP_NF_MANGLE is not set
+# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
+# CONFIG_IP_NF_MATCH_AH is not set
+# CONFIG_IP_NF_MATCH_ECN is not set
+# CONFIG_IP_NF_MATCH_IPP2P is not set
+CONFIG_IP_NF_MATCH_IPRANGE=y
+# CONFIG_IP_NF_MATCH_OWNER is not set
+# CONFIG_IP_NF_MATCH_RECENT is not set
+# CONFIG_IP_NF_MATCH_TIME is not set
+# CONFIG_IP_NF_MATCH_TOS is not set
+# CONFIG_IP_NF_MATCH_TTL is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_RAW is not set
+# CONFIG_IP_NF_SET is not set
+# CONFIG_IP_NF_TARGET_LOG is not set
+# CONFIG_IP_NF_TARGET_NETMAP is not set
+# CONFIG_IP_NF_TARGET_REDIRECT is not set
+# CONFIG_IP_NF_TARGET_SAME is not set
+# CONFIG_IP_NF_TARGET_ULOG is not set
 CONFIG_IRQ_CPU=y
+# CONFIG_ISDN is not set
+# CONFIG_JFFS2_FS is not set
 # CONFIG_LEMOTE_FULONG is not set
+# CONFIG_LIBCRC32C is not set
+# CONFIG_LLC2 is not set
 # CONFIG_MACH_ALCHEMY is not set
 # CONFIG_MACH_DECSTATION is not set
 # CONFIG_MACH_JAZZ is not set
 # CONFIG_MACH_VR41XX is not set
+CONFIG_MAGIC_SYSRQ=y
 CONFIG_MIPS=y
 # CONFIG_MIPS_ATLAS is not set
 # CONFIG_MIPS_COBALT is not set
@@ -76,34 +152,23 @@
 # CONFIG_MIPS_MT_SMTC is not set
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_MIPS_SIM is not set
+# CONFIG_MISC_DEVICES is not set
+# CONFIG_MODULE_UNLOAD is not set
 CONFIG_MTD=y
 # CONFIG_MTD_ABSENT is not set
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_MTD_BLOCK2MTD is not set
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-CONFIG_MTD_CFI_AMDSTD=y
-# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
-# CONFIG_MTD_CFI_GEOMETRY is not set
+# CONFIG_MTD_CFI is not set
 CONFIG_MTD_CFI_I1=y
 CONFIG_MTD_CFI_I2=y
 # CONFIG_MTD_CFI_I4 is not set
 # CONFIG_MTD_CFI_I8 is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
-CONFIG_MTD_CFI_NOSWAP=y
-# CONFIG_MTD_CFI_STAA is not set
-CONFIG_MTD_CFI_UTIL=y
 CONFIG_MTD_CHAR=y
 # CONFIG_MTD_CMDLINE_PARTS is not set
-CONFIG_MTD_COMPLEX_MAPPINGS=y
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
 # CONFIG_MTD_CONCAT is not set
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
 # CONFIG_MTD_DOC2001PLUS is not set
-CONFIG_MTD_GEN_PROBE=y
 # CONFIG_MTD_JEDECPROBE is not set
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
@@ -112,38 +177,93 @@
 CONFIG_MTD_MAP_BANK_WIDTH_4=y
 # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
 # CONFIG_MTD_MTDRAM is not set
+CONFIG_MTD_MYLOADER_PARTS=y
 # CONFIG_MTD_ONENAND is not set
-# CONFIG_MTD_OTP is not set
 CONFIG_MTD_PARTITIONS=y
 # CONFIG_MTD_PHRAM is not set
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_BANKWIDTH=0
-CONFIG_MTD_PHYSMAP_LEN=0x0
-CONFIG_MTD_PHYSMAP_START=0x0
 # CONFIG_MTD_PLATRAM is not set
 # CONFIG_MTD_RAM is not set
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
-CONFIG_MTD_REDBOOT_PARTS=y
-CONFIG_MTD_REDBOOT_PARTS_READONLY=y
-# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ROOTFS_ROOT_DEV is not set
+# CONFIG_MTD_ROOTFS_SPLIT is not set
 # CONFIG_MTD_SLRAM is not set
 CONFIG_MTD_SPIFLASH=y
+# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
+# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
+# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
+# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set
+# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+# CONFIG_NETFILTER_XT_MATCH_ESP is not set
+# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
+# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
+# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
+# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
+# CONFIG_NETFILTER_XT_MATCH_MAC is not set
+# CONFIG_NETFILTER_XT_MATCH_MARK is not set
+# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
+# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_PORTSCAN is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
+# CONFIG_NETFILTER_XT_MATCH_STATE is not set
+# CONFIG_NETFILTER_XT_MATCH_STRING is not set
+# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
+# CONFIG_NETFILTER_XT_MATCH_U32 is not set
+# CONFIG_NETFILTER_XT_TARGET_CHAOS is not set
+# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
+# CONFIG_NETFILTER_XT_TARGET_DELUDE is not set
+# CONFIG_NETFILTER_XT_TARGET_MARK is not set
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
+# CONFIG_NETFILTER_XT_TARGET_TARPIT is not set
+# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_KEY is not set
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_NFSD is not set
+# CONFIG_NFS_FS is not set
+# CONFIG_NF_CONNTRACK_AMANDA is not set
+CONFIG_NF_CONNTRACK_FTP=y
+# CONFIG_NF_CONNTRACK_H323 is not set
+# CONFIG_NF_CONNTRACK_IRC is not set
+# CONFIG_NF_CONNTRACK_MARK is not set
+# CONFIG_NF_CONNTRACK_PPTP is not set
+# CONFIG_NF_CONNTRACK_RTSP is not set
+# CONFIG_NF_CONNTRACK_SIP is not set
+# CONFIG_NF_CONNTRACK_TFTP is not set
+# CONFIG_NF_CT_ACCT is not set
+# CONFIG_NF_NAT_AMANDA is not set
+CONFIG_NF_NAT_FTP=y
+# CONFIG_NF_NAT_H323 is not set
+# CONFIG_NF_NAT_IRC is not set
+# CONFIG_NF_NAT_PPTP is not set
+# CONFIG_NF_NAT_RTSP is not set
+# CONFIG_NF_NAT_SIP is not set
+# CONFIG_NF_NAT_SNMP_BASIC is not set
+# CONFIG_NF_NAT_TFTP is not set
+# CONFIG_NLS is not set
 # CONFIG_NO_IOPORT is not set
+# CONFIG_PACKET_MMAP is not set
 # CONFIG_PAGE_SIZE_16KB is not set
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_64KB is not set
 # CONFIG_PAGE_SIZE_8KB is not set
-CONFIG_PHYLIB=y
 # CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_QSEMI_PHY is not set
+# CONFIG_PPP is not set
+CONFIG_PRINTK_TIME=y
 # CONFIG_RTC is not set
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-CONFIG_SCSI_WAIT_SCAN=m
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250_EXTENDED is not set
 CONFIG_SERIAL_8250_NR_UARTS=1
 CONFIG_SERIAL_8250_RUNTIME_UARTS=1
@@ -159,21 +279,27 @@
 # CONFIG_SIBYTE_RHONE is not set
 # CONFIG_SIBYTE_SENTOSA is not set
 # CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SMSC_PHY is not set
-# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_SOFT_WATCHDOG=y
+# CONFIG_SOUND is not set
 # CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_SQUASHFS is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_SYSVIPC is not set
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
 CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_TOSHIBA_RBTX4927 is not set
 # CONFIG_TOSHIBA_RBTX4938 is not set
 CONFIG_TRAD_SIGNALS=y
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-# CONFIG_USB_ARCH_HAS_HCD is not set
-# CONFIG_USB_ARCH_HAS_OHCI is not set
+# CONFIG_TUN is not set
+# CONFIG_USB_SUPPORT is not set
 # CONFIG_USER_NS is not set
 # CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_WLAN_80211 is not set
 CONFIG_ZONE_DMA_FLAG=0
diff -urN openwrt-r9800/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c openwrt-np25g/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c
--- openwrt-r9800/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c	2007-07-03 23:55:23.000000000 -0400
+++ openwrt-np25g/target/linux/atheros/files/arch/mips/atheros/ar5315/board.c	2007-12-18 19:44:39.000000000 -0500
@@ -192,10 +192,9 @@
 	ar531x_find_config(ar5315_flash_limit());
 	bcfg = (struct ar531x_boarddata *) board_config;
 
-#if 0
 	{
 	/* Detect the hardware based on the device ID */
-	u32 devid = sysRegRead(AR5315_SREV) & AR5315_REV_MAJ >> AR5315_REV_MAJ_S;
+	u32 devid = (sysRegRead(AR5315_SREV) & AR5315_REV_MAJ) >> AR5315_REV_MAJ_S;
 		switch(devid) {
 		case 0x9:
 			mips_machtype = MACH_ATHEROS_AR2317;
@@ -207,7 +206,6 @@
 			break;
 		}
 	}
-#endif
 
 	config = (struct ar531x_config *) kzalloc(sizeof(struct ar531x_config), GFP_KERNEL);
 	config->board = board_config;
diff -urN openwrt-r9800/target/linux/atheros/files/drivers/mtd/devices/spiflash.c openwrt-np25g/target/linux/atheros/files/drivers/mtd/devices/spiflash.c
--- openwrt-r9800/target/linux/atheros/files/drivers/mtd/devices/spiflash.c	2007-05-23 19:10:09.000000000 -0400
+++ openwrt-np25g/target/linux/atheros/files/drivers/mtd/devices/spiflash.c	2007-12-18 23:27:17.000000000 -0500
@@ -425,7 +425,7 @@
 
 
 #ifdef CONFIG_MTD_PARTITIONS
-static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "MyLoader", NULL };
 #endif
 
 
diff -urN openwrt-r9800/target/linux/atheros/files/drivers/mtd/myloader.c openwrt-np25g/target/linux/atheros/files/drivers/mtd/myloader.c
--- openwrt-r9800/target/linux/atheros/files/drivers/mtd/myloader.c	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/files/drivers/mtd/myloader.c	2008-01-08 00:01:20.000000000 -0500
@@ -0,0 +1,180 @@
+/*
+ *  $Id: myloader.c 9263 2007-10-11 15:09:50Z juhosg $
+ *
+ *  Parse MyLoader-style flash partition tables and produce a Linux partition
+ *  array to match.
+ *
+ *  Copyright (C) 2007 OpenWrt.org
+ *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
+ *
+ *  This file was based on drivers/mtd/redboot.c
+ *  Author: Red Hat, Inc. - David Woodhouse <dwmw2@cambridge.redhat.com>
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version 2
+ *  of the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the
+ *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA  02110-1301, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/vmalloc.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include <linux/byteorder/generic.h>
+
+#include <prom/myloader.h>
+
+#define NAME_LEN_MAX		20
+#define NAME_MYLOADER		"MyLoader"
+#define NAME_PARTITION_TABLE	"Partition Table"
+#define BLOCK_LEN_MIN		0x10000
+
+int parse_myloader_partitions(struct mtd_info *master,
+			struct mtd_partition **pparts,
+			unsigned long origin)
+{
+	struct mylo_partition_table *tab;
+	struct mylo_partition *part;
+	struct mtd_partition *mtd_parts;
+	struct mtd_partition *mtd_part;
+	int num_parts;
+	int ret, i, linux_assigned;
+	size_t retlen;
+	char *names;
+	unsigned long offset;
+	unsigned long blocklen;
+
+	tab = kmalloc(sizeof(*tab), GFP_KERNEL);
+	if (!tab) {
+		return -ENOMEM;
+	}
+
+	blocklen = master->erasesize;
+	if (blocklen < BLOCK_LEN_MIN)
+		blocklen = BLOCK_LEN_MIN;
+
+	/* Partition Table is always located on the second erase block */
+	offset = blocklen;
+	printk(KERN_NOTICE "%s: searching for MyLoader partition table at "
+			"offset 0x%lx\n", master->name, offset);
+
+	ret = master->read(master, offset, sizeof(*tab), &retlen, (void *)tab);
+	if (ret)
+		goto out_free_buf;
+
+	if (retlen != sizeof(*tab)) {
+		ret = -EIO;
+		goto out_free_buf;
+	}
+
+	/* Check for Partition Table magic number */
+	if (tab->magic != le32_to_cpu(MYLO_MAGIC_PARTITIONS)) {
+		printk(KERN_NOTICE "%s: no MyLoader partition table found\n",
+			master->name);
+		ret = 0;
+		goto out_free_buf;
+	}
+
+	/* The MyLoader and the Partition Table is always present */
+	num_parts = 2;
+
+	/* Detect number of used partitions */
+	for (i = 0; i < MYLO_MAX_PARTITIONS; i++) {
+		part = &tab->partitions[i];
+
+		if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE)
+			continue;
+
+		num_parts++;
+	}
+
+	mtd_parts = kzalloc((num_parts * sizeof(*mtd_part) +
+				num_parts * NAME_LEN_MAX), GFP_KERNEL);
+
+	if (!mtd_parts) {
+		ret = -ENOMEM;
+		goto out_free_buf;
+	}
+
+	mtd_part = mtd_parts;
+	names = (char *)&mtd_parts[num_parts];
+
+	strncpy(names, NAME_MYLOADER, NAME_LEN_MAX-1);
+	mtd_part->name = names;
+	mtd_part->offset = 0;
+	mtd_part->size = blocklen;
+	mtd_part->mask_flags = MTD_WRITEABLE;
+	mtd_part++;
+	names += NAME_LEN_MAX;
+
+	strncpy(names, NAME_PARTITION_TABLE, NAME_LEN_MAX-1);
+	mtd_part->name = names;
+	mtd_part->offset = blocklen;
+	mtd_part->size = blocklen;
+	mtd_part->mask_flags = MTD_WRITEABLE;
+	mtd_part++;
+	names += NAME_LEN_MAX;
+
+	for (i = linux_assigned = 0; i < MYLO_MAX_PARTITIONS; i++) {
+		part = &tab->partitions[i];
+
+		if (le16_to_cpu(part->type) == PARTITION_TYPE_FREE)
+			continue;
+
+		mtd_part->offset = le32_to_cpu(part->addr);
+		mtd_part->size = le32_to_cpu(part->size);
+		if(linux_assigned == 0 && mtd_part->offset >= 0x20000 && mtd_part->size >= 1024*1024) {
+			mtd_part->name = "linux";
+			linux_assigned = 1;
+		} else {
+			sprintf(names, "partition%d", i);
+			mtd_part->name = names;
+		}
+		mtd_part++;
+		names += NAME_LEN_MAX;
+	}
+
+	*pparts = mtd_parts;
+	ret = num_parts;
+
+out_free_buf:
+	kfree(tab);
+	return ret;
+}
+
+static struct mtd_part_parser mylo_mtd_parser = {
+	.owner = THIS_MODULE,
+	.parse_fn = parse_myloader_partitions,
+	.name = NAME_MYLOADER,
+};
+
+static int __init mylo_mtd_parser_init(void)
+{
+	return register_mtd_parser(&mylo_mtd_parser);
+}
+
+static void __exit mylo_mtd_parser_exit(void)
+{
+	deregister_mtd_parser(&mylo_mtd_parser);
+}
+
+module_init(mylo_mtd_parser_init);
+module_exit(mylo_mtd_parser_exit);
+
+MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>");
+MODULE_DESCRIPTION("Parsing code for MyLoader partition tables");
+MODULE_LICENSE("GPL");
diff -urN openwrt-r9800/target/linux/atheros/files/include/asm-mips/mach-atheros/prom/myloader.h openwrt-np25g/target/linux/atheros/files/include/asm-mips/mach-atheros/prom/myloader.h
--- openwrt-r9800/target/linux/atheros/files/include/asm-mips/mach-atheros/prom/myloader.h	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/files/include/asm-mips/mach-atheros/prom/myloader.h	2007-12-18 23:27:17.000000000 -0500
@@ -0,0 +1,191 @@
+/*
+ *  $Id: myloader.h 8538 2007-08-29 17:27:11Z juhosg $
+ *
+ *  Compex's MyLoader specific definitions
+ *
+ *  Copyright (C) 2006,2007 Gabor Juhos <juhosg at openwrt.org>
+ *  Copyright (C) 2007 OpenWrt.org
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version 2
+ *  of the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the
+ *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA  02110-1301, USA.
+ */
+
+#ifndef _MYLOADER_H_
+#define _MYLOADER_H_
+
+/*
+ * Firmware file format:
+ *
+ *	<header>
+ *	[<block descriptor 0>]
+ *	...
+ *	[<block descriptor n>]
+ *	<null block descriptor>
+ *	[<block data 0>]
+ *	...
+ *	[<block data n>]
+ *
+ *
+ */
+
+/* Myloader specific magic numbers */
+#define MYLO_MAGIC_FIRMWARE	0x4C594D00
+#define MYLO_MAGIC_20021103	0x20021103
+#define MYLO_MAGIC_20021107	0x20021107
+
+#define MYLO_MAGIC_SYS_PARAMS	MYLO_MAGIC_20021107
+#define MYLO_MAGIC_PARTITIONS	MYLO_MAGIC_20021103
+#define MYLO_MAGIC_BOARD_PARAMS	MYLO_MAGIC_20021103
+
+/*
+ * Addresses of the data structures provided by MyLoader
+ */
+#define MYLO_MIPS_SYS_PARAMS	0x80000800	/* System Parameters */
+#define MYLO_MIPS_BOARD_PARAMS	0x80000A00	/* Board Parameters */
+#define MYLO_MIPS_PARTITIONS	0x80000C00	/* Partition Table */
+#define MYLO_MIPS_BOOT_PARAMS	0x80000E00	/* Boot Parameters */
+
+/* Vendor ID's (seems to be same as the PCI vendor ID's) */
+#define VENID_COMPEX		0x11F6
+
+/* Devices based on the ADM5120 */
+#define DEVID_COMPEX_NP27G	0x0078
+#define DEVID_COMPEX_NP28G	0x044C
+#define DEVID_COMPEX_NP28GHS	0x044E
+#define DEVID_COMPEX_WP54Gv1C	0x0514
+#define DEVID_COMPEX_WP54G	0x0515
+#define DEVID_COMPEX_WP54AG	0x0546
+#define DEVID_COMPEX_WPP54AG	0x0550
+#define DEVID_COMPEX_WPP54G	0x0555
+
+/* Devices based on the IXP422 */
+#define DEVID_COMPEX_WP18	0x047E
+#define DEVID_COMPEX_NP18A	0x0489
+
+/* Other devices */
+#define DEVID_COMPEX_NP26G8M	0x03E8
+#define DEVID_COMPEX_NP26G16M	0x03E9
+
+struct mylo_fw_header {
+	uint32_t	magic;	/* must be MYLO_MAGIC_FIRMWARE */
+	uint32_t	crc;	/* CRC of the whole firmware */
+	uint32_t	res0;	/* unknown/unused */
+	uint32_t	res1;	/* unknown/unused */
+	uint16_t	vid;	/* vendor ID */
+	uint16_t	did;	/* device ID */
+	uint16_t	svid;	/* sub vendor ID */
+	uint16_t	sdid;	/* sub device ID */
+	uint32_t	rev;	/* device revision */
+	uint32_t	fwhi;	/* FIXME: firmware version high? */
+	uint32_t	fwlo;	/* FIXME: firmware version low? */
+	uint32_t	flags;	/* firmware flags */
+};
+
+#define FW_FLAG_BOARD_PARAMS_WP	0x01 /* board parameters are write protected */
+#define FW_FLAG_BOOT_SECTOR_WE	0x02 /* enable of write boot sectors (below 64K) */
+
+struct mylo_fw_blockdesc {
+	uint32_t	type;	/* block type */
+	uint32_t	addr;	/* relative address to flash start */
+	uint32_t	dlen;	/* size of block data in bytes */
+	uint32_t	blen;	/* total size of block in bytes */
+};
+
+#define FW_DESC_TYPE_UNUSED	0
+#define FW_DESC_TYPE_USED	1
+
+struct mylo_partition {
+	uint16_t	flags;	/* partition flags */
+	uint16_t	type;	/* type of the partition */
+	uint32_t	addr;	/* relative address of the partition from the
+				   flash start */
+	uint32_t	size;	/* size of the partition in bytes */
+	uint32_t	param;	/* if this is the active partition, the
+				   MyLoader load code to this address */
+};
+
+#define PARTITION_FLAG_ACTIVE	0x8000 /* this is the active partition,
+					* MyLoader loads firmware from here */
+#define PARTITION_FLAG_ISRAM	0x2000 /* FIXME: this is a RAM partition? */
+#define PARTIIION_FLAG_RAMLOAD	0x1000 /* FIXME: load this partition into the RAM? */
+#define PARTITION_FLAG_PRELOAD	0x0800 /* the partition data preloaded to RAM
+					* before decompression */
+#define PARTITION_FLAG_HAVEHDR  0x0002 /* the partition data have a header */
+
+#define PARTITION_TYPE_FREE	0
+#define PARTITION_TYPE_USED	1
+
+#define MYLO_MAX_PARTITIONS	8	/* maximum number of partitions in the
+					   partition table */
+
+struct mylo_partition_table {
+	uint32_t	magic;	/* must be MYLO_MAGIC_PARTITIONS */
+	uint32_t	res0;	/* unknown/unused */
+	uint32_t	res1;	/* unknown/unused */
+	uint32_t 	res2;	/* unknown/unused */
+	struct mylo_partition partitions[MYLO_MAX_PARTITIONS];
+};
+
+struct mylo_partition_header {
+	uint32_t	len;	/* length of the partition data */
+	uint32_t	crc;	/* CRC value of the partition data */
+};
+
+struct mylo_system_params {
+	uint32_t	magic;	/* must be MYLO_MAGIC_SYS_PARAMS */
+	uint32_t	res0;
+	uint32_t	res1;
+	uint32_t	mylo_ver;
+	uint16_t	vid;	/* Vendor ID */
+	uint16_t	did;	/* Device ID */
+	uint16_t	svid;	/* Sub Vendor ID */
+	uint16_t	sdid;	/* Sub Device ID */
+	uint32_t	rev;	/* device revision */
+	uint32_t	fwhi;
+	uint32_t	fwlo;
+	uint32_t	tftp_addr;
+	uint32_t	prog_start;
+	uint32_t	flash_size;	/* Size of boot FLASH in bytes */
+	uint32_t	dram_size;	/* Size of onboard RAM in bytes */
+};
+
+
+struct mylo_eth_addr {
+	uint8_t	mac[6];
+	uint8_t	csum[2];
+};
+
+#define MYLO_ETHADDR_COUNT	8	/* maximum number of ethernet address
+					   in the board parameters */
+
+struct mylo_board_params {
+	uint32_t	magic;	/* must be MYLO_MAGIC_BOARD_PARAMS */
+	uint32_t	res0;
+	uint32_t	res1;
+	uint32_t	res2;
+	struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT];
+};
+
+struct myloader_info {
+	u32	vid;
+	u32	did;
+	u32	svid;
+	u32	sdid;
+};
+
+extern struct myloader_info myloader_info;
+extern int myloader_present(void) __init;
+
+#endif /* _MYLOADER_H_*/
diff -urN openwrt-r9800/target/linux/atheros/image/Makefile openwrt-np25g/target/linux/atheros/image/Makefile
--- openwrt-r9800/target/linux/atheros/image/Makefile	2007-11-10 18:08:11.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/image/Makefile	2008-01-04 17:39:41.000000000 -0500
@@ -10,9 +10,15 @@
 define Image/BuildKernel
 	cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux.elf
 	gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
-	$(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
-	dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma bs=65536 conv=sync
+	#$(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
+	#dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma bs=65536 conv=sync
 	dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz bs=65536 conv=sync
+	# compex NP25G image
+	$(STAGING_DIR_HOST)/bin/mkmylofw -i 0x11f6:0x5e6:0x11f6:0x5e6 -s 0x400000 \
+		-p 0x20000:0x3c0000:ah:0x80041000:$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz \
+		-p 0x3e0000:0x10000::0x0 \
+		$(BIN_DIR)/openwrt-np25g.img
+	ls -l $(BIN_DIR)/openwrt-np25g.img
 endef
 
 define Image/Build/squashfs
@@ -22,6 +28,12 @@
 define Image/Build
 	$(call Image/Build/$(1))
 	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync
+	# compex NP25G image
+	$(STAGING_DIR_HOST)/bin/mkmylofw -i 0x11f6:0x5e6:0x11f6:0x5e6 -s 0x400000 \
+		-p 0x20000:0x130000:ah:0x80041000:$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz \
+		-p 0x150000:0x290000:::$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \
+		-p 0x3e0000:0x10000::0x0 \
+		$(BIN_DIR)/openwrt-np25g-sq.img
 endef
 
 
diff -urN openwrt-r9800/target/linux/atheros/Makefile openwrt-np25g/target/linux/atheros/Makefile
--- openwrt-r9800/target/linux/atheros/Makefile	2007-10-23 04:13:12.000000000 -0400
+++ openwrt-np25g/target/linux/atheros/Makefile	2007-12-18 19:44:39.000000000 -0500
@@ -11,7 +11,7 @@
 BOARDNAME:=Atheros
 FEATURES:=squashfs jffs2
 
-LINUX_VERSION:=2.6.23.1
+LINUX_VERSION:=2.6.23.11
 
 include $(INCLUDE_DIR)/target.mk
 
diff -urN openwrt-r9800/target/linux/atheros/patches/100-mtd_myloder_partition_parser.patch openwrt-np25g/target/linux/atheros/patches/100-mtd_myloder_partition_parser.patch
--- openwrt-r9800/target/linux/atheros/patches/100-mtd_myloder_partition_parser.patch	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/patches/100-mtd_myloder_partition_parser.patch	2007-12-18 23:27:17.000000000 -0500
@@ -0,0 +1,39 @@
+Index: linux-2.6.23/drivers/mtd/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/mtd/Kconfig
++++ linux-2.6.23/drivers/mtd/Kconfig
+@@ -160,6 +160,22 @@ config MTD_AFS_PARTS
+ 	  for your particular device. It won't happen automatically. The
+ 	  'armflash' map driver (CONFIG_MTD_ARMFLASH) does this, for example.
+ 
++config MTD_MYLOADER_PARTS
++	tristate "MyLoader partition parsing"
++	depends on MTD_PARTITIONS
++	---help---
++	  MyLoader is a bootloader which allows the user to define partitions
++	  in flash devices, by putting a table in the second erase block
++	  on the device, similar to a partition table. This table gives the 
++	  offsets and lengths of the user defined partitions.
++
++	  If you need code which can detect and parse these tables, and
++	  register MTD 'partitions' corresponding to each image detected,
++	  enable this option.
++
++	  You will still need the parsing functions to be called by the driver
++	  for your particular device. It won't happen automatically.
++
+ comment "User Modules And Translation Layers"
+ 
+ config MTD_CHAR
+Index: linux-2.6.23/drivers/mtd/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/mtd/Makefile
++++ linux-2.6.23/drivers/mtd/Makefile
+@@ -11,6 +11,7 @@ obj-$(CONFIG_MTD_CONCAT)	+= mtdconcat.o
+ obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
+ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
+ obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o
++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
+ 
+ # 'Users' - code which presents functionality to userspace.
+ obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o
diff -urN openwrt-r9800/target/linux/atheros/patches/131-ar2313_ethernet_np25g.patch openwrt-np25g/target/linux/atheros/patches/131-ar2313_ethernet_np25g.patch
--- openwrt-r9800/target/linux/atheros/patches/131-ar2313_ethernet_np25g.patch	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/patches/131-ar2313_ethernet_np25g.patch	2007-12-18 20:54:18.000000000 -0500
@@ -0,0 +1,155 @@
+diff -X linux-2.6.23.11/Documentation/dontdiff -urN linux-2.6.23.11.orig/drivers/net/Kconfig linux-2.6.23.11/drivers/net/Kconfig
+--- linux-2.6.23.11.orig/drivers/net/Kconfig	2007-12-18 18:14:37.000000000 -0500
++++ linux-2.6.23.11/drivers/net/Kconfig	2007-12-18 19:36:58.000000000 -0500
+@@ -354,6 +354,16 @@
+ 	help
+ 	  Support for the AR231x/531x ethernet controller
+ 
++config AR2313_ADM6996F_MGMT_IFACE_ON_MDIO
++	bool "Use MDIO interface as ADM6996F config interface"
++	depends on AR2313
++	help
++	  On the Compex NP25G, the MDIO interface is not connected to the
++	  MDIO interface of the ADM6996F, but to the serial/eeprom interface.
++	  This config option disabled the PHY status checking (which doesn't
++	  work anyway) and configures 2 VLANs (port 0/1/2/3 -> VLAN1, port4
++	  -> VLAN2)
++
+ config MACE
+ 	tristate "MACE (Power Mac ethernet) support"
+ 	depends on PPC_PMAC && PPC32
+diff -X linux-2.6.23.11/Documentation/dontdiff -urN linux-2.6.23.11.orig/drivers/net/ar2313/ar2313.c linux-2.6.23.11/drivers/net/ar2313/ar2313.c
+--- linux-2.6.23.11.orig/drivers/net/ar2313/ar2313.c	2007-10-13 20:07:43.000000000 -0400
++++ linux-2.6.23.11/drivers/net/ar2313/ar2313.c	2007-12-18 20:47:37.000000000 -0500
+@@ -155,6 +155,8 @@
+ 
+ static int mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
+ static int mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value);
++static int mdiobus_read_adm6996f(struct ar2313_private *sp, int regnum);
++static void mdiobus_write_adm6996f(struct ar2313_private *sp, int regnum, u16 value);
+ static int mdiobus_reset(struct mii_bus *bus);
+ static int mdiobus_probe (struct net_device *dev);
+ static void ar2313_adjust_link(struct net_device *dev);
+@@ -291,6 +293,7 @@
+ 	sp->mii_bus.irq = kmalloc(sizeof(int), GFP_KERNEL);
+ 	*sp->mii_bus.irq = PHY_POLL;
+ 	
++#ifndef CONFIG_AR2313_ADM6996F_MGMT_IFACE_ON_MDIO
+ 	mdiobus_register(&sp->mii_bus);
+ 
+ 	if (mdiobus_probe(dev) != 0) {
+@@ -303,6 +306,7 @@
+ 		/* start link poll timer */
+ 		ar2313_setup_timer(dev);
+ 	}
++#endif
+ 	
+ 	return 0;
+ }
+@@ -660,7 +664,7 @@
+ {
+ 	struct ar2313_private *sp = (struct ar2313_private *) dev->priv;
+ 	unsigned int ethsal, ethsah;
+-	unsigned int flags;
++	unsigned int i, flags;
+ 
+ 	*sp->int_regs |= sp->cfg->reset_mac;
+ 	mdelay(10);
+@@ -669,7 +673,32 @@
+ 	*sp->int_regs |= sp->cfg->reset_phy;
+ 	mdelay(10);
+ 	*sp->int_regs &= ~sp->cfg->reset_phy;
+-	mdelay(10);
++	mdelay(40);
++
++#ifdef CONFIG_AR2313_ADM6996F_MGMT_IFACE_ON_MDIO
++   /* disable port 4 first */
++	mdiobus_write_adm6996f(sp, 0x08, 0x0020);
++	   
++	/* setup VLANs: port0-3 -> VLAN1 (lan), port4 -> VLAN2 (wan), port5 -> cpu/tagged;
++	   we do it before ar2313_init because we don't ever want any forwarding between
++	   port0-3 and port4 going on */
++	mdiobus_write_adm6996f(sp, 0x13, 0x0000); //vlan#0
++	mdiobus_write_adm6996f(sp, 0x14, 0x0155); //vlan#1
++	mdiobus_write_adm6996f(sp, 0x15, 0x0180); //vlan#2
++	for(i = 3; i < 16; i++)
++		mdiobus_write_adm6996f(sp, 0x13 + i, 0x0000); //vlan#3-15
++	mdiobus_write_adm6996f(sp, 0x11, 0xff20);
++	mdiobus_write_adm6996f(sp, 0x01, 0x840e); //0 (lan) pvid=1
++	mdiobus_write_adm6996f(sp, 0x03, 0x840e); //1 (lan) pvid=1
++	mdiobus_write_adm6996f(sp, 0x05, 0x840e); //2 (lan) pvid=1
++	mdiobus_write_adm6996f(sp, 0x07, 0x840e); //3 (lan) pvid=1
++	mdiobus_write_adm6996f(sp, 0x09, 0x881e); //5 (cpu) pvid=2 tagged
++	/* enable port4 last */
++	mdiobus_write_adm6996f(sp, 0x08, 0x880e); //4 (wan) pvid=2
++
++	/* it seems the last write is lost, so do a dummy write */
++	mdiobus_write_adm6996f(sp, 0x00, 0x0000);
++#endif
+ 
+ 	sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
+ 	mdelay(10);
+@@ -1249,12 +1278,6 @@
+ 	
+ 	switch (cmd) {
+ 
+-	case SIOCETHTOOL:
+-		spin_lock_irq(&sp->lock);
+-		ret = phy_ethtool_ioctl(sp->phy_dev, (void *) ifr->ifr_data);
+-		spin_unlock_irq(&sp->lock);
+-		return ret;
+-
+ 	case SIOCSIFHWADDR:
+ 		if (copy_from_user
+ 			(dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
+@@ -1267,11 +1290,23 @@
+ 			return -EFAULT;
+ 		return 0;
+ 	
++#ifdef CONFIG_AR2313_ADM6996F_MGMT_IFACE_ON_MDIO
++	case SIOCGMIIREG:
++		data->val_out = mdiobus_read_adm6996f(sp, data->reg_num);
++		return 0;
++#else
+ 	case SIOCGMIIPHY:
+ 	case SIOCGMIIREG:
+ 	case SIOCSMIIREG:
+ 		return phy_mii_ioctl(sp->phy_dev, data, cmd);
+ 	
++	case SIOCETHTOOL:
++		spin_lock_irq(&sp->lock);
++		ret = phy_ethtool_ioctl(sp->phy_dev, (void *) ifr->ifr_data);
++		spin_unlock_irq(&sp->lock);
++		return ret;
++#endif
++
+ 	default:
+ 		break;
+ 	}
+@@ -1321,6 +1356,26 @@
+ 	return 0;
+ }
+ 
++static int
++mdiobus_read_adm6996f(struct ar2313_private *sp, int regnum)
++{
++	volatile ETHERNET_STRUCT *ethernet = sp->phy_regs;
++
++	ethernet->mii_addr = MII_ADDR(0, regnum);
++	while (ethernet->mii_addr & MII_ADDR_BUSY);
++	return (ethernet->mii_data >> MII_DATA_SHIFT);
++}
++
++static void
++mdiobus_write_adm6996f(struct ar2313_private *sp, int regnum, u16 value)
++{
++	volatile ETHERNET_STRUCT *ethernet = sp->phy_regs;
++
++	while (ethernet->mii_addr & MII_ADDR_BUSY);
++	ethernet->mii_data = value << MII_DATA_SHIFT;
++	ethernet->mii_addr = MII_ADDR(0, regnum) | MII_ADDR_WRITE;
++}
++
+ static int mdiobus_reset(struct mii_bus *bus)
+ {
+ 	struct net_device *const dev = bus->priv;
diff -urN openwrt-r9800/target/linux/atheros/patches/666-jiffies-start-at-zero.patch openwrt-np25g/target/linux/atheros/patches/666-jiffies-start-at-zero.patch
--- openwrt-r9800/target/linux/atheros/patches/666-jiffies-start-at-zero.patch	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/patches/666-jiffies-start-at-zero.patch	2007-12-29 00:48:05.000000000 -0500
@@ -0,0 +1,12 @@
+diff -urN -X linux-2.6.23.11/Documentation/dontdiff linux-2.6.23.11.orig/include/linux/jiffies.h linux-2.6.23.11/include/linux/jiffies.h
+--- linux-2.6.23.11.orig/include/linux/jiffies.h	2007-12-21 22:45:19.000000000 -0500
++++ linux-2.6.23.11/include/linux/jiffies.h	2007-12-21 22:46:48.000000000 -0500
+@@ -134,7 +134,7 @@
+  * Have the 32 bit jiffies value wrap 5 minutes after boot
+  * so jiffies wrap bugs show up earlier.
+  */
+-#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
++#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (0*HZ))
+ 
+ /*
+  * Change timeval to jiffies, trying to avoid the
diff -urN openwrt-r9800/target/linux/atheros/patches/667-softdog-verbose-close openwrt-np25g/target/linux/atheros/patches/667-softdog-verbose-close
--- openwrt-r9800/target/linux/atheros/patches/667-softdog-verbose-close	1969-12-31 19:00:00.000000000 -0500
+++ openwrt-np25g/target/linux/atheros/patches/667-softdog-verbose-close	2008-03-24 12:38:55.000000000 -0400
@@ -0,0 +1,10 @@
+--- linux-2.6.23.11/drivers/char/watchdog/softdog.c.orig	2008-03-24 12:37:04.000000000 -0400
++++ linux-2.6.23.11/drivers/char/watchdog/softdog.c	2008-03-24 12:38:08.000000000 -0400
+@@ -150,6 +150,7 @@
+ 	 * 	Lock it in if it's a module and we set nowayout
+ 	 */
+ 	if (expect_close == 42) {
++		printk(KERN_DEBUG PFX "Expected close, stopping watchdog!\n");
+ 		softdog_stop();
+ 		module_put(THIS_MODULE);
+ 	} else {
diff -urN openwrt-r9800/target/linux/generic-2.4/image/initramfs-base-files.txt openwrt-np25g/target/linux/generic-2.4/image/initramfs-base-files.txt
--- openwrt-r9800/target/linux/generic-2.4/image/initramfs-base-files.txt	2007-10-23 02:23:29.000000000 -0400
+++ openwrt-np25g/target/linux/generic-2.4/image/initramfs-base-files.txt	2008-01-16 12:06:44.000000000 -0500
@@ -1,9 +1,22 @@
 nod /dev/console 600 0 0 c 5 1
 nod /dev/null 666 0 0 c 1 3
 nod /dev/zero 666 0 0 c 1 5
+nod /dev/mem 600 0 0 c 1 1
 nod /dev/tty 666 0 0 c 5 0
 nod /dev/tty0 660 0 0 c 4 0
-nod /dev/tty1 660 0 0 c 4 1
 nod /dev/random 666 0 0 c 1 8
 nod /dev/urandom 666 0 0 c 1 9
+nod /dev/ptmx 666 0 0 c 5 2
+nod /dev/ttyS0 666 0 0 c 4 64
+nod /dev/mtd0 600 0 0 c 90 0
+nod /dev/mtd1 600 0 0 c 90 2
+nod /dev/mtd2 600 0 0 c 90 4
+nod /dev/mtd3 600 0 0 c 90 6
+nod /dev/mtd4 600 0 0 c 90 8
+nod /dev/mtd5 600 0 0 c 90 10
+nod /dev/mtd6 600 0 0 c 90 12
+nod /dev/mtd7 600 0 0 c 90 14
+nod /dev/watchdog 600 0 0 c 10 130
 dir /dev/pts 755 0 0
+dir /etc/dropbear 700 0 0
+dir /dev/shm 700 0 0
diff -urN openwrt-r9800/target/linux/generic-2.6/image/initramfs-base-files.txt openwrt-np25g/target/linux/generic-2.6/image/initramfs-base-files.txt
--- openwrt-r9800/target/linux/generic-2.6/image/initramfs-base-files.txt	2007-10-23 02:23:29.000000000 -0400
+++ openwrt-np25g/target/linux/generic-2.6/image/initramfs-base-files.txt	2008-01-16 12:06:44.000000000 -0500
@@ -1,9 +1,22 @@
 nod /dev/console 600 0 0 c 5 1
 nod /dev/null 666 0 0 c 1 3
 nod /dev/zero 666 0 0 c 1 5
+nod /dev/mem 600 0 0 c 1 1
 nod /dev/tty 666 0 0 c 5 0
 nod /dev/tty0 660 0 0 c 4 0
-nod /dev/tty1 660 0 0 c 4 1
 nod /dev/random 666 0 0 c 1 8
 nod /dev/urandom 666 0 0 c 1 9
+nod /dev/ptmx 666 0 0 c 5 2
+nod /dev/ttyS0 666 0 0 c 4 64
+nod /dev/mtd0 600 0 0 c 90 0
+nod /dev/mtd1 600 0 0 c 90 2
+nod /dev/mtd2 600 0 0 c 90 4
+nod /dev/mtd3 600 0 0 c 90 6
+nod /dev/mtd4 600 0 0 c 90 8
+nod /dev/mtd5 600 0 0 c 90 10
+nod /dev/mtd6 600 0 0 c 90 12
+nod /dev/mtd7 600 0 0 c 90 14
+nod /dev/watchdog 600 0 0 c 10 130
 dir /dev/pts 755 0 0
+dir /etc/dropbear 700 0 0
+dir /dev/shm 700 0 0
diff -urN openwrt-r9800/target/linux/pxa/image/initramfs-base-files.txt openwrt-np25g/target/linux/pxa/image/initramfs-base-files.txt
--- openwrt-r9800/target/linux/pxa/image/initramfs-base-files.txt	2007-10-23 02:23:29.000000000 -0400
+++ openwrt-np25g/target/linux/pxa/image/initramfs-base-files.txt	2008-01-16 12:06:44.000000000 -0500
@@ -1,9 +1,22 @@
 nod /dev/console 600 0 0 c 5 1
 nod /dev/null 666 0 0 c 1 3
 nod /dev/zero 666 0 0 c 1 5
+nod /dev/mem 600 0 0 c 1 1
 nod /dev/tty 666 0 0 c 5 0
 nod /dev/tty0 660 0 0 c 4 0
-nod /dev/tty1 660 0 0 c 4 1
 nod /dev/random 666 0 0 c 1 8
 nod /dev/urandom 666 0 0 c 1 9
+nod /dev/ptmx 666 0 0 c 5 2
+nod /dev/ttyS0 666 0 0 c 4 64
+nod /dev/mtd0 600 0 0 c 90 0
+nod /dev/mtd1 600 0 0 c 90 2
+nod /dev/mtd2 600 0 0 c 90 4
+nod /dev/mtd3 600 0 0 c 90 6
+nod /dev/mtd4 600 0 0 c 90 8
+nod /dev/mtd5 600 0 0 c 90 10
+nod /dev/mtd6 600 0 0 c 90 12
+nod /dev/mtd7 600 0 0 c 90 14
+nod /dev/watchdog 600 0 0 c 10 130
 dir /dev/pts 755 0 0
+dir /etc/dropbear 700 0 0
+dir /dev/shm 700 0 0
