diff --git a/openwrt/target/linux/Config.in b/openwrt/target/linux/Config.in
index 4b621231c70fc0231788433cbbde236bc011cc84..5a6c11a0f18afaa5d18199077f8c38ba727d1f58 100644
--- a/openwrt/target/linux/Config.in
+++ b/openwrt/target/linux/Config.in
@@ -67,58 +67,8 @@ config BR2_LINUX_PCMCIA_SUPPORT
 
 comment "Device specific modules"
 
-config BR2_PACKAGE_KMOD_BRCM_ET
-	prompt "kmod-brcm-et...................... Broadcom Ethernet Driver"
-	tristate
-	depends BR2_LINUX_2_4_BRCM
-	default m
-	help
-	  Proprietary driver for Broadcom Ethernet chipsets (obsolete)
+source "target/linux/*-2.[46]/Config.in"
 
-config BR2_PACKAGE_KMOD_BRCM_WL
-	prompt "kmod-brcm-wl...................... Broadcom Wireless Network Driver"
-	tristate
-	depends BR2_LINUX_2_4_BRCM
-	default y
-	help
-	  Proprietary driver for Broadcom Wireless chipsets
-
-config BR2_PACKAGE_KMOD_BRCM_WL2
-	prompt "kmod-brcm-wl2..................... Broadcom Wireless Network Driver (new)"
-	tristate
-	depends BR2_LINUX_2_4_BRCM
-	default m
-	help
-	  Proprietary driver for Broadcom Wireless chipsets
-	  New version with Multi-BSS capability
-
-config BR2_PACKAGE_KMOD_CPMAC
-	prompt "kmod-cpmac........................ AR7 CPMAC Network Driver"
-	tristate
-	default y
-	depends BR2_LINUX_2_4_AR7
-	help
-	  Driver for the AR7 CPMAC network chip
-
-config BR2_PACKAGE_KMOD_SANGAM_ATM_A
-	prompt "kmod-sangam-atm-annex-a........... AR7 Sangam ADSL Driver (Annex A)"
-	tristate
-	default m
-	depends BR2_LINUX_2_4_AR7
-	select BR2_PACKAGE_KMOD_ATM
-	help
-	  ATM driver for the Sangam ADSL chip on AR7
-	  Annex A version
-
-config BR2_PACKAGE_KMOD_SANGAM_ATM_B
-	prompt "kmod-sangam-atm-annex-b........... AR7 Sangam ADSL Driver (Annex B)"
-	tristate
-	default y
-	depends BR2_LINUX_2_4_AR7
-	select BR2_PACKAGE_KMOD_ATM
-	help
-	  ATM driver for the Sangam ADSL chip on AR7
-	  Annex B version
 
 comment "Networking modules"
 
@@ -126,7 +76,7 @@ config BR2_PACKAGE_KMOD_ATM
 	prompt "kmod-atm.......................... ATM support"
 	tristate
 	default y if BR2_LINUX_2_4_AR7
-	default m if BR2_LINUX_2_6_BRCM
+	default m
 	help
 	  ATM support
 
@@ -164,7 +114,6 @@ config BR2_PACKAGE_KMOD_PPPOATM
 	prompt   "kmod-pppoatm.................... PPPoA (PPP over ATM) kernel support"
 	tristate
 	default y if BR2_LINUX_2_4_AR7
-	default m if BR2_LINUX_2_6_BRCM
 	default m
 	depends BR2_PACKAGE_KMOD_PPP
 	select BR2_PACKAGE_KMOD_ATM
diff --git a/openwrt/target/linux/Makefile b/openwrt/target/linux/Makefile
index 5dfe12ad7fa4b33588a67927e6ec44b317fcbc29..038983f3aa078038697e2c9a31561c4aabd37bb8 100644
--- a/openwrt/target/linux/Makefile
+++ b/openwrt/target/linux/Makefile
@@ -10,23 +10,23 @@ define kernel_template
 
 $(1)/$(2)-clean:
 	@$(TRACE) target/linux/linux-$(1)/clean
-	$(MAKE) -C linux-$(1) KERNEL="$(1)" BOARD="$(2)" clean
+	$(MAKE) -C $(2)-$(1) BOARD="$(2)" clean
 
 $(1)/$(2)-prepare:
 	@$(TRACE) target/linux/linux-$(1)/prepare
-	$(MAKE) -C linux-$(1) KERNEL="$(1)" BOARD="$(2)" prepare
+	$(MAKE) -C $(2)-$(1) BOARD="$(2)" prepare
 
 $(1)/$(2)-compile:
 	@$(TRACE) target/linux/linux-$(1)/compile
-	$(MAKE) -C linux-$(1) KERNEL="$(1)" BOARD="$(2)" compile
+	$(MAKE) -C $(2)-$(1) BOARD="$(2)" compile
 
 $(1)/$(2)-rebuild:
 	@$(TRACE) target/linux/linux-$(1)/rebuild
-	$(MAKE) -C linux-$(1) KERNEL="$(1)" BOARD="$(2)" rebuild
+	$(MAKE) -C $(2)-$(1) BOARD="$(2)" rebuild
 
 $(1)/$(2)-install:
 	@$(TRACE) target/linux/linux-$(1)/install
-	$(MAKE) -C linux-$(1) KERNEL="$(1)" BOARD="$(2)" install
+	$(MAKE) -C $(2)-$(1) BOARD="$(2)" install
 
 $(1)/$(2)-image: $(1)/$(2)-install
 	@$(TRACE) target/linux/image/install
diff --git a/openwrt/target/linux/ar531x-2.4/Makefile b/openwrt/target/linux/ar531x-2.4/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..989bcc45820b8e771b59d4ce7dde4c52c8e9fb57
--- /dev/null
+++ b/openwrt/target/linux/ar531x-2.4/Makefile
@@ -0,0 +1,17 @@
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.4.32
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=38f4d0830e95a20f4bfed17622d5557c
+
+include ../rules.mk
+include ./config
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
diff --git a/openwrt/target/linux/linux-2.4/config/ar531x b/openwrt/target/linux/ar531x-2.4/config
similarity index 100%
rename from openwrt/target/linux/linux-2.4/config/ar531x
rename to openwrt/target/linux/ar531x-2.4/config
diff --git a/openwrt/target/linux/linux-2.4/patches/ar531x/000-atheros-support.patch b/openwrt/target/linux/ar531x-2.4/patches/000-atheros-support.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar531x/000-atheros-support.patch
rename to openwrt/target/linux/ar531x-2.4/patches/000-atheros-support.patch
diff --git a/openwrt/target/linux/linux-2.4/ar7.mk b/openwrt/target/linux/ar7-2.4/Makefile
similarity index 67%
rename from openwrt/target/linux/linux-2.4/ar7.mk
rename to openwrt/target/linux/ar7-2.4/Makefile
index f562f15d668c752f506a608b5c29a6e1698700e1..daa734107ded6e98b4e7511bb770053603705bde 100644
--- a/openwrt/target/linux/linux-2.4/ar7.mk
+++ b/openwrt/target/linux/ar7-2.4/Makefile
@@ -1,13 +1,48 @@
-#############################################################
-# $Id$
-#
-# Makefile for the AR7-specific kernel/driver stuff
-#
-#############################################################
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.4.32
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=38f4d0830e95a20f4bfed17622d5557c
+
+include ../rules.mk
+include ./config
+
+ATM_FIRMWARE_VERSION:=0.4
+ATM_FIRMWARE_DIR=sangam-atm-firmware-$(ATM_FIRMWARE_VERSION)
+
+$(eval $(call KMOD_template,SANGAM_ATM_A,sangam-atm-annex-a,\
+	$(MODULES_DIR)/kernel/drivers/atm/tiatm.o \
+,CONFIG_MIPS_SANGAM_ATM,kmod-atm,60,tiatm, \
+	cp $(BUILD_DIR)/$(ATM_FIRMWARE_DIR)/ar0700xx_a.bin $$(I_SANGAM_ATM_A)/lib/modules/ar0700xx.bin \
+))
+
+$(eval $(call KMOD_template,SANGAM_ATM_B,sangam-atm-annex-b,\
+	$(MODULES_DIR)/kernel/drivers/atm/tiatm.o \
+,CONFIG_MIPS_SANGAM_ATM,kmod-atm,60,tiatm, \
+	cp $(BUILD_DIR)/$(ATM_FIRMWARE_DIR)/ar0700xx_b.bin $$(I_SANGAM_ATM_B)/lib/modules/ar0700xx.bin \
+))
+
+$(eval $(call KMOD_template,CPMAC,cpmac,\
+	$(MODULES_DIR)/kernel/drivers/net/avalanche_cpmac/avalanche_cpmac.o \
+,CONFIG_MIPS_AVALANCHE_CPMAC,,10,avalanche_cpmac))
+
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
+
+###############################################
+# ATM firmware for the DSL modem
+###############################################
 
 DOWNLOAD_SITE=http://openwrt.org/downloads/sources
 # extracted from netgear DG834B V1.0.5 GPL release
-ATM_FIRMWARE_DIR=sangam-atm-firmware-0.4
 ATM_FIRMWARE_FILE=$(ATM_FIRMWARE_DIR).tar.gz
 ATM_FIRMWARE_MD5SUM=8bfcb31109796502d66b11baaeb2fba6
 
@@ -29,19 +64,3 @@ drivers-clean:
 	rm -rf $(BUILD_DIR)/$(ATM_FIRMWARE_DIR)
 
 
-$(eval $(call KMOD_template,SANGAM_ATM_A,sangam-atm-annex-a,\
-	$(MODULES_DIR)/kernel/drivers/atm/tiatm.o \
-,CONFIG_MIPS_SANGAM_ATM,kmod-atm,60,tiatm, \
-	cp $(BUILD_DIR)/$(ATM_FIRMWARE_DIR)/ar0700xx_a.bin $$(I_SANGAM_ATM_A)/lib/modules/ar0700xx.bin \
-))
-
-$(eval $(call KMOD_template,SANGAM_ATM_B,sangam-atm-annex-b,\
-	$(MODULES_DIR)/kernel/drivers/atm/tiatm.o \
-,CONFIG_MIPS_SANGAM_ATM,kmod-atm,60,tiatm, \
-	cp $(BUILD_DIR)/$(ATM_FIRMWARE_DIR)/ar0700xx_b.bin $$(I_SANGAM_ATM_B)/lib/modules/ar0700xx.bin \
-))
-
-$(eval $(call KMOD_template,CPMAC,cpmac,\
-	$(MODULES_DIR)/kernel/drivers/net/avalanche_cpmac/avalanche_cpmac.o \
-,CONFIG_MIPS_AVALANCHE_CPMAC,,10,avalanche_cpmac))
-
diff --git a/openwrt/target/linux/linux-2.4/config/ar7 b/openwrt/target/linux/ar7-2.4/config
similarity index 100%
rename from openwrt/target/linux/linux-2.4/config/ar7
rename to openwrt/target/linux/ar7-2.4/config
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/000-ar7_support.patch b/openwrt/target/linux/ar7-2.4/patches/000-ar7_support.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/000-ar7_support.patch
rename to openwrt/target/linux/ar7-2.4/patches/000-ar7_support.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/001-flash_map.patch b/openwrt/target/linux/ar7-2.4/patches/001-flash_map.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/001-flash_map.patch
rename to openwrt/target/linux/ar7-2.4/patches/001-flash_map.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/002-led_driver.patch b/openwrt/target/linux/ar7-2.4/patches/002-led_driver.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/002-led_driver.patch
rename to openwrt/target/linux/ar7-2.4/patches/002-led_driver.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/003-net_driver_cpmac.patch b/openwrt/target/linux/ar7-2.4/patches/003-net_driver_cpmac.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/003-net_driver_cpmac.patch
rename to openwrt/target/linux/ar7-2.4/patches/003-net_driver_cpmac.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/004-atm_driver.patch b/openwrt/target/linux/ar7-2.4/patches/004-atm_driver.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/004-atm_driver.patch
rename to openwrt/target/linux/ar7-2.4/patches/004-atm_driver.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/005-wdt_driver.patch b/openwrt/target/linux/ar7-2.4/patches/005-wdt_driver.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/005-wdt_driver.patch
rename to openwrt/target/linux/ar7-2.4/patches/005-wdt_driver.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch b/openwrt/target/linux/ar7-2.4/patches/006-sched_use_tsc.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/ar7/006-sched_use_tsc.patch
rename to openwrt/target/linux/ar7-2.4/patches/006-sched_use_tsc.patch
diff --git a/openwrt/target/linux/brcm-2.4/Config.in b/openwrt/target/linux/brcm-2.4/Config.in
new file mode 100644
index 0000000000000000000000000000000000000000..c344a97e816b484098beea1364a5f3852e75b81c
--- /dev/null
+++ b/openwrt/target/linux/brcm-2.4/Config.in
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_KMOD_BRCM_WL
+	prompt "kmod-brcm-wl...................... Broadcom Wireless Network Driver"
+	tristate
+	depends BR2_LINUX_2_4_BRCM
+	default y
+	help
+	  Proprietary driver for Broadcom Wireless chipsets
+
+config BR2_PACKAGE_KMOD_BRCM_WL2
+	prompt "kmod-brcm-wl2..................... Broadcom Wireless Network Driver (new)"
+	tristate
+	depends BR2_LINUX_2_4_BRCM
+	default m
+	help
+	  Proprietary driver for Broadcom Wireless chipsets
+	  New version with Multi-BSS capability
+
+
diff --git a/openwrt/target/linux/linux-2.4/broadcom.mk b/openwrt/target/linux/brcm-2.4/Makefile
similarity index 67%
rename from openwrt/target/linux/linux-2.4/broadcom.mk
rename to openwrt/target/linux/brcm-2.4/Makefile
index ffd118edeac4fbdb214bc653cf59f3111a9a92bf..435b542df3118107301f9aa79ad208d8649f1ba1 100644
--- a/openwrt/target/linux/linux-2.4/broadcom.mk
+++ b/openwrt/target/linux/brcm-2.4/Makefile
@@ -1,9 +1,11 @@
-#############################################################
-# $Id$
-#
-# Makefile for the proprietary Broadcom drivers
-#
-#############################################################
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.4.32
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=38f4d0830e95a20f4bfed17622d5557c
+
+include ../rules.mk
+include ./config
 
 # broadcom specific kmod packages
 $(eval $(call KMOD_template,BRCM_WL,brcm-wl,\
@@ -14,10 +16,6 @@ $(eval $(call KMOD_template,BRCM_WL2,brcm-wl2,\
 	$(BUILD_DIR)/wl/wl2/wl.o \
 ,CONFIG_WL,,20,wl))
 
-$(eval $(call KMOD_template,BRCM_ET,brcm-et,\
-	$(MODULES_DIR)/kernel/drivers/net/et/et.o \
-,CONFIG_ET,,10,et))
-
 $(eval $(call KMOD_template,LP,lp,\
 	$(MODULES_DIR)/kernel/drivers/parport/parport.o \
 	$(MODULES_DIR)/kernel/drivers/parport/parport_splink.o \
@@ -25,20 +23,30 @@ $(eval $(call KMOD_template,LP,lp,\
 	$(MODULES_DIR)/kernel/drivers/char/ppdev.o \
 ,CONFIG_PARPORT,,50,parport parport_splink lp))
 
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
+
+###############################################
+# Proprietary driver for BCM43xx
+###############################################
+
 LINUX_BINARY_DRIVER_SITE=http://openwrt.org/downloads/sources
 # proprietary driver, extracted from Linksys GPL sourcetree WRT54GS 4.70.6
 LINUX_BINARY_WL_DRIVER=kernel-binary-wl-0.5.tar.gz
 LINUX_BINARY_WL_MD5SUM=78e839842bdc04022bb44469f92b1131
-LINUX_ET_DRIVER=kernel-source-et-0.13.tar.gz
-LINUX_ET_MD5SUM=b2072f26a4f25a7d6bc2669c4fe6419d
 
 $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER):
 	$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_BINARY_WL_DRIVER) $(LINUX_BINARY_WL_MD5SUM) $(LINUX_BINARY_DRIVER_SITE) $(MAKE_TRACE)
-
-$(DL_DIR)/$(LINUX_ET_DRIVER):
-	$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_ET_DRIVER) $(LINUX_ET_MD5SUM) $(LINUX_BINARY_DRIVER_SITE) $(MAKE_TRACE)
 	
-$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) $(DL_DIR)/$(LINUX_ET_DRIVER)
+$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER)
 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.drivers-unpacked
 $(LINUX_DIR)/.modules_done: $(LINUX_DIR)/.drivers-unpacked
 $(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.drivers-installed
@@ -48,12 +56,8 @@ $(LINUX_DIR)/.drivers-unpacked: $(LINUX_DIR)/.unpacked
 	zcat $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
 	zcat $(DL_DIR)/$(LINUX_ET_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
 	# copy binary wlan driver
-	mkdir -p $(LINUX_DIR)/drivers/net/{et,wl}
+	mkdir -p $(LINUX_DIR)/drivers/net/wl
 	cp -fpR $(BUILD_DIR)/wl/*.o $(LINUX_DIR)/drivers/net/wl
-	# copy proprietary et source
-	cp -fpR $(BUILD_DIR)/et/* $(LINUX_DIR)/drivers/net/et
-	mkdir -p $(LINUX_DIR)/arch/mips/bcm947xx/include/
-	cp -fpR $(BUILD_DIR)/et/*.h $(LINUX_DIR)/arch/mips/bcm947xx/include/
 	touch $@
 
 $(LINUX_DIR)/.drivers-installed: $(LINUX_DIR)/.modules_done
@@ -64,4 +68,4 @@ $(LINUX_DIR)/.drivers-installed: $(LINUX_DIR)/.modules_done
 linux-dirclean: drivers-clean
 
 drivers-clean:
-	rm -rf $(BUILD_DIR)/{wl,et}
+	rm -rf $(BUILD_DIR)/wl
diff --git a/openwrt/target/linux/linux-2.4/config/brcm b/openwrt/target/linux/brcm-2.4/config
similarity index 99%
rename from openwrt/target/linux/linux-2.4/config/brcm
rename to openwrt/target/linux/brcm-2.4/config
index 0bfc6b46f243fce9b393889a327abce484c65244..26d9cd102a2fcbe5291917b4e54d8ca22d086ecf 100644
--- a/openwrt/target/linux/linux-2.4/config/brcm
+++ b/openwrt/target/linux/brcm-2.4/config
@@ -763,7 +763,6 @@ CONFIG_NET_PCI=y
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_APRICOT is not set
 CONFIG_B44=y
-CONFIG_ET=m
 # CONFIG_CS89x0 is not set
 # CONFIG_TULIP is not set
 # CONFIG_DE4X5 is not set
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/001-bcm47xx.patch b/openwrt/target/linux/brcm-2.4/patches/001-bcm47xx.patch
similarity index 99%
rename from openwrt/target/linux/linux-2.4/patches/brcm/001-bcm47xx.patch
rename to openwrt/target/linux/brcm-2.4/patches/001-bcm47xx.patch
index e616893e9e159f8b598969fc750f8ce140df77d2..9d919156b6b350ee2ed2c90cbf655b918d41422b 100644
--- a/openwrt/target/linux/linux-2.4/patches/brcm/001-bcm47xx.patch
+++ b/openwrt/target/linux/brcm-2.4/patches/001-bcm47xx.patch
@@ -14673,39 +14673,6 @@ diff -Nur linux-2.4.32/drivers/net/Config.in linux-2.4.32-brcm/drivers/net/Confi
  source drivers/net/arcnet/Config.in
  
  tristate 'Dummy net driver support' CONFIG_DUMMY
-@@ -173,6 +175,7 @@
- 
-       dep_tristate '    Apricot Xen-II on board Ethernet' CONFIG_APRICOT $CONFIG_ISA
-       dep_tristate '    Broadcom 4400 ethernet support (EXPERIMENTAL)' CONFIG_B44 $CONFIG_PCI $CONFIG_EXPERIMENTAL
-+      dep_tristate '    Proprietary Broadcom 10/100 Ethernet support' CONFIG_ET $CONFIG_PCI
-       dep_tristate '    CS89x0 support' CONFIG_CS89x0 $CONFIG_ISA
-       dep_tristate '    DECchip Tulip (dc21x4x) PCI support' CONFIG_TULIP $CONFIG_PCI
-       if [ "$CONFIG_TULIP" = "y" -o "$CONFIG_TULIP" = "m" ]; then
-diff -Nur linux-2.4.32/drivers/net/et/Makefile linux-2.4.32-brcm/drivers/net/et/Makefile
---- linux-2.4.32/drivers/net/et/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.4.32-brcm/drivers/net/et/Makefile	2005-12-16 23:39:11.284858000 +0100
-@@ -0,0 +1,21 @@
-+#
-+# Makefile for the Broadcom et driver
-+#
-+# Copyright 2004, Broadcom Corporation
-+# All Rights Reserved.
-+# 
-+# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
-+# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
-+# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
-+# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
-+#
-+# $Id: Makefile,v 1.1 2005/03/16 13:50:00 wbx Exp $
-+#
-+
-+EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include -DBCM47XX_CHOPS -DDMA -DBCMDRIVER
-+
-+O_TARGET	:= et.o
-+obj-y		:= et_linux.o etc.o etc47xx.o etc_robo.o etc_adm.o
-+obj-m		:= $(O_TARGET)
-+
-+include $(TOPDIR)/Rules.make
 diff -Nur linux-2.4.32/drivers/net/hnd/bcmsrom.c linux-2.4.32-brcm/drivers/net/hnd/bcmsrom.c
 --- linux-2.4.32/drivers/net/hnd/bcmsrom.c	1970-01-01 01:00:00.000000000 +0100
 +++ linux-2.4.32-brcm/drivers/net/hnd/bcmsrom.c	2005-12-16 23:39:11.284858000 +0100
@@ -21875,26 +21842,22 @@ diff -Nur linux-2.4.32/drivers/net/Makefile linux-2.4.32-brcm/drivers/net/Makefi
  obj-y           :=
  obj-m           :=
  obj-n           :=
-@@ -39,6 +41,9 @@
+@@ -39,6 +41,8 @@
    obj-$(CONFIG_ISDN) += slhc.o
  endif
  
 +subdir-$(CONFIG_HND) += hnd
-+subdir-$(CONFIG_ET) += et
 +subdir-$(CONFIG_WL) += wl
  subdir-$(CONFIG_NET_PCMCIA) += pcmcia
  subdir-$(CONFIG_NET_WIRELESS) += wireless
  subdir-$(CONFIG_TULIP) += tulip
-@@ -69,6 +74,16 @@
+@@ -69,6 +74,13 @@
  obj-$(CONFIG_MYRI_SBUS) += myri_sbus.o
  obj-$(CONFIG_SUNGEM) += sungem.o
  
 +ifeq ($(CONFIG_HND),y)
 +  obj-y += hnd/hnd.o
 +endif
-+ifeq ($(CONFIG_ET),y)
-+  obj-y += et/et.o
-+endif
 +ifeq ($(CONFIG_WL),y)
 +  obj-y += wl/wl.o
 +endif
@@ -21902,14 +21865,6 @@ diff -Nur linux-2.4.32/drivers/net/Makefile linux-2.4.32-brcm/drivers/net/Makefi
  obj-$(CONFIG_MACE) += mace.o
  obj-$(CONFIG_BMAC) += bmac.o
  obj-$(CONFIG_GMAC) += gmac.o
-@@ -265,6 +280,7 @@
- endif
- endif
- 
-+
- include $(TOPDIR)/Rules.make
- 
- clean:
 diff -Nur linux-2.4.32/drivers/net/wireless/Config.in linux-2.4.32-brcm/drivers/net/wireless/Config.in
 --- linux-2.4.32/drivers/net/wireless/Config.in	2004-11-17 12:54:21.000000000 +0100
 +++ linux-2.4.32-brcm/drivers/net/wireless/Config.in	2005-12-16 23:39:11.364863000 +0100
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/002-wl_fix.patch b/openwrt/target/linux/brcm-2.4/patches/002-wl_fix.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/002-wl_fix.patch
rename to openwrt/target/linux/brcm-2.4/patches/002-wl_fix.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/003-bcm47xx_cache_fixes.patch b/openwrt/target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/003-bcm47xx_cache_fixes.patch
rename to openwrt/target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/004-flash-map.patch b/openwrt/target/linux/brcm-2.4/patches/004-flash-map.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/004-flash-map.patch
rename to openwrt/target/linux/brcm-2.4/patches/004-flash-map.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/005-bluetooth_sco_buffer_align.patch b/openwrt/target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/005-bluetooth_sco_buffer_align.patch
rename to openwrt/target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/006-ide_workaround.patch b/openwrt/target/linux/brcm-2.4/patches/006-ide_workaround.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/006-ide_workaround.patch
rename to openwrt/target/linux/brcm-2.4/patches/006-ide_workaround.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch b/openwrt/target/linux/brcm-2.4/patches/007-sched_use_tsc.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/brcm/007-sched_use_tsc.patch
rename to openwrt/target/linux/brcm-2.4/patches/007-sched_use_tsc.patch
diff --git a/openwrt/target/linux/brcm-2.6/Makefile b/openwrt/target/linux/brcm-2.6/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..02ed5c49d47296cbc687227b62be06468253e1d2
--- /dev/null
+++ b/openwrt/target/linux/brcm-2.6/Makefile
@@ -0,0 +1,19 @@
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.6.15
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=cdf95e00f5111e31f78e1d97304d9522
+
+include ../rules.mk
+include ./config
+
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
diff --git a/openwrt/target/linux/linux-2.6/config/brcm b/openwrt/target/linux/brcm-2.6/config
similarity index 100%
rename from openwrt/target/linux/linux-2.6/config/brcm
rename to openwrt/target/linux/brcm-2.6/config
diff --git a/openwrt/target/linux/linux-2.6/patches/brcm/001-bcm947xx.patch b/openwrt/target/linux/brcm-2.6/patches/001-bcm947xx.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/brcm/001-bcm947xx.patch
rename to openwrt/target/linux/brcm-2.6/patches/001-bcm947xx.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch b/openwrt/target/linux/brcm-2.6/patches/002-flash-map.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch
rename to openwrt/target/linux/brcm-2.6/patches/002-flash-map.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/brcm/003-bcm4710_cache_fixes.patch b/openwrt/target/linux/brcm-2.6/patches/003-bcm4710_cache_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/brcm/003-bcm4710_cache_fixes.patch
rename to openwrt/target/linux/brcm-2.6/patches/003-bcm4710_cache_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/README b/openwrt/target/linux/generic-2.4/README
similarity index 100%
rename from openwrt/target/linux/linux-2.4/README
rename to openwrt/target/linux/generic-2.4/README
diff --git a/openwrt/target/linux/linux-2.4/Makefile b/openwrt/target/linux/generic-2.4/modules.mk
similarity index 65%
rename from openwrt/target/linux/linux-2.4/Makefile
rename to openwrt/target/linux/generic-2.4/modules.mk
index 3d668fa95e11b162a01f00b617b4cbfe120334dd..6aea74203b4beaa9c29c027b3fc7e7bf812d73a0 100644
--- a/openwrt/target/linux/linux-2.4/Makefile
+++ b/openwrt/target/linux/generic-2.4/modules.mk
@@ -1,55 +1,3 @@
-# $Id$
-# Linux 2.4 kernel target for the OpenWRT project
-
-include $(TOPDIR)/rules.mk
-include ../rules.mk
-
-KERNEL:=2.4
-LINUX_VERSION:=2.4.32
-MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
-LINUX_KCONFIG:=./config/$(BOARD)
-LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.4-$(BOARD)
-LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
-LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
-
-LINUX_BINARY_DRIVER_SITE := http://openwrt.org/downloads/sources/
-LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
-LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
-MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
-TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
-IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
-
-PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
-PKG_RELEASE := 2
-
-KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
-KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
-
-KPKG_MAKEOPTS:=	IPKG="$(IPKG_KERNEL)" \
-		BOARD="$(BOARD)" \
-		TARGET_DIR="$(LINUX_TARGET_DIR)" \
-		BUILD_DIR="$(LINUX_BUILD_DIR)" \
-		KERNEL_DIR="$(LINUX_SOURCE_DIR)" \
-		LINUX_VERSION="$(LINUX_VERSION)" \
-		KERNEL_RELEASE="$(PKG_RELEASE)"
-
-include $(LINUX_KCONFIG)
-
-INSTALL_TARGETS := $(KERNEL_IPKG)
-TARGETS := 
-
-ifeq ($(BOARD),brcm)
-include ./broadcom.mk
-endif
-
-ifeq ($(BOARD),x86)
-include ./x86.mk
-endif
-
-ifeq ($(BOARD),ar7)
-include ./ar7.mk
-endif
-
 include ../netfilter.mk
 
 # Networking
@@ -374,105 +322,4 @@ $(eval $(call KMOD_template,SOFTDOG,softdog,\
 ,CONFIG_SOFT_WATCHDOG,,95,softdog))
 
 
-$(TARGETS): $(PACKAGE_DIR)
-
-$(PACKAGE_DIR):
-	mkdir -p $(PACKAGE_DIR)
-
-$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
-	-mkdir -p $(LINUX_BUILD_DIR)
-	bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
-	rm -f $(LINUX_DIR)
-	ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
-	touch $(LINUX_DIR)/.unpacked
-
-$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
-	$(PATCH) $(LINUX_DIR) ./patches/generic $(MAKE_TRACE)
-	[ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD) $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.patched
-
-$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
-	-cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
-	$(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
-	  $(LINUX_DIR)/Makefile  \
-	  $(LINUX_DIR)/arch/*/Makefile
-	$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
-	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.configured
-
-$(LINUX_DIR)/.depend_done:  $(LINUX_DIR)/.configured
-	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.depend_done
-
-$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
-	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
-
-$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
-	$(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
-	touch -c $(LINUX_KERNEL)
-
-$(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
-	rm -rf $(LINUX_BUILD_DIR)/modules
-	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules $(MAKE_TRACE)
-	$(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.modules_done
-
-$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
-	mkdir -p $(STAGING_DIR)/include
-	tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
-	tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
-
-$(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
-	@mkdir -p $(STAMP_DIR)
-	@$(MAKE) $(TARGETS)
-	ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
-	@$(TRACE) target/linux/package
-	$(MAKE) -C $(TOPDIR)/target/linux/package \
-		$(KPKG_MAKEOPTS) \
-		compile
-	touch $@
-
-$(TARGET_MODULES_DIR): 
-	-mkdir -p $(TARGET_MODULES_DIR)
-
-$(KERNEL_IPKG):
-	rm -rf $(KERNEL_IDIR)
-	mkdir -p $(KERNEL_IDIR)/etc
-	$(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) $(ARCH)
-	if [ -f ./config/$(BOARD).modules ]; then \
-		cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
-	fi
-	$(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
-
-source: $(DL_DIR)/$(LINUX_SOURCE)
-prepare: $(LINUX_DIR)/.configured
-compile:
-	$(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
-
-install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
-	rm -rf $(LINUX_BUILD_DIR)/root*
-	cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
-	echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
-	$(MAKE) -C $(TOPDIR)/target/linux/package \
-		$(KPKG_MAKEOPTS) \
-		install
-	@{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE) 
-
-mostlyclean:
-	rm -f $(STAMP_DIR)/.linux-compile
-	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
-	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
-	$(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
-	rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
-
-rebuild:
-	-$(MAKE) mostlyclean
-	if [ -f $(LINUX_KERNEL) ]; then \
-		$(MAKE) clean $(MAKE_TRACE); \
-	fi
-	$(MAKE) compile $(MAKE_TRACE)
-
-clean:
-	rm -f $(STAMP_DIR)/.linux-compile
-	rm -rf $(LINUX_BUILD_DIR)
-	rm -f $(TARGETS)
+
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/000-linux_mips.patch b/openwrt/target/linux/generic-2.4/patches/000-linux_mips.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/000-linux_mips.patch
rename to openwrt/target/linux/generic-2.4/patches/000-linux_mips.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/001-squashfs.patch b/openwrt/target/linux/generic-2.4/patches/001-squashfs.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/001-squashfs.patch
rename to openwrt/target/linux/generic-2.4/patches/001-squashfs.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/002-squashfs_lzma.patch b/openwrt/target/linux/generic-2.4/patches/002-squashfs_lzma.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/002-squashfs_lzma.patch
rename to openwrt/target/linux/generic-2.4/patches/002-squashfs_lzma.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/003-jffs2_compression.patch b/openwrt/target/linux/generic-2.4/patches/003-jffs2_compression.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/003-jffs2_compression.patch
rename to openwrt/target/linux/generic-2.4/patches/003-jffs2_compression.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/004-exec_pagesize.patch b/openwrt/target/linux/generic-2.4/patches/004-exec_pagesize.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/004-exec_pagesize.patch
rename to openwrt/target/linux/generic-2.4/patches/004-exec_pagesize.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/005-mtd_flashtypes.patch b/openwrt/target/linux/generic-2.4/patches/005-mtd_flashtypes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/005-mtd_flashtypes.patch
rename to openwrt/target/linux/generic-2.4/patches/005-mtd_flashtypes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch b/openwrt/target/linux/generic-2.4/patches/006-gcc4_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch
rename to openwrt/target/linux/generic-2.4/patches/006-gcc4_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch b/openwrt/target/linux/generic-2.4/patches/007-more_gcc4_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch
rename to openwrt/target/linux/generic-2.4/patches/007-more_gcc4_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/050-build_flags.patch b/openwrt/target/linux/generic-2.4/patches/050-build_flags.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/050-build_flags.patch
rename to openwrt/target/linux/generic-2.4/patches/050-build_flags.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/106-mppe_mppc.patch b/openwrt/target/linux/generic-2.4/patches/106-mppe_mppc.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/106-mppe_mppc.patch
rename to openwrt/target/linux/generic-2.4/patches/106-mppe_mppc.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/107-cifs.patch b/openwrt/target/linux/generic-2.4/patches/107-cifs.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/107-cifs.patch
rename to openwrt/target/linux/generic-2.4/patches/107-cifs.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/108-optional_aout_support.patch b/openwrt/target/linux/generic-2.4/patches/108-optional_aout_support.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/108-optional_aout_support.patch
rename to openwrt/target/linux/generic-2.4/patches/108-optional_aout_support.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/109-ipsec_nat_traversal.patch b/openwrt/target/linux/generic-2.4/patches/109-ipsec_nat_traversal.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/109-ipsec_nat_traversal.patch
rename to openwrt/target/linux/generic-2.4/patches/109-ipsec_nat_traversal.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/110-netdev_random_core.patch b/openwrt/target/linux/generic-2.4/patches/110-netdev_random_core.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/110-netdev_random_core.patch
rename to openwrt/target/linux/generic-2.4/patches/110-netdev_random_core.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/112-bridging_performance.patch b/openwrt/target/linux/generic-2.4/patches/112-bridging_performance.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/112-bridging_performance.patch
rename to openwrt/target/linux/generic-2.4/patches/112-bridging_performance.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch b/openwrt/target/linux/generic-2.4/patches/113-even_more_gcc4_stuff.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch
rename to openwrt/target/linux/generic-2.4/patches/113-even_more_gcc4_stuff.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/200-i4l.patch b/openwrt/target/linux/generic-2.4/patches/200-i4l.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/200-i4l.patch
rename to openwrt/target/linux/generic-2.4/patches/200-i4l.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/201-hfc_usb_backport.patch b/openwrt/target/linux/generic-2.4/patches/201-hfc_usb_backport.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/201-hfc_usb_backport.patch
rename to openwrt/target/linux/generic-2.4/patches/201-hfc_usb_backport.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/202-pl2303_backport.patch b/openwrt/target/linux/generic-2.4/patches/202-pl2303_backport.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/202-pl2303_backport.patch
rename to openwrt/target/linux/generic-2.4/patches/202-pl2303_backport.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/203-hfsplus_fix.patch b/openwrt/target/linux/generic-2.4/patches/203-hfsplus_fix.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/203-hfsplus_fix.patch
rename to openwrt/target/linux/generic-2.4/patches/203-hfsplus_fix.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/204-net_b44.patch b/openwrt/target/linux/generic-2.4/patches/204-net_b44.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/204-net_b44.patch
rename to openwrt/target/linux/generic-2.4/patches/204-net_b44.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/206-gcc_3.4_fixes.patch b/openwrt/target/linux/generic-2.4/patches/206-gcc_3.4_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/206-gcc_3.4_fixes.patch
rename to openwrt/target/linux/generic-2.4/patches/206-gcc_3.4_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/208-usb2_fix.patch b/openwrt/target/linux/generic-2.4/patches/208-usb2_fix.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/208-usb2_fix.patch
rename to openwrt/target/linux/generic-2.4/patches/208-usb2_fix.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/209-build_fixes.patch b/openwrt/target/linux/generic-2.4/patches/209-build_fixes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/209-build_fixes.patch
rename to openwrt/target/linux/generic-2.4/patches/209-build_fixes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/210-fix-irq-serial.patch b/openwrt/target/linux/generic-2.4/patches/210-fix-irq-serial.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/210-fix-irq-serial.patch
rename to openwrt/target/linux/generic-2.4/patches/210-fix-irq-serial.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/212-htb_time_fix.patch b/openwrt/target/linux/generic-2.4/patches/212-htb_time_fix.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/212-htb_time_fix.patch
rename to openwrt/target/linux/generic-2.4/patches/212-htb_time_fix.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/213-htb_disable_hysteresis.patch b/openwrt/target/linux/generic-2.4/patches/213-htb_disable_hysteresis.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/213-htb_disable_hysteresis.patch
rename to openwrt/target/linux/generic-2.4/patches/213-htb_disable_hysteresis.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/222-sound.patch b/openwrt/target/linux/generic-2.4/patches/222-sound.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/222-sound.patch
rename to openwrt/target/linux/generic-2.4/patches/222-sound.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/223-pf_ring.patch b/openwrt/target/linux/generic-2.4/patches/223-pf_ring.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/223-pf_ring.patch
rename to openwrt/target/linux/generic-2.4/patches/223-pf_ring.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/224-atm_hotplug.patch b/openwrt/target/linux/generic-2.4/patches/224-atm_hotplug.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/224-atm_hotplug.patch
rename to openwrt/target/linux/generic-2.4/patches/224-atm_hotplug.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/601-netfilter_ipp2p.patch b/openwrt/target/linux/generic-2.4/patches/601-netfilter_ipp2p.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/601-netfilter_ipp2p.patch
rename to openwrt/target/linux/generic-2.4/patches/601-netfilter_ipp2p.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/602-netfilter_layer7_1.5nbd.patch b/openwrt/target/linux/generic-2.4/patches/602-netfilter_layer7_1.5nbd.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/602-netfilter_layer7_1.5nbd.patch
rename to openwrt/target/linux/generic-2.4/patches/602-netfilter_layer7_1.5nbd.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/603-netfilter_nat_pptp.patch b/openwrt/target/linux/generic-2.4/patches/603-netfilter_nat_pptp.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/603-netfilter_nat_pptp.patch
rename to openwrt/target/linux/generic-2.4/patches/603-netfilter_nat_pptp.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/604-netfilter_maxconn.patch b/openwrt/target/linux/generic-2.4/patches/604-netfilter_maxconn.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/604-netfilter_maxconn.patch
rename to openwrt/target/linux/generic-2.4/patches/604-netfilter_maxconn.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/605-netfilter_TTL.patch b/openwrt/target/linux/generic-2.4/patches/605-netfilter_TTL.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/605-netfilter_TTL.patch
rename to openwrt/target/linux/generic-2.4/patches/605-netfilter_TTL.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/606-netfilter_NETMAP.patch b/openwrt/target/linux/generic-2.4/patches/606-netfilter_NETMAP.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/606-netfilter_NETMAP.patch
rename to openwrt/target/linux/generic-2.4/patches/606-netfilter_NETMAP.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/607-netfilter_connmark.patch b/openwrt/target/linux/generic-2.4/patches/607-netfilter_connmark.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/607-netfilter_connmark.patch
rename to openwrt/target/linux/generic-2.4/patches/607-netfilter_connmark.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/608-netfilter_ipset.patch b/openwrt/target/linux/generic-2.4/patches/608-netfilter_ipset.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/608-netfilter_ipset.patch
rename to openwrt/target/linux/generic-2.4/patches/608-netfilter_ipset.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/609-netfilter_string.patch b/openwrt/target/linux/generic-2.4/patches/609-netfilter_string.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/609-netfilter_string.patch
rename to openwrt/target/linux/generic-2.4/patches/609-netfilter_string.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/610-netfilter_connbytes.patch b/openwrt/target/linux/generic-2.4/patches/610-netfilter_connbytes.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/610-netfilter_connbytes.patch
rename to openwrt/target/linux/generic-2.4/patches/610-netfilter_connbytes.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/611-netfilter_condition.patch b/openwrt/target/linux/generic-2.4/patches/611-netfilter_condition.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/611-netfilter_condition.patch
rename to openwrt/target/linux/generic-2.4/patches/611-netfilter_condition.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/612-netfilter_quota.patch b/openwrt/target/linux/generic-2.4/patches/612-netfilter_quota.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/612-netfilter_quota.patch
rename to openwrt/target/linux/generic-2.4/patches/612-netfilter_quota.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/613-netfilter_nat_sip.patch b/openwrt/target/linux/generic-2.4/patches/613-netfilter_nat_sip.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/613-netfilter_nat_sip.patch
rename to openwrt/target/linux/generic-2.4/patches/613-netfilter_nat_sip.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/614-netfilter_nat_h323.patch b/openwrt/target/linux/generic-2.4/patches/614-netfilter_nat_h323.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/614-netfilter_nat_h323.patch
rename to openwrt/target/linux/generic-2.4/patches/614-netfilter_nat_h323.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/615-netfilter_nat_mms.patch b/openwrt/target/linux/generic-2.4/patches/615-netfilter_nat_mms.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/615-netfilter_nat_mms.patch
rename to openwrt/target/linux/generic-2.4/patches/615-netfilter_nat_mms.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/616-netfilter_imq.patch b/openwrt/target/linux/generic-2.4/patches/616-netfilter_imq.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/616-netfilter_imq.patch
rename to openwrt/target/linux/generic-2.4/patches/616-netfilter_imq.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/617-netfilter_nat_rtsp.patch b/openwrt/target/linux/generic-2.4/patches/617-netfilter_nat_rtsp.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/617-netfilter_nat_rtsp.patch
rename to openwrt/target/linux/generic-2.4/patches/617-netfilter_nat_rtsp.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/618-netfilter_time.patch b/openwrt/target/linux/generic-2.4/patches/618-netfilter_time.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/generic/618-netfilter_time.patch
rename to openwrt/target/linux/generic-2.4/patches/618-netfilter_time.patch
diff --git a/openwrt/target/linux/linux-2.6/Makefile b/openwrt/target/linux/generic-2.6/modules.mk
similarity index 67%
rename from openwrt/target/linux/linux-2.6/Makefile
rename to openwrt/target/linux/generic-2.6/modules.mk
index f18e25d47cc80cd3f41d19b602a1dd110135f3b6..f450e4b92d5055e6794dff3bcabcdb9b9f3af459 100644
--- a/openwrt/target/linux/linux-2.6/Makefile
+++ b/openwrt/target/linux/generic-2.6/modules.mk
@@ -1,56 +1,3 @@
-# $Id$
-# Linux 2.6 kernel target for the OpenWRT project
-
-include $(TOPDIR)/rules.mk
-include ../rules.mk
-
-KERNEL:=2.6
-LINUX_VERSION:=2.6.15
-LINUX_KERNEL_MD5SUM:=cdf95e00f5111e31f78e1d97304d9522
-LINUX_SITE=http://www.fi.kernel.org/pub/linux/kernel/v2.6 \
-           http://www.fr.kernel.org/pub/linux/kernel/v2.6 \
-           http://www.kernel.org/pub/linux/kernel/v2.6 \
-           http://www.de.kernel.org/pub/linux/kernel/v2.6
-MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
-LINUX_KCONFIG:=./config/$(BOARD)
-LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-2.6-$(BOARD)
-LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
-LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
-LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
-	-e 's/mipsel/mips/' \
-	-e 's/powerpc/ppc/' \
-	-e 's/sh[234]/sh/' \
-	)
-
-LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
-LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
-MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
-TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
-IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
-
-PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
-PKG_RELEASE := 1
-
-KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
-KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
-
-KPKG_MAKEOPTS:=	IPKG="$(IPKG_KERNEL)" \
-		BOARD="$(BOARD)" \
-		TARGET_DIR="$(LINUX_TARGET_DIR)" \
-		BUILD_DIR="$(LINUX_BUILD_DIR)" \
-		KERNEL_DIR="$(LINUX_SOURCE_DIR)" \
-		LINUX_VERSION="$(LINUX_VERSION)" \
-		KERNEL_RELEASE="$(PKG_RELEASE)"
-
-include $(LINUX_KCONFIG)
-
-INSTALL_TARGETS := $(KERNEL_IPKG)
-TARGETS := 
-
-ifeq ($(BOARD),x86)
-include ./x86.mk
-endif
-
 include ../netfilter.mk
 
 # Networking
@@ -397,101 +344,3 @@ $(eval $(call KMOD_template,BLUETOOTH,bluetooth,\
 ,CONFIG_BLUEZ))
 
 
-$(TARGETS): $(PACKAGE_DIR)
-
-$(PACKAGE_DIR):
-	mkdir -p $(PACKAGE_DIR)
-
-$(DL_DIR)/$(LINUX_SOURCE):
-	-mkdir -p $(DL_DIR)
-	$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) $(MAKE_TRACE)
-
-$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
-	-mkdir -p $(LINUX_BUILD_DIR)
-	bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
-	rm -f $(LINUX_DIR)
-	ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
-	touch $(LINUX_DIR)/.unpacked
-
-$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
-	$(PATCH) $(LINUX_DIR) ./patches/generic $(MAKE_TRACE)
-	[ -d ./patches/$(BOARD) ] && $(PATCH) $(LINUX_DIR) ./patches/$(BOARD) $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.patched
-
-$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
-	-cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
-	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.configured
-
-$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.configured
-	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
-
-$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
-	$(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
-	touch -c $(LINUX_KERNEL)
-	
-$(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
-	rm -rf $(LINUX_BUILD_DIR)/modules
-	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules $(MAKE_TRACE)
-	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
-	touch $(LINUX_DIR)/.modules_done
-
-$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
-	mkdir -p $(STAGING_DIR)/include
-	tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
-	tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
-
-$(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
-	@mkdir -p $(STAMP_DIR)
-	@$(MAKE) $(TARGETS)
-	ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
-	@$(TRACE) target/linux/package
-	$(MAKE) -C $(TOPDIR)/target/linux/package \
-		$(KPKG_MAKEOPTS) \
-		compile
-	touch $@
-
-$(TARGET_MODULES_DIR): 
-	-mkdir -p $(TARGET_MODULES_DIR)
-
-$(KERNEL_IPKG):
-	rm -rf $(KERNEL_IDIR)
-	mkdir -p $(KERNEL_IDIR)/etc
-	$(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) $(ARCH)
-	if [ -f ./config/$(BOARD).modules ]; then \
-		cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
-	fi
-	$(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
-
-source: $(DL_DIR)/$(LINUX_SOURCE)
-prepare: $(LINUX_DIR)/.configured
-compile:
-	$(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
-
-install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
-	rm -rf $(LINUX_BUILD_DIR)/root*
-	cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
-	echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
-	$(MAKE) -C $(TOPDIR)/target/linux/package \
-		$(KPKG_MAKEOPTS) \
-		install
-	@{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE) 
-
-mostlyclean:
-	rm -f $(STAMP_DIR)/.linux-compile
-	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
-	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
-	$(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
-	rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
-
-rebuild:
-	-$(MAKE) mostlyclean
-	if [ -f $(LINUX_KERNEL) ]; then \
-		$(MAKE) clean $(MAKE_TRACE); \
-	fi
-	$(MAKE) compile $(MAKE_TRACE)
-
-clean:
-	rm -f $(STAMP_DIR)/.linux-compile
-	rm -rf $(LINUX_BUILD_DIR)
-	rm -f $(TARGETS)
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/000-reenable_devfs.patch b/openwrt/target/linux/generic-2.6/patches/000-reenable_devfs.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/000-reenable_devfs.patch
rename to openwrt/target/linux/generic-2.6/patches/000-reenable_devfs.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/001-squashfs.patch b/openwrt/target/linux/generic-2.6/patches/001-squashfs.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/001-squashfs.patch
rename to openwrt/target/linux/generic-2.6/patches/001-squashfs.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/002-squashfs_lzma.patch b/openwrt/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/002-squashfs_lzma.patch
rename to openwrt/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/003-net-b44-1.patch b/openwrt/target/linux/generic-2.6/patches/003-net-b44-1.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/003-net-b44-1.patch
rename to openwrt/target/linux/generic-2.6/patches/003-net-b44-1.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/003-net-b44-2.patch b/openwrt/target/linux/generic-2.6/patches/003-net-b44-2.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/003-net-b44-2.patch
rename to openwrt/target/linux/generic-2.6/patches/003-net-b44-2.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/004-extra_optimization.patch b/openwrt/target/linux/generic-2.6/patches/004-extra_optimization.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/004-extra_optimization.patch
rename to openwrt/target/linux/generic-2.6/patches/004-extra_optimization.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/100-netfilter_layer7.patch b/openwrt/target/linux/generic-2.6/patches/100-netfilter_layer7.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/100-netfilter_layer7.patch
rename to openwrt/target/linux/generic-2.6/patches/100-netfilter_layer7.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/102-openswan-2.4.0.kernel-2.6-natt.patch b/openwrt/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/102-openswan-2.4.0.kernel-2.6-natt.patch
rename to openwrt/target/linux/generic-2.6/patches/102-openswan-2.4.0.kernel-2.6-natt.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/103-netfilter-ipset.patch b/openwrt/target/linux/generic-2.6/patches/103-netfilter-ipset.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/103-netfilter-ipset.patch
rename to openwrt/target/linux/generic-2.6/patches/103-netfilter-ipset.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/104-pf_ring.patch b/openwrt/target/linux/generic-2.6/patches/104-pf_ring.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/104-pf_ring.patch
rename to openwrt/target/linux/generic-2.6/patches/104-pf_ring.patch
diff --git a/openwrt/target/linux/linux-2.6/patches/generic/105-netfilter_time.patch b/openwrt/target/linux/generic-2.6/patches/105-netfilter_time.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/generic/105-netfilter_time.patch
rename to openwrt/target/linux/generic-2.6/patches/105-netfilter_time.patch
diff --git a/openwrt/target/linux/kernel.mk b/openwrt/target/linux/kernel.mk
new file mode 100644
index 0000000000000000000000000000000000000000..74490cf6b407d9821afb8a092f81cd8240d48f73
--- /dev/null
+++ b/openwrt/target/linux/kernel.mk
@@ -0,0 +1,117 @@
+LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
+LINUX_SITE=http://www.fi.kernel.org/pub/linux/kernel/v$(KERNEL) \
+           http://www.fr.kernel.org/pub/linux/kernel/v$(KERNEL) \
+           http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
+           http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
+
+KERNEL_IPKG:=$(LINUX_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
+KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
+
+$(TARGETS): $(PACKAGE_DIR)
+
+$(PACKAGE_DIR):
+	mkdir -p $(PACKAGE_DIR)
+	
+$(DL_DIR)/$(LINUX_SOURCE):
+	-mkdir -p $(DL_DIR)
+	$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE) $(MAKE_TRACE)
+
+$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
+	-mkdir -p $(LINUX_BUILD_DIR)
+	bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
+	rm -f $(BUILD_DIR)/linux
+	ln -s $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
+	touch $@
+
+ifeq ($(KERNEL),2.4)
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
+	$(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
+	  $(LINUX_DIR)/Makefile  \
+	  $(LINUX_DIR)/arch/*/Makefile
+	$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
+	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h $(MAKE_TRACE)
+	touch $@
+
+$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
+	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep $(MAKE_TRACE)
+	touch $@
+
+$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
+else
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
+	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) oldconfig $(MAKE_TRACE)
+	touch $@
+endif
+
+$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.configured
+	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(MAKE_TRACE)
+
+$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
+	$(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ $(MAKE_TRACE)
+	touch -c $(LINUX_KERNEL)
+
+$(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
+	rm -rf $(LINUX_BUILD_DIR)/modules
+	$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH="$(TARGET_PATH)" modules $(MAKE_TRACE)
+	$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install $(MAKE_TRACE)
+	touch $(LINUX_DIR)/.modules_done
+
+$(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
+	mkdir -p $(STAGING_DIR)/include
+	tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
+	tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
+
+$(STAMP_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
+	@mkdir -p $(STAMP_DIR)
+	@$(MAKE) $(TARGETS)
+	ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
+	@$(TRACE) target/linux/package
+	$(MAKE) -C $(TOPDIR)/target/linux/package \
+		$(KPKG_MAKEOPTS) \
+		compile
+	touch $@
+
+$(TARGET_MODULES_DIR): 
+	-mkdir -p $(TARGET_MODULES_DIR)
+
+$(KERNEL_IPKG):
+	rm -rf $(KERNEL_IDIR)
+	mkdir -p $(KERNEL_IDIR)/etc
+	$(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
+	if [ -f ./config/$(BOARD).modules ]; then \
+		cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
+	fi
+	$(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR) $(MAKE_TRACE)
+
+source: $(DL_DIR)/$(LINUX_SOURCE)
+prepare: $(LINUX_DIR)/.configured
+compile:
+	$(MAKE) $(STAMP_DIR)/.linux-compile $(MAKE_TRACE)
+
+install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
+	rm -rf $(LINUX_BUILD_DIR)/root*
+	cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
+	echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
+	$(MAKE) -C $(TOPDIR)/target/linux/package \
+		$(KPKG_MAKEOPTS) \
+		install
+	@{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG_KERNEL) install $(INSTALL_TARGETS) || true; } $(MAKE_TRACE) 
+
+mostlyclean:
+	rm -f $(STAMP_DIR)/.linux-compile
+	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
+	rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
+	$(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(MAKE_TRACE)
+	rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
+
+rebuild:
+	-$(MAKE) mostlyclean
+	if [ -f $(LINUX_KERNEL) ]; then \
+		$(MAKE) clean $(MAKE_TRACE); \
+	fi
+	$(MAKE) compile $(MAKE_TRACE)
+
+clean:
+	rm -f $(STAMP_DIR)/.linux-compile
+	rm -rf $(LINUX_BUILD_DIR)
+	rm -f $(TARGETS)
diff --git a/openwrt/target/linux/linux-2.4/x86.mk b/openwrt/target/linux/linux-2.4/x86.mk
deleted file mode 100644
index 0753b10cce568b6d42687a0b9e626f750a3d284c..0000000000000000000000000000000000000000
--- a/openwrt/target/linux/linux-2.4/x86.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# $Id$
-
-# x86 specific kmod packages
-
-$(eval $(call KMOD_template,WD1100,wd1100,\
-	$(MODULES_DIR)/kernel/drivers/char/wd1100.o \
-,CONFIG_WD1100))
-
-
-$(LINUX_BUILD_DIR)/bzImage: $(LINUX_DIR)/vmlinux
-	$(MAKE) -C $(LINUX_DIR) TOPDIR=$(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) bzImage $(MAKE_TRACE)
-	cp -f $(LINUX_DIR)/arch/i386/boot/bzImage $@
-	touch $@
-
-compile: $(LINUX_BUILD_DIR)/bzImage
diff --git a/openwrt/target/linux/linux-2.6/x86.mk b/openwrt/target/linux/linux-2.6/x86.mk
deleted file mode 100644
index 12ff4bd510aa1fe723b7644a11b589d34f6404b3..0000000000000000000000000000000000000000
--- a/openwrt/target/linux/linux-2.6/x86.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# $Id$
-
-# x86 specific kmod packages
-
-$(LINUX_BUILD_DIR)/bzImage: $(LINUX_DIR)/vmlinux
-	$(MAKE) -C $(LINUX_DIR) V=1 CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) bzImage $(MAKE_TRACE)
-	cp -f $(LINUX_DIR)/arch/i386/boot/bzImage $@
-	touch $@
-
-compile: $(LINUX_BUILD_DIR)/bzImage
diff --git a/openwrt/target/linux/package/Makefile b/openwrt/target/linux/package/Makefile
index 3d28ca77e30b66c912066d87fc9c443410968eec..a2567ea6bc7dab8d10f825493755c7538c644a6a 100644
--- a/openwrt/target/linux/package/Makefile
+++ b/openwrt/target/linux/package/Makefile
@@ -1,11 +1,9 @@
 # Main makefile for the packages
 include $(TOPDIR)/rules.mk
+include ../rules.mk
 
-ifneq ($(BOARD),ar7)
-ifneq ($(BOARD)-$(KERNEL),x86-2.6)
+package-y += base-files
 package-$(BR2_PACKAGE_KMOD_ALSA) += alsa
-endif
-endif
 package-$(BR2_PACKAGE_KMOD_FUSE) += fuse
 package-$(BR2_PACKAGE_KMOD_HOSTAP) += hostap
 package-$(BR2_PACKAGE_KMOD_BCM43XX_DSCAPE) += bcm43xx-dscape
@@ -17,14 +15,11 @@ package-$(BR2_PACKAGE_KMOD_SHFS) += shfs
 package-$(BR2_PACKAGE_KMOD_SPCA5XX) += spca5xx
 package-$(BR2_PACKAGE_KMOD_SWITCH) += switch
 package-$(BR2_PACKAGE_KMOD_UEAGLE_ATM) += ueagle-atm
-package-y += base-files
-bcm43xx-dscape-compile: ieee80211-dscape-compile
-
-ifeq ($(BOARD)-$(KERNEL),brcm-2.4)
 package-$(BR2_PACKAGE_KMOD_DIAG) += diag
 package-$(BR2_PACKAGE_KMOD_WLCOMPAT) += wlcompat
+
+bcm43xx-dscape-compile: ieee80211-dscape-compile
 wlcompat-compile: base-files-compile
-endif
 
 all: compile install
 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
@@ -32,20 +27,12 @@ prepare: $(patsubst %,%-prepare,$(package-y) $(package-m))
 compile: $(patsubst %,%-compile,$(package-y) $(package-m))
 install: $(patsubst %,%-install,$(package-y))
 
-MAKEOPTS:=	BOARD="$(BOARD)" \
-		KERNEL="$(KERNEL)" \
-		IPKG="$(IPKG)" \
-		TARGET_DIR="$(TARGET_DIR)" \
-		BUILD_DIR="$(BUILD_DIR)" \
-		KERNEL_DIR="$(KERNEL_DIR)" \
-		LINUX_VERSION="$(LINUX_VERSION)" \
-		KERNEL_RELEASE="$(KERNEL_RELEASE)"
-
+KPKG_MAKEOPTS += BUILD_DIR="$(LINUX_BUILD_DIR)"
 
 %-prepare:
 	@$(START_TRACE) "target/linux/package/$(patsubst %-prepare,%,$@)/prepare: "
 	$(MAKE) -C $(patsubst %-prepare,%,$@) \
-		$(MAKEOPTS) \
+		$(KPKG_MAKEOPTS) \
 		prepare
 	@$(CMD_TRACE) " done"
 	@$(END_TRACE)
@@ -53,7 +40,7 @@ MAKEOPTS:=	BOARD="$(BOARD)" \
 %-compile:
 	@$(START_TRACE) "target/linux/package/$(patsubst %-compile,%,$@)-compile: "
 	$(MAKE) -C $(patsubst %-compile,%,$@) \
-		$(MAKEOPTS) \
+		$(KPKG_MAKEOPTS) \
 		compile
 	@$(CMD_TRACE) " done"
 	@$(END_TRACE)
@@ -61,7 +48,7 @@ MAKEOPTS:=	BOARD="$(BOARD)" \
 %-install:
 	@$(START_TRACE) "target/linux/package/$(patsubst %-install,%,$@)-install: "
 	$(MAKE) -C $(patsubst %-install,%,$@) \
-		$(MAKEOPTS) \
+		$(KPKG_MAKEOPTS) \
 		install
 	@$(CMD_TRACE) " done"
 	@$(END_TRACE)
diff --git a/openwrt/target/linux/package/alsa/Config.in b/openwrt/target/linux/package/alsa/Config.in
index 29a4e89e1786c6a4a28250319d5d4ac220246760..df4da0b7d1dcf6bc5087cdda347942fb0e0a25e7 100644
--- a/openwrt/target/linux/package/alsa/Config.in
+++ b/openwrt/target/linux/package/alsa/Config.in
@@ -1,9 +1,9 @@
 config BR2_PACKAGE_KMOD_ALSA
 	prompt "kmod-alsa......................... Alsa Sound Drivers"
 	tristate
-	default m if CONFIG_DEVEL
-        depends BR2_LINUX_2_4_X86 || BR2_LINUX_2_4_BRCM || BR2_LINUX_2_6_X86 || BR2_LINUX_2_6_BRCM
+    depends BR2_LINUX_2_4_X86 || BR2_LINUX_2_4_BRCM || BR2_LINUX_2_6_X86 || BR2_LINUX_2_6_BRCM
 	depends BR2_PACKAGE_KMOD_USB_CONTROLLER
 	select BR2_PACKAGE_KMOD_SOUNDCORE
+	default m if CONFIG_DEVEL
 	help
 	  Alsa Drivers for USB Soundcards
diff --git a/openwrt/target/linux/package/alsa/Makefile b/openwrt/target/linux/package/alsa/Makefile
index 02baa44b3457b62d5a36339ce45f87cb4da2ede7..711ee1fc4cb8acf7957edd41e5e8f94cce43b990 100644
--- a/openwrt/target/linux/package/alsa/Makefile
+++ b/openwrt/target/linux/package/alsa/Makefile
@@ -14,29 +14,25 @@ PKG_CAT:=bzcat
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
 include $(TOPDIR)/package/rules.mk
 
 ifeq ($(LINUX_KARCH),i386)
-KERNEL_C_INCS:= -I$(KERNEL_DIR)/include/asm-i386/mach-generic
+KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-i386/mach-generic
 KERNEL_C_OPTS:= -Os -mpreferred-stack-boundary=2 -march=i486 -fno-unit-at-a-time
 endif
 ifeq ($(LINUX_KARCH),mips)
-KERNEL_C_INCS:= -I$(KERNEL_DIR)/include/asm-mips/mach-generic
+KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-mips/mach-generic
 KERNEL_C_OPTS:= -Os -G 0 -mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
 endif
 
-$(eval $(call PKG_template,KMOD_ALSA,kmod-alsa,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_ALSA,kmod-alsa,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	(cd $(PKG_BUILD_DIR); \
 		CFLAGS="$(KERNEL_C_INCS)" \
 		./configure \
-		--with-build=$(KERNEL_DIR) \
-		--with-kernel=$(KERNEL_DIR) \
+		--with-build=$(LINUX_DIR) \
+		--with-kernel=$(LINUX_DIR) \
 		--with-cross=$(KERNEL_CROSS) \
 		--with-redhat=no \
 		--with-suse=no \
diff --git a/openwrt/target/linux/package/bcm43xx-dscape/Makefile b/openwrt/target/linux/package/bcm43xx-dscape/Makefile
index efdede6169919cf4dad0ca7f091ca325671d22df..5856bf74929347240d599efee388b588ff8f94ad 100644
--- a/openwrt/target/linux/package/bcm43xx-dscape/Makefile
+++ b/openwrt/target/linux/package/bcm43xx-dscape/Makefile
@@ -19,12 +19,7 @@ FIRMWARE_BLOB_MD5SUM := e08665c5c5b66beb9c3b2dd54aa80cb3
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_BCM43XX_DSCAPE,kmod-$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)+0.$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
+$(eval $(call PKG_template,KMOD_BCM43XX_DSCAPE,kmod-$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)+0.$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
@@ -38,12 +33,12 @@ $(PKG_BUILD_DIR)/fwcutter/.built:
 	touch $@
 
 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/fwcutter/.built
-	$(MAKE) -C "$(KERNEL_DIR)" \
+	$(MAKE) -C "$(LINUX_DIR)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		ARCH="$(LINUX_KARCH)" \
 		PATH="$(TARGET_PATH)" \
 		SUBDIRS="$(PKG_BUILD_DIR)" \
-		LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/ieee80211-dscape -I$(KERNEL_DIR)/include -DBCM47XX=1" \
+		LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/ieee80211-dscape -I$(LINUX_DIR)/include -DBCM47XX=1" \
 		modules
 	touch $@
 	
diff --git a/openwrt/target/linux/package/diag/Config.in b/openwrt/target/linux/package/diag/Config.in
index 001da0a0050f21a38b8cd8fde1288ea46cc7e707..b34f77369189c05fc9f51e597ac2b7b65db8e993 100644
--- a/openwrt/target/linux/package/diag/Config.in
+++ b/openwrt/target/linux/package/diag/Config.in
@@ -1,8 +1,7 @@
 config BR2_PACKAGE_KMOD_DIAG
 	prompt "kmod-diag......................... Driver for router LEDs and Buttons"
 	tristate
-	default y if BR2_LINUX_2_4_BRCM
+	depends BR2_LINUX_2_4_BRCM
 	default m if CONFIG_DEVEL
-	default n
 	help
 	  Driver for router LEDs and Buttons
diff --git a/openwrt/target/linux/package/diag/Makefile b/openwrt/target/linux/package/diag/Makefile
index 47908f0866a0338e1f67dba61f3c2897f1f3d20c..26bdcc952fe8032a0aab9e080909d28b8843ac90 100644
--- a/openwrt/target/linux/package/diag/Makefile
+++ b/openwrt/target/linux/package/diag/Makefile
@@ -10,16 +10,12 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_DIAG,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
+$(eval $(call PKG_template,KMOD_DIAG,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 DIAG_FLAGS:=$(TARGET_CFLAGS) -D__KERNEL__ -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 \
 		-mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 \
 		-Wa,-mips32 -Wa,--trap -Wstrict-prototypes -Wno-trigraphs -DMODULE -mlong-calls -fno-common -I. -I linux-2.4 -nostdinc \
-		-iwithprefix include -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/include/asm/gcc -c -I$(KERNEL_DIR)/arch/mips/bcm947xx/include -DBCMDRIVER
+		-iwithprefix include -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/asm/gcc -c -I$(LINUX_DIR)/arch/mips/bcm947xx/include -DBCMDRIVER
 
 $(PKG_BUILD_DIR)/.prepared:
 	mkdir -p $(PKG_BUILD_DIR)
diff --git a/openwrt/target/linux/package/fuse/Makefile b/openwrt/target/linux/package/fuse/Makefile
index 60134b77995cfcc980f59d78aab2d1b26b7fad98..62d6df36d9cf90dd031dd6f2ec2e0eeec9ddb3af 100644
--- a/openwrt/target/linux/package/fuse/Makefile
+++ b/openwrt/target/linux/package/fuse/Makefile
@@ -15,13 +15,9 @@ PKG_CAT:=zcat
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_FUSE,kmod-fuse,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_FUSE,kmod-fuse,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	(cd $(PKG_BUILD_DIR); \
@@ -60,7 +56,7 @@ $(PKG_BUILD_DIR)/.configured:
 			--disable-util \
 			--disable-example \
 			--disable-auto-modprobe \
-			--with-kernel=$(KERNEL_DIR) \
+			--with-kernel=$(LINUX_DIR) \
 			--disable-mtab \
 	);
 	touch $@
diff --git a/openwrt/target/linux/package/hostap/Makefile b/openwrt/target/linux/package/hostap/Makefile
index 7fff683ae67dfc2a021cf58bd8cd8ede26812f5b..ac031e3bc9aba875843bbc84f93e8e40382054e8 100644
--- a/openwrt/target/linux/package/hostap/Makefile
+++ b/openwrt/target/linux/package/hostap/Makefile
@@ -15,21 +15,17 @@ PKG_CAT:=zcat
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_HOSTAP,kmod-hostap,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-$(eval $(call PKG_template,KMOD_HOSTAP_PCI,kmod-hostap-pci,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-$(eval $(call PKG_template,KMOD_HOSTAP_PLX,kmod-hostap-plx,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_HOSTAP,kmod-hostap,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
+$(eval $(call PKG_template,KMOD_HOSTAP_PCI,kmod-hostap-pci,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
+$(eval $(call PKG_template,KMOD_HOSTAP_PLX,kmod-hostap-plx,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
 
 $(PKG_BUILD_DIR)/.built: 
-	$(MAKE) -C $(KERNEL_DIR)/ \
+	$(MAKE) -C $(LINUX_DIR)/ \
 		ARCH="$(LINUX_KARCH)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		SUBDIRS="$(PKG_BUILD_DIR)/driver/modules" \
diff --git a/openwrt/target/linux/package/ieee80211-dscape/Makefile b/openwrt/target/linux/package/ieee80211-dscape/Makefile
index 90d55b3c13d62b3517652f953d0a41ee10e97d6b..90fe09d3d84dc145f24544c220f0039601cd025c 100644
--- a/openwrt/target/linux/package/ieee80211-dscape/Makefile
+++ b/openwrt/target/linux/package/ieee80211-dscape/Makefile
@@ -9,12 +9,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_IEEE80211_DSCAPE,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
+$(eval $(call PKG_template,KMOD_IEEE80211_DSCAPE,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.prepared:
 	mkdir -p $(PKG_BUILD_DIR)
@@ -25,12 +20,12 @@ $(PKG_BUILD_DIR)/.configured:
 	touch $@
 
 $(PKG_BUILD_DIR)/.built:
-	$(MAKE) -C "$(KERNEL_DIR)" \
+	$(MAKE) -C "$(LINUX_DIR)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		ARCH="$(LINUX_KARCH)" \
 		PATH="$(TARGET_PATH)" \
 		SUBDIRS="$(PKG_BUILD_DIR)" \
-		LINUXINCLUDE="-I$(shell pwd)/src/include -I$(KERNEL_DIR)/include" \
+		LINUXINCLUDE="-I$(shell pwd)/src/include -I$(LINUX_DIR)/include" \
 		modules
 	touch $@
 	
diff --git a/openwrt/target/linux/package/madwifi/Makefile b/openwrt/target/linux/package/madwifi/Makefile
index 5432055c3523c7d11c906753c52f9c5174acaec9..c6dd8e106f497c425056f95a6f645b0f368c27e9 100644
--- a/openwrt/target/linux/package/madwifi/Makefile
+++ b/openwrt/target/linux/package/madwifi/Makefile
@@ -14,10 +14,6 @@ PKG_CAT:=zcat
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-ng-$(PKG_VERSION)
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
 ifeq ($(ARCH),mips)
 HAL_TARGET:=mips-be-elf
 endif
@@ -38,7 +34,7 @@ endif
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_MADWIFI,kmod-madwifi,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_MADWIFI,kmod-madwifi,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
@@ -51,7 +47,7 @@ $(PKG_BUILD_DIR)/.built:
 		TARGET="$(HAL_TARGET)" \
 		TOOLPREFIX="$(KERNEL_CROSS)" \
 		TOOLPATH="$(KERNEL_CROSS)" \
-		KERNELPATH="$(KERNEL_DIR)" \
+		KERNELPATH="$(LINUX_DIR)" \
 		BUS="$(BUS)" \
 		all
 	touch $@
diff --git a/openwrt/target/linux/package/mini_fo/Makefile b/openwrt/target/linux/package/mini_fo/Makefile
index cb1e1ad2c88363270403f7874d20cd9ec2c3607b..e4071a78e2dd306ba1f8dddb28375a907a6d8336 100644
--- a/openwrt/target/linux/package/mini_fo/Makefile
+++ b/openwrt/target/linux/package/mini_fo/Makefile
@@ -15,14 +15,9 @@ PKG_CAT := bzcat
 PKG_BUILD_DIR := $(BUILD_DIR)/mini_fo-0-6-2-pre1
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_MINI_FO,kmod-mini-fo,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_MINI_FO,kmod-mini-fo,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
@@ -33,7 +28,7 @@ $(PKG_BUILD_DIR)/.built:
 		ARCH="$(LINUX_KARCH)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		KERNELVERSION="$(KERNEL_VERSION)" \
-		KERNEL_SRC="$(KERNEL_DIR)" \
+		KERNEL_SRC="$(LINUX_DIR)" \
 		all
 	touch $@
 
diff --git a/openwrt/target/linux/package/openswan/Makefile b/openwrt/target/linux/package/openswan/Makefile
index 1f2dbb1268d5c94423cce34102f8f8629f2c76ed..e7faf3e361accf0933600419b76827327fde2b0d 100644
--- a/openwrt/target/linux/package/openswan/Makefile
+++ b/openwrt/target/linux/package/openswan/Makefile
@@ -15,19 +15,15 @@ PKG_CAT:=zcat
 
 include $(TOPDIR)/package/rules.mk
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
-$(eval $(call PKG_template,KMOD_OPENSWAN,kmod-openswan,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_OPENSWAN,kmod-openswan,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 FLAGS := $(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/linux/include -L$(STAGING_DIR)/usr/lib -I$(STAGING_DIR)/usr/include
 
 $(PKG_BUILD_DIR)/.built:
 	$(MAKE) -C $(PKG_BUILD_DIR) \
 		$(TARGET_CONFIGURE_OPTS) \
-		KERNEL_RELEASE="$(KERNEL_RELEASE)" \
-		KERNELSRC="$(KERNEL_DIR)" \
+		LINUX_RELEASE="$(LINUX_RELEASE)" \
+		KERNELSRC="$(LINUX_DIR)" \
 		ARCH="$(LINUX_KARCH)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		USERCOMPILE="$(FLAGS)" \
diff --git a/openwrt/target/linux/package/shfs/Makefile b/openwrt/target/linux/package/shfs/Makefile
index 5380792b4b1e8ec6d1e9fc907f1e4a156a06b2cd..a0ac839479cd5da2c34f4af75cbca90fecbcb8cb 100644
--- a/openwrt/target/linux/package/shfs/Makefile
+++ b/openwrt/target/linux/package/shfs/Makefile
@@ -15,13 +15,9 @@ PKG_CAT:=zcat
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_SHFS,kmod-shfs,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_SHFS,kmod-shfs,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
@@ -37,7 +33,7 @@ $(PKG_BUILD_DIR)/.built:
 		CC="$(TARGET_CC)" \
 		LINKER="$(TARGET_CC)" \
 		KERNEL="$(LINUX_VERSION)" \
-		KERNEL_SOURCES="$(KERNEL_DIR)" \
+		KERNEL_SOURCES="$(LINUX_DIR)" \
 		ROOT="$(PKG_INSTALL_DIR)" \
 		module module-install
 	touch $@
diff --git a/openwrt/target/linux/package/spca5xx/Makefile b/openwrt/target/linux/package/spca5xx/Makefile
index 4bbee25d5b157aed9d5ed1cdd863b625901d3cc7..08a4023cb4fce612552e4f4940072164792e4400 100644
--- a/openwrt/target/linux/package/spca5xx/Makefile
+++ b/openwrt/target/linux/package/spca5xx/Makefile
@@ -15,20 +15,15 @@ PKG_CAT:=zcat
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_SPCA5XX,kmod-spca5xx,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_SPCA5XX,kmod-spca5xx,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
 
 $(PKG_BUILD_DIR)/.built: 
-	$(MAKE) -C $(KERNEL_DIR) \
+	$(MAKE) -C $(LINUX_DIR) \
 		ARCH="$(LINUX_KARCH)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		KERNELVERSION="$(KERNEL_VERSION)" \
diff --git a/openwrt/target/linux/package/switch/Makefile b/openwrt/target/linux/package/switch/Makefile
index 6c2deed6c510722085eb3da5401280222d27eac5..cecdccca17794c0d3afca8aaa16d749bbc77c12d 100644
--- a/openwrt/target/linux/package/switch/Makefile
+++ b/openwrt/target/linux/package/switch/Makefile
@@ -9,12 +9,7 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_SWITCH,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
+$(eval $(call PKG_template,KMOD_SWITCH,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.prepared:
 	mkdir -p $(PKG_BUILD_DIR)
@@ -25,7 +20,7 @@ $(PKG_BUILD_DIR)/.configured:
 	touch $@
 
 $(PKG_BUILD_DIR)/.built:
-	$(MAKE) -C "$(KERNEL_DIR)" \
+	$(MAKE) -C "$(LINUX_DIR)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		ARCH="$(LINUX_KARCH)" \
 		PATH="$(TARGET_PATH)" \
diff --git a/openwrt/target/linux/package/ueagle-atm/Makefile b/openwrt/target/linux/package/ueagle-atm/Makefile
index 66f03f6a45ddeea11a79ce05ed78c811bf3a0a93..2da1f463e1a91438bbff6de55dff51e2b00bd4e3 100644
--- a/openwrt/target/linux/package/ueagle-atm/Makefile
+++ b/openwrt/target/linux/package/ueagle-atm/Makefile
@@ -15,14 +15,9 @@ PKG_CAT:=zcat
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
-KERNEL_VERSION=$(shell echo "$(LINUX_VERSION)" | cut -d. -f1,2)
-
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_UEAGLE_ATM,kmod-ueagle-atm,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(KERNEL_RELEASE))))
+$(eval $(call PKG_template,KMOD_UEAGLE_ATM,kmod-ueagle-atm,$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel-$(LINUX_VERSION)-$(BOARD) ($(LINUX_RELEASE))))
 
 $(PKG_BUILD_DIR)/.configured:
 	touch $@
@@ -32,7 +27,7 @@ $(PKG_BUILD_DIR)/.built:
 		ARCH="$(LINUX_KARCH)" \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
 		TARGET="$(HAL_TARGET)" \
-		KERNELDIR="$(KERNEL_DIR)" \
+		KERNELDIR="$(LINUX_DIR)" \
 		all
 	touch $@
 
diff --git a/openwrt/target/linux/package/wlcompat/Makefile b/openwrt/target/linux/package/wlcompat/Makefile
index e8f69c4c90bb8acea1dabeedd4745e5d104bd4e7..718b584aae776d612147eaaf51d10f072e527a18 100644
--- a/openwrt/target/linux/package/wlcompat/Makefile
+++ b/openwrt/target/linux/package/wlcompat/Makefile
@@ -8,17 +8,13 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
 
-$(eval $(call PKG_template,KMOD_WLCOMPAT,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-$(eval $(call PKG_template,KMOD_WLCOMPAT_DEBUG,$(PKG_NAME)-debug,$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(KERNEL_RELEASE))))
-
-ifeq ($(KERNEL_DIR),)
-KERNEL_DIR:=$(LINUX_DIR)
-endif
+$(eval $(call PKG_template,KMOD_WLCOMPAT,$(PKG_NAME),$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
+$(eval $(call PKG_template,KMOD_WLCOMPAT_DEBUG,$(PKG_NAME)-debug,$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE),$(ARCH),kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))))
 
 WLCOMPAT_FLAGS:=$(TARGET_CFLAGS) -D__KERNEL__ -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 \
 		-mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 \
 		-Wa,-mips32 -Wa,--trap -DMODULE -mlong-calls -fno-common -I. -I linux-2.4 -funsigned-char -nostdinc \
-		-iwithprefix include -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/include/asm/gcc -I$(STAGING_DIR)/usr/include -c
+		-iwithprefix include -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/asm/gcc -I$(STAGING_DIR)/usr/include -c
 
 $(PKG_BUILD_DIR)/.prepared:
 	mkdir -p $(PKG_BUILD_DIR)
diff --git a/openwrt/target/linux/rules.mk b/openwrt/target/linux/rules.mk
index 758b5251321e7401e1263d7ea4aa81b1b43ce60c..b921f153c16b2a33443432a09d2f658f9388291a 100644
--- a/openwrt/target/linux/rules.mk
+++ b/openwrt/target/linux/rules.mk
@@ -1,3 +1,20 @@
+KERNEL:=unknown
+ifneq (,$(findstring 2.4.,$(LINUX_VERSION)))
+KERNEL:=2.4
+endif
+ifneq (,$(findstring 2.6.,$(LINUX_VERSION)))
+KERNEL:=2.6
+endif
+
+MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
+
+LINUX_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
+LINUX_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
+LINUX_KERNEL:=$(LINUX_BUILD_DIR)/vmlinux
+
+LINUX_TARGET_DIR:=$(LINUX_BUILD_DIR)/root
+IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
+
 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
 	-e 's/mipsel/mips/' \
 	-e 's/mipseb/mips/' \
@@ -5,6 +22,19 @@ LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
 	-e 's/sh[234]/sh/' \
 )
 
+KPKG_MAKEOPTS:=	IPKG="$(IPKG_KERNEL)" \
+		BOARD="$(BOARD)" \
+		KERNEL="$(KERNEL)" \
+		TARGET_DIR="$(LINUX_TARGET_DIR)" \
+		LINUX_BUILD_DIR="$(LINUX_BUILD_DIR)" \
+		LINUX_DIR="$(LINUX_DIR)" \
+		LINUX_VERSION="$(LINUX_VERSION)" \
+		LINUX_RELEASE="$(LINUX_RELEASE)"
+
+KMOD_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
+MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
+TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
+
 ifeq ($(KERNEL),2.6)
 LINUX_KMOD_SUFFIX=ko
 else
@@ -18,10 +48,10 @@ else
 KDEPEND_$(1):=$($(4))
 endif
 
-IDEPEND_$(1):=kernel ($(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)) $(foreach pkg,$(5),", $(pkg)")
+IDEPEND_$(1):=kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)) $(foreach pkg,$(5),", $(pkg)")
 
-PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
-I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
+PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
+I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(2)
 
 ifeq ($$(KDEPEND_$(1)),m)
 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
@@ -34,7 +64,7 @@ endif
 
 $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
 	rm -rf $$(I_$(1))
-	$(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) $(ARCH)
+	$(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
 	echo "Depends: $$(IDEPEND_$(1))" >> $$(I_$(1))/CONTROL/control
 ifneq ($(strip $(3)),)
 	mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
@@ -51,4 +81,6 @@ endif
 
 endef
 
+INSTALL_TARGETS := $(KERNEL_IPKG)
+TARGETS := 
 
diff --git a/openwrt/target/linux/x86-2.4/Makefile b/openwrt/target/linux/x86-2.4/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..97ded843f74785a2ca42c2b72de82595f50594f6
--- /dev/null
+++ b/openwrt/target/linux/x86-2.4/Makefile
@@ -0,0 +1,30 @@
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.4.32
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=38f4d0830e95a20f4bfed17622d5557c
+
+include ../rules.mk
+include ./config
+
+$(eval $(call KMOD_template,WD1100,wd1100,\
+	$(MODULES_DIR)/kernel/drivers/char/wd1100.o \
+,CONFIG_WD1100))
+
+
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
+$(LINUX_BUILD_DIR)/bzImage: $(LINUX_DIR)/vmlinux
+	$(MAKE) -C $(LINUX_DIR) TOPDIR=$(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) bzImage $(MAKE_TRACE)
+	cp -f $(LINUX_DIR)/arch/i386/boot/bzImage $@
+	touch $@
+
+compile: $(LINUX_BUILD_DIR)/bzImage
diff --git a/openwrt/target/linux/linux-2.4/config/x86 b/openwrt/target/linux/x86-2.4/config
similarity index 100%
rename from openwrt/target/linux/linux-2.4/config/x86
rename to openwrt/target/linux/x86-2.4/config
diff --git a/openwrt/target/linux/linux-2.4/patches/x86/001-mgeode-cpu.patch b/openwrt/target/linux/x86-2.4/patches/001-mgeode-cpu.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/x86/001-mgeode-cpu.patch
rename to openwrt/target/linux/x86-2.4/patches/001-mgeode-cpu.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/x86/002-wd1100.patch b/openwrt/target/linux/x86-2.4/patches/002-wd1100.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/x86/002-wd1100.patch
rename to openwrt/target/linux/x86-2.4/patches/002-wd1100.patch
diff --git a/openwrt/target/linux/linux-2.4/patches/x86/003-mgeode-pci.patch b/openwrt/target/linux/x86-2.4/patches/003-mgeode-pci.patch
similarity index 100%
rename from openwrt/target/linux/linux-2.4/patches/x86/003-mgeode-pci.patch
rename to openwrt/target/linux/x86-2.4/patches/003-mgeode-pci.patch
diff --git a/openwrt/target/linux/x86-2.6/Makefile b/openwrt/target/linux/x86-2.6/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..bfdc0757de0a0ab85336890c2ac57558970cfa51
--- /dev/null
+++ b/openwrt/target/linux/x86-2.6/Makefile
@@ -0,0 +1,25 @@
+include $(TOPDIR)/rules.mk
+
+LINUX_VERSION:=2.6.15
+LINUX_RELEASE:=1
+LINUX_KERNEL_MD5SUM:=cdf95e00f5111e31f78e1d97304d9522
+
+include ../rules.mk
+include ./config
+
+include ../generic-$(KERNEL)/modules.mk
+include ../kernel.mk
+
+
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	[ -d ../generic-$(KERNEL)/patches ] && $(PATCH) $(LINUX_DIR) ../generic-$(KERNEL)/patches $(MAKE_TRACE)
+	[ -d ./patches ] && $(PATCH) $(LINUX_DIR) ./patches $(MAKE_TRACE)
+	@cp config $(LINUX_DIR)/.config
+	touch $@
+
+$(LINUX_BUILD_DIR)/bzImage: $(LINUX_DIR)/vmlinux
+	$(MAKE) -C $(LINUX_DIR) V=1 CROSS_COMPILE=$(TARGET_CROSS) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) bzImage $(MAKE_TRACE)
+	cp -f $(LINUX_DIR)/arch/i386/boot/bzImage $@
+	touch $@
+
+compile: $(LINUX_BUILD_DIR)/bzImage
diff --git a/openwrt/target/linux/linux-2.6/config/x86 b/openwrt/target/linux/x86-2.6/config
similarity index 100%
rename from openwrt/target/linux/linux-2.6/config/x86
rename to openwrt/target/linux/x86-2.6/config
diff --git a/openwrt/target/linux/linux-2.6/patches/x86/scx200-hr-timer-2.6.12-rc6-6.diff b/openwrt/target/linux/x86-2.6/patches/scx200-hr-timer-2.6.12-rc6-6.diff
similarity index 100%
rename from openwrt/target/linux/linux-2.6/patches/x86/scx200-hr-timer-2.6.12-rc6-6.diff
rename to openwrt/target/linux/x86-2.6/patches/scx200-hr-timer-2.6.12-rc6-6.diff