Custom Jetson Linux Kernel

Note

The custom kernel is only required for NVIDIA Jetson platforms (AGX Orin,Orin Nano). The AGX Thor requires a custom kernel only if connecting the Quectel modem as user equipment (qmi_wwan). The DGX Spark does not require kernel modifications.

The 5G core network requires SCTP (Stream Control Transmission Protocol) support in the Linux kernel. Additionally, connecting a Quectel modem via USB requires theqmi_wwan kernel module. By default, these are not enabled in the Jetson Linux kernel. This guide walks through building a custom Linux kernel that includes these features.

This guide is based on theJetson Linux Kernel Configuration Guide. The following instructions deviate from the original in a few points:

  • We do not use the Bootlin toolchain (11.3) but use the provided Ubuntu GCC compiler instead, since we are not cross-compiling

  • We add the SCTP network protocol and USB modem drivers as modules

  • We enable advanced routing in the kernel

  • We do not recompile the DTBs (Device Tree Blobs). The system’s device tree remains unchanged

  • We backup the original installation; we do not override it

Note

It is highly recommended NOT to perform these steps as root. Use sudo only when necessary for specific steps.

Automated Build (Recommended)

The easiest way to build and install the custom kernel is via the provided scripts:

./scripts/build-custom-kernel.sh./scripts/install-custom-kernel.shsudoreboot

The scripts automatically:

  • Detect the installed L4T version

  • Download the correct kernel sources

  • Apply the required configuration options

  • Build and install the kernel and modules

  • Update the initrd and boot configuration

Note

The scripts skip execution if the required modules (sctp andqmi_wwan) are already present. Use--force to rebuild anyway.

Manual Build

For advanced users who want more control over the build process, the following sections describe the manual steps.

Prerequisites

Install the required build tools:

sudoaptupdatesudoaptinstall-ygit-corebuild-essentialflexbisonbckmodlibssl-dev

Source Code

Download and extract the kernel source packages. The exact URL depends on your L4T version:

# Create build directorymkdir-pext/l4t&&cdext/l4t# Download sources (example for L4T 36.4.3)wgethttps://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.3/sources/public_sources.tbz2# Extract source packagestarxfpublic_sources.tbz2cdLinux_for_Tegra/source# Expand required sourcestarxfkernel_src.tbz2tarxfkernel_oot_modules_src.tbz2tarxfnvidia_kernel_display_driver_source.tbz2

Kernel Configuration

The kernel configuration options are stored inl4t/kernel/config.options:

CONFIG_IP_ADVANCED_ROUTER=yCONFIG_IP_MULTIPLE_TABLES=yCONFIG_INET_SCTP_DIAG=mCONFIG_IP_SCTP=mCONFIG_NETFILTER_XT_MATCH_SCTP=mCONFIG_NF_CT_PROTO_SCTP=yCONFIG_SCTP_COOKIE_HMAC_MD5=yCONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5=yCONFIG_USB_NET_DRIVERS=yCONFIG_USB_NET_CDCETHER=mCONFIG_USB_NET_CDC_NCM=mCONFIG_USB_NET_CDC_MBIM=mCONFIG_USB_NET_QMI_WWAN=mCONFIG_USB_WDM=mCONFIG_USB_SERIAL_WWAN=m

These enable:

  • SCTP protocol: Required for 5G core network communication

  • Advanced routing: Required for proper network configuration

  • USB network drivers: Required for Quectel modem connectivity (qmi_wwan)

To apply these options manually, navigate to the kernel source directory and use the kernel config scripts:

cdLinux_for_Tegra/source/kernel/kernel-jammy-src# or kernel-noble for Thor# Start from default configmakemrpropermakedefconfig# Apply each option (example)./scripts/config--file.config--set-valCONFIG_IP_SCTPm# ... repeat for other options# Resolve dependenciesmakeolddefconfig

Building the Kernel

cdLinux_for_Tegra/source# Build the kernelmake-Ckernel# Create temporary rootfs directoriesmkdir-pLinux_for_Tegra/rootfs/bootmkdir-pLinux_for_Tegra/rootfs/kernel# Set module installation pathexportINSTALL_MOD_PATH=$PWD/../rootfs# Install kernelsudo-Emakeinstall-Ckernel# Set kernel headers path (adjust for your Ubuntu version)exportKERNEL_HEADERS=$PWD/kernel/kernel-jammy-src# or kernel-noble# For Thor (Noble), also set:exportkernel_name=noble# Build and install modulesmakemodulessudo-Emakemodules_install

Installing the Kernel

Warning

Back up your existing kernel before proceeding. Package updates may overwrite custom kernels.

# Backup existing kernel and modulessudocp/boot/Image/boot/Image.originalsudocp/boot/initrd/boot/initrd.originalsudocp-r/lib/modules/$(uname-r)/lib/modules/$(uname-r).original# Install new kernelsudocpLinux_for_Tegra/rootfs/boot/Image/boot/Image# Install new modulessudocp-rLinux_for_Tegra/rootfs/lib/modules/$(uname-r)/lib/modules/# Update initrd and boot configurationsudonv-update-initrdsudonv-update-extlinuxgeneric

Boot Configuration (Optional)

For more control over boot options, you can manually edit the extlinux configuration. This is equivalent to editinggrub.conf on a standard system and allows you to boot the system to the old kernel if necessary.

Note

This example assumes the system uses an NVMe SSD (root=/dev/nvme0n1p1). Adjust as needed for your setup.

cd/boot/extlinux# Backup current configurationsudocpextlinux.confextlinux.conf.original

Editextlinux.conf to add boot entries. Example configuration:

TIMEOUT30DEFAULTprimaryMENUTITLEL4TbootoptionsLABELprimaryMENULABELprimarykernelLINUX/boot/ImageINITRD/boot/initrdAPPEND${cbootargs}root=/dev/nvme0n1p1rwrootwaitrootfstype=ext4mminit_loglevel=4console=ttyTCU0,115200console=ttyAMA0,115200firmware_class.path=/etc/firmwarefbcon=map:0net.ifnames=0nospectre_bhbvideo=efifb:offconsole=tty0nv-auto-configLABELoriginalMENULABELoriginalprecompiledkernelLINUX/boot/Image.originalINITRD/boot/initrd.originalAPPEND${cbootargs}root=/dev/nvme0n1p1rwrootwaitrootfstype=ext4mminit_loglevel=4console=ttyTCU0,115200console=ttyAMA0,115200firmware_class.path=/etc/firmwarefbcon=map:0net.ifnames=0nospectre_bhbvideo=efifb:offconsole=tty0nv-auto-config

Change theDEFAULT entry to the label you want to use and reboot.

Verification

After rebooting, verify the modules are available:

# Check for SCTP modulemodinfosctp# Check for Quectel modem drivermodinfoqmi_wwan# Load modulessudomodprobesctpsudomodprobeqmi_wwan# List loaded moduleslsmod|grep-E"sctp|qmi"