Hardware Reference
In-Depth Information
The Host
You're going to need a Linux machine. This can be a physical machine or a virtual machine. You may be able to apply
the instructions in this chapter to the OSX as it is based on the Berkeley Software Distribution, and getting a working
copy of the GNU Compiler Collection (GCC) should not be a hard task. You may be able to get this to work under
Cygwin but I do not have the knowledge of Windows to do this. My home contains no Windows or OSX machines so
I will be using Linux. You should also use a reasonably fast machine. Some applications such as LibreOffice and GCC
itself are very memory- and processor-intensive to compile; they also require a large amount of temporary disk space.
GCC will require well over 5 GB of disk just to compile. You're also going to find out very quickly that cross compiling
an application is not a simple process: it will fail and you may need to start the build from scratch. Do you really want
to do that on a low-powered machine?
To build a cross compiling environment you're going to need some basic tools. The most important tool you're
going to need is GCC. If you're using Gentoo, then you already have a working installation of GCC. More than likely
you are not using Gentoo but one of the more common distributions like Fedora or Ubuntu. These distributions by
default do not come with GCC installed. You're going to need to use your distributions package manager to install
GCC. To install GCC in Fedora use this command:
# yum groupinstall "Development Tools"
For Ubuntu you can use this command:
# apt-get install build-essential
Now you should have a working GCC version. It's a wise idea to test GCC to confirm it's alive and working.
First, check that you can execute GCC . A simple test is to run the gcc -v command. This command will list the version
and build information about GCC. In Figure 6-2 you can see the output of this command on my machine.
Figure 6-2. The output of the gcc -v command
It is very important that this command execute successfully. If you try and do any part of this chapter without
a working GCC you're never going to get anywhere. Moving on from GCC, you're going to make use of an open source
project called crosstool-NG.
Crosstool-NG
The crosstool-NG project aims to provide a stable, easy-to-build tool chain. A tool chain is a set of tools, including
GCC, that allows you to build an application for a different architecture than the one you are building on. As part of
crosstool-NG it will take care of downloading and configuring parts of the tool chain for your selected architecture.
The tool chain will include the binutils tool and some C libraries that are specific to your target architecture.
Crosstool-NG also has a very nice ncurses menu system that will easily allow you to build a tool chain.
With that in mind, it's time to download and configure this tool. Open up your browser and go to
http://crosstool-ng.org/download/crosstool-ng/ . It's best to sort the file listing by the “Last Modified” field
because you want the latest package. You will see a file at the top of this directory that indicates the current version:
in my case, that is 1.16.0. You can see in Figure 6-3 the latest version at the time of writing and the download file named
 
 
Search WWH ::




Custom Search