[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQopEkzYH9_urDxU9i060GDgtXYWWxTsRikxfYxxLCOxQ@mail.gmail.com>
Date: Tue, 18 Jul 2023 21:14:24 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Michal Suchanek <msuchanek@...e.de>
Cc: linux-modules@...r.kernel.org, Takashi Iwai <tiwai@...e.com>,
Lucas De Marchi <lucas.de.marchi@...il.com>,
Michal Koutný <mkoutny@...e.com>,
Jiri Slaby <jslaby@...e.com>, Jan Engelhardt <jengelh@...i.de>,
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 v5] depmod: Handle installing modules under a prefix
On Tue, Jul 18, 2023 at 9:03 PM Michal Suchanek <msuchanek@...e.de> wrote:
>
> 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 the config command, use it to determine the correct
> module installation path.
>
> With kmod that does not provide the config command /lib/modules is used
> as before.
>
> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
> v2: Avoid error on systems with kmod that does not support config
> command
> v3: More verbose commit message
> v4:
> - Document jq requirement
> - fix bashism
> - Update to getting full module path, not just additional prefix
> v5: switch to pkgconfig
> ---
> Makefile | 4 +++-
> scripts/depmod.sh | 8 ++++----
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 47690c28456a..1620d224ad9c 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_DIRECTORY := $(shell pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --variable=module_directory kmod || echo /lib/modules)
As I replied in another thread, Kbuild already provides
the max flexibility.
Please do not send this any more. NACK.
> +
> +MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
> export MODLIB
>
> PHONY += prepare0
> diff --git a/scripts/depmod.sh b/scripts/depmod.sh
> index 3643b4f896ed..06961f990fcb 100755
> --- a/scripts/depmod.sh
> +++ b/scripts/depmod.sh
> @@ -27,16 +27,16 @@ fi
> # numbers, so we cheat with a symlink here
> depmod_hack_needed=true
> tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
> -mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
> +mkdir -p "$tmp_dir$KERNEL_MODULE_DIRECTORY/$KERNELRELEASE"
> if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
> - if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
> - -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
> + if test -e "$tmp_dir$KERNEL_MODULE_DIRECTORY/$KERNELRELEASE/modules.dep" -o \
> + -e "$tmp_dir$KERNEL_MODULE_DIRECTORY/$KERNELRELEASE/modules.dep.bin"; then
> depmod_hack_needed=false
> fi
> fi
> rm -rf "$tmp_dir"
> if $depmod_hack_needed; then
> - symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
> + symlink="$INSTALL_MOD_PATH$KERNEL_MODULE_DIRECTORY/99.98.$KERNELRELEASE"
> ln -s "$KERNELRELEASE" "$symlink"
> KERNELRELEASE=99.98.$KERNELRELEASE
> fi
> --
> 2.41.0
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists