2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
11 LINUX_VERSION?=<LINUX_VERSION>
13 include $(INCLUDE_DIR)/target.mk
21 ifneq (,$(findstring uml,$(BOARD)))
25 KERNEL_CC:=$(TARGET_CC)
26 KERNEL_CROSS:=$(TARGET_CROSS)
29 KERNEL_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
30 LINUX_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
32 MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
33 MODULES_DIR := $(KERNEL_BUILD_DIR)/modules/$(MODULES_SUBDIR)
34 TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
36 LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux
38 LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
39 LINUX_SITE:=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
40 http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
41 http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
42 http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
47 define KernelPackage/Defaults
56 mkdir -p $(2)/etc/modules.d; \
58 for mod in $$$$$$$$2; do \
61 ) > $(2)/etc/modules.d/$$$$$$$$1-$(1); \
62 modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \
65 if [ -n "$$$$$$$$modules" ]; then \
66 mkdir -p $(2)/etc/modules.d; \
67 echo "#!/bin/sh" > $(2)/CONTROL/postinst; \
68 echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \
69 echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \
70 echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \
71 chmod 0755 $(2)/CONTROL/postinst; \
78 $(eval $(call KernelPackage/Defaults))
79 $(eval $(call KernelPackage/$(1)))
80 $(eval $(call KernelPackage/$(1)/$(KERNEL)))
81 $(eval $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL)))
83 define Package/kmod-$(1)
86 CATEGORY:=Kernel modules
88 DESCRIPTION:=$(DESCRIPTION)
89 EXTRA_DEPENDS:='kernel (=$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))'
90 $(call KernelPackage/$(1))
91 $(call KernelPackage/$(1)/$(KERNEL))
92 $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL))
95 ifeq ($(findstring m,$(KCONFIG)),m)
96 ifneq ($(strip $(FILES)),)
97 define Package/kmod-$(1)/install
98 mkdir -p $$(1)/lib/modules/$(LINUX_VERSION)
99 $(CP) $$(FILES) $$(1)/lib/modules/$(LINUX_VERSION)/
100 $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD))
101 $(call KernelPackage/$(1)/install,$$(1))
105 $$(eval $$(call BuildPackage,kmod-$(1)))
109 add_module $(1) "$(2)";