# [SOLVED] Unable to calculate Linux Kernel version for build

## Xywa

Hi,

I had some problems with nvidia-drives and kernel 3.8.0:

https://forums.gentoo.org/viewtopic-t-951692-highlight-.html

so I had to downgrade to 3.7.8.

It looks like everything is fine, but I had some such messages 'Could not find a Makefile in the kernel source directory' after last emerge -uDN world.

```
 * Messages for package www-client/chromium-25.0.1364.97:

 * Could not find a Makefile in the kernel source directory.

 * Please ensure that /usr/src/linux points to a complete set of Linux sources

 * Unable to calculate Linux Kernel version for build, attempting to use running version

 * Unable to check for the following kernel config options due

```

```
* Messages for package x11-drivers/xf86-video-intel-2.21.3:

 * Could not find a Makefile in the kernel source directory.

 * Please ensure that /usr/src/linux points to a complete set of Linux sources

 * Unable to calculate Linux Kernel version for build, attempting to use running version

```

```
# eselect kernel list

Available kernel symlink targets:

  [1]   linux-3.7.7-gentoo

  [2]   linux-3.7.8-gentoo *

  [3]   linux-3.8.0-gentoo

```

```
$ ls -la /usr/src/linux

lrwxrwxrwx 1 root root 18 Feb 20 07:42 /usr/src/linux -> linux-3.7.8-gentoo
```

Last edited by Xywa on Wed Feb 27, 2013 8:09 pm; edited 1 time in total

----------

## Jaglover

You probably ran depclean, too, and it cleaned your kernel sources, leaving only files that were not part of source package.

----------

## Xywa

 *Jaglover wrote:*   

> You probably ran depclean, too, and it cleaned your kernel sources, leaving only files that were not part of source package.

 

Yes, I was running depclean to add one of the driver (in manually install) after moving into 3.8.0. 

But because there is a problem with 3.8.0 and nvidia-drivers:

https://forums.gentoo.org/viewtopic-t-951692-highlight-.html

I had to go back to 3.7.8.

Now some more packages says Unable to calculate Linux Kernel version for build...

So what should I do? I cannot go for 3.8.0 as this bug with nvidia.

----------

## khayyam

 *Xywa wrote:*   

> Now some more packages says Unable to calculate Linux Kernel version for build... So what should I do? I cannot go for 3.8.0 as this bug with nvidia.

 

Xywa ... its not simply a matter of installing the sources, you have to prepare, and or/build, them. It sounds as you have installed sys-kernel/gentoo-sources-3.7.8 but haven't run 'menuconfig', 'oldconfig', 'make' (or what-have-you) and for this reason there is no 'Makefile'. So, assuming you have CONFIG_IKCONFIG_PROC=y you will have the .config for the currently booted kernel in /proc and can do the following:

```
# zcat /proc/config.gz > /usr/src/linux/.config

# cd /usr/src/linux && make oldconfig
```

If you don't have IKCONFIG_PROC enabled but have a known working config from some previous build then you can do the following:

```
# cp /path/to/gentoo-sources/.config /usr/src/linux/.config

# cd /usr/src/linux && make oldconfig
```

This should create the missing Makefile, and your ready to either 'make && make modules_install' or 'emerge nvidia-drivers'.

best ... khay

----------

## Xywa

 *khayyam wrote:*   

>  *Xywa wrote:*   Now some more packages says Unable to calculate Linux Kernel version for build... So what should I do? I cannot go for 3.8.0 as this bug with nvidia. 
> 
> Xywa ... its not simply a matter of installing the sources, you have to prepare, and or/build, them. It sounds as you have installed sys-kernel/gentoo-sources-3.7.8 but haven't run 'menuconfig', 'oldconfig', 'make' (or what-have-you) and for this reason there is no 'Makefile'. So, assuming you have CONFIG_IKCONFIG_PROC=y you will have the .config for the currently booted kernel in /proc and can do the following:
> 
> ```
> ...

 

Many thanks for all sugestions.

Anyway, I did emerge gentoo-sources again (with masked >3.7. :Cool:  and it did the job  :Smile: 

SOLVED

----------

