From: "Michal Suchánek" <msuchanek@suse.de>
To: Jan Engelhardt <jengelh@inai.de>
Cc: linux-modules@vger.kernel.org, "Takashi Iwai" <tiwai@suse.com>,
"Lucas De Marchi" <lucas.de.marchi@gmail.com>,
"Michal Koutný" <mkoutny@suse.com>,
"Jiri Slaby" <jslaby@suse.com>,
"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: Re: [PATCH kmod v4 4/4] libkmod, depmod, modprobe: Make directory for kernel modules configurable
Date: Tue, 18 Jul 2023 12:29:59 +0200 [thread overview]
Message-ID: <20230718102958.GW9196@kitsune.suse.cz> (raw)
In-Reply-To: <81n281ns-s8on-rsrn-pp61-q28pn42ns531@vanv.qr>
On Tue, Jul 18, 2023 at 11:41:32AM +0200, Jan Engelhardt wrote:
>
> On Tuesday 2023-07-18 10:43, Michal Suchánek wrote:
> >> >With this distributions that do not want to ship files in /lib can also
> >> >move kernel modules to /usr while others can keep them in /lib.
> >>
> >> This patch breaks kernel builds/installation / bisecting [when the
> >> system has a kmod ./configure'd --with-module-directory=/usr/lib/modules]
> >
> >It might be nice to provide backwads compatibility with earlier
> >configurations.
> >
> >However, if it comes at the cost of making the implementation more
> >complex and future maintenance more difficult it might not be such a
> >great idea. So far I have not seen a proposal how to do it nicely.
>
>
>
> diff --git a/configure.ac b/configure.ac
> index a195c8e..7fde927 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -84,11 +84,7 @@ AC_ARG_WITH([rootlibdir],
> [], [with_rootlibdir=$libdir])
> AC_SUBST([rootlibdir], [$with_rootlibdir])
>
> -# Ideally this would be $prefix/lib/modules but default to /lib/modules for compatibility with earlier versions
> -AC_ARG_WITH([module_directory],
> - AS_HELP_STRING([--with-module-directory=DIR], [directory in which to look for kernel modules - typically '/lib/modules' or '${prefix}/lib/modules']),
> - [], [with_module_directory=/lib/modules])
> -AC_SUBST([module_directory], [$with_module_directory])
> +AC_SUBST([module_directory], [/lib/modules])
>
> AC_ARG_WITH([zstd],
> AS_HELP_STRING([--with-zstd], [handle Zstandard-compressed modules @<:@default=disabled@:>@]),
> diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h
> index 4a4af58..e2f9c95 100644
> --- a/libkmod/libkmod-internal.h
> +++ b/libkmod/libkmod-internal.h
> @@ -199,3 +199,5 @@ void kmod_module_signature_info_free(struct kmod_signature_info *sig_info) __att
>
> /* libkmod-builtin.c */
> ssize_t kmod_builtin_get_modinfo(struct kmod_ctx *ctx, const char *modname, char ***modinfo) __attribute__((nonnull(1, 2, 3)));
> +
> +extern const char *dirname_default_prefix;
> diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
> index d2ed874..b426cde 100644
> --- a/libkmod/libkmod.c
> +++ b/libkmod/libkmod.c
> @@ -209,7 +209,7 @@ static int log_priority(const char *priority)
> return 0;
> }
>
> -static const char *dirname_default_prefix = MODULE_DIRECTORY;
> +const char *dirname_default_prefix = MODULE_DIRECTORY;
>
> static char *get_kernel_release(const char *dirname)
> {
> diff --git a/tools/depmod.c b/tools/depmod.c
> index 22bc1d8..929060f 100644
> --- a/tools/depmod.c
> +++ b/tools/depmod.c
> @@ -65,6 +65,7 @@ static const struct option cmdopts[] = {
> { "quick", no_argument, 0, 'A' },
> { "basedir", required_argument, 0, 'b' },
> { "outdir", required_argument, 0, 'o' },
> + { "modulesdir", required_argument, 0, 'M' },
> { "config", required_argument, 0, 'C' },
> { "symvers", required_argument, 0, 'E' },
> { "filesyms", required_argument, 0, 'F' },
> @@ -2943,6 +2944,9 @@ static int do_depmod(int argc, char *argv[])
> free(out_root);
> out_root = path_make_absolute_cwd(optarg);
> break;
> + case 'M':
> + dirname_default_prefix = optarg;
> + break;
> case 'C': {
> size_t bytes = sizeof(char *) * (n_config_paths + 2);
> void *tmp = realloc(config_paths, bytes);
That breaks kmod for the usrmerged distributions, though.
It might be fine to provide an option to override the build-time
default. Still the build-time default has to match where the modules are
placed in the distribution for things to work correctly out of the box.
Note: it will work either way at the times the module directory can be
accessed through the lib -> usr/lib compatibility symlink. The default
needs to be correct for the cases when the symlink is not provided.
So you could do
make DEPMOD='depmod -M /lib/modules'
to build an old kernel but you could equally do
make DEPMOD='/path/to/special/depmod'
If you needed
make DEPMOD='depmod -M /usr/lib/modules'
to build an usrmerged kernel on usrmerged distribution then this whole
exercise is pointless. kmod cannot find the usrmerged modules then.
Thanks
Michal
next prev parent reply other threads:[~2023-07-18 10:30 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 15:31 [PATCH 0/4] kmod /usr support Michal Suchanek
2023-07-11 15:31 ` [PATCH 1/4] man/depmod.d: Fix incorrect /usr/lib search path Michal Suchanek
2023-07-11 15:31 ` [PATCH 2/4] libkmod, depmod: Load modprobe.d, depmod.d from $prefix/lib Michal Suchanek
2023-07-12 6:47 ` Jiri Slaby
2023-07-12 7:35 ` Michal Suchánek
2023-07-11 15:31 ` [PATCH 3/4] kmod: Add config command to show compile time configuration as JSON Michal Suchanek
2023-07-11 15:31 ` [PATCH 4/4] libkmod, depmod, modprobe: Search for kernel modules under ${module_prefix} Michal Suchanek
2023-07-11 15:34 ` [PATCH] depmod: Handle installing modules under a prefix Michal Suchanek
2023-07-12 5:47 ` Jiri Slaby
2023-07-12 7:38 ` Michal Suchánek
[not found] ` <20230712134533.4419-1-msuchanek@suse.de>
2023-07-14 6:25 ` [PATCH v2] " Jiri Slaby
2023-07-14 12:21 ` [PATCH v3] " Michal Suchanek
2023-07-14 13:38 ` Jan Engelhardt
2023-07-14 13:57 ` Michal Suchánek
2023-07-14 13:59 ` Michal Koutný
2023-07-14 14:05 ` Michal Suchánek
2023-07-14 14:05 ` Nicolas Schier
2023-07-14 14:30 ` Michal Suchánek
2023-07-14 14:42 ` Jan Engelhardt
2023-07-14 14:54 ` Nicolas Schier
2023-07-14 15:10 ` Michal Suchánek
2023-07-14 19:37 ` Nicolas Schier
2023-07-17 9:55 ` Michal Suchánek
2023-07-17 19:14 ` Masahiro Yamada
2023-07-18 8:52 ` Michal Suchánek
2023-09-11 19:56 ` [PATCH] kbuild: rpm-pkg: Fix build with non-default MODLIB Michal Suchanek
2023-07-17 19:13 ` [PATCH v3] depmod: Handle installing modules under a prefix Masahiro Yamada
2023-07-12 14:00 ` [PATCH kmod v2 1/4] man/depmod.d: Fix incorrect /usr/lib search path Michal Suchanek
2023-07-12 14:00 ` [PATCH kmod v2 2/4] libkmod, depmod: Load modprobe.d, depmod.d from $prefix/lib Michal Suchanek
2023-07-14 14:16 ` Nicolas Schier
2023-07-14 14:34 ` Michal Suchánek
2023-07-12 14:00 ` [PATCH kmod v2 3/4] kmod: Add config command to show compile time configuration as JSON Michal Suchanek
2023-07-14 13:52 ` Jan Engelhardt
2023-07-14 14:02 ` Michal Suchánek
2023-07-14 14:12 ` Jan Engelhardt
2023-07-14 15:26 ` Nicolas Schier
2023-07-14 16:58 ` Michal Suchánek
2023-07-12 14:00 ` [PATCH kmod v2 4/4] libkmod, depmod, modprobe: Search for kernel modules under ${module_prefix} Michal Suchanek
2023-07-14 13:54 ` Jan Engelhardt
2023-07-17 10:39 ` [PATCH kmod v4 0/4] kmod /usr support Michal Suchanek
2023-07-17 10:39 ` [PATCH kmod v4 1/4] man/depmod.d: Fix incorrect /usr/lib search path Michal Suchanek
2023-07-17 10:39 ` [PATCH kmod v4 2/4] libkmod, depmod: Load modprobe.d, depmod.d from $prefix/lib Michal Suchanek
2023-07-17 10:39 ` [PATCH kmod v4 3/4] kmod: Add config command to show compile time configuration as JSON Michal Suchanek
2023-07-17 10:39 ` [PATCH kmod v4 4/4] libkmod, depmod, modprobe: Make directory for kernel modules configurable Michal Suchanek
2023-07-17 19:28 ` Jan Engelhardt
2023-07-18 8:43 ` Michal Suchánek
2023-07-18 9:41 ` Jan Engelhardt
2023-07-18 10:29 ` Michal Suchánek [this message]
2023-07-18 12:17 ` Jan Engelhardt
2023-07-18 12:27 ` Michal Suchánek
2023-07-18 12:42 ` Jan Engelhardt
2023-07-18 13:45 ` Michal Suchánek
2023-07-17 20:12 ` Lucas De Marchi
2023-07-18 8:32 ` Michal Suchánek
2023-07-17 10:40 ` [PATCH v4] depmod: Handle installing modules under a prefix Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 0/5] kmod /usr support Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 1/5] configure: Detect openssl sm3 support Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 2/5] man/depmod.d: Fix incorrect /usr/lib search path Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 3/5] libkmod, depmod: Load modprobe.d, depmod.d from ${prefix}/lib Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 4/5] kmod: Add pkgconfig file with kmod compile time configuration Michal Suchanek
2023-07-18 12:01 ` [PATCH kmod v5 5/5] libkmod, depmod, modprobe: Make directory for kernel modules configurable Michal Suchanek
2023-10-17 17:50 ` Lucas De Marchi
2023-10-18 1:25 ` Jan Engelhardt
2023-11-09 17:40 ` Michal Suchánek
2023-11-09 17:44 ` Michal Suchánek
2023-11-10 12:13 ` [PATCH 0/2] kmod /usr support Michal Suchanek
2023-11-10 12:13 ` [PATCH 1/2] libkmod, depmod, modprobe: Make directory for kernel modules configurable Michal Suchanek
2023-11-10 12:13 ` [PATCH 2/2] configure: Check that provided paths are absolute Michal Suchanek
2023-12-06 18:36 ` [PATCH 0/2] kmod /usr support Lucas De Marchi
2023-12-19 8:37 ` Masahiro Yamada
2024-08-21 17:58 ` Nathan Chancellor
2024-08-22 5:05 ` Lucas De Marchi
2024-08-22 13:12 ` Emil Velikov
2024-08-22 6:05 ` Lucas De Marchi
2024-08-22 8:36 ` Michal Suchánek
2024-08-23 13:03 ` Masahiro Yamada
2024-08-23 14:29 ` Michal Suchánek
2023-11-13 9:27 ` [PATCH kmod v5 5/5] libkmod, depmod, modprobe: Make directory for kernel modules configurable Michal Suchánek
2023-07-18 12:03 ` [PATCH v5] depmod: Handle installing modules under a prefix Michal Suchanek
2023-07-18 12:14 ` Masahiro Yamada
2023-08-17 16:37 ` [PATCH kmod v5 0/5] kmod /usr support Michal Suchánek
2023-08-19 11:25 ` Masahiro Yamada
2023-08-21 6:22 ` Michal Suchánek
2023-09-11 19:50 ` Michal Suchánek
2023-10-17 15:45 ` Michal Suchánek
2023-10-17 16:18 ` Lucas De Marchi
2023-10-17 16:40 ` Michal Suchánek
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=20230718102958.GW9196@kitsune.suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).