07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.10.1. Introduction and Prerequisites<br />

Debian manages the kernel in the form of a package, which is not how kernels have traditionally<br />

been compiled and installed. Specific tools have therefore been developed for this purpose.<br />

They allow easy creation of a Debian package from Linux kernel sources, possibly adding patches<br />

along the way. Since the kernel remains under the control of the packaging system, it can then<br />

be removed cleanly, or deployed on several machines. Furthermore, the scripts associated with<br />

these packages automate the interaction with the bootloader.<br />

To compile a Linux kernel the Debian way, you will need to use the tools included in the kernelpackage<br />

package. Furthermore, the configuration step for the kernel requires the libncurses5-dev<br />

package. Finally, the fakeroot package will enable creation of the Debian package without using<br />

administrator's rights.<br />

8.10.2. Geing the Sources<br />

Like anything that can be useful on a Debian system, the Linux kernel sources are available<br />

in a package. To retrieve them, just install the linux-source-version package. The apt-cache<br />

search ˆlinux-source command lists the various kernel versions packaged by Debian. The<br />

latest version is available in the Unstable distribution: you can retrieve them without much risk<br />

(especially if your APT is configured according to the instructions of Section 6.2.6, “Working<br />

with Several Distributions” (page 113)). Note that the source code contained in these packages<br />

does not correspond precisely with that published by Linus Torvalds and the kernel developers;<br />

like all distributions, Debian applies a number of patches. These modifications include patches<br />

(some relevant to security problems) that are waiting to be included in the next version of the<br />

kernel, as well as some features that are specific to Debian (like cramfs, a filesystem specifically<br />

for the initrd image).<br />

CULTURE<br />

Names of kernel packages<br />

Historically, packages containing the Debian kernel were called kernel-image-<br />

*, but they all actually contained a Linux kernel. Since Debian works with<br />

other kernels (Hurd or FreeBSD, for example), this was confusing. Nowadays,<br />

the packages are called “linux-image-*"; the kernel-image-* packages<br />

are now empty shells and their only purpose is to facilitate the transition.<br />

Source packages for the Linux kernel are also called “linux-source-*”. As for<br />

packages containing patches, the transition is still in progress so both linuxpatch-*<br />

packages and kernel-patch-* can still be found. kernel-package remains<br />

kernel-package, since it is not specific to Linux (it could, for example, prepare<br />

FreeBSD kernel packages).<br />

The remainder of this section focuses on the 2.6.32 version of the Linux kernel, but the examples<br />

can, of course, be adapted to the particular version of the kernel that you want.<br />

We assume the linux-source-2.6.32 package has been installed. It contains /usr/src/<br />

linux-source-2.6.32.tar.bz2, a compressed archive of the kernel sources. You must extract<br />

these files in a new directory (not directly under /usr/src/, since there is no need for<br />

special permissions to compile a Linux kernel): ~/kernel/ is appropriate.<br />

174 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!