Hardware Reference
In-Depth Information
2
Hacking Linux for the
Raspberry Pi
While there are many available operating systems for the Raspberry Pi, the most sup-
ported one is Linux. The Raspberry Pi Foundation maintains a Linux kernel source tree
with support for the Raspberry Pi hardware.
Linux is famous for its flexibility and support for a large number of devices. Whether
you are just interested in learning Linux, or if you need to make some modifications
in order to enable an awesome hack, this chapter will help you through the process.
Build a Cross-Compiler Toolchain
HACK 21
The Raspberry Pi is well-suited for many things, but compile speed is not
one of them. To build anything of consequence from source in a reason-
able amount of time, you'll need to to use a cross-compiler running on a
faster computer.
A cross-compiler is a compiler (and dependent libraries) built to run on one architec-
ture but that generates binaries for a different architecture, usually an incompatible
one. In this case, you need a cross-compiler that will allow you to build binaries opti-
mized for the Raspberry Pi Linux environment.
Like most tasks in Linux, you can generate a cross-compiler in a few ways, but to
ensure that you end up with a toolchain optimized for the best performance on the
Raspberry Pi, we suggest not installing prepackaged cross-compilers that come with
your Linux distribution. Instead, the following sections will walk you through the pro-
cess of using crosstool-ng to build it from scratch.
Install crosstool-ng
crosstool-ng is designed to assist you in the complicated task of generating a compiler
toolchain. It provides a powerful frontend and build scripts that let you choose what
you need your toolchain to do, then automate the build, while keeping you from need-
Search WWH ::




Custom Search