Linux Modules
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Michal Suchanek" <msuchanek@suse.de>,
	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>,
	"Jan Engelhardt" <jengelh@inai.de>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] kmod /usr support
Date: Thu, 22 Aug 2024 14:12:58 +0100	[thread overview]
Message-ID: <Zsc5Wh0PKTdXKRlX@arch-x395> (raw)
In-Reply-To: <20240821175843.GA2531464@thelio-3990X>

On 2024/08/21, Nathan Chancellor wrote:
> On Tue, Dec 19, 2023 at 05:37:31PM +0900, Masahiro Yamada wrote:
> > On Thu, Dec 7, 2023 at 3:37 AM Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> > >
> > > On Fri, Nov 10, 2023 at 01:13:53PM +0100, Michal Suchanek wrote:
> > > >Hello,
> > > >
> > > >This is resend of the last patch in the series that adds prefix support
> > > >to kernel module location together with additional patch for validating
> > > >the user supplied input to options that are interpreted as directories.
> > > >
> > > >Thanks
> > >
> > > applied, thanks
> > >
> > > Lucas De Marchi
> > 
> > 
> > 
> > If I understood this correctly, MODULE_DIRECTORY is determined
> > by "configure --with-module-directory=...", and there is no
> > way to change it after that.
> > 
> > 
> > If so, how to work with cross-building?
> > 
> > Cross-building is typical when building embedded Linux systems.
> > 
> > 
> > Consider this scenario:
> > 
> > - Your build machine adopts
> >     MODULE_DIRECTORY=/usr/lib/modules
> > - The target embedded system adopts
> >     MODULE_DIRECTORY=/lib/modules
> > 
> > (or vice a versa)
> > 
> > 
> > 
> > 
> > depmod is used also for cross-building because
> > it is executed as a part of "make module_install".
> > 
> > 
> > The counterpart patch set for Kbuild provides
> > KERNEL_MODULE_DIRECTORY, which only changes
> > the destination directory to which *.ko are copied.
> > 
> > You cannot change the directory where the
> > depmod searches for modules, as it is fixed
> > at the compile-time of kmod.
> > 
> > 
> > 
> > 
> > In this case, what we can do is to build another
> > instance of kmod configured for the target system,
> > and use it for modules_install:
> > 
> > 1. In the kmod source directory
> >     ./configure --with=module-directory=/lib/modules
> >     make
> > 
> > 2. make modules_install INSTALL_MOD_PATH=<staging-dir>
> >      KERNEL_MODULE_DIRECTORY=/lib/modules
> >      DEPMOD=<new-depmod-you-has-just-built>
> > 
> > 
> > 
> > If you use OpenEmbedded etc., this is what you do
> > because host tools are built from sources.
> > 
> > But, should it be required all the time?
> > Even when the target embedded system uses
> > busybox-based modprobe instead of kmod?
> > 
> > 
> > 
> > depmod provides --basedir option, which changes
> > the prefix part, but there is no way to override
> > the stem part, MODULE_DIRECTRY.
> > 
> > In the review of the counter patch set,
> > I am suggesting an option to override MODULE_DIRECTRY
> > (let's say --moduledir) at least for depmod.
> > 
> > (Perhaps modinfo too, as it also supports --basedir)
> > 
> > 
> > 
> > Then, we can change scripts/depmod.sh so that
> > Kbuild can propagate KERNEL_MODULE_DIRECTORY
> > to depmod.
> > 
> > 
> > if  <depmod supports --moduledir>; then
> >     set -- "$@"  --moduledir "${KERNEL_MODULE_DIRECTORY}"
> > fi
> > 
> > 
> > 
> > Does it make sense?
> 
> Did this conversation go anywhere? After the upgrade to kmod 33 in Arch
> Linux, which includes building with the configuration option
> '--with-module-directory' set to '/usr/lib/modules' [1], building a
> tarzst-pkg breaks for me, seemingly for the reason noted above.
> 
>   $ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- O=$HOME/tmp/build/linux defconfig tarzst-pkg
>   depmod: ERROR: could not open directory /home/nathan/tmp/build/linux/tar-install/usr/lib/modules/6.11.0-rc4-00019-gb311c1b497e5: No such file or directory
>   depmod: FATAL: could not search modules: No such file or directory
> 
>   $ ls $HOME/tmp/build/linux/tar-install
>   boot  lib
> 
> I don't see how to get around this without an option to override
> MODULE_DIRECTORY.
> 
> I guess I'll ask Arch Linux to revert this option for the time being, as
> it mentions they do not really need it at the moment.
> 
> [1]: https://gitlab.archlinux.org/archlinux/packaging/packages/kmod/-/commit/0efd732cb78bc0b7851a8367f4dc8e6933f5b99d
> 

Since we've officially (?) switched to Github for issues, I opened one
[1].

I suspect it would be a little harder to get lost in the noise, although
Github and all that.

Everyone feel free to subscribe, comment ... or even send some patches.
Ideally we'll get Michal to help this although I'm not sure how busy he
is.

HTH
Emil

[1] https://github.com/kmod-project/kmod/issues/85

  parent reply	other threads:[~2024-08-22 13:13 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
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 [this message]
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=Zsc5Wh0PKTdXKRlX@arch-x395 \
    --to=emil.l.velikov@gmail.com \
    --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=lucas.demarchi@intel.com \
    --cc=masahiroy@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=msuchanek@suse.de \
    --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