Looking for Linux Kernel source
Alan Pope
alan at popey.com
Wed Sep 14 07:33:55 UTC 2011
On 14 September 2011 01:53, Alan Gauld <alan.gauld at btinternet.com> wrote:
> I've bought Love's book on the Linux Kernel to read on my holiday next week.
> I thought it would be useful to have the Kernel source to read along with it
> but don't want to install it as a package, I'd rather just have a tarball on
> a USB stick.
>
The source package in the repo _contains_ a tarball you could put on a stick.
apt-get source linux-image-`uname -r`
(the uname -r will ensure it gets the kernel you're currently running)
That will download the source tarball and then unpack it in the
current directory. It also applies whatever patches the Ubuntu kernel
team add to the Ubuntu flavour of the kernel. You could run this from
a terminal on the USB stick and you're done.
> I suppose I could just install the package via Synaptic but I wasn't sure
> what else the package install might do to my system in the background...
>
It wont do anything else in the background other than grab a
compressed source tarball, a diff, a dsc file and then unzip the
tarball and apply the patches. Everything you install from that
command is contained within the current directory.
You can omit some of the steps with the '--download-only' option if
you dont want to apply the patches or unpack it. So you can unpack
later.
apt-get source --download-only linux-image-`uname -r`
Here's an example:-
alan at wopr:~$ apt-get source --download-only linux-image-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'linux' as source package instead of 'linux-image-2.6.38-11-generic'
NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-natty.git
Need to get 99.6 MB of source archives.
Get:1 http://gb.archive.ubuntu.com/ubuntu/ natty-updates/main linux
2.6.38-11.48 (dsc) [5,145 B]
Get:2 http://gb.archive.ubuntu.com/ubuntu/ natty-updates/main linux
2.6.38-11.48 (tar) [94.1 MB]
Get:3 http://gb.archive.ubuntu.com/ubuntu/ natty-updates/main linux
2.6.38-11.48 (diff) [5,428 kB]
Fetched 99.6 MB in 28s (3,470 kB/s)
Download complete and in download only mode
alan at wopr:~$ ls -l linux_2.6.38*
-rw-r--r-- 1 alan alan 5428471 2011-08-02 00:04 linux_2.6.38-11.48.diff.gz
-rw-r--r-- 1 alan alan 5145 2011-08-02 00:04 linux_2.6.38-11.48.dsc
-rw-r--r-- 1 alan alan 94143774 2011-03-21 23:05 linux_2.6.38.orig.tar.gz
Alternatively if you want 'upstream' kernel source you can grab it
from github whilst kernel.org is down.
https://github.com/torvalds/linux
Cheers,
Al.
More information about the ubuntu-users
mailing list