LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 10-31-2012, 01:16 AM   #1
TriggerHuang
LQ Newbie
 
Registered: Jul 2011
Posts: 16

Rep: Reputation: Disabled
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.
 
Old 10-31-2012, 02:04 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,447

Rep: Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204
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.
 
1 members found this post helpful.
Old 10-31-2012, 04:50 AM   #3
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 287Reputation: 287Reputation: 287
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.
 
Old 10-31-2012, 05:50 AM   #4
TriggerHuang
LQ Newbie
 
Registered: Jul 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
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?
 
Old 10-31-2012, 10:37 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,985

Rep: Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611
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/

.

Last edited by knudfl; 10-31-2012 at 10:44 AM.
 
Old 10-31-2012, 10:52 AM   #6
snowpine
Senior Member
 
Registered: Feb 2009
Posts: 3,921

Rep: Reputation: 1049Reputation: 1049Reputation: 1049Reputation: 1049Reputation: 1049Reputation: 1049Reputation: 1049Reputation: 1049
Did you do:

Code:
sudo apt-get update
first?
 
Old 10-31-2012, 10:10 PM   #7
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,447

Rep: Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204
Hi,

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

Evo2.
 
Old 11-01-2012, 09:26 PM   #8
TriggerHuang
LQ Newbie
 
Registered: Jul 2011
Posts: 16

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to download source code of the linux kernel? saagar Linux - Newbie 3 05-11-2009 03:07 PM
source code download jomy Linux - Software 1 08-13-2006 07:21 AM
need to download linux source code for 2.6 kernel bishalpoudyal Linux - Software 2 04-13-2006 01:17 PM
how to download kernel-source w/o ubuntu? mandavi Ubuntu 6 11-06-2005 03:21 AM


All times are GMT -5. The time now is 05:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration