diff mbox

Failure while make modules_install if kmod was compiled with --with-rootprefix set

Message ID CAPNxggbrC7cKXYTKk=ivDL2ZT2w+5G4PACH1YT7iK-ZNk7twRQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arokux B. Aug. 10, 2012, 9:50 p.m. UTC
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


-       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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Michal Marek Aug. 30, 2012, 2:37 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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