Hardware Reference
In-Depth Information
Chapter 6
Cross Compile Environment
Unfortunately this chapter will not contain any electronics work, and it will not really contain much work on your
Raspberry Pi. In fact you will spend most of this chapter on a host machine and most likely it will be an x86 system.
Most systems available today are using an x86 processor type. This is an evolution from the original Intel 8086, and all
consumer-grade CPUs from Intel and AMD use the x86 architecture. On that note I also hope your host system has
a lot more power than your Raspberry Pi. I don't want you using that spare Celeron 733-MHz system you may have
hidden in the cupboard. At this point I hope you're a little bit confused as to why I am talking about everything but the
Raspberry Pi. There is a good reason for this. This chapter is going to need a lot of resources on what will be referred to
as your host system.
This chapter is written for a host system that runs Linux, and any Linux distribution is fine. It may be possible to
do this under Cygwin in Windows but I have not tried nor will be trying that. So what has this host system got to do
with a Raspberry Pi? To better answer that, you need to think about how any distribution for the Raspberry Pi is put
together. Recall in Chapter 2 that you used a tool to install Fedora: where did that tarball come from? Did someone
sit down one day and compile a whole distribution on a Raspberry Pi? Given the Raspberry Pi's limited resources,
I would assume not. I know firsthand how much goes into compiling your own Linux distribution. Armed with this
knowledge I can assume that someone cross compiled the Fedora remix on a more powerful machine, rather than
doing it by hand slowly on the Raspberry Pi. If you're interested, take a look at the Linux From Scratch project at
http://linuxfromscratch.org . This will give you an idea about how to compile your own distribution. It will not
only teach you a lot about Linux but also show you why someone did not do this style of work on the Raspberry Pi.
In this chapter you won't be building a whole distribution so don't feel too worried! By the end of this chapter you
will have set up a basic cross compile environment that is capable of building binary applications for your Raspberry
Pi. You will do this without even using a single CPU cycle on the Raspberry Pi. How amazing is that? You will be using
your desktop machine to build an application that can be run on your Raspberry Pi, in anticipation of Chapter 7 where
you will need to do just that.
Introducing Cross Compiling
So how did you end up with a Linux distribution for your Raspberry Pi? This is where your host machine comes back
in with a concept called cross compiling. Cross compiling is where you compile an application for a different machine
type than your host system. In this chapter the host will be a 64-bit x86 machine and the target machine will be your
little Raspberry Pi, a 32-bit ARM machine.
 
Search WWH ::




Custom Search