fix kernel module defaults
[openwrt.git] / package / kernel / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=kernel
13 PKG_VERSION:=$(LINUX_VERSION)-$(BOARD)
14 PKG_RELEASE:=1
15
16 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages
17
18 include $(INCLUDE_DIR)/package.mk
19 ifeq ($(DUMP),)
20 -include $(LINUX_DIR)/.config
21 include $(INCLUDE_DIR)/netfilter.mk
22 endif
23
24 define Build/Prepare
25 mkdir -p $(PKG_BUILD_DIR)
26 endef
27
28 define Build/Compile
29 endef
30
31 define KernelPackage/Defaults
32 FILES:=
33 KCONFIG:=m
34 AUTOLOAD:=
35 endef
36
37 define ModuleAutoLoad
38 export modules=; \
39 add_module() { \
40 mkdir -p $(2)/etc/modules.d; \
41 echo "$$$$$$$$2" > $(2)/etc/modules.d/$$$$$$$$1-$(1); \
42 modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \
43 }; \
44 $(3) \
45 if [ -n "$$$$$$$$modules" ]; then \
46 mkdir -p $(2)/etc/modules.d; \
47 echo "#!/bin/sh" >> $(2)/CONTROL/postinst; \
48 echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit" >> $(2)/CONTROL/postinst; \
49 echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \
50 echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \
51 chmod 0755 $(2)/CONTROL/postinst; \
52 fi
53 endef
54
55
56 define KernelPackage
57 NAME:=$(1)
58 $(eval $(call KernelPackage/Defaults))
59 $(eval $(call KernelPackage/$(1)))
60 $(eval $(call KernelPackage/$(1)/$(KERNEL)))
61
62 ifneq ($(findstring m,$(KCONFIG)),m)
63 CONFIG_PACKAGE_kmod-$(1):=
64 endif
65
66 define Package/kmod-$(1)
67 TITLE:=$(TITLE)
68 SECTION:=kernel
69 CATEGORY:=Kernel modules
70 DEFAULT:=m
71 DESCRIPTION:=$(DESCRIPTION)
72 EXTRA_DEPENDS:='kernel (=$(PKG_VERSION))'
73 $(call KernelPackage/$(1))
74 $(call KernelPackage/$(1)/$(KERNEL))
75 endef
76
77 define Package/kmod-$(1)/install
78 mkdir -p $$(1)/lib/modules/$(LINUX_VERSION)
79 $(CP) $(FILES) $$(1)/lib/modules/$(LINUX_VERSION)/
80 $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD))
81 endef
82 $$(eval $$(call BuildPackage,kmod-$(1)))
83 endef
84
85 define AutoLoad
86 add_module $(1) "$(2)";
87 endef
88
89 include ./modules.mk
90
This page took 0.052308 seconds and 5 git commands to generate.