Thread (31 messages) 31 messages, 5 authors, 2023-12-18

Re: [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB

From: Michal Suchánek <hidden>
Date: 2023-10-09 14:07:41
Also in: linux-kbuild, lkml

On Mon, Oct 09, 2023 at 09:34:10PM +0900, Masahiro Yamada wrote:
On Mon, Oct 9, 2023 at 5:52 PM Michal Suchánek [off-list ref] wrote:
quoted
Hello,

On Mon, Oct 09, 2023 at 05:31:02PM +0900, Masahiro Yamada wrote:
quoted
On Fri, Oct 6, 2023 at 12:49 AM Michal Suchanek [off-list ref] wrote:
quoted
The default MODLIB value is composed of two variables and the hardcoded
string '/lib/modules/'.

MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)

Defining this middle part as a variable was rejected on the basis that
users can pass the whole MODLIB to make, such as

In other words, do you want to say

"If defining this middle part as a variable had been accepted,
this patch would have been unneeded." ?
If it were accepted I would not have to guess what the middle part is,
and could use the variable that unambiguosly defines it instead.

How?

scripts/package/kernel.spec hardcodes 'lib/modules'
in a couple of places.

I am asking how to derive the module path.
Not sure what you are asking here. The path is hardcoded, everywhere.

The current Makefile has

MODLIB	= $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)

and there is no reliable way to learn what the middle part was after the
fact - $(INSTALL_MOD_PATH) can be non-empty.

The rejected patch was changing this to a variable, and also default to
adjusting the content to what kmod exports in pkgconfig after applying a
proposed patch to make this hardcoded part configurable:

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)

It would be completely posible to only define the middle part as a
variable that could then be used in rpm-pkg:

export KERNEL_MODULE_DIRECTORY := /lib/modules

MODLIB	= $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)

Thanks

Michal

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help