apt-get source to download the Ubuntu version of the kernel
apt-get source linux-image-$(uname -r)
gives a folder that contains, for example:
The bolded diff includes all the Ubuntu/Debian customizations.
2. To build a stock kernel with your own
.config, use the "old-fashioned" Debian
This is the alternate old-fashioned way described in the wiki.
sudo apt-get install kernel-package
If you are compiling a kernel for the first time.
sudo apt-get build-dep linux-image-$(uname -r)
cd into the source directory (here,
make oldconfig to create
with your running kernel's configuration, or copy a third-part
.config to this directory
Depending on whether you want a text or graphical config, install:
sudo apt-get install libncurses5 libncurses5-dev
sudo apt-get install qt3-dev-tools libqt3-mt-dev
(text) or for graphical
When done, just run
make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers
N is how many jobs to run in parallel (usually the number of CPUs you have), and
my-very-own-kernel is a custom string to identify this build.
When done, the kernel image and header files will be ready as debs in the parent directory; you can simply install them with
sudo dpkg -i, which will also take care of adding GRUB entries, etc.