This script supports:
- ✅ Native compilation on Jetson
- 🔁 Cross-compilation on PC
- 📦 Building multiple kernel modules via
modules.txt
Before running, create a modules.txt file:
For example: CAN kernels
# module_name|config_symbol|module_dir
gs_usb|CONFIG_CAN_GS_USB|drivers/net/can/usb
peak_usb|CONFIG_CAN_PEAK_USB|drivers/net/can/usbmodule_name→ output.konameconfig_symbol→ kernel config to enablemodule_dir→ path inside kernel source
git clone https://github.com/pairlab/jetson-gs_usb-kernel-builder.git
cd jetson-gs_usb-kernel-builder
./jetson-gs_usb-kernel-builder.sh- Automatically detects Jetson L4T version
- Generates kernel config from
/proc/config.gz - Builds all modules listed in
modules.txt - Installs modules directly to system
- Adds them to
/etc/modules - Runs
depmod
./jetson-gs_usb-kernel-builder.sh --kernel-version 36.4.3zcat /proc/config.gz > configscp config user@host:/path/to/jetson-gs_usb-kernel-builder/git clone https://github.com/pairlab/jetson-gs_usb-kernel-builder.git
cd jetson-gs_usb-kernel-builder
./jetson-gs_usb-kernel-builder.sh --kernel-version 36.4.3- Requires
--kernel-versionon PC - Downloads matching:
- public kernel sources
- cross-compilation toolchain
- Builds all modules from
modules.txt - Outputs
.kofiles to current directory
scp *.ko user@jetson:/home/user/sudo mkdir -p /lib/modules/$(uname -r)/kernel/<module-subdir>/
sudo cp *.ko /lib/modules/$(uname -r)/kernel/<module-subdir>/
echo "<module_name>" | sudo tee -a /etc/modules
sudo depmod -a
sudo reboot./jetson-gs_usb-kernel-builder.sh [OPTIONS]
Options:
--kernel-version VERSION Target L4T version (required for cross-compile)
--modules-file FILE Module definition file (default: modules.txt)
-h, --help Show helpThis script uses a lookup table for NVIDIA releases to ensure the correct:
- public source package
- toolchain version
Currently supported:
36.4.336.4.4
To add support for a new version:
- Update
resolve_release_info()in the script - Verify URLs from NVIDIA Jetson Linux resources
- Cross-compilation requires a valid
configfrom the target Jetson - Kernel version refers to the L4T version (for example
36.4.3), notuname -r - Modules are installed automatically only in native mode
- Cross-compiled modules must be manually copied to Jetson
- Keep multiple
modules.txtfiles for different projects or devices - Version-control your module list for reproducibility
- Use native mode for quick iteration, and cross-compile for CI or faster builds