TIP: Compiling 2.6.33 and above kernels on Debian Lenny
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!


Email Subscription









June 3rd, 2011 at 3:29 am
hello and thanks :-)
this “exploit” doesn’t run on 2.6.37.6
is there a patch or other to risolve?
thanks!
Pol
Reply to this comment
November 27th, 2011 at 12:22 am
Do I have to recompile the ENTIRE fkcing kernal after doing this??? coz I tried to resume after doing this and the error persists, *^&*^&$#!!!! rm -rf MAKE!!!! arg!
Reply to this comment
November 27th, 2011 at 12:27 am
run “make-kpkg clean” at the end of this procedure, before recompiling?
Reply to this comment