28

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

0

6 Answers 6

33

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)
3
  • 6 years old, and the first useful answer for http/ftp I have found amongst dozens.
    – mckenzm
    May 16, 2016 at 19:45
  • There are issues with apt-get source, see this to download directly from launchpad. Jul 23, 2017 at 14:48
  • 1
    No longer works on Ubuntu 20.04, only meta data is downloaded by now
    – daisy
    Nov 1, 2021 at 4:31
4

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

3

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)
1
2

I believe you can find the Linux Kernel maintenance here: LaunchPad: Linux Kernel

However, while the kernel for Ubuntu may be referred to as the Ubuntu Kernel - it's actually the Linux Kernel modified by the Ubuntu Kernel Team. You can find more information about the Ubuntu Kernel Members and how to get the Ubuntu Kernel using Git on the Ubuntu Wiki: Kernel

1
  • You do have a good point about finding information on the kernel team's wiki pages.
    – Brad Figg
    Aug 23, 2010 at 17:11
2

Download from the Git Repo:

git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/$RELEASE_NAME

On Jammy Jellyfish (22.04), for example:

git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy 
1
  • That's a good update. Thanks for posting it.
    – karel
    Feb 26, 2023 at 5:44
0

You can get the unmodified Linux Kernel at kernel.org.

1
  • 3
    These of course are not the Ubuntu kernels, but the kernel source on which the Ubuntu kernels are based.
    – Andy
    May 16, 2011 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .