Ubuntu – get kernel source code

kernelsourceUbuntu

I need a specific kernel version to compile it with some additional modules.

When I typing:

uname -r

I get

3.8.0-29-generic

I need this one.

 uname -a
 Linux "..." 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Where can I find this version? Here https://www.kernel.org/ seems that there isn't..

Best Answer

You could just use apt to get the source, check that the file /etc/apt/sources.list contains a line starting with

deb-src 

and then use the command:

apt-get update
#if you want to download the source into the current directory use:
apt-get source linux-image-$(uname -r)
#if you want the source to be installed in the system directory use:
apt-get install linux-source-$(uname -r)

It will download the source in the folder:

/usr/src or /usr/sources
Related Question