3. Download the Source Code

Next, you will need to download the source code for the version of the kernel you would like to build. You have two options for this. You may either install the Debian source package or download a vanilla version of the source code from http://www.kernel.org/. The Debian package would be the stabler of the two, but you will not find packages for the latest releases of the Linux kernel. If you do not need the new features of the most recent kernel, install the Debian source package. The command apt-cache search kernel-source should show you which versions of the kernel are available. The Debian source package will drop a compressed bzip file into /usr/src/. Unpack it with sudo tar -jxvf sourcetree.tar.bz2. The vanilla source tree will be either a bzip or a tarball depending on your download. To unpack the tarball, run sudo tar -zxvf sourcetree.tar.gz.