Building Crosstool-ng Toolchain and glibc
The NVIDIA® Tegra® Linux Driver Package contains the source code for the Crosstool-NG toolchain suite version 4.5.3 and the glibc suite. The Cross-NG toolchain suite resembles the toolchain NVIDIA uses to produce the L4T binaries.
This topic describes how to build Crosstool-NG and glibc on your Ubuntu host system.
Toolchain Information
The toolchain contains following components:
•Crosstool-NG reference (http://crosstool-ng.org/)
•Cross Toolchain Version : 4.5.3
•glibc Version : 2.11
Host System Requirements
System requirements for the Ubuntu host systems includes:
•Ubuntu 10.04 32-bit distribution (64-bit distribution is not supported for building the toolchain)
•Fast host CPU such as Core 2 Duo (to reduce build time)
•1GB Free space on HDD
•2GB SDRAM
Dependent Packages
The Ubuntu host system must have the following packages installed:
•mercurial
•bison
•flex
•gperf
•texinfo
•m4
•libtool
•automake
Verify that the host system is connected to the internet, and run the following command to install the packages:
$ sudo apt-get install mercurial bison flex gperf texinfo m4 libtool automake
Building the Toolchain Suite
To build the toolchain you must:
•Set the TOP_DIR environment variable and create a directory tree
•Install autoconf-2.68
•Configure crosstool-NG
•Invoke the build
To set the TOP_DIR environment variable and create directories
1. To set the TOP_DIR variable to ${HOME}/crosstool enter the following command:
$ export TOP_DIR="${HOME}/crosstool"
2. In the ${TOP_DIR} directory, create the following subdirectories:
$ mkdir depends
$ mkdir crosstool-ng
$ cd depends
$ mkdir src
$ mkdir install
$ cd src
$ mkdir autoconf
$ mkdir ct-ng
To install autoconf-2.68
1. Change to the autoconf directory. Then download autoconf-2.68.tar.bz2 by executing the following commands:
$ cd ${TOP_DIR}/depends/src/autoconf
$ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2
2. Extract and configure autoconf-2.68:
$ tar xf autoconf-2.68.tar.bz2
$ cd autoconf-2.68
$ ./configure --prefix=${TOP_DIR}/depends/install/autoconf_install/autoconf-2.68-install
3. Make and install autoconf-2.68:
$ make
$ make install
To configure crosstool-NG
1. Change to the ct-ng directory:
$ cd ${TOP_DIR}/depends/src/ct-ng
2. Add the autoconf-2.68-install directory to your path:
$ export PATH=${TOP_DIR}/depends/install/autoconf_install/autoconf-2.68-install/bin:${PATH}
3. Clone the crosstool-ng repository:
$ hg clone http://crosstool-ng.org/hg/crosstool-ng
4. Configure crosstool-ng:
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=${TOP_DIR}/depends/install/ct-ng_install/crosstool-ng-hg-install
5. Make and install crosstool-ng:
$ make
$ make install
6. Create the ${TOP_DIR}/crosstool-ng/src directory for locally saving downloaded packages:
mkdir ${TOP_DIR}/crosstool-ng/src
To invoke the build
1. Change to the /crosstool-ng-hg-install/bin directory:
$ cd ${TOP_DIR}/depends/install/ct-ng_install/crosstool-ng-hg-install/bin
Note: .config is a hidden file. After creating it, confirm it exists in the correct location by running ls -a in the directory.
3. Build ct-ng using 8 parallel paths:
$./ct-ng oldconfig
$./ct-ng build.8
This will build the complete suite and install the binary components in ${TOP_DIR}/crosstool-ng/install.
Verifying the Build
After a successful build, the ${TOP_DIR}/crosstool-ng/install directory contains the following tree structure, as reported by the tree application (where available):
$ tree -L 2
|-- arm-cortex_a9-linux-gnueabi
| |-- bin
| |-- debug-root
| |-- include
| |-- lib -> sysroot/lib
| |-- lib32 -> lib
| |-- lib64 -> lib
| `-- sysroot
|-- bin
| |-- arm-cortex_a9-linux-gnueabi-addr2line
| |-- arm-cortex_a9-linux-gnueabi-ar
| |-- arm-cortex_a9-linux-gnueabi-as
| |-- arm-cortex_a9-linux-gnueabi-c++
| |-- arm-cortex_a9-linux-gnueabi-cc -> arm-cortex_a9-linux-gnueabi-gcc
| |-- arm-cortex_a9-linux-gnueabi-c++filt
| |-- arm-cortex_a9-linux-gnueabi-cpp
| |-- arm-cortex_a9-linux-gnueabi-ct-ng.config
| |-- arm-cortex_a9-linux-gnueabi-g++
| |-- arm-cortex_a9-linux-gnueabi-gcc
| |-- arm-cortex_a9-linux-gnueabi-gcc-4.5.3
| |-- arm-cortex_a9-linux-gnueabi-gccbug
| |-- arm-cortex_a9-linux-gnueabi-gcov
| |-- arm-cortex_a9-linux-gnueabi-gprof
| |-- arm-cortex_a9-linux-gnueabi-ld
| |-- arm-cortex_a9-linux-gnueabi-ldd
| |-- arm-cortex_a9-linux-gnueabi-nm
| |-- arm-cortex_a9-linux-gnueabi-objcopy
| |-- arm-cortex_a9-linux-gnueabi-objdump
| |-- arm-cortex_a9-linux-gnueabi-populate
| |-- arm-cortex_a9-linux-gnueabi-ranlib
| |-- arm-cortex_a9-linux-gnueabi-readelf
| |-- arm-cortex_a9-linux-gnueabi-size
| |-- arm-cortex_a9-linux-gnueabi-strings
| `-- arm-cortex_a9-linux-gnueabi-strip
|-- build.log.bz2
|-- include
|-- lib
| |-- gcc
| |-- ldscripts
| `-- libiberty.a
|-- libexec
| `-- gcc
`-- share
`-- gcc-4.5.3