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.
10 LINUX_VERSION:=<LINUX_VERSION>
13 include $(TOPDIR)/.kernel.mk
14 include $(INCLUDE_DIR)/target.mk
16 # check to see if .kernel.mk matches target.mk
17 ifeq ($(CONFIG_BOARD)-$(CONFIG_KERNEL),$(BOARD)-$(KERNEL))
18 LINUX_VERSION:=$(CONFIG_LINUX_VERSION)
19 LINUX_RELEASE:=$(CONFIG_LINUX_RELEASE)
20 LINUX_KARCH:=$(CONFIG_LINUX_KARCH)
22 # oops, old .kernel.config; rebuild it (hiding the misleading errors this produces)
23 $(warning rebuilding .kernel.mk)
24 $(TOPDIR)/.kernel.mk: FORCE
25 ifneq ($(KERNEL_BUILD),1)
27 @$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL) $@ &>/dev/null
37 ifneq (,$(findstring uml,$(BOARD)))
41 KERNEL_CC:=$(TARGET_CC)
42 KERNEL_CROSS:=$(TARGET_CROSS)
45 KERNEL_BUILD_DIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
46 LINUX_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
48 MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)
49 MODULES_DIR := $(KERNEL_BUILD_DIR)/modules/$(MODULES_SUBDIR)
50 TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
52 LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux
56 define KernelPackage/Defaults
65 mkdir -p $(2)/etc/modules.d; \
67 for mod in $$$$$$$$2; do \
70 ) > $(2)/etc/modules.d/$$$$$$$$1-$(1); \
71 modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \
74 if [ -n "$$$$$$$$modules" ]; then \
75 mkdir -p $(2)/etc/modules.d; \
76 echo "#!/bin/sh" > $(2)/CONTROL/postinst; \
77 echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL/postinst; \
78 echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \
79 echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \
80 chmod 0755 $(2)/CONTROL/postinst; \
87 $(eval $(call KernelPackage/Defaults))
88 $(eval $(call KernelPackage/$(1)))
89 $(eval $(call KernelPackage/$(1)/$(KERNEL)))
90 $(eval $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL)))
92 define Package/kmod-$(1)
95 CATEGORY:=Kernel modules
97 DESCRIPTION:=$(DESCRIPTION)
98 EXTRA_DEPENDS:='kernel (=$(PKG_VERSION)-$(PKG_RELEASE))'
99 $(call KernelPackage/$(1))
100 $(call KernelPackage/$(1)/$(KERNEL))
101 $(call KernelPackage/$(1)/$(BOARD)-$(KERNEL))
104 ifeq ($(findstring m,$(KCONFIG)),m)
105 ifneq ($(strip $(FILES)),)
106 define Package/kmod-$(1)/install
107 mkdir -p $$(1)/lib/modules/$(LINUX_VERSION)
108 $(CP) $$(FILES) $$(1)/lib/modules/$(LINUX_VERSION)/
109 $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD))
110 $(call KernelPackage/$(1)/install,$$(1))
114 $$(eval $$(call BuildPackage,kmod-$(1)))
118 add_module $(1) "$(2)";