diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2015-08-03 13:45:08 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2015-08-03 14:13:17 +0200 |
commit | c6a72670b54e13d3ab3a6056d7c4f4c503cf0d78 (patch) | |
tree | 51c776165e7abb4f1336a93edc519461786496fe /mk/kernel.mk | |
parent | 6debfdc194f5192706120783d133fbb99271eccc (diff) |
rework kernel module infrastructure
Instead of maintaining mk/modules.mk which defines compilations of
related kernel modules to pack together into a single package, follow an
automatic approach: For every kernel module found in the modules
installation directory, create a single package.
There are a few caveats to cover:
=== Module Loading Order ===
Upon bootup, module loading is ordered based on the number-prefixed
files in /etc/modules.d/. The correct number was previously managed in
mk/modules.mk on a per-collection basis. The new approach is to have
levels which modules are to be assigned to. Level 0 contains modules
with no dependencies at all. Level 1 contains modules which have only
level 0 dependencies, and so on. This information is determined at
compile-time by make-module-ipkgs.sh.
=== Module Installation to Target RootFS ===
Since module packages are created automatically from the modules the
script finds, ADK build system has no knowledge about the connection
between what the user has selected in menuconfig and the actual module
packages. Therefore the earlier approach to install selected packages
into rootfs does not hold anymore. Instead, use wildcards to find all
packages in firmware directory prefixed by 'kmod-' and install them all
(hopefully doing the right thing).
=== Kernel Version ===
KERNEL_VERSION now contains KERNEL_RELEASE already
By creating a localversion file, make KERNEL_RELEASE part of the
kernel's version number (so KERNEL_VERSION is correct in most
situations)
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'mk/kernel.mk')
-rw-r--r-- | mk/kernel.mk | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/mk/kernel.mk b/mk/kernel.mk deleted file mode 100644 index 8eb8ec2d1..000000000 --- a/mk/kernel.mk +++ /dev/null @@ -1,78 +0,0 @@ -# This file is part of the OpenADK project. OpenADK is copyrighted -# material, please see the LICENCE file in the top-level directory. - -include $(ADK_TOPDIR)/mk/kernel-ver.mk - -LINUX_KMOD_SUFFIX=ko -MODULES_SUBDIR := lib/modules/$(KERNEL_MOD_VERSION) -LINUX_BUILD_DIR := $(BUILD_DIR)/linux-$(ADK_TARGET_ARCH) -KMOD_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules -MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR) -TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR) - -INSTALL_TARGETS:= $(KERNEL_PKG) -NOINSTALL_TARGETS:= -TARGETS:= - -ifneq ($(ADK_RUNTIME_DEV_UDEV),y) -# KMOD_template (not used for udev which autoloads modules) -# -# Adds a target for creating a package containing -# the specified (kernel-provided) modules. -# Parameters: -# 1: the config symbol name (without leading 'ADK_KERNEL_') -# this _must_ be equal to the kernel config symbol name -# 2: the name for the package, should be unique -# 3: actual modules to add; absolute path inside $(MODULES_DIR) -# OMIT THE KERNEL-SPECIFIC EXTENSION! -# 4: order of module loading at system startup; the modules in $(3) are (in their order) -# added to this file, if $(6) is non-empty -# 5: the kmod packages this package depends on -# -define KMOD_template - -IDEPENDK_$(1):=kernel ($(KERNEL_VERSION)) $(foreach pkg,$(5),", $(pkg)") - -PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(KERNEL_VERSION)-$(KERNEL_RELEASE)_$(ADK_TARGET_CPU_ARCH).$(PKG_SUFFIX) -I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(2) - -ifeq ($${ADK_TARGET_KERNEL_CUSTOMISING},y) -ifeq ($$(ADK_KERNEL_$(1)),m) -TARGETS+=$$(PKG_$(1)) -INSTALL_TARGETS+=$$(PKG_$(1)) -endif -endif - -$$(PKG_$(1)): - rm -rf $$(I_$(1)) - @mkdir -p $$(I_$(1)) - echo "Package: kmod-$(2)" > $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control - echo "Priority: optional" >> $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control - echo "Section: sys" >> $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control - echo "Description: kernel module $(2)" >> $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control - ${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh $$(I_$(1)) \ - $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control \ - $(KERNEL_VERSION)-$(KERNEL_RELEASE) $(ADK_TARGET_CPU_ARCH) - echo "Depends: $$(IDEPENDK_$(1))" >> $$(I_$(1))/CONTROL/control -ifneq ($(strip $(3)),) - mkdir -p $$(I_$(1))/lib/modules/$(KERNEL_MOD_VERSION) - $(CP) $(foreach mod,$(3),$(mod).$(LINUX_KMOD_SUFFIX)) $$(I_$(1))/lib/modules/$(KERNEL_MOD_VERSION) -ifneq ($(4),) - mkdir -p $$(I_$(1))/etc/modules.d - for module in $(notdir $(3)); do \ - echo $$$$module >> $$(I_$(1))/etc/modules.d/$(4)-$(2); \ - done - echo "#!/bin/sh" >> $$(I_$(1))/CONTROL/postinst - echo "if [ -z \"\$$$${IPKG_INSTROOT}\" ]; then" >> $$(I_$(1))/CONTROL/postinst - echo ". /etc/functions.sh" >> $$(I_$(1))/CONTROL/postinst - echo "load_modules /etc/modules.d/$(4)-$(2)" >> $$(I_$(1))/CONTROL/postinst - echo "fi" >> $$(I_$(1))/CONTROL/postinst - chmod 0755 $$(I_$(1))/CONTROL/postinst -endif -endif - $${RSTRIP} $${I_$(1)} $(MAKE_TRACE) - $(PKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) $(MAKE_TRACE) -endef -endif - -include $(BUILD_DIR)/.kernelconfig |