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 ifneq ($(KERNEL_BUILD
),1)
23 # oops, old .kernel.config; rebuild it (hiding the misleading errors this produces)
24 $(warning rebuilding .kernel.mk
)
25 $(TOPDIR
)/.kernel.mk
: FORCE
26 @
$(MAKE
) -C
$(TOPDIR
)/target
/linux
/$(BOARD
)-$(KERNEL
) $@
&>/dev
/null
36 ifneq (,$(findstring uml
,$(BOARD
)))
40 KERNEL_CC
:=$(TARGET_CC
)
41 KERNEL_CROSS
:=$(TARGET_CROSS
)
44 KERNEL_BUILD_DIR
:=$(BUILD_DIR
)/linux-
$(KERNEL
)-$(BOARD
)
45 LINUX_DIR
:= $(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)
47 MODULES_SUBDIR
:=lib
/modules
/$(LINUX_VERSION
)
48 MODULES_DIR
:= $(KERNEL_BUILD_DIR
)/modules
/$(MODULES_SUBDIR
)
49 TARGET_MODULES_DIR
:= $(LINUX_TARGET_DIR
)/$(MODULES_SUBDIR
)
51 LINUX_KERNEL
:=$(KERNEL_BUILD_DIR
)/vmlinux
55 define KernelPackage
/Defaults
64 mkdir
-p
$(2)/etc
/modules.d
; \
66 for mod in
$$$$$$$$2; do \
69 ) > $(2)/etc
/modules.d
/$$$$$$$$1-$(1); \
70 modules
="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \
73 if
[ -n
"$$$$$$$$modules" ]; then \
74 mkdir
-p
$(2)/etc
/modules.d
; \
75 echo
"#!/bin/sh" > $(2)/CONTROL
/postinst
; \
76 echo
"[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit 0" >> $(2)/CONTROL
/postinst
; \
77 echo
". /etc/functions.sh" >> $(2)/CONTROL
/postinst
; \
78 echo
"load_modules $$$$$$$$modules" >> $(2)/CONTROL
/postinst
; \
79 chmod
0755 $(2)/CONTROL
/postinst
; \
86 $(eval
$(call KernelPackage
/Defaults
))
87 $(eval
$(call KernelPackage
/$(1)))
88 $(eval
$(call KernelPackage
/$(1)/$(KERNEL
)))
89 $(eval
$(call KernelPackage
/$(1)/$(BOARD
)-$(KERNEL
)))
91 define Package
/kmod-
$(1)
94 CATEGORY
:=Kernel modules
96 DESCRIPTION
:=$(DESCRIPTION
)
97 EXTRA_DEPENDS
:='kernel (=$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))'
98 $(call KernelPackage
/$(1))
99 $(call KernelPackage
/$(1)/$(KERNEL
))
100 $(call KernelPackage
/$(1)/$(BOARD
)-$(KERNEL
))
103 ifeq ($(findstring m
,$(KCONFIG
)),m
)
104 ifneq ($(strip $(FILES
)),)
105 define Package
/kmod-
$(1)/install
106 mkdir
-p
$$(1)/lib
/modules
/$(LINUX_VERSION
)
107 $(CP
) $$(FILES
) $$(1)/lib
/modules
/$(LINUX_VERSION
)/
108 $(call ModuleAutoLoad
,$(1),$$(1),$(AUTOLOAD
))
109 $(call KernelPackage
/$(1)/install,$$(1))
113 $$(eval
$$(call BuildPackage
,kmod-
$(1)))
117 add_module
$(1) "$(2)";