Kernel Customization

You can manually rebuild the kernel used for the NVIDIA® Jetson™ Linux. You must have Internet access for this.

Obtaining the Kernel Sources with Git


  • You have installed Git. You can install with the following command:

    $ sudo apt install git-core
  • Your system has the default Git port 9418 open for outbound connections.

To Sync the Kernel Sources

  • Get the kernel source by running

    $ ./

Enter a tag name when the script prompts you. The proper tag name is specified in the Release Notes. This tag name syncs the sources to the source revision from which the release binary was built.

You can sync the sources to any other Linux tag if you need to do so. To see a list of the available release tags, enter this command in the kernel source repository:

$ git tag -l tegra-l4t\*

Manually Downloading and Expanding Kernel Sources

As an alternative to syncing the kernel sources, you can download the kernel source files and then manually extract them. If possible, NVIDIA recommends that you sync with Git instead.

To Manually Download and Expand the Kernel Sources

  1. In your browser, go to

  2. Locate and download the Jetson Linux source files for your release.

  3. Extract the .tbz2 file:

    $ tar -xjf public_sources.tbz2
  4. Extract the kernel source file:

    $ cd Linux_for_Tegra/source/public
    $ tar –xjf kernel_src.tbz2

    This extracts the kernel source to the kernel/ subdirectory.

Building the Kernel

Before you build the kernel you must install the Jetson Linux build utilities. Enter the command:

$ sudo apt install build-essential bc

To Build the Kernel

  1. Sync or download and expand the kernel sources, and install the kernel build utilities, as described above.

  2. If you are cross-compiling on a host system (for example, anything other than the Jetson device for which you are building), export the following environment variables:

    $ export CROSS_COMPILE_AARCH64_PATH=<toolchain-path>
    $ export CROSS_COMPILE_AARCH64=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-

    See Jetson Linux Toolchain for information about how to download and build the reference toolchains.

  3. Enter the command:

    $ mkdir kernel_out

    Where kernel_out is the directory where the compiled kernel is to be written.

  4. Build the kernel:

    $ ./ -o $PWD/kernel_out

    Note is only included in the kernel_src.tbz2 tar file that is part of public_sources.tbz2. If the kernel sources were synced from the Git server, you need to manually copy from the tar file.

  5. Replace Linux_for_Tegra/rootfs/usr/lib/modules/$(uname -r)/kernel/drivers/gpu/nvgpu/nvgpu.ko with a copy of this file:

  6. For the device tree, replace the files in Linux_for_Tegra/kernel/dtb/ with a copy from:

  7. Replace Linux_for_Tegra/kernel/Image with a copy of this file:


    Optionally, archive the installed kernel modules:

    $ cd <modules_install_path>
    $ tar --owner root --group root -cjf kernel_supplements.tbz2 lib/modules

    You can use the installed modules to provide the contents of /lib/modules/<kernel_version>/ on the target system. Before you run, make a copy of this archive to replace the one at this location on the target device:


To Build the Real-Time Kernel

  1. Apply RT patches to the kernel:

    ./kernel-5.10/scripts/ apply-patches
  2. Complete steps 2-7 as described in the previous section.

  3. Install the kernel modules:

    $ cd <path_to_kernel_source>
    $ sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=<top>/Linux_for_Tegra/rootfs/

    Ensure there is a new folder with -rt63- in its name under Linux_for_Tegra/rootfs/usr/lib/modules/.

  4. Build the display drivers.

Refer to To Build Display Kernel Modules for information about how to build display drivers.
  1. Copy nvidia-drm.ko, nvidia.ko, and nvidia-modeset.ko into the following directory:

    <top>/Linux_for_Tegra/rootfs/usr/lib/modules/$(uname -r)/extra/opensrc-disp/

If this folder does not exist, create it manually. $(uname -r) refers to the folder that was created in the previous step where kernel modules are installed.

  1. In Orin, fix the black screen. This is not required on Xavier.

    1. Flash the system into your Jetson device.

    2. At the first boot, log in, type sudo depmod -a, and then reboot. The GUI should now be back.

    The display is not available upon first boot, so the process of setting user accounts through a serial connection might not be stable. To create user accounts before you flash, use under Linux_for_Tegra/tools/. To use it, run the following command:

    $ sudo ./l4t_create_default_user -u <username> -p <password>

    For Xavier, if USB devices such as a mouse and a keyboard do not provide a response at boot time, unplug and plug them in again.

Signing and Encrypting the Kernel, the kernel-dtb, and the initrd Binary Files

To support Secure Boot, the kernel, kernel-dtb, and initrd binary files must be signed and encrypted with keys to generate encrypted binary files and signature files.

See the topic Secure Boot.

Preparing to Build External Kernel Modules

These procedures describe how to prepare a set of kernel headers, or a kernel source tree to allow building an out-of-tree kernel module.

To Prepare the Jetson Linux Kernel Headers on a Jetson System

On a Jetson system you can use the files in this directory to build out-of-tree modules without further action:

/usr/src/linux-headers-$(uname -r)-ubuntu20.04_aarch64


/lib/modules/$(uname -r)/build/

To Prepare the Jetson Linux kernel Headers on a Non-Jetson System

  • Extract the archive and place it in a local directory with the commands:

    $ cd <local_src_dir>
    $ tar -xjf <top>/Linux_for_Tegra/kernel/kernel_headers.tbz2

    Where <local_src_dir> is a local directory of your choice.

    You can use the files in this directory to build out-of-tree modules:

    <local_src_dir>/linux-headers-$(uname -r)-linux_x86_64/

    To build out-of-tree modules, specify the kernel directory as:

    <local src dir>/linux-headers-$(uname -r)-linux_x86_64/

To Use a Manually Built Kernel Source Tree

  • If you built the kernel from source, use the same source tree to build out-of-tree kernel modules. When building out-of-tree modules, use $TEGRA_KERNEL_OUT as the kernel directory.

To Prepare a Kernel Source Tree that is not Built

You can build out-of-tree modules that are compatible with a Linux kernel source tree without building the entire kernel image.

  1. To extract the kernel source, set any required shell or environment variables, and create the .config file, follow the instructions provided in these topics:

  2. Enter this command to prepare the kernel source tree for building out-of-tree kernel modules:

       $ make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j<n> modules_prepare
    Where ``<n>`` is the number of parallel processes to be used. NVIDIA recommends using the number of CPUs in your system.

When building out-of-tree modules, point $TEGRA_KERNEL_OUT to the kernel directory.

To Build External Kernel Modules

  1. If you are cross-compiling the kernel, ensure that the CROSS_COMPILE environment variable is set as described in preceding sections.

  1. Enter these commands to build an out-of-tree kernel module:

    $ cd <path_to_module_source>
    $ make ARCH=arm64 –C <kernel_directory> M=$(pwd)

    Enter these commands to strip unneeded symbols from the kernel module:

    $ <tool_chain_path>/aarch64-linux-gnu-strip -–strip-unneeded <path-of-kernel-module.ko>

To Build Display Kernel Modules

  1. If you are cross-compiling the kernel, ensure that the CROSS_COMPILE environment variable is set as described in preceding sections.

  2. Export the required variables as per the Linux kernel module compilation steps:

    $ export LOCALVERSION="-tegra"
  3. If building for RT-Kernel, make sure to set IGNORE_PREEMPT_RT_PRESENCE:

  4. Untar the file nvidia_kernel_display_driver_source.tbz2, which contains the display source code

  5. cd NVIDIA-kernel-module-source-<Version>

  6. Make the modules with following command:

    $ make \
          modules \
          SYSSRC=<KERNELSRC> \
          CC=${CROSS_COMPILE_AARCH64}gcc \
          LD=${CROSS_COMPILE_AARCH64}ld.bfd \
          AR=${CROSS_COMPILE_AARCH64}ar \
          CXX=${CROSS_COMPILE_AARCH64}g++ \
          OBJCOPY=${CROSS_COMPILE_AARCH64}objcopy \
          TARGET_ARCH=aarch64 \

    Modules are built under “NVIDIA-kernel-module-source-<Version>/kernel-open”.

Using the Jetson Linux Real-Time Kernel Package

Starting with release 35.1, Real-Time Kernel support is provided with Developer-Preview quality for the following platforms:

  • Jetson Xavier AGX

  • Jetson Xavier NX

  • Jetson Orin AGX

  • Jetson Orin NX and Nano

  1. RT Latency Tuning

    1. To get the best latency value, apply these settings for Xavier series after the RT kernel boot.

      This step is not applicable for the Orin series.

echo 100 > /sys/kernel/debug/tegra_mce/rt_window_us
echo 20 > /sys/kernel/debug/tegra_mce/rt_fwd_progress_us
echo 0x7f > /sys/kernel/debug/tegra_mce/rt_safe_mask