Linux: Cross-compiling development environment for the Raspberry Pi

0
116

Hi ! In this Article i will explain how to setup a cross-compiling development environment for the Raspberry Pi.The aim of this
demonstration is compiling a program using the cross compiler and then deploy it onto a Raspberry Pi board to run it.

 

But Why Cross compiling?

“A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a Windows 7 PC but generates code that runs on Android smartphone is a cross compiler.”

So for the explanation we will use :

 

  • A cloud based Ubuntu Server 14.04 LTS

Target Environment:

 

  • Raspberry Pi board

The Raspberry Pi is a series of credit card–sized single-board computers

2

First we need to Login to Ubuntu server via SSH

3

Getting Started: Install Dependencies

Now We  must install a few packages:

APT-GET INSTALL This command installs new packages.

5

Create Development Directories

mkdir() attempts to create directories

6

Download, Build, and Install Crosstool-NG

pushd and popd are commands used to work with directories:

The pushd command saves the current working directory in memory

The popd command returns to the path at the top of the directory stack

7

Run ./configure Script

8

Make and  make install Commands:

Makefiles are a simple way to organize code compilation

9

Export the environment variable $PATH

10

Kernel Configurations: (Target arch, compiler etc…)

11

12

Build the Kernel:

If you want to build it locally on a Raspberry Pi  it will take a long time or you can cross-compile it (you need to wait just about 17 min) , which is much quicker.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here