Kernel Customization

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

Prerequisites

  • 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.

  • You have installed the Linux kernel build utilities. You can install with the following command:

    $ sudo apt install build-essential bc
    
  • You have installed the toolchain. See Jetson Linux Toolchain for information about how to download and install the reference toolchain.

Obtaining the Kernel Sources

You can obtain the Jetson Linux kernel sources in the following ways:

  • Sync the sources using Git.

  • download the kernel source files and manually extract them.

NVIDIA recommends that you sync with Git.

To Sync the Kernel Sources with Git

To get the kernel source, run the source_sync.sh script:

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

The correct release-tag is specified in the release notes. This tag name syncs the sources to the source revision from which the release binary was built.

To Manually Download and Expand the Kernel Sources

  1. In your browser, go to https://developer.nvidia.com/embedded/jetson-linux-archive.

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

  3. Extract the .tbz2 file:

    $ tar xf public_sources.tbz2 -C <install-path>/Linux_for_Tegra/..
    
  4. Extract the kernel and the 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
    

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

Building the Jetson Linux Kernel

  1. Go to the build directory:

    $ cd <install-path>/Linux_for_Tegra/source
    
  2. If you are building the real-time kernel, enable the real-time configuration:

    $ ./generic_rt_build.sh "enable"
    
  3. Run the following commands to build the Jetson Linux kernel and its in-tree modules:

    $ export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
    $ make -C kernel
    
  4. 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-jammy-src/arch/arm64/boot/Image \
      <install-path>/Linux_for_Tegra/kernel/Image
    

Building the NVIDIA Out-of-Tree Modules

  1. Go to the build directory:

    $ cd <install-path>/Linux_for_Tegra/source
    
  2. If you are building the real-time kernel, configure the following variable that pertains to the nvdisplay drivers:

    $ export IGNORE_PREEMPT_RT_PRESENCE=1
    
  3. Run the following commands to build:

    $ export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
    $ export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src
    $ make modules
    
  4. Run the following commands to install:

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

Building the DTBs

  1. Go to the build directory:

    $ cd <install-path>/Linux_for_Tegra/source
    
  2. Run the following commands to build:

    $ export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
    $ export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src
    $ make dtbs
    
  3. Run the following commands to install:

    $ cp nvidia-oot/device-tree/platform/generic-dts/dtbs/* \
         <install-path>/Linux_for_Tegra/kernel/dtb/
    

Note

If KERNEL_HEADERS points to a source directory rather than an exported headers directory, you will need to run make ARCH=arm64 defconfig scripts or equivalent in order to build dtc.

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.

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 Orin AGX

  • Jetson Orin NX and Nano

Note

By default, kernel real-time patches disable UEFI runtime services. To enable these services, add uefi=runtime to the kernel command line. If these services are enabled in rt-kernel, it might trigger a larger latency. Refer to ba7585a4a5580b4cba26ebe76050bd2ef1148948 commit for more information.