Bug 218758

Summary: depmod: Handle installing modules under a prefix
Product: Other Reporter: sander44 (ionut_n2001)
Component: ModulesAssignee: other_modules
Status: NEW ---    
Severity: normal    
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description sander44 2024-04-21 13:17:25 UTC
Hi Kernel Team,

I use OpenSUSE as a daily driver to develop and optimize kernel modules. From what I can see, the "make -j25 tar-pkg ARCH=x86_64 LOCALVERSION=-vanilla-lowlatency1" command does not do a complete depmod to the modules because they are not installed in the correct location.

A patch can be made in this area as well as upstream, to solve this aspect.

At the moment I use the version with detection through pkg-config and kmod.

Patch:
diff --git a/Makefile b/Makefile
index 59d8a7f95..3af2efda6 100644
--- a/Makefile
+++ b/Makefile
@@ -1087,7 +1087,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
 # makefile but the argument can be passed to make if needed.
 #
 
-MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
+export KERNEL_MODULE_DIRECTORY := $(shell pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --variable=module_directory kmod || echo /lib/modules)
+
+MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
 export MODLIB
 
 PHONY += prepare0


Kernel: 6.8.x