Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am planning to write some device drivers and I need to get the Linux kernel source. My Linux kernel version is 3.2.0-23-generic-pae and I downloaded the image from this. In many of the articles I have read, it tells me that I need to have the entire kernel tree to start inserting new modules.

Is it enough if I download this image and paste it into the usr/src/ folder or do I have to do something else?

share|improve this question
1  
I usually just install the 'linux-source' package from synaptic when I'm custom compiling for one of my machines, but given you're doing development you might need the most recent version. This link might be useful to you: help.ubuntu.com/community/Kernel/Compile –  Mark Paskal Jul 5 '12 at 5:50
add comment

1 Answer 1

up vote 12 down vote accepted

In precise, this will get the source of the kernel:

apt-get source linux-source-3.2.0

Or if you want the git source of the ubuntu kernel:

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git
share|improve this answer
    
+1 for the git link –  hbdgaf Jul 5 '12 at 6:35
    
If I use git to clone how do i specify the version. Also If i Clone it is it enough if a I copy pate it into the usr/src folder –  Sab Jul 5 '12 at 7:07
    
That git repository is kept to 3.2.0 specifically; it follows what's in Ubuntu Precise (12.04). If you want a different version change ubuntu-precise.git to ubuntu-quantal.git or whatever. It should be fine to just copy into usr/src. –  Bryce Jul 5 '12 at 7:11
    
Okay.Thanks- But how did you find that git link? –  Sab Jul 5 '12 at 7:15
    
Found it at wiki.ubuntu.com/KernelTeam/GitKernelBuild –  Bryce Jul 5 '12 at 7:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.