Compiling Jetson cboot sources

From RidgeRun Developer Wiki
Revision as of 01:15, 24 November 2021 by Mzeledon (talk | contribs) (Created page with "= Introduction = Some times changes need to be done to the cboot sources in order to generate a different cboot binary from the one that already comes in the JetPack SDK. Th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

Some times changes need to be done to the cboot sources in order to generate a different cboot binary from the one that already comes in the JetPack SDK. This wiki page describes the steps that need to be done to compile the L4T cboot sources.

Get the sources

1. Identify the cboot sources tarball for your L4T version and download it. The latest cboot sources can be found at Nvidia's Jetson Linux web page, which contains all the L4T BSP sources.

2. Create a cboot directory to hold the extracted contents and extract the sources:

mkdir cboot
tar -xjf <cboot_source_tarball> -C cboot

Get the toolchain

A 64-bit ARM toolchain is required for cross compilation.

1. Get the toolchain tarball:

wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

2. Extract the contents:

tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

3. Set the CROSS_COMPILE environment variable for cross compilation:

export CROSS_COMPILE=./gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

Compile and install the sources

1. Set the path environment variable:

IMPORTANT: Make sure your current top directory's path is not made up of symbolic links.

export TEGRA_TOP=$PWD
export TOP=$PWD

2. Build the cboot binary:

  • For Jetson TX2:
make -C ./bootloader/partner/t18x/cboot PROJECT=t186 TOOLCHAIN_PREFIX="${CROSS_COMPILE}" DEBUG=2 BUILDROOT="${PWD}"/out NV_BUILD_SYSTEM_TYPE=l4t NOECHO=@
  • For Jetson Xavier:
make -C ./bootloader/partner/t18x/cboot PROJECT=t194 TOOLCHAIN_PREFIX="${CROSS_COMPILE}" DEBUG=2 BUILDROOT="${PWD}"/out NV_TARGET_BOARD=t194ref NV_BUILD_SYSTEM_TYPE=l4t NOECHO=@

After this step, the resulting binary will be in the following paths within the cboot directory:

  • ./out/build-t186/lk.bin for Jetson TX2.
  • ./out/build-t194/lk.bin for Jetson Xavier.

3. Rename the binary:

  • For Jetson TX2:
mv ./out/build-t186/lk.bin ./out/build-t186/cboot.bin
  • For Jetson Xavier:
mv ./out/build-t194/lk.bin ./out/build-t194/cboot_t194.bin

4. Replace the existing cboot binary with compiled one:

  • For Jetson TX2:
mv ./out/build-t186/cboot.bin <Linux_For_Tegra directory path>/bootloader
  • For Jetson Xavier:
mv ./out/build-t194/cboot_t194.bin <Linux_For_Tegra directory path>/bootloader