Jetson Kernel Customization - norlab-ulaval/Norlab_wiki GitHub Wiki

By default, Jetpack omits a lot of modules from the kernel to keep it lightweight so we sometimes need to recompile modules for specific drivers. For example, to support exFAT filesystems.

Prerequisites

This guide was written and tested on a Jetson Orin AGX with Jetpack 6.0. We will be compiling directly on the Jetson itself.

Compiling kernel modules on the Jetson

  1. Make sure system is up to date
sudo apt update && sudo apt upgrade -y
  1. Clone this repo from jetsonhacks
git clone https://github.com/jetsonhacks/jetson-orin-kernel-builder.git
cd jetson-orin-kernel-builder
  1. Run a script to download the sources for the current Jetson version. They will be downloaded to /usr/src/kernel. It will also copy the current kernel config from the jetson in zcat /proc/config.gz
cd scripts
./get_kernel_sources.sh
  1. Edit the config for your specific use case in the make menuconfig.
cd /usr/src/kernel/kernel-jammy-src/
sudo make menuconfig
# Press '/' to search or navigate manually to the module you want to enable
# Once found, make sure the module is marked with [M], which means not loaded in the kernel images but as a dynamic module that we can enable after boot
# Save and exit
  1. Once done, build the modules. Then, go and grab a coffee, this will take about 30 minutes.
sudo make modules -j$(nproc)
  1. Install the freshly built modules.
sudo make modules_install
sudo depmod -a
  1. Reboot the system
sudo reboot
  1. Enable the new module. For example in our case, the module is named exfat
sudo modprobe exfat
  1. Check that it is in fact loaded
sudo lsmod | grep exfat
# You should see something in the output, if not, its not properly loaded
  1. Reboot and make sure it is still loaded
sudo reboot
# Once rebooted
sudo lsmod | grep exfat
# You should see something in the output, if not, its not properly loaded

More informations