NVIDIA Jetson Orin - Compiling Source Code

From RidgeRun Developer Connection
< NVIDIA Jetson Orin‎ | JetPack 5.0.2
Revision as of 13:24, 17 August 2023 by Spalli (talk | contribs) (Install the Toolchain)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Previous: JetPack 5.0‎.2/Getting_Started/Components Index Next: JetPack_5.0.2/Flashing_Board


Nvidia-preferred-partner-badge-rgb-for-screen.png




Learning to build the BSP and OS components enables developers to customize the software for their specific project needs.

This section will guide you through the process of building the BSP and OS components for the NVIDIA Jetson Orin. For this section you are going to need Jetpack 5.0.2 for Orin AGX installed on your host computer, we assume that you got this installed following through our Getting Started and Installing Jetpack sections.

Assumptions

  1. The build of the BSP/OS components source code will be performed by cross-compiling on a host computer running a Linux OS.
  2. Make sure the following dependencies are installed on your system:
    • wget
    • lbzip2
    • build-essential
    • bc
    • zip
    • libgmp-dev
    • libmpfr-dev
    • libmpc-dev
    • vim-common # For xxd

In Debian based systems you can run the following:

sudo apt install wget lbzip2 build-essential bc zip libgmp-dev libmpfr-dev libmpc-dev vim-common

Downloading and compiling

Download the JetPack sources

You can obtain the JetPack 5.0.2 DP sources by doing the following:

1. Go to https://developer.nvidia.com/embedded/jetson-linux-archive and download the source files for your release.

2. Extract the .tbz2 file:

tar -xjf public_sources.tbz2

3. Extract the kernel source file:

cd Linux_for_Tegra/source/public
JETSON_SOURCES=$PWD
tar -xjf kernel_src.tbz2

This extracts the kernel source to the kernel/ subdirectory.

Kernel build instructions

Once the sources have been downloaded, perform the following steps in order to build.

Install the Toolchain

First, download the Bootlin toolchain binaries from the NVIDIA Jetson Linux home page. Go to the bottom of the page and click on the Bootlin Toolchain gcc option as shown in the image below:

Toolchain.png


After that do:

mkdir $HOME/l4t-gcc
cd $HOME/l4t-gcc
tar xf <path_to_toolchain_archive>

Build the kernel

  • Establish the building paths and create directories:
KERNEL_OUT=$JETSON_SOURCES/kernel_out
MODULES_OUT=$JETSON_SOURCES/modules_out
mkdir -p $KERNEL_OUT
mkdir -p $MODULES_OUT
  • Use the following command to install dependencies on Ubuntu:
sudo apt install libncurses-dev
  • Export environment variables:
export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc
export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-
  • Compile kernel:
cd $JETSON_SOURCES
./nvbuild.sh -o $KERNEL_OUT
  • Install the modules
make -C $JETSON_SOURCES/kernel/kernel-5.10/ ARCH=arm64 O=$KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$MODULES_OUT modules_install



Previous: JetPack 5.0‎.2/Getting_Started/Components Index Next: JetPack_5.0.2/Flashing_Board