Hardware Reference
In-Depth Information
Figure 6-14. crosstool-NG has finished building the tool chain
Preconfigured Tool Chains
Now that you have gone through every menu and all the suboptions I will show you the easy way to use crosstool-NG.
If you had read the help screen for crosstool-NG you would have noticed a section on preconfigured tool chains.
A really good feature of crosstool-NG that I have purposely not told you about is that it includes sample configurations
to build many different tool chains. You can get a list of all preconfigured tool chains by running the following command:
# ct-ng list-samples
This will produce a list of available cross compiler tool chains. You will notice a set of letters in square brackets.
These indicate where the profile is stored and its status. I would advise you not to use any tool chains that have a
broken status. If you wish to opt for the easy way to build the tool chain that you have just finished manually building
you can run the following command:
# ct-ng arm-unknown-linux-gnueabin
This will use a set of predefined and tested options to build the tool chain. Once you have told crosstool-NG
what profile to use, you can run the normal build step to build and install the cross compile tool chain. There is a
good reason I put this method at the end of the manual process: I am trying to show you what exactly is involved with
configuring a cross compile environment because it's really important that you start to understand the environment
and architecture that you are developing for. This way you can optimize your tool chain and produce better binary
files for your Raspberry Pi. You can also optimize your applications better if you know where and how to do so. The
predefined profiles won't give you this ability. Now that you have built a tool chain, what can you do with it? You can
cross compile an application, of course.
Your First Cross Compile
The first thing you're going to need to know is where did your tool chain get installed? It's not in /usr/local/crosstool ,
so where is it? When you run the build steps for crosstool-NG the last step creates a directory called x-tools in your
home directory. In this directory there will be a subdirectory for each tool chain you build. In my case the full path
to the tool chain I had just created will be /home/brendan/x-tools/arm-unknown-linux-gnueabi . Inside the
arm-unknown-linux-gnueabi directory will be the usual directories for a Linux application and a copy of the build
log. Given the way that modern make and configure scripts work, you're going to need to update your path so that the
scripts can find where the ARM tool chain has been installed.
This should be a simple case of running the following command:
# export PATH=$PATH:$HOME/x-tools/arm-unknown-linux-gnueabi/bin
This will append the tool-chain bin path to your existing path variable. To test that your tool chain is fully working
I recommend that you cross compile a simple well-known application. For this I use the GNU hello application. I am
sure you can guess what this application will do. Connect to the following web site to find the latest version of the GNU
hello application: http://ftp.gnu.org/gnu/hello/ . For me, it was version 2.8. Download a copy of the application
 
Search WWH ::




Custom Search