linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] depmod: Remove version parsing hack
@ 2023-08-23 17:06 Michal Koutný
  2023-08-23 17:31 ` Michal Suchánek
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Koutný @ 2023-08-23 17:06 UTC (permalink / raw)
  To: linux-kernel, linux-modules, linux-kbuild
  Cc: Masahiro Yamada, Michal Suchánek

When kbuild on usr-merged distro like:

        make INSTALL_MOD_PATH="$BUILD_DIR_C/mods" \
             MODLIB="$BUILD_DIR_C/mods/usr/lib/modules/$release" \
             modules_install

(notice the '/usr' insert)

where
        release=$(make -s kernelrelease)

depmod fails:

>   DEPMOD  /var/tmp/build/mods/usr/lib/modules/6.5.0-rc5-default
> ln: failed to create symbolic link '/var/tmp/build/mods/lib/modules/99.98.6.5.0-rc5-default': No such file or directory
> depmod: ERROR: could not open directory /var/tmp/build/mods/usr/lib/modules/99.98.6.5.0-rc5-default: No such file or directory
> depmod: FATAL: could not search modules: No such file or directory

I used kmod-30-8.1.x86_64 (openSUSE Tumbleweed with usr-merge).

The explicit MODLIB doesn't cut it because of another path dependency in
depmod's hack. That provision was added in commit bfe5424a8b31 ("kbuild:
Hack for depmod not handling X.Y versions") (2011, v3.0).
It says the hack is needed for module-init-tools < 3.13, 3.13 is from
2011 too. Actually, it seems to be a cautious action between 2.6.xx
series and an expected 3.0 but it ended up as 3.0.0 and SUBLEVEL=0
has been since then (so even the busybox's depmod should work without
the hack).

Remove the hack to make builds with custom INSTALL_MOD_PATH on
usr-merged distros possible.

Link: https://lore.kernel.org/r/CAK7LNAT6mQ0EpwmKUCBhv9Acaf_qyGq4hu%3DXvSWRuZ-pNAFWVw@mail.gmail.com/
Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
 scripts/depmod.sh | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 3643b4f896ed..84311255e4bf 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -23,24 +23,6 @@ if [ -z $(command -v $DEPMOD) ]; then
 	exit 0
 fi
 
-# older versions of depmod require the version string to start with three
-# 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"
-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
-		depmod_hack_needed=false
-	fi
-fi
-rm -rf "$tmp_dir"
-if $depmod_hack_needed; then
-	symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
-	ln -s "$KERNELRELEASE" "$symlink"
-	KERNELRELEASE=99.98.$KERNELRELEASE
-fi
-
 set -- -ae -F System.map
 if test -n "$INSTALL_MOD_PATH"; then
 	set -- "$@" -b "$INSTALL_MOD_PATH"
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] depmod: Remove version parsing hack
  2023-08-23 17:06 [PATCH] depmod: Remove version parsing hack Michal Koutný
@ 2023-08-23 17:31 ` Michal Suchánek
  2023-08-23 17:36   ` Michal Koutný
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Suchánek @ 2023-08-23 17:31 UTC (permalink / raw)
  To: Michal Koutný
  Cc: linux-kernel, linux-modules, linux-kbuild, Masahiro Yamada

Hello,

On Wed, Aug 23, 2023 at 07:06:32PM +0200, Michal Koutný wrote:
> When kbuild on usr-merged distro like:
> 
>         make INSTALL_MOD_PATH="$BUILD_DIR_C/mods" \
>              MODLIB="$BUILD_DIR_C/mods/usr/lib/modules/$release" \
>              modules_install
> 
> (notice the '/usr' insert)
> 
> where
>         release=$(make -s kernelrelease)
> 
> depmod fails:
> 
> >   DEPMOD  /var/tmp/build/mods/usr/lib/modules/6.5.0-rc5-default
> > ln: failed to create symbolic link '/var/tmp/build/mods/lib/modules/99.98.6.5.0-rc5-default': No such file or directory
> > depmod: ERROR: could not open directory /var/tmp/build/mods/usr/lib/modules/99.98.6.5.0-rc5-default: No such file or directory
> > depmod: FATAL: could not search modules: No such file or directory
> 
> I used kmod-30-8.1.x86_64 (openSUSE Tumbleweed with usr-merge).
> 
> The explicit MODLIB doesn't cut it because of another path dependency in
> depmod's hack. That provision was added in commit bfe5424a8b31 ("kbuild:
> Hack for depmod not handling X.Y versions") (2011, v3.0).
> It says the hack is needed for module-init-tools < 3.13, 3.13 is from
> 2011 too. Actually, it seems to be a cautious action between 2.6.xx
> series and an expected 3.0 but it ended up as 3.0.0 and SUBLEVEL=0
> has been since then (so even the busybox's depmod should work without
> the hack).
> 
> Remove the hack to make builds with custom INSTALL_MOD_PATH on
> usr-merged distros possible.

As far as I can tell this is already merged as
4d15c9fa058e6dee09324cfc93f48858d4296019 in
https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git

Thanks

Michal

> 
> Link: https://lore.kernel.org/r/CAK7LNAT6mQ0EpwmKUCBhv9Acaf_qyGq4hu%3DXvSWRuZ-pNAFWVw@mail.gmail.com/
> Signed-off-by: Michal Koutný <mkoutny@suse.com>
> ---
>  scripts/depmod.sh | 18 ------------------
>  1 file changed, 18 deletions(-)
> 
> diff --git a/scripts/depmod.sh b/scripts/depmod.sh
> index 3643b4f896ed..84311255e4bf 100755
> --- a/scripts/depmod.sh
> +++ b/scripts/depmod.sh
> @@ -23,24 +23,6 @@ if [ -z $(command -v $DEPMOD) ]; then
>  	exit 0
>  fi
>  
> -# older versions of depmod require the version string to start with three
> -# 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"
> -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
> -		depmod_hack_needed=false
> -	fi
> -fi
> -rm -rf "$tmp_dir"
> -if $depmod_hack_needed; then
> -	symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
> -	ln -s "$KERNELRELEASE" "$symlink"
> -	KERNELRELEASE=99.98.$KERNELRELEASE
> -fi
> -
>  set -- -ae -F System.map
>  if test -n "$INSTALL_MOD_PATH"; then
>  	set -- "$@" -b "$INSTALL_MOD_PATH"
> -- 
> 2.41.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] depmod: Remove version parsing hack
  2023-08-23 17:31 ` Michal Suchánek
@ 2023-08-23 17:36   ` Michal Koutný
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Koutný @ 2023-08-23 17:36 UTC (permalink / raw)
  To: Michal Suchánek
  Cc: linux-kernel, linux-modules, linux-kbuild, Masahiro Yamada

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Wed, Aug 23, 2023 at 07:31:20PM +0200, Michal Suchánek <msuchanek@suse.de> wrote:
> As far as I can tell this is already merged as
> 4d15c9fa058e6dee09324cfc93f48858d4296019 in
> https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git

I assume this is heading to v6.6-rc1.
Perfect, thanks! (It even handles dead cleanup part better than mine.)

Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-23 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 17:06 [PATCH] depmod: Remove version parsing hack Michal Koutný
2023-08-23 17:31 ` Michal Suchánek
2023-08-23 17:36   ` Michal Koutný

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).