Rootserver Sponsor



Please support your operating system's further development:


How to recompile aptosid kernel

This is intended for those who want to recompile aptosid kernel, to change some settings or add/remove patch.

In my case, to remove a patch that breaks backlight brightness on my laptop.

Please note that this procedure is intended to be done as a regular user, unless specified otherwise.

Grab the source

First step is to get the aptosid version of the kernel source.

To do that, you have to enable source in your apt configuration.

As root, edit your /etc/apt/sources.list.d/aptosid.list and remove the # in front of the line saying:

 deb-src sid main fix.main 

Then as root update your apt:

 apt-get update 

Now as a regular user, you can actually grab the source:

replace $arch with the arch you actually want, in my case amd64
 apt-get source linux-image-2.6-aptosid-$arch 

NOTE: In case you're looking for the previous revision of aptosid kernels they are available via svn on Get the one you want with a svn checkout:

 svn checkout<desired version> 

Install the required dependencies

As root, install the needed files
apt-get install fakeroot build-essential devscripts
apt-get build-dep linux-2.6

Compile the kernel

Where to find the config file

The .config file used for compiling a specific aptosid kernel version can be found in /boot or at /proc/config.gz

In my case: /boot/config-2.6.37-0.slh.23-aptosid-amd64


You can add or remove patches to be applied to the kernel in the relevant debian/patches subdirectory, then update the debian/series file.

In my case: removing the line referencing candidate/0147-drm-i915-panel-Fix-application-of-legacy-backlight-v.patch which is the culprit for breaking brightness on my intel video chipset.

Building custom binary package

The use of make-kpkg is deprecated, now you should use make deb-pkg.

In my case, it would be: fakeroot make deb-pkg

Rebuilding official binary package

You can build specific kernel binary packages using the targets listed in debian/rules.gen which have names of the form: binary-arch_<architecture>_<featureset>_<flavour>

In my case, it would be:

 fakeroot make -f debian/rules.gen binary-arch_amd64_none_aptosid-amd64 

Install the new kernel package

As root, you can now use dpkg to install the resulting .deb kernel package:

 dpkg -i linux-image-2.6.37-0.moose.backlightbugfix-aptosid-amd64.deb 

Other resources

Here are a few helpful resources for dealing with kernels and debian based distro:

System Administration