NVIDIA Jetson Orin NX - JetPack 5.1.1 - Building the Kernel, Modules and DTBs

From RidgeRun Developer Wiki





Follow Us On Twitter LinkedIn Email Share this page



Previous: Jetpack_5.X/Kernel_Compile/Obtaining_Sources Index Next: Jetpack_5.X/Cmd_Flash







Once the kernel sources have been obtained, the next step is to configure and compile the kernel, kernel modules, and device tree blobs (DTBs). This process ensures that the build artifacts match the JetPack 5.1.1 release.

Install the Toolchain

Jetson kernels are built on the host PC using cross-compilation. For JetPack 5.1.1, NVIDIA recommends the Bootlin GCC 9.3 toolchain for AArch64.

cd ~/Downloads
wget https://developer.nvidia.com/embedded/jetson-linux/bootlin-toolchain-gcc-93
mkdir -p $HOME/l4t-gcc
tar -xvf bootlin-toolchain-gcc-93 -C $HOME/l4t-gcc --strip-components=1
export PATH=$PATH:$HOME/l4t-gcc/bin

Export Environment Variables

Export the required environment variables so that the build process knows where the sources, toolchain, and outputs are located.

export DEVDIR=$HOME/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/sources
export CROSS_COMPILE=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-
export TEGRA_KERNEL_OUT=$HOME/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/kernel-5.10_out
export TEGRA_MODULES_OUT=$HOME/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/rootfs
export ARCH=arm64
export LOCALVERSION=-tegra
export JETPACK=$HOME/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra

Build, Install and Deploy Outputs

1. Configure the kernel with the default NVIDIA configuration:

make -C $DEVDIR/kernel/kernel-5.10/ ARCH=$ARCH O=$TEGRA_KERNEL_OUT tegra_defconfig

2. Build the kernel image:

make -C $DEVDIR/kernel/kernel-5.10/ ARCH=$ARCH O=$TEGRA_KERNEL_OUT -j$(nproc)

3. Build the device tree blobs:

make -C $DEVDIR/kernel/kernel-5.10/ ARCH=$ARCH O=$TEGRA_KERNEL_OUT dtbs

4. Build and install the modules:

make -C $DEVDIR/kernel/kernel-5.10/ ARCH=$ARCH O=$TEGRA_KERNEL_OUT modules
sudo make -C $DEVDIR/kernel/kernel-5.10/ ARCH=$ARCH O=$TEGRA_KERNEL_OUT \
    INSTALL_MOD_PATH=$TEGRA_MODULES_OUT modules_install LOCALVERSION=$LOCALVERSION

5. Backup the binaries that come installed by default in JetPack:

BKUP_DATE=`date "+%Y_%m_%d_%H_%M_%S"`
mv $JETPACK/kernel/Image{,.$BKUP_DATE}
mv $JETPACK/kernel/kernel_supplements.tbz2{,.$BKUP_DATE}
mv $JETPACK/kernel/dtb{,.$BKUP_DATE}

6. Copy the new kernel image and DTBs into the expected locations:

cd $TEGRA_KERNEL_OUT
cp ./arch/arm64/boot/Image $JETPACK/kernel/
cp -r ./arch/arm64/boot/dts $JETPACK/kernel/dtb

7. Update the kernel supplements archive with the rebuilt modules:

cd $TEGRA_MODULES_OUT
tar --owner root --group root -cjf $JETPACK/kernel/kernel_supplements.tbz2 lib/modules

At this point, the $JETPACK/kernel/ directory contains:

  • The new kernel image (Image).
  • The new device tree blobs (dtb/).
  • An updated kernel_supplements.tbz2 archive with the rebuilt modules.

These files will be automatically included the next time you flash the device with flash.sh or SDK Manager.

Known Issues

We found the following errors during the BSP build using JetPack 5.0-DP and 5.0.1-DP. They may still appear on 5.1.1 if sources are incomplete:

Missing osi_core.h

Error message:

fatal error: osi_core.h: No such file or directory

Fix:

ln -s ${JETPACK}/sources/kernel/nvethernetrm \
      ${JETPACK}/sources/kernel/nvidia/drivers/net/ethernet/nvidia/nvethernet

Missing dtsi file

Error message:

fatal error: t234-common-cvm/tegra234-cvm-p3701.dtsi: No such file or directory

Fix:

mkdir $JETPACK/sources/hardware/nvidia/platform/t23x/common/kernel-dts
mv $JETPACK/sources/hardware/nvidia/platform/t23x/common/t234* \
   $JETPACK/sources/hardware/nvidia/platform/t23x/common/kernel-dts



Previous: Jetpack_5.X/Kernel_Compile/Obtaining_Sources Index Next: Jetpack_5.X/Cmd_Flash