Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 239189 - app-emulation/kvm doesn't pass $KERNEL_DIR when building modules
Summary: app-emulation/kvm doesn't pass $KERNEL_DIR when building modules
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
: 245953 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-09-30 19:47 UTC by Scott M. Ferris
Modified: 2008-11-11 03:11 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
kerneldir patch for app-emulation/kvm-75 (kvm-kerneldir.patch,490 bytes, patch)
2008-09-30 19:49 UTC, Scott M. Ferris
Details | Diff
patch to use --kerneldir=$KV_DIR (kvm-kerneldir.patch,486 bytes, patch)
2008-09-30 20:05 UTC, Scott M. Ferris
Details | Diff
full build.log for the failing case (kvm-75.build.log,111.98 KB, text/plain)
2008-10-01 15:54 UTC, Scott M. Ferris
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott M. Ferris 2008-09-30 19:47:59 UTC
app-emulation/kvm with USE=modules doesn't pass $KERNEL_DIR to the configure script.  This means the configure script will use `uname -r` to try to find kernel source, rather than use the kernel source the linux-mod eclass finds.

Adding the following to the ebuild's src_compile avoids the `uname -r` lookup and instead uses the $KERNEL_DIR from linux-mod.eclass.

use modules && conf_opts="$conf_opts --kerneldir=$KERNEL_DIR"


Reproducible: Always

Steps to Reproduce:
1. Update kernel source to a newer version, build a new kernel, change /usr/src/linux symlink, but don't reboot yet.
2. emerge kvm


Actual Results:  
make -C /lib/modules/2.6.27-rc7/build M=`pwd` \
		LINUXINCLUDE="-I`pwd`/include -Iinclude -Iarch/x86/include -I`pwd`/include-compat \
		-include include/linux/autoconf.h \
		-include `pwd`/x86/external-module-compat.h"
make: *** /lib/modules/2.6.27-rc7/build: No such file or directory.  Stop.
make: *** [all] Error 2


Expected Results:  
make -C /usr/src/linux M=`pwd` \
		LINUXINCLUDE="-I`pwd`/include -Iinclude -Iarch/x86/include -I`pwd`/include-compat \
		-include include/linux/autoconf.h \
		-include `pwd`/x86/external-module-compat.h"
make[1]: Entering directory `/usr/src/linux-2.6.27-rc8'
Comment 1 Scott M. Ferris 2008-09-30 19:49:17 UTC
Created attachment 166863 [details, diff]
kerneldir patch for app-emulation/kvm-75
Comment 2 Scott M. Ferris 2008-09-30 20:05:17 UTC
Created attachment 166864 [details, diff]
patch to use --kerneldir=$KV_DIR

Actually, it looks like the correct variable is $KV_DIR from linux-info.eclass, not $KERNEL_DIR.  Revised patch attached.
Comment 3 Daniel Gryniewicz (RETIRED) gentoo-dev 2008-10-01 14:41:39 UTC
Hrm...  As far as I can tell, the kvm build system shouldn't be attempting to build any kernel modules, so it doesn't need that option.  Could you attach a full build log?
Comment 4 Scott M. Ferris 2008-10-01 15:54:23 UTC
Created attachment 166913 [details]
full build.log for the failing case

The USE=modules flag tells the ebuild to build from the module source in the package.

pkg_setup does:

        elif use modules ; then
                BUILD_TARGETS="all"
                MODULE_NAMES="kvm(kvm:${S}/kernel:${S}/kernel/x86)"
                MODULE_NAMES="${MODULE_NAMES} kvm-intel(kvm:${S}/kernel:${S}/kernel/x86)"
                MODULE_NAMES="${MODULE_NAMES} kvm-amd(kvm:${S}/kernel:${S}/kernel/x86)"
                linux-mod_pkg_setup

When src_compile does:
        if use modules && ! use havekernel ; then
                linux-mod_src_compile
        fi


then linux-mod_src_compile will run `emake all` in the kernel directory of the kvm package (because of the MODULE_NAMES), and kernel/Makefile pulls in the KERNELDIR setting from ../config.mk, which is the --kerneldir passed to the configure step.
Comment 5 Daniel Gryniewicz (RETIRED) gentoo-dev 2008-11-11 02:38:18 UTC
*** Bug 245953 has been marked as a duplicate of this bug. ***
Comment 6 Daniel Gryniewicz (RETIRED) gentoo-dev 2008-11-11 03:11:32 UTC
Sorry, I lost track of this.  Fixed in 78 without a bump.