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