In my case, at the time of this writing, I am still using Kubuntu 13.04. I begin by getting the source code from the GIT repository. It is important to note here that the kernel source can also be installed via the package manager, but it is my preference to work with the GIT tree. 1.) That allows me to create branches and save various build input and/or output in control. 2.) I can reset the source back to the original point if I have totally messed something up and 3.) I can travel "back in time" to older versions of the kernel source with which I can use to build.
To use the package manager to install the source for the kernel that is being currently used:
To get the source code from GIT you will need to use the repository associated with your version of Ubuntu. The Ubuntu wiki lists each:
In my case however the above link gives me the wrong URL (as my version is now "archived"). If you are not able to perform a GIT clone with what is listed, go straight to the root and look for the "folder" that matches your version. The root can be found here:
In my case then I will be cloning with the following:
For my needs, I will only need an abbreviated list of commands. I will also mention that while performing the build I will be using the canonical kernel.