NVIDIA Jetson Orin - JetPack 6.1 - Building the Kernel, OoT Modules and DTBs

From RidgeRun Developer Wiki



Follow Us On Twitter LinkedIn Email Share this page


Previous: JetPack_6.1/Compiling_Code/Obtaining_Sources Index Next: JetPack_6.1/Flashing_Board








Follow these steps to compile the kernel, device tree, and modules for JetPack 6.1 (L4T r36.4).

Install the Toolchain

The Jetson kernel must be cross-compiled on the host PC using the reference toolchain. Download the Bootlin toolchain recommended for L4T r36.4 from the Jetson Linux page.

mkdir $HOME/l4t-gcc
cd $HOME/l4t-gcc
wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2
tar -xjf aarch64--glibc--stable-2022.08-1.tar.bz2

This installs the cross-compilation binaries into $HOME/l4t-gcc.

Export Environment Variable

Export the variables that will be used during the build process. If your sources are in a different directory, update DEVDIR to point to the correct Linux_for_Tegra folder.

export DEVDIR=$HOME/nvidia/nvidia_sdk/JetPack_6.1_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra
export CROSS_COMPILE=$HOME/l4t-gcc/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-
export INSTALL_MOD_PATH=$DEVDIR/rootfs/
export KERNEL_HEADERS=$DEVDIR/source/kernel/kernel-jammy-src

Explanation:

  • DEVDIR: Path to the JetPack 6.1 Linux_for_Tegra installation.
  • CROSS_COMPILE: Path to the cross-compilation toolchain.
  • INSTALL_MOD_PATH: Path where kernel modules will be installed.
  • KERNEL_HEADERS: Path to the kernel headers.

Configure the Kernel

Go to the kernel source directory:

cd $KERNEL_HEADERS

(Optional) Open the kernel configuration menu if you want to enable or disable specific features:

make menuconfig

Compile the Kernel

Change to the sources directory and compile the kernel:

cd $DEVDIR/source
make -C kernel

Install the kernel into the Linux_for_Tegra tree:

sudo -E make install -C kernel
cp kernel/kernel-jammy-src/arch/arm64/boot/Image $DEVDIR/kernel/Image

Compile the Device Trees

Build the device tree blobs (DTBs):

make dtbs

Copy the generated DTBs into the Linux_for_Tegra/kernel/dtb/ directory:

cp $DEVDIR/source/kernel-devicetree/generic-dts/dtbs/* $DEVDIR/kernel/dtb/

Compile the Out-of-Tree Modules

Compile the additional NVIDIA modules:

make modules

Install the modules into the rootfs:

sudo -E make modules_install

Update the initramfs to include the new modules:

cd $DEVDIR
sudo ./tools/l4t_update_initrd.sh

Note: If you are building natively on the Jetson target, you can update the initramfs directly with:

sudo nv-update-initrd

After completing these steps, the $DEVDIR/kernel/ and $DEVDIR/rootfs/ directories will contain the updated kernel, DTBs, and modules. These components are now ready to be flashed onto the Jetson device.

Next, continue with Flashing the Board.



Previous: JetPack_6.1/Compiling_Code/Obtaining_Sources Index Next: JetPack_6.1/Flashing_Board