Hardware Reference
In-Depth Information
and extract it to any directory you want. I like to create a build directory for each architecture I will be cross compiling
for; this will help you later on when you have applications with many dependencies. The GNU hello application
requires a configure step and then a make step; this is quite normal.
You're going to need two pieces of information for the configure stage to succeed. First, you need to update the
CC variable, which will ensure that the configure script uses the correct GCC version. This must be specified as the full
name of the ARM tool chain. In your case this will be arm-unknown-linux-gnueabi-gcc . You can easily work this out
by looking into the bin directory of the tool chain to see the full name of the GCC binary. You can see in Listing 6-1 the
full name of my ARM tool-chain GCC binary.
Listing 6-1. The Real GCC Location
/home/brendan/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-cc->
arm-unknown-linux-gnueabi-gcc
As you can see it's a symlink to the CC application. Now that you know the full name of your application you
can move on to the configure script parameters. It's always wise to run the configure script with the -help option the
first time:
# ./configure -help
This will print all of the options that the configure script supports for the GNU hello application. There should
be one option that stands out right away if you have taken the time to read the output. That option is the --host=HOST
option. This option sets what host architecture you will build for. This is not simply ARM. After all, ARM is a very
vague term. This is where you come back to the full path of the CC application. This full path can be broken up into five
sections. See Table 6-1 for the breakdown.
Table 6-1. The full name breakdown
Section
Meaning
arm
Main architecture type
unknown
Subarchitecture type
linux
Operating system
gnueabi
Application binary interface (ABI) type
gcc
Binary application name
With this information it is quite simple now to work out what your host should be set to. You should use the name
of the application up to the last section. For you this will be arm-unknown-linux-gnueabi . You now have the two
critical pieces of information for cross compiling any application. You may in the future need more configure options
but you will not get away with any less than these two. With that in mind, the full command to configure the GNU
hello application is the following:
# CC=arm-unknown-linux-gnueabi-gcc ./configure -host=arm-unknown-linux-gnueabi
This should complete quickly with no errors; if you have errors you need to fix them. The best thing about using
configure scripts is that it lessens the amount of options for make . The make file now knows that you're doing a cross
compile and for what architecture and with what tool chain. Make files will become another good friend of yours.
Go ahead and run make :
# make
 
 
Search WWH ::




Custom Search