summaryrefslogtreecommitdiff
path: root/openwrt/target/linux/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/target/linux/rules.mk')
-rw-r--r--openwrt/target/linux/rules.mk28
1 files changed, 28 insertions, 0 deletions
diff --git a/openwrt/target/linux/rules.mk b/openwrt/target/linux/rules.mk
new file mode 100644
index 0000000000..be10370cf6
--- /dev/null
+++ b/openwrt/target/linux/rules.mk
@@ -0,0 +1,28 @@
+define KMOD_template
+ifeq ($$(strip $(4)),)
+KDEPEND_$(1):=m
+else
+KDEPEND_$(1):=$($(4))
+endif
+
+PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
+
+ifeq ($$(KDEPEND_$(1)),m)
+ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
+TARGETS += $$(PKG_$(1))
+endif
+ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
+INSTALL_TARGETS += $$(PKG_$(1))
+endif
+endif
+
+$$(PKG_$(1)): $(LINUX_DIR)/.modules_done
+ mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(PKG_RELEASE) $(ARCH)
+ cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
+ $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR)
+
+endef
+
+