So let’s say you want to install a Linux kernel 2.6.33 or newer on your Debian Lenny system.

Problem

The problem is that after you give your usual make-kpkg command to compile Linux kernel on Debian Lenny you will see the following error message after sometime into the compilation process:

COLUMNS=150 dpkg -l 'gcc*' perl dpkg 'libc6*' binutils make dpkg-dev |\
awk '$1 ~ /[hi]i/ { printf("%s-%s\n", $2, $3) }'> debian/buildinfo
uname -a >> debian/buildinfo
echo using the compiler: >> debian/buildinfo
grep LINUX_COMPILER include/linux/compile.h | \
sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >> debian/buildinfo
grep: include/linux/compile.h: No such file or directory
echo kernel source package used: >> debian/buildinfo
echo linux-source-2.6.33 1~experimental.4 >> debian/buildinfo
echo applied kernel patches: >> debian/buildinfo
echo done > debian/stamp/build/kernel
/usr/bin/make -f ./debian/rules     debian/stamp/binary/pre-linux-image-2.6.33-lennycompiletest2633squeeze
make[1]: Entering directory `/usr/src/linux-source-2.6.33'
====== making target debian/stamp/install/linux-image-2.6.33-lennycompiletest2633squeeze [new prereqs: ]======
This is kernel package version 11.015.
echo "The UTS Release version in include/linux/version.h"; echo "       \"\" "; echo "does not match current version:"; echo "       \"2.6.33-lennycompiletest2633squeeze\" "; echo "Please correct this."; exit 2
The UTS Release version in include/linux/version.h
""
does not match current version:
"2.6.33-lennycompiletest2633squeeze"
Please correct this.

make[1]: *** [debian/stamp/install/linux-image-2.6.33-lennycompiletest2633squeeze] Error 2
make[1]: Leaving directory `/usr/src/linux-source-2.6.33'
make: *** [kernel_image] Error 2

Just for sake of completeness, the command that I gave for above compilation was:

lenny:/usr/src/linux-source-2.6.33# make-kpkg --initrd --append-to-version=-lennycompiletest2633squeeze kernel_image

The reason that we get the above error message is because the kernel folks decided to change something in the kernel-package that is responsible for compiling custom kernel.

Solution

The easiest way to fix this error message is to modify the following file that gets installed when you install kernel-package package:

# nano /usr/share/kernel-package/ruleset/misc/version_vars.mk

and change the following lines:

UTS_RELEASE_HEADER=$(call doit,if [ -f include/linux/utsrelease.h ]; then  \
echo include/linux/utsrelease.h;            \
else                                            \
echo include/linux/version.h ;              \
fi)

to

UTS_RELEASE_HEADER=$(call doit,if [ -f include/linux/utsrelease.h ]; then  \
echo include/generated/utsrelease.h;            \
else                                            \
echo include/generated/utsrelease.h ;              \
fi)

and now re-compile your kernel again by giving your make-kpkg command.

In the next stable release of Debian i.e. Squeeze, the file version_vars.mk changed from current stable release i.e. Lenny.

root@debian:~# diff version_vars.mk.lenny version_vars.mk.squeeze

Output:
141,145c141,147
< UTS_RELEASE_HEADER=$(call doit,if [ -f include/linux/utsrelease.h ]; then  \
<                              echo include/linux/utsrelease.h;            \
<                          else                                            \
<                                echo include/linux/version.h ;              \
<                          fi)
---
> UTS_RELEASE_HEADER=$(call doit,if [ -f include/generated/utsrelease.h ]; then \
>                                echo include/generated/utsrelease.h;         \
>                                elif [ -f include/linux/utsrelease.h ]; then   \
>                                echo include/linux/utsrelease.h;             \
>                              else                                           \
>                                  echo include/linux/version.h ;               \
>                              fi)
187,188d188
<
< AM_OFFICIAL := $(call doit,if [ -f debian/official ]; then echo YES; fi )
root@debian:~#

The changes are not the exact same as I mentioned above but it does fix the same problem. May be you should copy the changes (instead of mine from above) from the Squeeze to your existing Lenny system as those changes are from the actual kernel maintainers!

That’s it!

Be Sociable, Share!