I am following this to learn to compile the kernel. I used
apt-get source linux-image-$(uname -r)
to download the source code of the Linux kernel I am curretly using.
After running the above command, the following files (and directories) were downloaded.
user $ ls -l
total 130972
drwxrwxr-x 27 sps sps 4096 Oct 16 03:10 linux-lts-vivid-3.19.0
-rw-rw-r-- 1 sps sps 10980684 Oct 5 10:54 linux-lts-vivid_3.19.0-30.34~14.04.1.diff.gz
-rw-rw-r-- 1 sps sps 7396 Oct 5 10:54 linux-lts-vivid_3.19.0-30.34~14.04.1.dsc
-rw-rw-r-- 1 sps sps 123115155 May 6 21:35 linux-lts-vivid_3.19.0.orig.tar.gz
user $
In the same page it is mentioned:
Building the kernel is quite easy. Change your working directory to the root of the kernel source tree and then type the following commands:
But I am not sure which is the "root of the kernel source tree".
Is it the current directory (where I ran apt-get source ...
and where I have the above listed files)?
Or, is it the directory:
drwxrwxr-x 27 sps sps 4096 Oct 16 03:10 linux-lts-vivid-3.19.0
or, should I extract the tarball
-rw-rw-r-- 1 sps sps 123115155 May 6 21:35 linux-lts-vivid_3.19.0.orig.tar.gz
Output for uname -r
:
user $ uname -r
3.19.0-30-generic
user $
Best Answer
From the Debian Wiki:
It's quite the same for Ubuntu, and in your case:
When you run
apt-get source linux-image-$(uname -r)
, the upstream tarball is automatically patched with the modifications listed in "linux-lts-vivid_3.19.0-30.34~14.04.1.diff.gz" in "linux-lts-vivid-3.19.0":