The following steps describe how to create a no-compromises Raspberry Pi toolchain on Ubuntu 12.04 using Crosstool-NG.
1. Install dependencies
Run the following command to install the required packages:
Crosstool-NG isn't available in the standard Ubuntu repositories. Run the following commands to download, build, and install it:
Crosstool-NG comes with a tool called menuconfig that makes it easy to configure how the toolchain should be built. Run the following commands to launch menuconfig, then follow the sub-sections below to configure the toolchain build parameters:
4. Build the toolchain
We are now ready to build and install the toolchain. Start the build by running the following commands:
Run the following command to install the required packages:
$ sudo apt-get install gawk bison flex gperf cvs texinfo automake libtool ncurses-dev g++ subversion python-dev libexpat1-dev cmake
2. Download, build, and install Crosstool-NG
Crosstool-NG isn't available in the standard Ubuntu repositories. Run the following commands to download, build, and install it:
$ pushd ~/raspberry_pi/build3. Configure, build, and install the toolchain
$ curl -O http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.18.0.tar.bz2
$ tar xf crosstool-ng-1.18.0.tar.bz2
$ cd crosstool-ng-1.18.0
$ ./configure --enable-local && make && make install
$ export PATH=`pwd`:$PATH
$ popd
Crosstool-NG comes with a tool called menuconfig that makes it easy to configure how the toolchain should be built. Run the following commands to launch menuconfig, then follow the sub-sections below to configure the toolchain build parameters:
$ pushd ~/raspberry_pi/build/toolchain
$ ct-ng menuconfig
Setup Path Options
- Navigate to Paths and misc options.
- Enable Try features marked as EXPERIMENTAL.
- Set Prefix directory to ${HOME}/raspberry_pi/toolchains/${CT_TARGET}.
- Enable Use a mirror.
- Set Number of parallel jobs to twice the number of HW threads.
- Navigate to Target options.
- Set Target Architecture to arm.
- Leave Endianness as Little and Bitness as 32-bit.
- Set append ‘hf' to the tuple (EXPERIMENTAL).
- Navigate to Operating System.
- Set Target OS to Linux.
- Navigate to Binary utilities.
- Set Binutils to 2.22.
- Navigate to C compiler.
- Enable Show Linaro versions.
- Enable C++ support.
- Set eglibc version to 2_13.
Setup Debug Options
- Navigate to Debug facilities.
- Enable gdb, then press [Enter] to configure additional GDB settings.
- Enable Build a static cross gdb.
- Set Cross-gdb extra config to --with-expat.
- Enable ltrace.
- Enable strace.
4. Build the toolchain
We are now ready to build and install the toolchain. Start the build by running the following commands:
$ ct-ng build
$ popd
If the build was successful, the toolchain will be located at ~/raspberry_pi/toolchains/arm-unknown-linux-gnueabihf/. All the tools (gcc, ld, gdb, etc) are located in the bin/ directory of the toolchain with the name of the toolchain prefixed.
Run the following command to add the toolchain binaries to the PATH environment variable:
Run the following command to add the toolchain binaries to the PATH environment variable:
$ pushd ~/raspberry_pi/toolchains/arm-unknown-linux-gnueabihf/bin
$ export PATH=`pwd`:$PATH
$ popd
No comments:
Post a Comment