Building Cross Toolchains
This topic describes the cross toolchains present in this SDK release and how to build a cross toolchain.
A cross toolchain refers to the compiler, linker and target’s C library which executes on the host (x86 or x86_64) but generates code for the ARM architecture. The C library is used for linking compiled code to create the target application.
The toolchains provided in the SDK (<
top>/toolchains directory) are described in the table below.
Directory | Components | Where to use the toolchain |
aarch64-linux-android-4.8 | GCC - 4.8 Binutils - 2.24 Library - None Origin - Android code | Building 64 bit Trusted OS |
arm-eabi-4.8 | GCC -4.8 Binutils - 2.23.2 Library - None Origin - Android code | Building 32 bit modules for trusted OS |
tegra-4.8.5-nv-softp-adsp | GCC - 4.8.5 Binutils - 2.23.2 Library - eglibc-2.18 Origin - Yocto 1.8 | For ADSP firmware and ADSP plugins compilation |
tegra-4.9-nv | GCC - 4.9.4 Binutils - 2.24 Library - glibc-2.21 Origin - Yocto 1.8 | Binding a guest PCT to the hypervisor, building 64-bit Quickboot, and building user-space components |
arm-none-eabi-4_8-2014q3-20140805 | GCC - 4.8.4 20140725 Binutils - 2.23.2.20140731 Library - Newlib 2.1.0 with mainline backports Origin - Linaro | Building 32 bit ARM code for SPE and SCE. This is also used to set CROSS32CC for building flashing Kernel. For instructions for rebuilding the GCC toolchain see How-to-build-toolchain.pdf available in the SDK at <top>/drive-t186ref-foundation_src/linaro/ or at the following website: https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q3-update |
Prerequisites
1. Setup Linux host system running Ubuntu 14.04. or later.
2. Install required packages with the following command:
sudo apt-get install gawk wget git-core diffstat
unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm make xsltproc docbook-utils fop dblatex xmlto realpath
3. Install the Linux run files:
<
top>/drive-t186ref-linux-5.0.10.3-<
build>-oss-src.run
<top>/drive-t186ref-linux-5.0.10.3-<build>-oss-minimal-pdk.run
<top>/drive-t186ref-linux-5.0.10.3-<build>-nv-minimal-pdk.run
To build the NVIDIA tegra-4.9-nv toolchain
1. Change to the build directory on the host system with the following command:
cd <top>/drive-t186ref-linux_src/yocto
Where <top> is the directory on the host where the release is installed.
2. Extract the contents of nvidia-layer.tgz with the following command:
tar xzf nvidia-layer.tgz
3. Export TEMPLATECONF to use templates from the meta-vib4 layer with the following command:
export TEMPLATECONF=$PWD/layers/meta-vib4/conf
4. Initialize the Yocto Project build environment with the following command:
source oss/genivi-7/poky/oe-init-build-env
5. Bitbake the toolchain:
bitbake meta-toolchain
6. Generate the toolchain with the following command:
./layers/scripts-vib4/create_toolchain.sh $PWD
7. After executing yocto build steps, the built toolchain is available at:
<top>/drive-t186ref-linux_src/yocto/build/install
To update NVIDIA tegra-4.9-nv toolchain
1. Change to toolchain directory:
cd <top>/toolchains
2. Back-up existing toolchain:
mv tegra-4.9-nv tegra-4.9-nv-original
3. Copy over built toolchain to its place:
mkdir tegra-4.9-nv
mv <top>/drive-t186ref-linux_src/yocto/build/install/* tegra-4.9-nv
To build ADSP toolchain
1. Change to the build directory on the host system:
cd <top>/drive-t186ref-linux_src/yocto
2. Extract the contents of nvidia-layer.tgz:
tar xzf nvidia-layer.tgz
3. Export MACHINE, KERN_DIR and start the build:
cd layers/scripts-vib3
export MACHINE=”<system_name>”
export KERN_DIR=$(realpath ../../../kernel)
rm -f ../meta-tegra/recipes-kernel/linux/kernel-tegra-early-boot.bb
rm -f ../meta-tegra/recipes-core/systemd/systemd_%.bbappend
./build_yocto.sh -c toolchain -t all
Where <system_name> represents the machine name.
4. The toolchain is built and deployed in directory named install at the current directory.
Note: | Building the toolchains in separate shells is recommended. Remove any existing build directory in <top>/drive-t186ref-linux_src/yocto/ to avoid mixing configuration. |
Tip: | In case python locale errors occur during bitbake, use the following commands as a workaround: export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 |