How to Install an ARM Cross-Compilation ToolChain on a Ubuntu Linux Operating System

Beaglebone black board

In this article, we will show how to install an ARM cross-compilation toolchain on a ubuntu linux operating system.

A cross-compilation (or cross-compiling) toolchain is a collection of tools, which when working together, allows a programmer to get from the source code to the desired output (executable binary or installable package).

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running.

With this toolchain, we can generate our own u-boot disc image file for a microprocessor device such as a beaglebone board or a raspberry pi board.

This can then be used, along with an MLO, to boot U-boot, which can then boot a linux kernel.

So now we will go through the steps of installing and setting up an ARM compiler toolchain.

What this allows for us to do is to create u-boot disc file images for our target architecture, which in this case is ARM.

If we had another type of architecture, this cross compiler toolchain would be able to generate it due to its cross compiler nature.

To download the arm cross compilation toolchain, go to the following link:

This brings you to a page that shows the latest cross toolchains, shown below.

Linaro arm cross toolchain latest releases

You can download the latest version. This should bring you a page such as that seen below.

Downloading the linaro arm cross compilation toolchain in the linux operating system

Click the arm-linux-gnueabihf option.

Clicking this option leads you to the following page shown below.

Downloading the linaro arm cross compilation toolchain gcc linaro in the linux operating system

This software should now be downloaded to your host computer.

Now extract the contents of this file to the same directory.

This is important because we're going to have to link to this extracted directory in order to set up this cross compilation toolchain.

Next, we need to add an environment variable to our linux code.

This is done by modifying the .bashrc file found at /home/david/.bashrc

We can modify this through the vi text editor.

This is shown below.

Adding an environment variable by modifying the bashrc file in linux

Of course you change david to the name that you gave your linux system.

You want to go to the end of this file and add in the following line shown below.

What this line does is it creates an environment variable that specifies the path to the arm cross compiler toolchain, which we will then use to do tasks such as create U-boot disc image files. Whatever version you use, place it in this line and make sure you direct it to the bin folder of this directory.

The code in the .bashrc file should look as that shown below.

Adding line in the bashrc file to create an environment variable for the arm cross compiler toolchain in linux

With this line inserted into the file, you can leave this file by pressing Esc followed by :wq.

One thing we must do so that our linux system recognizes this newly created environment variable is to source it.

This is done by the following line of code.

This is displayed below.

Source the bashrc file for linux to recognize new environment variable

Once this goes through, we can test to make sure that the environment variable is created and set up correctly.

If the environment variable is set up correctly, you should see it in the list of environment variables.

You can check this by running the following command in the terminal.

You should see the path you specified in the bashrc file in the PATH environment variable.

This is shown below.

Testing to see if the arm cross compiler toolchain is installed successfully in linux

So if you see this, then you know that the arm cross compiler toolchain is successfully installed in your linux operating system. You can now use it to generate executable software for your target architecture.

So this is how to install an ARM cross-compilation toolchain on a ubuntu linux operating system.

Related Resources

HTML Comment Box is loading comments...