From patchwork Fri Aug 10 21:50:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Arokux B." X-Patchwork-Id: 1306691 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D5D39DF266 for ; Fri, 10 Aug 2012 21:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758086Ab2HJVuL (ORCPT ); Fri, 10 Aug 2012 17:50:11 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:58014 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756370Ab2HJVuK (ORCPT ); Fri, 10 Aug 2012 17:50:10 -0400 Received: by lbbgj3 with SMTP id gj3so431691lbb.19 for ; Fri, 10 Aug 2012 14:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=TQb1qedN5X5oksFlp30MrqT4PDx4wnfc6O8sa52Fa+Y=; b=YhGLM1hoB5IDF8yXo/eAoudK2Gfwl8Pyhs6aCjwAiog4MG+zztgejudID9+7xKasYQ 5sqdhMP+PVaySuBoG1WuUHxxMc5tjUsWn7RAYhBJyDsuqsQ32iFB8rKIYacNepSGhksj /7ld9ierdG7zfPqMHDWIcQUKQkTKT93/DT1l/xk8RHR2Q1LbGqj6fdF2m3pBrUtN4iZj 9p9UMciA7AGrE1ZkOxmCn+7AAj+3q+Kyf/n47OBjSeF1y0ls8Z5A+UBXpQ3v6oMQRRmZ jDmMZ6myWAaRmRf2Iia7jj8+a8AtIQLE6s58Yn/+Dh9bn6Ogc3XbBKdCAP19TDNZwUW8 g9vQ== MIME-Version: 1.0 Received: by 10.152.111.200 with SMTP id ik8mr4287876lab.15.1344635407819; Fri, 10 Aug 2012 14:50:07 -0700 (PDT) Received: by 10.114.1.161 with HTTP; Fri, 10 Aug 2012 14:50:07 -0700 (PDT) Date: Fri, 10 Aug 2012 23:50:07 +0200 Message-ID: Subject: Failure while make modules_install if kmod was compiled with --with-rootprefix set From: "Arokux B." To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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/. 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 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