summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-06-26 01:55:47 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-06-26 01:55:47 +0000
commit539e5f19d6bc417179b729466077adb6fc449720 (patch)
tree0f66e1e98c7045b140cf8ee7b33f3ad5cf67dcd2
parent77aeb32a1d3d514d184d8911f801fa1e2d26bf0d (diff)
add support for new modules.mk format (no autogenerated Config.in yet)
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4083 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--include/kernel-build.mk90
-rw-r--r--include/modules-2.4.mk5
-rw-r--r--include/modules-2.6.mk5
-rw-r--r--include/modules.mk27
-rw-r--r--target/linux/Config.in20
5 files changed, 134 insertions, 13 deletions
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 706764db58..3a455a812e 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -127,3 +127,93 @@ clean: FORCE
rm -f $(STAMP_DIR)/.linux-compile
rm -rf $(KERNEL_BUILD_DIR)
rm -f $(TARGETS)
+
+
+define AutoLoad
+add_module $(1) "$(2)";
+endef
+
+define KernelPackage/Defaults
+ VERSION:=$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)
+ DEPENDS:=
+ MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
+ SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
+ PKGARCH:=$(ARCH)
+ PRIORITY:=optional
+ KCONFIG:=
+ FILES:=
+ BUILD:=
+ MODULES:=
+ TITLE:=
+ DESCRIPTION:=
+endef
+
+define KernelPackage
+ NAME:=$(1)
+ $(eval $(call KernelPackage/Defaults))
+ $(eval $(call KernelPackage/$(1)))
+ $(eval $(call KernelPackage/$(1)/$(KERNEL)))
+
+ PKG_$(1) := $(PACKAGE_DIR)/kmod-$(1)_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
+ I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(1)
+
+ IDEPEND_$(1):='kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))' $(DEPENDS)
+
+ ifeq ($$(strip $(KCONFIG)),)
+ KDEPEND_$(1):=m
+ else
+ KDEPEND_$(1):=$($(KCONFIG))
+ endif
+ ifeq ($$(KDEPEND_$(1)),m)
+ ifneq ($(CONFIG_PACKAGE_kmod-$(1)),)
+ packages: $$(PKG_$(1))
+ endif
+ ifeq ($(CONFIG_PACKAGE_kmod-$(1)),y)
+ install-kmod-$(1): FORCE
+ $(IPKG) install $$(PKG_$(1))
+ pkg-install: install-kmod-$(1)
+ endif
+ endif
+
+ $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
+ rm -rf $$(I_$(1))
+ install -d -m0755 $$(I_$(1))/CONTROL
+ echo "Package: kmod-$(1)" > $$(I_$(1))/CONTROL/control
+ echo "Version: $(VERSION)" >> $$(I_$(1))/CONTROL/control
+ ( \
+ DEPENDS=; \
+ for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
+ DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
+ done; \
+ echo "Depends: $$$$DEPENDS" >> $$(I_$(1))/CONTROL/control; \
+ )
+ echo "Source: $(SOURCE)" >> $$(I_$(1))/CONTROL/control
+ echo "Section: kernel" >> $$(I_$(1))/CONTROL/control
+ echo "Priority: $(PRIORITY)" >> $$(I_$(1))/CONTROL/control
+ echo "Maintainer: $(MAINTAINER)" >> $$(I_$(1))/CONTROL/control
+ echo "Architecture: $(PKGARCH)" >> $$(I_$(1))/CONTROL/control
+ echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(I_$(1))/CONTROL/control
+ ifneq ($(strip $(FILES)),)
+ mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
+ $(CP) $(FILES) $$(I_$(1))/lib/modules/$(LINUX_VERSION)/
+ endif
+ ifneq ($(MODULES),)
+ export modules=; \
+ add_module() { \
+ mkdir -p $$(I_$(1))/etc/modules.d; \
+ echo "$$$$2" > $$(I_$(1))/etc/modules.d/$$$$1-$(1); \
+ modules="$$$${modules:+$$$$modules }$$$$1-$(1)"; \
+ }; \
+ $(MODULES) \
+ mkdir -p $$(I_$(1))/etc/modules.d; \
+ echo "#!/bin/sh" >> $$(I_$(1))/CONTROL/postinst; \
+ echo "[ -z \"\$$$$IPKG_INSTROOT\" ] || exit" >> $$(I_$(1))/CONTROL/postinst; \
+ echo ". /etc/functions.sh" >> $$(I_$(1))/CONTROL/postinst; \
+ echo "load_modules $$$$modules" >> $$(I_$(1))/CONTROL/postinst; \
+ chmod 0755 $$(I_$(1))/CONTROL/postinst;
+ endif
+ $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR)
+endef
+
+-include $(INCLUDE_DIR)/modules.mk
+
diff --git a/include/modules-2.4.mk b/include/modules-2.4.mk
index 553db03270..325cf16bcc 100644
--- a/include/modules-2.4.mk
+++ b/include/modules-2.4.mk
@@ -107,11 +107,6 @@ $(eval $(call KMOD_template,IP6TABLES,ip6tables,\
# Block devices
-$(eval $(call KMOD_template,IDE,ide,\
- $(MODULES_DIR)/kernel/drivers/ide/*.o \
- $(MODULES_DIR)/kernel/drivers/ide/*/*.o \
-,CONFIG_IDE,,20,pdc202xx_old ide-core ide-detect ide-disk))
-
$(eval $(call KMOD_template,LOOP,loop,\
$(MODULES_DIR)/kernel/drivers/block/loop.o \
,CONFIG_BLK_DEV_LOOP,,20,loop))
diff --git a/include/modules-2.6.mk b/include/modules-2.6.mk
index aada707fbc..6e8a2ded70 100644
--- a/include/modules-2.6.mk
+++ b/include/modules-2.6.mk
@@ -112,11 +112,6 @@ $(eval $(call KMOD_template,IP6TABLES,ip6tables,\
# Block devices
-$(eval $(call KMOD_template,IDE,ide,\
- $(MODULES_DIR)/kernel/drivers/ide/*.ko \
- $(MODULES_DIR)/kernel/drivers/ide/*/*.ko \
-,CONFIG_IDE))
-
$(eval $(call KMOD_template,LOOP,loop,\
$(MODULES_DIR)/kernel/drivers/block/loop.ko \
,CONFIG_BLK_DEV_LOOP,,20,loop))
diff --git a/include/modules.mk b/include/modules.mk
new file mode 100644
index 0000000000..026c4a6103
--- /dev/null
+++ b/include/modules.mk
@@ -0,0 +1,27 @@
+include $(TOPDIR)/include/kernel.mk
+
+define KernelPackage/ide-core
+TITLE:=Kernel support for IDE
+DESCRIPTION:=Kernel modules for IDE support\\\
+ useful for usb mass storage devices (e.g. on WL-HDD)\\\
+ \\\
+ Includes: \\\
+ - ide-core \\\
+ - ide-detect \\\
+ - ide-disk \\\
+ - pdc202xx_old
+KCONFIG:=CONFIG_IDE
+FILES:=$(MODULES_DIR)/kernel/drivers/ide/*.$(LINUX_KMOD_SUFFIX)
+MODULES:=$(call AutoLoad,20,ide-core) $(call AutoLoad,90,ide-detect ide-disk)
+endef
+$(eval $(call KernelPackage,ide-core))
+
+define KernelPackage/ide-pdc202xx
+TITLE:=PDC202xx IDE driver
+DESCRIPTION:=PDC202xx IDE driver
+KCONFIG:=CONFIG_BLK_DEV_PDC202XX_OLD
+FILES:=$(MODULES_DIR)/kernel/drivers/ide/pci/pdc202xx_old.$(LINUX_KMOD_SUFFIX)
+MODULES:=$(call AutoLoad,30,pdc202xx_old)
+endef
+$(eval $(call KernelPackage,ide-pdc202xx))
+
diff --git a/target/linux/Config.in b/target/linux/Config.in
index 71f88d7a52..65b8592abd 100644
--- a/target/linux/Config.in
+++ b/target/linux/Config.in
@@ -265,8 +265,8 @@ endmenu
menu "Block devices support"
-config PACKAGE_KMOD_IDE
- prompt "kmod-ide.......................... IDE support"
+config PACKAGE_kmod-ide-core
+ prompt "kmod-ide-core..................... IDE support"
tristate
default m
depends LINUX_2_4_X86 || LINUX_2_6_X86 || LINUX_2_4_BRCM || LINUX_2_6_BRCM
@@ -278,7 +278,21 @@ config PACKAGE_KMOD_IDE
- ide-core
- ide-detect
- ide-disk
- - pdc202xx_old
+
+config PACKAGE_kmod-ide-pdc202xx
+ prompt "kmod-ide-pdc202xx................. PDC202xx driver"
+ tristate
+ default m
+ depends PACKAGE_kmod-ide-core
+ depends LINUX_2_4_X86 || LINUX_2_6_X86 || LINUX_2_4_BRCM || LINUX_2_6_BRCM
+ help
+ Kernel modules for IDE support
+ useful for usb mass storage devices (e.g. on WL-HDD)
+
+ Includes:
+ - ide-core
+ - ide-detect
+ - ide-disk
config PACKAGE_KMOD_LOOP
prompt "kmod-loop......................... Loop mount support"