[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230712073817.GE9196@kitsune.suse.cz>
Date: Wed, 12 Jul 2023 09:38:17 +0200
From: Michal Suchánek <msuchanek@...e.de>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: linux-modules@...r.kernel.org, Takashi Iwai <tiwai@...e.com>,
Lucas De Marchi <lucas.de.marchi@...il.com>,
Michal KoutnĂ˝ <mkoutny@...e.com>,
Jan Engelhardt <jengelh@...i.de>,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] depmod: Handle installing modules under a prefix
On Wed, Jul 12, 2023 at 07:47:13AM +0200, Jiri Slaby wrote:
> On 11. 07. 23, 17:34, Michal Suchanek wrote:
> > Some distributions aim at not shipping any files in / ustside of usr.
> >
> > The path under which kernel modules are instaleld is hardcoded to /lib
> > which conflicts with this goal.
> >
> > When kmod provides the config command use it to determine the correct
> > module installation prefix.
> >
> > On kmod that does not provide the command / is used as before.
> >
> > Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> > ---
> > Makefile | 4 +++-
> > scripts/depmod.sh | 8 ++++----
> > 2 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 47690c28456a..b05d696f06bd 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1165,7 +1165,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_PREFIX := $(shell kmod config | jq -r .module_prefix)
>
> echo -e 'KERNEL_MODULE_PREFIX := $(shell kmod config | jq -r
> .module_prefix)\nall:'|make -f -
> invalid command 'config'
> parse error: Invalid numeric literal at line 1, column 5
>
> I think you should pipe kmod's 2> /dev/null to support older kmod. Ah, but
> you'd need 2> /dev/null for jq too. That would not be good as jq might not
> be installed and a user wouldn't see the error. So instead, I would do:
>
> $(shell kmod config &> /dev/null && kmod config | jq -r .module_prefix)
Yes, that sounds reasonable. Also would cover the potential problem of
kmod changing the error output into something that is a valid JSON in
the future.
Thanks
Michal
Powered by blists - more mailing lists