add support for new modules.mk format (no autogenerated Config.in yet)
authorFelix Fietkau <nbd@openwrt.org>
Mon, 26 Jun 2006 01:55:47 +0000 (01:55 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 26 Jun 2006 01:55:47 +0000 (01:55 +0000)
SVN-Revision: 4083

openwrt/include/kernel-build.mk
openwrt/include/modules-2.4.mk
openwrt/include/modules-2.6.mk
openwrt/include/modules.mk [new file with mode: 0644]
openwrt/target/linux/Config.in

index 706764db5819aea93a2b198f4d9d66e9a22c89b1..3a455a812ecdb95fc4c427b0bd0f72dde7d55066 100644 (file)
@@ -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
+
index 553db03270fdbd6c68dc56b697424f3d0ff4426b..325cf16bccb417d32ff317e34cdb688b1ea883ad 100644 (file)
@@ -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))
index aada707fbcce245540d29851d5a4ee9f1b5fcfef..6e8a2ded70f9c634c9714cee2a597a3d90fb1c71 100644 (file)
@@ -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/openwrt/include/modules.mk b/openwrt/include/modules.mk
new file mode 100644 (file)
index 0000000..026c4a6
--- /dev/null
@@ -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))
+
index 71f88d7a527a36b9c47f778494976a9a067ac0d8..65b8592abdca8348388e827e826ca652217929da 100644 (file)
@@ -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"