A bash utility to compile and setup Jetson Linux kernel modules for adc, pwm and iio peripheries
In future releases, Device Tree Overlays will be included to automate board configuration as well.
A helper script to build Jetson Linux kernel modules for selected peripherals (currently PWM PCA9685).
- A Linux host with bash, tar, make, and
scripts/config(provided in the kernel sources).
- Go to NVIDIA’s Jetson Linux archive: https://developer.nvidia.com/embedded/jetson-linux-archive
- Select the Jetson platform and release you’re targeting.
- In the table, download Driver Package (BSP) Sources (e.g.,
public_sources.tbz2). - Save the tarball somewhere accessible.
The script automatically detects the host architecture:
- x86_64 (Ubuntu/Debian): Enables cross-compilation for ARM64. The script will automatically install
gcc-aarch64-linux-gnuand configure the build withARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-. - aarch64 (Jetson device): Uses native compilation.
This allows you to build Jetson kernel modules on a faster x86_64 development machine and then transfer the .ko files to your Jetson device.
./build.sh [--pwm-pca9685] [--ads1015] [--sc16is7xx] [--output-dir DIR] <public_sources.tbz2>--pwm-pca9685: Compile the PWM PCA9685 kernel module.--ads1015: Compile the IIO ADC ADS1015 kernel module.--sc16is7xx: Compile the SC16IS7XX I2C/SPI to UART bridge kernel module.--output-dir DIR: (Optional) Directory to copy the built.kofile (defaults to current directory).<public_sources.tbz2>: The downloaded BSP sources tarball.
After building, the module .ko file should be placed into the kernel modules tree for your running kernel:
sudo install -m 644 pwm-pca9685.ko /lib/modules/$(uname -r)/kernel/drivers/pwm/Then update the module dependency list:
sudo depmod -aTo verify the module is available (either by filesystem or via modprobe):
modprobe -l | grep pwm_pca9685-
Load the module:
sudo modprobe pwm-pca9685
-
Check that it’s loaded:
lsmod | grep pwm_pca9685 -
View module information:
modinfo pwm-pca9685
If you encounter issues loading or running the module, check:
-
Kernel messages:
dmesg | tail -n 50 -
System logs:
journalctl -k --since "5 minutes ago" -
Driver‑specific logs: filter for the driver name, e.g.:
dmesg | grep -i pca9685 journalctl -k | grep -i pca9685
These commands can help you identify configuration errors, missing dependencies, or driver load failures.