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 @
$(MAKE
) -C
$(TOPDIR
)/target
/linux
/$(BOARD
)-$(KERNEL
) $@
&>/dev
/null
34 ifneq (,$(findstring uml
,$(BOARD
)))
38 KERNEL_CC
:=$(TARGET_CC
)
39 KERNEL_CROSS
:=$(TARGET_CROSS
)
42 KERNEL_BUILD_DIR
:=$(BUILD_DIR
)/linux-
$(KERNEL
)-$(BOARD
)
43 LINUX_DIR
:= $(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
45 MODULES_SUBDIR
:=lib
/modules
/$(LINUX_VERSION
)
46 MODULES_DIR
:= $(KERNEL_BUILD_DIR
)/modules
/$(MODULES_SUBDIR
)
47 TARGET_MODULES_DIR
:= $(LINUX_TARGET_DIR
)/$(MODULES_SUBDIR
)
49 LINUX_KERNEL
:=$(KERNEL_BUILD_DIR
)/vmlinux
53 define KernelPackage
/Defaults
62 mkdir
-p
$(2)/etc
/modules.d
; \
64 for mod in
$$$$$$$$2; do \
67 ) > $(2)/etc
/modules.d
/$$$$$$$$1-$(1); \
68 modules
="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \
71 if
[ -n
"$$$$$$$$modules" ]; then \
72 mkdir
-p
$(2)/etc
/modules.d
; \
73 echo
"#!/bin/sh" > $(2)/CONTROL
/postinst
; \
74 echo
"[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL
/postinst
; \
75 echo
". /etc/functions.sh" >> $(2)/CONTROL
/postinst
; \
76 echo
"load_modules $$$$$$$$modules" >> $(2)/CONTROL
/postinst
; \
77 chmod
0755 $(2)/CONTROL
/postinst
; \
84 $(eval
$(call KernelPackage
/Defaults
))
85 $(eval
$(call KernelPackage
/$(1)))
86 $(eval
$(call KernelPackage
/$(1)/$(KERNEL
)))
87 $(eval
$(call KernelPackage
/$(1)/$(BOARD
)-$(KERNEL
)))
89 define Package
/kmod-
$(1)
92 CATEGORY
:=Kernel modules
94 DESCRIPTION
:=$(DESCRIPTION
)
95 EXTRA_DEPENDS
:='kernel (=$(PKG_VERSION)-$(PKG_RELEASE))'
96 $(call KernelPackage
/$(1))
97 $(call KernelPackage
/$(1)/$(KERNEL
))
98 $(call KernelPackage
/$(1)/$(BOARD
)-$(KERNEL
))
101 ifeq ($(findstring m
,$(KCONFIG
)),m
)
102 ifneq ($(strip $(FILES
)),)
103 define Package
/kmod-
$(1)/install
104 mkdir
-p
$$(1)/lib
/modules
/$(LINUX_VERSION
)
105 $(CP
) $$(FILES
) $$(1)/lib
/modules
/$(LINUX_VERSION
)/
106 $(call ModuleAutoLoad
,$(1),$$(1),$(AUTOLOAD
))
107 $(call KernelPackage
/$(1)/install,$$(1))
111 $$(eval
$$(call BuildPackage
,kmod-
$(1)))
115 add_module
$(1) "$(2)";