Where can I find the source code for the Ubuntu Kernel?

I'd like to build my own copy of the Ubuntu kernel. Where can I get the source code?


For building kernels, it is strongly suggested that you use git to get the latest source code from the Ubuntu kernel git repositories.

These repositories contain all updates to Ubuntu kernels, including ones which are proposed for release but not released yet. By fetching from the repos, you will be guaranteed to have the latest code.

If you want to fetch the source for a specific release, you may check out the tag associated with that release. Tags are similar to this example: "Ubuntu-2.6.32-17.26". The final number is an upload number which is sequentially increased, and the rest is the version number.

You can see a list of the Ubuntu kernel repositories here:

http://kernel.ubuntu.com/git

This page also lists a number of repositories for individual developers. The official Ubuntu kernel repositories begin with "ubuntu/ubuntu-"

If you are looking to just get the sources to the kernel that you are currently running you can:

apt-get source linux-image-$(uname -r)

https://help.ubuntu.com/community/Kernel/Compile

follow this steps, before apt-get source you should run

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

Best place is from the kernel team git repositories, see:

  • https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide