# kernel-sources

## the brave

I'm trying to get nvidia drivers installed, but it seems that my system doesn't have a kernel-source installed.

my kernel version is:

```
poseidon root # uname -a

Linux poseidon 2.6.5-gentoo-r1 #1 SMP Sun Sep 12 01:13:09 UTC 2004 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux

```

I followed the directions in this https://forums.gentoo.org/viewtopic.php?t=204656 How To, but when I emerge the packages "nvidia-kernel nvidia-glx opengl-update", when nvidia-kernel is being installed the system complains saying:

```
 *** Unable to determine the target kernel version. ***

make: *** [select_makefile] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.6111 failed.

!!! Function src_compile, Line 89, Exitcode 2

!!! Failed to build module
```

What's going on here? Is the problem related to the kernel-source, or is there anything else which I 'm missing?

Thanks for the help.

----------

## DaMouse

yap you require a kernel sources to build against.. i advise emerging ck-sources and using that as a base (need bzImage from it..) or you could emerge the gentoo-dev-sources again if you wish to continue with that  :Smile: 

-DaMouse

----------

## the brave

DaMouse:

I installed the latest dev kernel version (2.6.8-gentoo), but when trying to load the system with the new kernel it got stuck and gave me some error messages saying that module.dep or whatever was not found. 

See below the steps I followed in order to get it installed (took from another thread):

```

1) emerge -u gentoo-dev-sources

2) check if the link /usr/src/linux is pointing to the new kernel (kernel-2.6.8-gentoo-r3)

3) cp /usr/src/linux-2.6.5-gentoo-r1/.config /usr/src/linux (at this moment no .config file was found, so that it was not copied to /usr/src/linux)

4) cd /usr/src/linux

5) make oldconfig (many questions were raised asking me if I'd like to install the new things available in the new kernel, I said Yes to all of them)

6) make && make modules_install

7) cp System.map /boot (with my boot partition mounted)

8) cp arch/i386/boot/bzImage /boot/kernel-2.6.8-gentoo-r3

9) edited my /boot/grub/grub.conf file 
```

My grub.conf looks like:

```
default 0

timeout 30

splashimage=(hd0,1)/grub/splash.xpm.gz

title=Gentoo 2.6.5-r1

root (hd0,1)

kernel /kernel-2.6.5-gentoo-r1 root=/dev/hda4 vga=788

title=Gentoo 2.6.8-r3

root (hd0,1)

kernel /kernel-2.6.8-gentoo-r3 root=/dev/hda4 vga=788

title=Windoze XP

rootnoverify (hd0,0)

chainloader +1
```

Not sure if the error messages I got could be associated to my grub file, I haven't run grub > root (hd0,1) > setup (hd0) commands, just editied the grub.conf file. Was this procedure correct?

Any suggestions or hints will be welcome.

Thanks.

PS: I unmerged the new kernel and of course I'm still supposed to reinstall it. Not sure if the bunch of yes (during step 5) was the cause for the problem. There were some question which the answers were obvious but for most of them it was not and I prefered to say y than n.   :Laughing: 

----------

## DaMouse

mmm, you sure you did modules_install? also, try running depmod -a or re-emerging module-init-tools

-DaMouse

----------

## rush_ad

get a new kernel. try 2.6.8

----------

## oumpah-pah

I think you shouldn't use

```
make oldconfig
```

as you did at point 5). You said you had no .config file to start with, and since make oldconfig is intended to only promt for changes between your old and new kernel, it prompted for everything. Try using

```
make menuconfig
```

instead, reading carefuly help about options you do not understand. The rest of the procedure seems correct, and your grub.conf file too (just check that you have a menu.lst link pointing to it).

----------

## the brave

Up till now I was not able to figure out what's going on here with 2.6.8-r3. Actually, I cannot understand one point: I've already have gento-dev -sources (kernel-2.6.5-gentoo-r1) installed when installing gentoo. 

I've just jumped to gentoo after 1 year using Mandrake. With mandrake I used to have the kernel and kernel-sources installed so that the nvidia driver could be installed (both versions of kernel and kernel source had to match each other otherwise the nvidia installation wouldn't be succesful)

My question is, if I have a kernel (gentoo-dev-sources) version 2.6.5, why do I have to upgrade to 2.6.8 to get nvidia installed here. Why I'm receiving this message during nvidia emerging process?

```
If you are using a Linux 2.6 kernel, please make sure

you have configured kernel sources matching your kernel

installed on your system. If you specified a separate

output directory using either the "KBUILD_OUTPUT" or

the "O" KBUILD parameter, make sure to specify this

directory with the SYSOUT environment variable or with

the appropriate nvidia-installer command line option.

*** Unable to determine the target kernel version. ***

make: *** [select_makefile] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.6111 failed.

!!! Function src_compile, Line 89, Exitcode 2

!!! Failed to build module
```

I'm sorry for my stupid question, but where to find the sources so that it can match my kernel version?

Thanks.

----------

## oumpah-pah

If you use a 2.6.5 kernel, it's just fine. You only have to make sure that the /usr/src/linux symlink points to the sources corresponding to your kernel. Also, I think you should have the .config file corresponding to the kernel you're using in that directory.

----------

## the brave

 *oumpah-pah wrote:*   

> Also, I think you should have the .config file corresponding to the kernel you're using in that directory.

 

I have no .config file neither in /usr/src/linux symlink nor /usr/src/linux-2.6.5-gentoo-r3.  :Question:  despite of having compiled the kernel using make menuconfig command, saving the changes I made and of course running make && make modules_install.

PS: and /usr/src/linux is also pointing to the correct kernel

----------

## MrApples

im not sure how that could be, unless its pointing to a different config file for some reason, try make menuconfig, then "Save to an Alternate File" and save it as something else, then copy it to .config

----------

## the brave

Actually I had forgotten to cp .config  /boot/config-2.6.5-gentoo-r1. Now it's done, but still getting the same error while emerging nvidia:

```
poseidon / # emerge nvidia-kernel nvidia-glx opengl-update

Calculating dependencies ...done!

>>> emerge (1 of 3) media-video/nvidia-kernel-1.0.6111 to /

x86

>>> md5 src_uri ;-) NVIDIA-Linux-x86-1.0-6111-pkg1.run

x86

x86

>>> Unpacking source...

 * /usr/src/linux is a symbolic link

 * Determining the real directory of the Linux kernel source code

 * Building for Linux 2.6.5-gentoo-r1 found in /usr/src/linux

 * which outputs to /usr/src/linux

 * By not using the kernel's ability to output to an alternative

 * directory, some external module builds may fail.

 * See <insert link to user doc here>

Creating directory NVIDIA-Linux-x86-1.0-6111-pkg1

Verifying archive integrity... OK

Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 1.0-6111..........................................................................................................................................................................................................

 * Applying power-suspend-2.6.9-changes.patch...                          [ ok ] * Applying nv_enable_pci.patch...                                        [ ok ]>>> Source unpacked.

x86

If you are using a Linux 2.4 kernel, please make sure

you either have configured kernel sources matching your

kernel or the correct set of kernel headers installed

on your system.

If you are using a Linux 2.6 kernel, please make sure

you have configured kernel sources matching your kernel

installed on your system. If you specified a separate

output directory using either the "KBUILD_OUTPUT" or

the "O" KBUILD parameter, make sure to specify this

directory with the SYSOUT environment variable or with

the appropriate nvidia-installer command line option.

*** Unable to determine the target kernel version. ***

make: *** [select_makefile] Error 1

!!! ERROR: media-video/nvidia-kernel-1.0.6111 failed.

!!! Function src_compile, Line 89, Exitcode 2

!!! Failed to build module
```

Before receiving the above output, I got an error message saying to run mrproper inside /usr/src/linux-2.6.5-gentoo-r1. It was done, but still no success.

Any suggestion.

----------

## oumpah-pah

You should be aware that

```
make mrproper
```

deletes your .config file too. So you have to copy it back in /usr/src/linux.

----------

