Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bad detection of kernel sources when using emerge.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
barlad
l33t
l33t


Joined: 22 Feb 2003
Posts: 673

PostPosted: Sat Mar 15, 2003 12:15 am    Post subject: Bad detection of kernel sources when using emerge. Reply with quote

Hello there,

when I use the emerge command to install some programs, the configure script run by the ebuild script detects an incorrect version of the kernel sources.
The concerned packages so far are nvidia-kernel and alsa-driver. When I run the configure script of those packages manually, correct sources are detected (/usr/src/linux-2.5.64-bk9), when I run the ebuild script, sources detected are : /usr/src/linux (which is /usr/src/linux-2.4.20-ck4)

Here are the two lines concerned (although it does not tell much) :
checking for directory with kernel source... /usr/src/linux
checking for kernel version... 2.4.20-ck4

when I run the configure script manually :
checking for directory with kernel source.../usr/src/linux-2.5.64-bk9
checking for kernel version... 2.5.64-bk9

If I delete the /usr/src/linux symlink, I get an error :
*
* Could not determine your kernel version.
* Make sure that you have /usr/src/linux symlink.
* And that said kernel has been configured.
* You can also simply run the following command
* in the kernel referenced by /usr/src/linux:
* make include/linux/version.h
*

Is there any solution to this besides symlinking /usr/src/linux to the kernel I am using ? (which is not really a good thingI think)
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sat Mar 15, 2003 10:20 am    Post subject: Reply with quote

You can temporarily change the symlink to the other sourcecode.

Otherwise define KV yourself in make.conf:
Code:

KV="2.5.64-bk9"
KVERS="2/5/64-bk9"
Back to top
View user's profile Send private message
barlad
l33t
l33t


Joined: 22 Feb 2003
Posts: 673

PostPosted: Sat Mar 15, 2003 11:05 am    Post subject: Reply with quote

Ok thanks, I will try to define KV manually.

Anyone minds explaining to me why is portage/emerge detecting the wrong version though, just out of curiosity? I find it wierd that when emerge runs the configure script, it does not work and when I do it, it works.
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sat Mar 15, 2003 4:17 pm    Post subject: Reply with quote

Because the ebuild doesn't use the ./configure kernelversion-guessing, but the portage.py's defined check_kv(), which tries to find out the kernelversion out of the /usr/src/linux directory...

In the ebuild:
Code:

pkg_setup() {
        check_KV
}


In portage.py:
Code:

    if (mydo!="depend") or not settings.has_key("KV"):
        mykv,err1=ExtractKernelVersion(root+"usr/src/linux")
        if mykv:
            # Regular source tree
            settings["KV"]=mykv
        else:
            settings["KV"]=""

    if (mydo!="depend") or not settings.has_key("KVERS"):
        myso=getstatusoutput("uname -r")
        settings["KVERS"]=myso[1]



So defining KV and KVERS in make.conf will list it in the settings-dictionary. If not, it will extract the kernelversion (ExtractKernelVersion(root+"usr/src/linux")). KVERS is the running kernel. This doesn't need to be defined in make.conf, but it won't hurt either (I think).
Back to top
View user's profile Send private message
Dalrain
Tux's lil' helper
Tux's lil' helper


Joined: 02 Jul 2002
Posts: 136
Location: Wooster, OH USA

PostPosted: Sat Mar 15, 2003 5:49 pm    Post subject: Reply with quote

Err...why on earth wouldn't you point the /usr/src/linux symlink to your current sources? That is why it's there...why would you want to point it anywhere else?
Back to top
View user's profile Send private message
i_hate_your_os
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2002
Posts: 128
Location: Manhattan Beach, CA

PostPosted: Sat Mar 15, 2003 9:58 pm    Post subject: because Linus says so Reply with quote

seriously. fwiw,

see

http://www.linuxfocus.org/common/src/article240/erratum.html

and

http://www.linuxgazette.com/issue62/tag/4.html
_________________
-IHYOS

"All laws which are repugnant to the constitution are null and void."
-Marbury vs. Madison, 5 US (2 Cranch) 137, 174, 176, (1803)
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sun Mar 16, 2003 9:36 am    Post subject: Reply with quote

I've had a discussion about that with lostlogic, one of Gentoo's kerneldevels. Here is his answer:
Quote:

Actually we solve this concern in a very different way. Most linux distribution
s use a symlink to /usr/src/linux/include/asm and /usr/src/linux/include/linux f
or the linux kernel headers for the C library. We do not. We physically instal
l headers during system installation directly to /usr/src/include/linux and /usr
/src/include/asm so it is then perfectly acceptable to use /usr/src/linux for wh
atever kernel the system happens to be running.
Back to top
View user's profile Send private message
i_hate_your_os
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2002
Posts: 128
Location: Manhattan Beach, CA

PostPosted: Sun Mar 16, 2003 11:04 am    Post subject: Reply with quote

Sven Vermeulen wrote:
I've had a discussion about that with lostlogic, one of Gentoo's kerneldevels. Here is his answer:
Quote:

physically install headers during system installation directly to /usr/src/include/linux and /usr/src/include/asm so it is then perfectly acceptable to use /usr/src/linux for whatever kernel the system happens to be running.


hmm,... above, /usr/src/include/{linux,asm}/ relates to /usr/src/linux/ how, exactly? does he mean /usr/src/linux/include/{linux,asm}/ perhaps, as in:

Quote:

physically install headers during system installation directly to /usr/src/linux/include/linux and /usr/src/linux/include/asm so it is then perfectly acceptable to use /usr/src/linux for whatever kernel the system happens to be running.


what seems wierd about gentoo to me, and presumably what caused the impetus for this thread, is that there is the kernel headers (2.4.19, or whatever), put into /usr/include/linux. And then there's tons of ebuilds that get "clever" and decide for us automagically to use /usr/src/linux/include instead (because, for example, they create km's, and don't want to break).

I have tried replacing the kernel-headers ebuild with whatever bleeding edge sources I am using with some success at various times, but it's such a hassle and breaks ebuild "magic" sometimes requiring all kinds of awful hand-holding to get ebuilds to go... I understand that QA would be pretty hard without knowing what headers are there... but it would be nice to have a per-ebuild choice somehow....
_________________
-IHYOS

"All laws which are repugnant to the constitution are null and void."
-Marbury vs. Madison, 5 US (2 Cranch) 137, 174, 176, (1803)
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Sun Mar 16, 2003 11:25 pm    Post subject: Reply with quote

This has come up a few times before. The most detailed incarnation of it that I remember is Unresolved symbols in nvidia-kernel.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum