1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR
)/mk
/kernel-ver.mk
7 MODULES_SUBDIR
:= lib
/modules
/$(KERNEL_MOD_VERSION
)
8 LINUX_BUILD_DIR
:= $(BUILD_DIR
)/linux-
$(ADK_TARGET_ARCH
)
9 KMOD_BUILD_DIR
:= $(LINUX_BUILD_DIR
)/linux-modules
10 MODULES_DIR
:= $(LINUX_BUILD_DIR
)/modules
/$(MODULES_SUBDIR
)
11 TARGET_MODULES_DIR
:= $(LINUX_TARGET_DIR
)/$(MODULES_SUBDIR
)
13 INSTALL_TARGETS
:= $(KERNEL_PKG
)
17 ifneq ($(ADK_RUNTIME_DEV_UDEV
),y
)
18 # KMOD_template (not used for udev which autoloads modules)
20 # Adds a target for creating a package containing
21 # the specified (kernel-provided) modules.
23 # 1: the config symbol name (without leading 'ADK_KERNEL_')
24 # this _must_ be equal to the kernel config symbol name
25 # 2: the name for the package, should be unique
26 # 3: actual modules to add; absolute path inside $(MODULES_DIR)
27 # OMIT THE KERNEL-SPECIFIC EXTENSION!
28 # 4: order of module loading at system startup; the modules in $(3) are (in their order)
29 # added to this file, if $(6) is non-empty
30 # 5: the kmod packages this package depends on
34 IDEPENDK_
$(1):=kernel
($(KERNEL_VERSION
)) $(foreach pkg
,$(5),", $(pkg)")
36 PKG_
$(1) := $(PACKAGE_DIR
)/kmod-
$(2)_
$(KERNEL_VERSION
)-$(KERNEL_RELEASE
)_
$(ADK_TARGET_CPU_ARCH
).
$(PKG_SUFFIX
)
37 I_
$(1) := $(KMOD_BUILD_DIR
)/ipkg
/$(2)
39 ifeq ($${ADK_TARGET_KERNEL_CUSTOMISING},y
)
40 ifeq ($$(ADK_KERNEL_
$(1)),m
)
42 INSTALL_TARGETS
+=$$(PKG_
$(1))
49 echo
"Package: kmod-$(2)" > $(LINUX_BUILD_DIR
)/kmod-control
/kmod-
$(2).control
50 echo
"Priority: optional" >> $(LINUX_BUILD_DIR
)/kmod-control
/kmod-
$(2).control
51 echo
"Section: sys" >> $(LINUX_BUILD_DIR
)/kmod-control
/kmod-
$(2).control
52 echo
"Description: kernel module $(2)" >> $(LINUX_BUILD_DIR
)/kmod-control
/kmod-
$(2).control
53 ${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh
$$(I_
$(1)) \
54 $(LINUX_BUILD_DIR
)/kmod-control
/kmod-
$(2).control \
55 $(KERNEL_VERSION
)-$(KERNEL_RELEASE
) $(ADK_TARGET_CPU_ARCH
)
56 echo
"Depends: $$(IDEPENDK_$(1))" >> $$(I_
$(1))/CONTROL
/control
57 ifneq ($(strip $(3)),)
58 mkdir
-p
$$(I_
$(1))/lib
/modules
/$(KERNEL_MOD_VERSION
)
59 $(CP
) $(foreach mod
,$(3),$(mod
).
$(LINUX_KMOD_SUFFIX
)) $$(I_
$(1))/lib
/modules
/$(KERNEL_MOD_VERSION
)
61 mkdir
-p
$$(I_
$(1))/etc
/modules.d
62 for module in
$(notdir $(3)); do \
63 echo
$$$$module >> $$(I_
$(1))/etc
/modules.d
/$(4)-$(2); \
65 echo
"#!/bin/sh" >> $$(I_
$(1))/CONTROL
/postinst
66 echo
"if [ -z \"\$$$${IPKG_INSTROOT}\" ]; then" >> $$(I_
$(1))/CONTROL
/postinst
67 echo
". /etc/functions.sh" >> $$(I_
$(1))/CONTROL
/postinst
68 echo
"load_modules /etc/modules.d/$(4)-$(2)" >> $$(I_
$(1))/CONTROL
/postinst
69 echo
"fi" >> $$(I_
$(1))/CONTROL
/postinst
70 chmod
0755 $$(I_
$(1))/CONTROL
/postinst
73 $${RSTRIP} $${I_
$(1)} $(MAKE_TRACE
)
74 $(PKG_BUILD
) $$(I_
$(1)) $(PACKAGE_DIR
) $(MAKE_TRACE
)
78 include $(BUILD_DIR
)/.kernelconfig