Cross-compiling a kernel module

I’m working with a Jetson Orin Nano and I would like to use a kernel module that is not available in Jetson Linux r36.5. I would like to build it from the sources, preferably with cross-compilation. I’m finding the manual a bit hard to follow, though: Kernel Customization — NVIDIA Jetson Linux Developer Guide

Where can I find this source_sync.sh script? Is it something I can just run stand-alone or does it need to be ran inside a file tree?

Where is the git repo?

What exactly should I download from Jetson Linux Release 36.5 | NVIDIA Developer ? The BSP, the root filesystem or both?

I also see that in Jetson Download Center | NVIDIA Developer maybe 36.5 is not available yet? And is it really the “driver package” that I should get? Pardon if I find the name a bit confusing.

To clarify, I’m only trying to build a “in-tree” module, hopefully the simplest of kernel-related tasks, I appreciate any help. I tried to follow instructions on the PC (with cross compilation), and now on the Jetson itself. I believe I have the source code, but how do I obtain the “.config”? The documentation says “follow those steps to get the `.config`” but it doesn’t seem effective. Can I just use `/proc/config.gz`?

The source_sync.sh can get by sdkmanager.

If you are using sdkmanager to flash the device. It should generate and save in the host.

And you can download the source from below link.

Hi @nicolau2

You can download the sources either using source_sync.sh or manually.

  • Using source_sync.sh

You can find source_sync.sh in the Linux_for_Tegra/source folder.

Run the following commands to download the Jetson Linux r36.5 sources:

cd Linux_for_Tegra/source
./source_sync.sh -t jetson_36.5

This command will download the sources into the source folder.

  • Manual download

You can dowloand the Drvier Package (BSP) sources from Jetson Linux Release 36.5 | NVIDIA Developer Jetson Linux release r36.5 archive

Run the following commands to extract the sources:

wget https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v5.0/sources/public_sources.tbz2
tar -xjf public_sources.tbz2 Linux_for_Tegra/source/kernel_src.tbz2 --strip-components 2
tar -xjf public_sources.tbz2 Linux_for_Tegra/source/kernel_oot_modules_src.tbz2 --strip-components 2
tar -xjf public_sources.tbz2 Linux_for_Tegra/source/nvidia_kernel_display_driver_source.tbz2 --strip-components 2

Create a sources directory inside Linux_for_Tegra, then extract the kernel and NVIDIA out-of-tree module sources into it:

cd 
mkdir Linux_for_Tegra/sources
tar -xjf kernel_src.tbz2 -C Linux_for_Tegra/sources
tar -xjf kernel_oot_modules_src.tbz2 -C Linux_for_Tegra/sources
tar -xjf nvidia_kernel_display_driver_source.tbz2 -C Linux_for_Tegra/sources

With the sources extracted, you can follow these instructions to compile: JetPack 6 Compiling Source Code - RidgeRun Developer Wiki
And these instructions to flash the board from the command line: NVIDIA JetPack 6 Flashing the Board from Cmdline

Regards,

Kimberly Carvajal
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com