Modify / Compile linux kernel for ubuntu

there are thousands of methods to do this, but let's do it with all the nice help we can get from ubuntu..

these steps are based on the ubuntu documentation about building a kernel and some Ubuntu community howto about compiling a kernel

  • cd into a directory where you want to have your kernel sources downloaded to
  • install all the packages needed and download the sources
apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5-dev
sudo apt-get build-dep linux
apt-get build-dep --no-install-recommends linux-image-`uname -r`
apt-get source linux-image-`uname -r`

cp linux-2.6.32/debian/control-scripts/{postinst,postrm,preinst,prerm} kernel-package/pkg/image/

cp linux-2.6.32/debian/control-scripts/headers-postinst kernel-package/pkg/headers/
  • cd into the linux-xxx directory that was created containing the sources
  • if you want, edit the config
make menuconfig
  • compile and build a deb package (nothe, the overlay-dir is only needed for ubuntu 10.04 (and maybe later too?))
make-kpkg clean
fakeroot make-kpkg --overlay-dir=$HOME/kernel-package/ --initrd --append-to-version=-custom.1.0 kernel_image kernel_headers
  • install the new kernel
dpkg -i ../linux-image-.....deb
dpkg -i ../linux-headers-.....deb
  • reboot :)
  • modify_compile_linux_kernel_in_ubuntu.txt
  • Last modified: 20.09.2010 17:17
  • by Pascal Suter