Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 68062 - external kernel modules installed in wrong directory: KV vs KERNEL_DIR
Summary: external kernel modules installed in wrong directory: KV vs KERNEL_DIR
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-18 14:43 UTC by Neil Katin
Modified: 2004-11-30 09:10 UTC (History)
2 users (show)

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


Attachments
Patch to /usr/lib/portage/pym/portage.py (portage.py.patch,962 bytes, patch)
2004-10-18 15:13 UTC, Neil Katin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Katin 2004-10-18 14:43:45 UTC
I've been working on some scripts to automatically config, compile, and build
a new kernel when released.  As part of the script I'm building the
kernel without changing the /usr/src/linux script (I wanted to leave that
as the "current, known good" kernel).

One of the external modules I'm installing is nvidia-kernel, which
is based off of /usr/portage/eclass/kmod.eclass.

I set the KERNEL_DIR environment variable to the new kernel and
everything works fine when I run the equivalent of
"env KERNEL_DIR=/usr/src/linux-2.6.8-gentoo-r8 emerge nvidia-kernel"
right up until the time when it is going to install the results in
/lib/modules.  Instead of installing the modules in
/lib/modules/2.6.8-gentoo-r8 (the slot that corresponds to the kernel
that was built) it incorrectly installs it in /lib/modules/2.6.8-gentoo-r7
(the slot that corresponds to /usr/src/linux).

The nvidia-kernel ebuild file uses this line to pick an installation
directory:  insinto /lib/modules/${KV}/video.  KV seems to be set
in /usr/lib/portage/pym/portage.py: (around line 2123)

    mykv,err1=ExtractKernelVersion(root+"usr/src/linux")

In other words, /usr/src/linux is hard coded; portage.py ignores
the KERNEL_DIR variable.

------------------------------

The right fix seems to be to make portage.py respect the KERNEL_DIR
variable, and to use /usr/src/linux only if KERNEL_DIR isn't set.
But I'm not sure how "global" the KERNEL_DIR variable was supposed to be.
KERNEL_DIR doesn't appear at all within /usr/lib/portage, and only
in /usr/lib/eclass/{kmod,kernel-mod}.eclass.

If KERNEL_DIR is not intended for the "base" portage application
I could also see overwriting KV in kmod.eclass but this seems an
uglier solution.
Comment 1 Neil Katin 2004-10-18 15:13:36 UTC
Created attachment 42126 [details, diff]
Patch to /usr/lib/portage/pym/portage.py


This patch fixes the install problem for me.  It changes
the doebuild function to respect the KERNEL_BUILD setting
when computing KV.
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2004-11-29 19:15:57 UTC
I noticed similar behavior using the new 2.6 ability to append a string on the end of your kernel name.  The EBuild would place the modules in the 'old name' directory when in fact the rest of my modules were in the appended name.

So all my modules would be in /lib/modules/gentoo-2.6.9-r1-pwned and the ebuild would place the nvidia module in /lib/modules/gentoo-2.6.9-r1.

This computer is at work, but I'll try the patched version and see if it corrects my problem as well.  Otherwise I'll probably submit a new bug ;0

Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2004-11-30 05:03:54 UTC
No need for a new bug. There's already bug #67804, which has been released in portage-2.0.51-r5. The fix might also soon be superceded by the new kernel-mod.eclass.
Comment 4 Daniel Drake (RETIRED) gentoo-dev 2004-11-30 05:27:44 UTC
We're moving away from portage setting KV, to using our own eclasses (linux-info and linux-mod) for this. We're also switching to KV_FULL to avoid conflicts. Will have to check if linux-info respects KERNEL_DIR in this respect.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2004-11-30 09:10:08 UTC
Yep it does. Please bear with us while we convert all ebuilds to using linux-info, not a minor operation!