NVIDIA Jetson AGX Thor - Compiling Kernel and DTB

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page





Previous: JetPack_7.0/Getting_Started/Components Index Next: JetPack_7.0/Flashing Board









Learn to build the BSP and OS components enable 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 AGX Thor. For this section you are going to need Jetpack 7.0 for AGX Thor installed on your host computer, we assume that you got this installed by 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:
    • git
    • flex
    • build-essential
    • bc
    • libssl-dev
    • zstd
    • toolchain


In Debian based systems you can run the following to install almost all dependencies:

sudo apt install git build-essential bc flex bison libssl-dev zstd

Get the Toolchain

The toolchain is the set of tools required to cross-compile the Linux kernel. If you haven't already, download the toolchain you can get it from: NVIDIA Jetson Linux home page

To extract the toolchain, use these commands:

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

Many build systems will require that you set environment variable CROSS_COMPILE to point at the toolchain to use. To set it up use:

export CROSS_COMPILE=$HOME/l4t-gcc/x-tools/aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

Download BSP sources

The BSP sources are provided by NVIDIA and include the kernel, modules, and device tree source files. At RidgeRun we often need to modify and rebuild these sources to develop our customer's projects. You can use one of the two following methods to obtain the BSP sources:

Method #1: Download via the sources_sync script

NVIDIA provides a script to clone the BSP sources, this script is included in Jetpack. To download kernel sources, execute the following commands in a terminal:

cd <install-path>/Linux_for_Tegra/source
./source_sync.sh -k <release-tag>

Method #2: Download via the NVIDIA web page

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

1. Go to Jetson Linux Archive and download the source files for your release. Important: Consider that JetPack-7.0. is only supported by Jetson Linux 38.x. For this example we use the Driver Package (BSP) Sources
2. Extract .tbz2 file:

tar xf public_sources.tbz2 -C <install-path>/Linux_for_Tegra/..

2. Extract kernel and NVIDIA out-of-tree modules source files:

cd <install-path>/Linux_for_Tegra/source/
tar -xf kernel_src.tbz2
tar xf kernel_oot_modules_src.tbz2
tar xf nvidia_kernel_display_driver_source.tbz2
tar xf nvidia_unified_gpu_display_driver_source.tbz2

This extracts the kernel source to the kernel/ subdirectory, and the NVIDIA out-of-tree kernel modules sources to the current directory.

Kernel build instructions

Once the sources have been downloaded, perform the following steps in order to build. 1. Go to Build directory:

cd <install-path>/Linux_for_Tegra/source

2. [OPTIONAL] If you are building real-time kernel, enable the real-time configuration:

./generic_rt_build.sh "enable"

3. Use the following commands to build the Jetson Linux Kernel and its in-tree modules:

export CROSS_COMPILE=<toolchain-path>/aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
make -C kernel

4. Now run the following commands to install the kernel and in-tree modules:

export INSTALL_MOD_PATH=<install-path>/Linux_for_Tegra/rootfs/
sudo -E make install -C kernel
cp kernel/kernel-noble/arch/arm64/boot/Image \
<install-path>/Linux_for_Tegra/kernel/Image

NVIDIA Out-of-Tree Modules build instructions

1. Go to Build directory:

cd <install-path>/Linux_for_Tegra/source

2. [OPTIONAL] If you are building real-time kernel, configure nvdisplay driver variables:

export IGNORE_PREEMPT_RT_PRESENCE=1

3. Use the following commands to build:

export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
export KERNEL_HEADERS=$PWD/kernel/kernel-noble
export kernel_name=noble
make modules

4.Run the following commands to install:

export INSTALL_MOD_PATH=<install-path>/Linux_for_Tegra/rootfs/
sudo -E make modules_install

5. To update initramfs, run the following commands:

cd <install-path>/Linux_for_Tegra
sudo ./tools/l4t_update_initrd.sh

DTBs build instructions

1. Go to build directory:

cd <install-path>/Linux_for_Tegra/source

2. Use the following commands to build:

export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
export KERNEL_HEADERS=$PWD/kernel/kernel-noble
make dtbs

3. Use the following commands to install:

cp kernel-devicetree/generic-dts/dtbs/*
<install-path>/Linux_for_Tegra/kernel/dtb/

[NOTE] If KERNEL_HEADERS points to a source directory, you must use the following command or equivalent to build dtc:

make ARCH=arm64 defconfig scripts



Previous: JetPack_7.0/Getting_Started/Components Index Next: JetPack_7.0/Flashing Board