0

If I download the source code as:

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git 

In Makefile I can see

VERSION = 3
PATCHLEVEL = 2
SUBLEVEL = 55
EXTRAVERSION =

If I do this:

apt-get source linux-image-$(uname -r)

In Makefile I can see

VERSION = 3
PATCHLEVEL = 8
SUBLEVEL = 13
EXTRAVERSION = .19

None of the above two matches with my running kernel:

#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise

Also:

3.8.0-38-generic #56~precise1-Ubuntu SMP Thu Mar 13 16:23:47 UTC 2014 i686 i686 i386 GNU/Linux

I understand I should have the exactly same source code that is running for developing and loading a driver using insmod. So how do I download the matching source code

0

Confusingly, the version number reported by uname does not correspond to the mainline kernel version in newer Ubuntu releases.

See this FAQ entry:
https://wiki.ubuntu.com/Kernel/FAQ#Kernel.2BAC8-FAQ.2BAC8-GeneralVersionToMainline.Given_an_Ubuntu_kernel_package_version_how_do_we_find_the_exact_mainline_release_it_is_based_on.3F

And the linked mapping table:
http://people.canonical.com/~kernel/info/kernel-version-map.html

Elsewhere on the FAQ page, you see how to query exact versions. On my 12.04.4 system, uname reports 3.2.0, but the upstream kernel used is 3.2.66:

user@host:~$ uname -r
3.2.0-77-generic
user@host:~$ cat /proc/version_signature 
Ubuntu 3.2.0-77.112-generic 3.2.66

If you check out tags/Ubuntu-3.2.0-77.112 from the precise kernel repo, you will see a Makefile with a SUBLEVEL of 66. The same is true for a tree installed via apt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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