All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Suchanek <msuchanek@suse.de>
To: linux-modules@vger.kernel.org
Cc: "Michal Suchanek" <msuchanek@suse.de>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Lucas De Marchi" <lucas.de.marchi@gmail.com>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Jiri Slaby" <jslaby@suse.com>,
	"Jan Engelhardt" <jengelh@inai.de>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v6 1/2] depmod: Handle installing modules under a different directory
Date: Wed,  6 Dec 2023 20:47:51 +0100	[thread overview]
Message-ID: <32b332af189bfca8acdb231cee294355aa4af290.1701892062.git.msuchanek@suse.de> (raw)
In-Reply-To: <CAK7LNAT3N82cJD3GsF+yUBEfPNOBkhzYPk37q3k0HdU7ukz9vQ@mail.gmail.com>

Some distributions aim at shipping all files in /usr.

The path under which kernel modules are installed is hardcoded to /lib
which conflicts with this goal.

When kmod provides kmod.pc, use it to determine the correct module
installation path.

With kmod that does not provide the config /lib/modules is used as
before.

While pkg-config does not return an error when a variable does not exist
the kmod configure script puts some effort into ensuring that
module_directory is non-empty. With that empty module_directory from
pkg-config can be used to detect absence of the variable.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v6:
 - use ?= instead of := to make it easier to override the value
 - use shorter expression for determining the module directory assuming
   it's non-empty
---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 511b5616aa41..84f32bd563d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1081,7 +1081,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 ?= $(or $(shell pkg-config --variable=module_directory kmod 2>/dev/null),/lib/modules)
+
+MODLIB	= $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
 export MODLIB
 
 PHONY += prepare0
-- 
2.42.0


  parent reply	other threads:[~2023-12-06 19:48 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 15:07 [PATCH rebased] kbuild: rpm-pkg: Fix build with non-default MODLIB Michal Suchanek
2023-10-06 16:58 ` Nathan Chancellor
2023-10-09  8:31 ` Masahiro Yamada
2023-10-09  8:52   ` Michal Suchánek
2023-10-09 12:34     ` Masahiro Yamada
2023-10-09 14:07       ` Michal Suchánek
2023-10-09 15:14         ` Masahiro Yamada
2023-10-09 16:01           ` Jan Engelhardt
2023-10-10 10:15           ` Michal Suchánek
2023-10-17 10:15             ` Masahiro Yamada
2023-10-17 10:44               ` Michal Suchánek
2023-10-17 12:05                 ` Masahiro Yamada
2023-10-17 12:27                   ` Michal Suchánek
2023-10-17 14:46                     ` Masahiro Yamada
2023-10-17 15:10                       ` Michal Suchánek
2023-10-18  1:12                         ` Jan Engelhardt
2023-11-10 17:44                           ` Michal Suchánek
2023-11-10 17:57                             ` Jan Engelhardt
2023-12-06 19:47                       ` Michal Suchanek [this message]
2023-12-10 18:43                         ` [PATCH v6 1/2] depmod: Handle installing modules under a different directory Masahiro Yamada
2023-12-10 18:51                           ` Woody Suwalski
2023-12-10 21:07                           ` Michal Suchánek
2023-12-11  4:29                             ` Masahiro Yamada
2023-12-12 13:03                               ` Michal Suchánek
2023-12-18 14:05                                 ` Masahiro Yamada
2023-12-06 19:47                       ` [PATCH v6 2/2] kbuild: rpm-pkg: Fix build with non-default MODLIB Michal Suchanek
2023-12-10 18:44                         ` Masahiro Yamada
2023-12-10 21:08                           ` Michal Suchánek
2023-12-11  4:33                             ` Masahiro Yamada
2023-12-12 13:12                               ` Michal Suchánek
2023-12-18 14:16                                 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32b332af189bfca8acdb231cee294355aa4af290.1701892062.git.msuchanek@suse.de \
    --to=msuchanek@suse.de \
    --cc=jengelh@inai.de \
    --cc=jslaby@suse.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=masahiroy@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.