NVIDIA Jetson Orin NX - 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 out-of-tree (OoT) modules for JetPack 6.1 (L4T r36.4). This process produces the updated binaries that can later be deployed and flashed to your Jetson Orin NX.

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 -p $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

Export Environment Variables

Export the variables that will be used during the build process. If your sources are in a different directory, update DEVDIR accordingly.

export DEVDIR=$HOME/nvidia/nvidia_sdk/JetPack_6.1_Linux_JETSON_ORIN_NX_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

Build, Install and Copy Outputs

1. Go to the build directory:

cd $DEVDIR/source

2. (Optional) If you are building the real-time kernel, enable the RT configuration:

./generic_rt_build.sh "enable"

3. Build the kernel and in-tree modules:

make -C kernel

4. Install the kernel and in-tree modules:

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

5. Build the NVIDIA Out-of-Tree modules:

make modules

6. Install the OoT modules into the rootfs:

sudo -E make modules_install

7. Build the device tree blobs (DTBs):

make dtbs

8. Copy the DTBs into the expected directory:

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

9. Update the initramfs so the new modules are included:

cd $DEVDIR
sudo ./tools/l4t_update_initrd.sh

Note: If building natively on the Jetson, you can instead run:

sudo nv-update-initrd

After these steps, the updated kernel, DTBs, and modules will be ready in the Linux_for_Tegra tree for flashing.



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