NVIDIA Tegra Tegra Linux Driver Package
Development Guide
May 16, 2016 | 24.1 Release

 
Building AARCH 64 Crosstool-ng Toolchain and glibc
 
Toolchain Information
Building the Toolchain
Troubleshooting
Host System Requirements
Dependent Packages
Building the Toolchain Suite
Verifying the Build
The NVIDIA® Tegra® Linux Driver Package contains the script and patches used to create the set of toolchains that NVIDIA uses to produce the AARCH64 L4T binaries. This topic describes how to build these toolchains.
Additionally, a Crosstool-NG toolchain used to produce the ARM L4T binaries is described in the Building Crosstool-ng Toolchain and glibc chapter of this guide.
Toolchain Information
There are two toolchains required for AARCH64 builds. Both are built from the same component sources and patches, but they are configured differently, as the following:
aarch64-unknown-linux-gnu
arm-uknown-linux-gnueabi
The ARM toolchain is needed for a small compatibility component of the arm64 kernel.
Each toolchain contains the following components:
GCC version: 4.8.2
Glibc Version : 2.17
Building the Toolchain
The toolchain build script and patches are provided in the Jetson TX1 Toolchain Build package.
To build the toolchain
1. Download the Jetson TX1 Toolchain Build package jetson-tx1-toolchain-build.tbz2.
2. Uncompress jetson-tx1-toolchain-build.tbz2. Output from tar is similar to the following:
$ tar xpf jetson-tx1-toolchain-build.tbz2
 
This unpacks into two folders, one for each toolchain:
toolchain-build-aarch64
toolchain-build-armhf
Each toolchain folder contains the following:
README instructions for setting up the build system and building the toolchain.
A script that builds the toolchain.
A patches folder containing patches to the toolchain sources.
3. Follow the build instructions in the README for each toolchain. Build products are located in the install directory.
Troubleshooting
Each step in the build process logs its progress and errors to a file named for that stage:
Build Process Step
Log File
Downloading sources
get_src.log
Applying patches
apply_patches.log
Build binutils
build_binutils.log
Installing Linux headers
install_linux_headers.log
Building GCC stage 1
build_gcc_stage1.log
Building Glibc stage 1
build_glibc_stage1.log
Building final Glibc
build_final_glibc.log
If the build succeeds, the script prints “Success!” at the end. Otherwise check log files for the last step shown to find the error.
The following are two common build errors:
The build system configuration is different from what is suggested in the README. There may be support packages needed for your particular system.
If using Ubuntu 12.04/14.04, install the necessary packages, in addition to the ones mentioned in the README, with the following commands:
$ sudo apt-get install gawk
$ sudo apt-get install texinfo
$ sudo apt-get install automake
$ sudo apt-get install libtool
$ sudo apt-get install g++
The build script downloads sources for the toolchain components from well-known locations. These URLs may become outdated over time. Make sure that the URLs in the get_src() function are up-to-date.
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
4. To set the TOP_DIR variable to ${HOME}/crosstool enter the following command:
$ export TOP_DIR="${HOME}/crosstool"
5. 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
2. Copy the following content of .config from the Sample Crosstool-ng Configuration File appendix to this guide to a file called .config.
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