Get the kernel source
There are a few ways to obtain the Ubuntu kernel source:
Use git (detailed instructions on it can be found in the Kernel Git Guide) - This is for users who always want to stay in sync with the latest Ubuntu kernel source.
- Download the source archive - This is for users who want to rebuild the standard Ubuntu packages with additional patches. Note that this will almost always be out of date compared to the latest development source, so you should use git (option #1) if you need the latest patches. To install the build dependencies and extract the source (to the current directory):
sudo apt-get build-dep linux-source
apt-get source linux-source
Starting from Hardy (8.04) this has changed to:
sudo apt-get build-dep linux-image-$(uname -r)Ubuntu modules source may also be needed if you plan to enable PAE and 64GB support in the kernel for 32bit Hardy (8.04). The Ubuntu supplied modules may not be compatible with PAE enabled kernel.
apt-get source linux-image-$(uname -r)
sudo apt-get build-dep linux-ubuntu-modules-$(uname -r)
apt-get source linux-ubuntu-modules-$(uname -r)
Download the source package (detailed instructions are further down this page under Alternate Build Method: The Old-Fashioned Debian Way) - This is for users who simply want to modify, or play around with, the Ubuntu-patched kernel source. Again, this will not be the most up-to-date (use option #1/git if you need the latest source). Please be aware this is NOT the same as option #2