LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   How to download the kernel source code of Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/how-to-download-the-kernel-source-code-of-ubuntu-4175434848/)

TriggerHuang 10-31-2012 01:16 AM

How to download the kernel source code of Ubuntu
 
Hi,

For the customer's requirement, we need to re-compile the kernel image of Ubuntu12.04, such as Linux-3.2.0-23.36. So would you please help to tell where I can download the kernel source code? The standard kernel on http://www.kernel.org/????

Thanks in advance.

evo2 10-31-2012 02:04 AM

Hi,

the source corresponding to your running kernel should be in the package called "linux-source-$(uname -r)". So, you should be able to download it with the following command.
Code:

sudo apt-get install linux-source-$(uname -r)
The source will be in /usr/src.

You can recompile it using what ever method you like, but I would recommend using the make-kpkg command from the "kernel-package" package.

HTH,

EVo2.

tommcd 10-31-2012 04:50 AM

In case you are interested in Ubuntu kernels from the Ubuntu developers that you can download as already compiled .deb packages, you can get them from here:
http://kernel.ubuntu.com/~kernel-ppa/mainline/
That site includes standard Ubuntu kernels as well as kernels that have not yet entered into the standard Ubuntu repositories.

TriggerHuang 10-31-2012 05:50 AM

Quote:

Originally Posted by evo2 (Post 4818726)
Hi,

the source corresponding to your running kernel should be in the package called "linux-source-$(uname -r)". So, you should be able to download it with the following command.
Code:

sudo apt-get install linux-source-$(uname -r)
The source will be in /usr/src.

You can recompile it using what ever method you like, but I would recommend using the make-kpkg command from the "kernel-package" package.

HTH,

EVo2.



Hi,
Thanks for your kindly reply.
But when I run sudo apt-get install linux-source-$(uname -r) on my Ubuntu12.04 system, the following error messages will show:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-source-3.2.0-23-generic-pae
E: Couldn't find any package by regex 'linux-source-3.2.0-23-generic-pae'
So it seems it can not find it. Did you ever seen this before?

knudfl 10-31-2012 10:37 AM

sudo apt-get install linux-source :
Code:

Unpacking linux-source-3.2.0 (from .../linux-source-3.2.0_3.2.0-32.51_all.deb) ...
Selecting previously unselected package linux-source.
Unpacking linux-source (from .../linux-source_3.2.0.32.35_all.deb) ...
Setting up linux-source-3.2.0 (3.2.0-32.51) ...
Setting up linux-source (3.2.0.32.35) ...

File list : $ dpkg -L linux-source-3.2.0

'-32.51' http://packages.ubuntu.com/source/precise/linux
The build / update '-23' that you have is a 6 month old version :
The relase version → No security updates.

Older versions ...
linux-source-3.2.0_3.2.0-23.36_all.deb 11-Apr-2012
linux-source-3.2.0_3.2.0-24.38_all.deb 02-May-2012
linux-source-3.2.0_3.2.0-24.39_all.deb 22-May-2012
linux-source-3.2.0_3.2.0-25.40_all.deb 25-May-2012
linux-source-3.2.0_3.2.0-26.41_all.deb 15-Jun-2012
linux-source-3.2.0_3.2.0-27.43_all.deb 07-Jul-2012
linux-source-3.2.0_3.2.0-29.46_all.deb 28-Jul-2012
linux-source-3.2.0_3.2.0-30.48_all.deb 25-Aug-2012
linux-source-3.2.0_3.2.0-31.50_all.deb 07-Sep-2012
http://dk.archive.ubuntu.com/ubuntu/pool/main/l/linux/

.

snowday 10-31-2012 10:52 AM

Did you do:

Code:

sudo apt-get update
first?

evo2 10-31-2012 10:10 PM

Hi,

oops, linux-source-$(uname -r) might be too specfic. Please just try linux-source-3.2.0

Evo2.

TriggerHuang 11-01-2012 09:26 PM

Dear all,

Thanks for all your kindly help.
Finally I downloaded Linux kernel source for version 3.2.0 with Ubuntu patches at
http://packages.ubuntu.com/source/precise/linux


All times are GMT -5. The time now is 05:30 PM.