I am developing a csi2 driver for a serdes device. Currently on Orin Nano, running on linux 36.5. What is the general guideline for doing so. Couple of queries I had were regarding
- setting up loadable kernel
- device tree editing
Both of these seem quite tedious. As we need to download BSP edit files and recompile whole kernel. As of now I was following a combination of https://docs.nvidia.com/jetson/archives/r36.5/DeveloperGuide/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html#loadable-kernel-module-lkm and https://docs.nvidia.com/jetson/archives/r36.5/DeveloperGuide/SD/Kernel/KernelCustomization.html . But I am frequently confused. Currently I am trying to build on the Orin Nano itself as we don’t have access to another Ubuntu machine.
Another thing that needs to be handled is streams from various VC ids, any info on this too would be much appreciated
Follow these steps to build the kernel directly on your Jetson device:
1. Install Prerequisites
Open your terminal and install the required build tools and libraries:
sudo apt update
sudo apt install build-essential bc libssl-dev flex bison
2. Download Kernel Sources
Navigate to your source directory and download the Jetson Linux Driver Package (BSP) Sources corresponding to your installed JetPack/Jetson Linux version from the Jetson Linux Archive.
Extract the kernel sources:
# Example extraction directory
mkdir -p /usr/src/kernel
cd /usr/src/kernel
# Untar your downloaded kernel sources
tar -xjf public_sources.tbz2
cd Linux_for_Tegra/source/public
tar -xjf kernel_src.tbz2
3. Configure and Build the Kernel
Prepare your kernel configuration and build the image. You can either configure options via the CLI (make menuconfig) or using built-in scripts:
# Export the output directory
export TEGRA_KERNEL_OUT=$PWD/build
mkdir -p $TEGRA_KERNEL_OUT
# Create the .config based on your current running system
make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
# (Optional) Customize your kernel features
make ARCH=arm64 O=$TEGRA_KERNEL_OUT menuconfig
# Compile the kernel, Device Trees (DTB), and modules
make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j$(nproc)
Config the vc-id in device tree for the virtual channel support.