When compiling nvidia kernel module with latest linux kernel 3.7.6, I got this error message:
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 equivalent nvidia-installer command line option.
Fortunately, I found a solution on the WWW (http://forums.gentoo.org/viewtopic-t-950330.html)
, pointing out a missing symlink which makes conftest.sh (subroutine select_makefile) run into a branch designed for V2.6 kernels (http://forum.chip.de/linux/kernel-3-7-6-nvidia-treiber-1710085.html)
if [ -n "$PATCHLEVEL" -a $PATCHLEVEL -ge 6 \
-a -n "$SUBLEVEL" -a $SUBLEVEL -le 5 ]; then
While kernel 3.7.5 still passed this check, 3.7.6 triggers an error
IMO, a check for kernel V2 vs. V3 should be added here ...
ln -s /usr/src/linux/include/generated/uapi/linux/version.h /usr/src/linux/include/linux/version.h
fixes the issue (or patching conftest.sh).