linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Failure while make modules_install if kmod was compiled with --with-rootprefix set
@ 2012-08-10 21:50 Arokux B.
  2012-08-30 14:37 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Arokux B. @ 2012-08-10 21:50 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild, linux-kernel

Dear Mr. Marek, dear all,

I have detected a hidden failure while building the kernel. If
--with-rootprefix is set for kmod, then depmod will look for modules
installed at the location $ROOTPREFIX/lib/modules/<version>. The
kernel build system does not know anything about $ROOTPREFIX, and so
the wrong directory is created for the test if the hack is needed for
an older versin of depmod at scripts/depmod.sh:19 mkdir -p
"$tmp_dir/lib/modules/$KERNELRELEASE". That is why "$DEPMOD" -b
"$tmp_dir" $KERNELRELEASE will always fail and kernel build system
will think that the hack is always needed and depmod_hack_needed will
always be true. After that the created symlink is wrong since it also
does not contain $ROOTPREFIX, which depmod will preprend. That is why
depmod will fail.

To cure the problem an additional variable $MOD_ROOT_PREFIX can be
introduced. With the help of this variable the paths in the
scripts/depmod.sh are parametrized. This variable should be set to the
same value which was passed to --with-rootprefix while compilation of
kmod. Example: if  --with-rootprefix is set to /usr and the modules
should be installed at the location /home/john, then the the following
make call should be issued: make INSTALL_MOD_PATH=/home/john
$MOD_ROOT_PREFIX=/usr. After that the modules will be installed at
/home/john/usr. However should be also added to other places where the
actuall installing takes place, and so I do not this this solution is
optimal, nevertheless, please find the patch for depmod.sh at the end
of this e-mail.

A more superior solution could be probably a new option for depmod
which would allow an overwriting of the $ROOTPREFIX. This option can
be used in depmod.sh then to overwrite $ROOTPREFIX with an empty
string.

I was unsure as of which solution is better if any at all and so such
a lengthy e-mail...

With kind regards,

Arokux


diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 2ae4817..87a6e42 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -16,16 +16,18 @@ 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/$MOD_ROOT_PREFIX/lib/modules/$KERNELRELEASE"
+"$DEPMOD" -b "$tmp_dir" $KERNELRELEASE
+echo hello
 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/$MOD_ROOT_PREFIX/lib/modules/$KERNELRELEASE/modules.dep" -o
\
+               -e
"$tmp_dir/$MOD_ROOT_PREFIX/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"
+       symlink="$INSTALL_MOD_PATH/$MOD_ROOT_PREFIX/lib/modules/99.98.$KERNELRELEASE"
        ln -s "$KERNELRELEASE" "$symlink"
        KERNELRELEASE=99.98.$KERNELRELEASE
 fi

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

* Re: Failure while make modules_install if kmod was compiled with --with-rootprefix set
  2012-08-10 21:50 Failure while make modules_install if kmod was compiled with --with-rootprefix set Arokux B.
@ 2012-08-30 14:37 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2012-08-30 14:37 UTC (permalink / raw)
  To: Arokux B.; +Cc: linux-kbuild, linux-kernel

On 10.8.2012 23:50, Arokux B. wrote:
> Dear Mr. Marek, dear all,
> 
> I have detected a hidden failure while building the kernel. If
> --with-rootprefix is set for kmod, then depmod will look for modules
> installed at the location $ROOTPREFIX/lib/modules/<version>. The
> kernel build system does not know anything about $ROOTPREFIX, and so
> the wrong directory is created for the test if the hack is needed for
> an older versin of depmod at scripts/depmod.sh:19 mkdir -p
> "$tmp_dir/lib/modules/$KERNELRELEASE". That is why "$DEPMOD" -b
> "$tmp_dir" $KERNELRELEASE will always fail

I think we can revert the hack, because the three-digit version number
will stay for foreseeable future and depmod is not the only tool that
used to rely on this. However, what you describe looks like a bug in
kmod's depmod. -b sets the basedir, depmod should not prepend it with
any compiled-in string.

Michal

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

end of thread, other threads:[~2012-08-30 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-10 21:50 Failure while make modules_install if kmod was compiled with --with-rootprefix set Arokux B.
2012-08-30 14:37 ` Michal Marek

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