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
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 flex bison libssl-dev zstd
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#
In your browser, go to https://developer.nvidia.com/embedded/jetson-linux-archive.
Locate and download the Jetson Linux source files for your release.
Extract the
.tbz2
file:$ tar xf public_sources.tbz2 -C <install-path>/Linux_for_Tegra/..
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#
Go to the build directory:
$ cd <install-path>/Linux_for_Tegra/source
If you are building the real-time kernel, enable the real-time configuration:
$ ./generic_rt_build.sh "enable"
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
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#
Go to the build directory:
$ cd <install-path>/Linux_for_Tegra/source
If you are building the real-time kernel, configure the following variable that pertains to the nvdisplay drivers:
$ export IGNORE_PREEMPT_RT_PRESENCE=1
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
Run the following commands to install:
$ export INSTALL_MOD_PATH=<install-path>/Linux_for_Tegra/rootfs/ $ sudo -E make modules_install
To update the initramfs, run the following commands:
$ cd <install-path>/Linux_for_Tegra $ sudo ./tools/l4t_update_initrd.sh
Note
If you are building natively on a target, to update the the initramfs directly on the target, run the sudo nv-update-initrd
command.
Building the DTBs#
Go to the build directory:
$ cd <install-path>/Linux_for_Tegra/source
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
Run the following commands to install:
$ cp kernel-devicetree/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.