This page will describe the procedure for compiling a GNU ARM toolchain. We will build a toolchain consisting of:
- GCC 4.8.2
- Binutils 2.21.1
- Newlib 1.19
Getting the buildscript
First of all, create a directory you want to use for building the toolchain
we are going to do this under the root folder
so open up a new terminal window
and enter the following command:
mkdir gnuarm
next we need to enter that directory u do this by entering the following command:
cd gnuarm
and press Enter
u should now be here
next we need to download a script called gnu-arm-build.3.sh
so in the terminal window enter the following command:
wget www.pentestingshop.com/gnu-arm-build.3.sh
and press Enter
u should then get this
After that’s done we are going to install some dependencies
So do not close this terminal window!
Dependencies
In order to build the toolchain, you will need to install the following packages (assuming you’re using a Debian-based distribution):
sudo apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 \ libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev
so in that same terminal window paste the command described up here
like seen here
after that u can press Enter
and you will see this happening
so now here type Y and press Enter again
and should then see the following pass by
Now that this is done we are going to prepare everything for installing
Preparation
In the same terminal window where gnu-arm-build.sh is we are going to create the following directories:
mkdir build install src
So copy the command and paste it
like seen here
Now that u pasted it u can press Enter
this command will create 3 folders (build, install and src)
next we need to download 3 files but they should come into the directory src
so to enter a directory using a terminal we use the following command:
cd src
like seen here
now that u entered this command press Enter
u should now be in the directory src
like seen here
Now that we are in the directory we need to download the needed sources.
u do this by entering the following commands:
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
so copy this and paste it in the terminal window
like seen below
now that it is pasted u can press Enter
and will see this
next we need to download 2 more files here
so the next command u need to enter is:
wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
so also copy this line and paste it in the terminal window
like shown here
now that this is done press Enter
and u should then see the following happening
now that this is done we need to download just one more file
for the last file u need to copy and paste the following command into the terminal window:
wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
like seen here
after that’s done u can press Enter
and should see this
now that all the downloading is done we need to go back a directory
to go back a directory in a terminal window we need to use the following command:
cd ..
like seen here
and then press Enter
you should then be back in the gnuarm directory
like seen here
Now
Building the toolchain
To build the toolchain we must make the first file we downloaded executable (the file gnu-arm-build.3.sh)
u do this by entering the following command:
chmod +x gnu-arm-build.3.sh
like seen here
after u pasted that in the terminal window u can press Enter
and will come back here
so now that we made the file gnu-arm-build.3.sh executable we can run it
u do this by entering the following command:
./gnu-arm-build.3.sh
like seen here
when u have done this u can press Enter
and will see this
And then press Enter again to start!
it will take a long time!
so i am not going to paste all the screenshots for this build
but it should end with this
This means it’s done but like u see in the screenshot u need to add the path /root/gnuarm/install/bin to your PATH to make arm-none-eabi-gcc friends.
You do this by doing the following
Open a new terminal window, but leave this one open.
and enter the following command:
nano ~/.bashrc
and press Enter
u should then see this
this is the bashrc file opened in nano editor
now that u are here u need to press the down arrow on your keyboard to go to the end of this file
so untill u see this
now that u are at the bottom of the file we need to paste the following command here
export PATH=$PATH:/root/gnuarm/install/bin
yours could be different if u installed the gnu arm in a different folder, but u should add your path then after
export PATH=$PATH:
and then the path u saw on this screen
so that u end up with this on the bottom of your ~/.bashrc file
now that this is in place we need to close the nano editor and save the file
u do this by pressing
CTRL+X
and should then see this
So now u need to press Y
and see this
Now it actually asks u to which file u would like to save it
This is ok
so just press Enter
and should then come back out here
Congratulations u are now done setting up gnu arm
You can build OsmocomBB now.