4.5. Build Software From Source

This section describes the method for manually building the drivers and devicetree from source. For most use cases, the provided packages in the release archive’s bin/ folder are sufficient and this section can be skipped. Building from source is only necessary when making modifications to D3 Embedded’s drivers or devicetree.

4.5.1. Get The Source Code

The release archive contains the source code in the src/ directory after extracting it:

# Make directory to extract release to keep things clean
mkdir d3-jetson-modules_<release name>/ && cd d3-jetson-modules_<release name>/
tar -xzf ../d3-jetson-modules_<release name>.tar.gz
cd src/

4.5.2. Setup Build Environment

Most of the dependencies necessary for building from source (automake, gcc, etc…) are provided by the Bootlin toolchain that NVIDIA recommends. You can download the toolchain for JetPack 6.2.1 from NVIDIA’s website.

Once downloaded, extract the archive to you preferred location and run the ./relocate-sdk.sh script:

mkdir -p /opt/nvidia/gcc-11.3 && cd /opt/nvidia/gcc-11.3
tar -xzf aarch64--glibc--stable-final.tar.gz
./relocate-sdk.sh

To use the newly extracted toolchain, update your PATH.

export PATH=/opt/nvidia/gcc-11.3/bin/:$PATH

4.5.3. Build With GitLab CI Script

We include a .gitlab-ci.sh script with our source which we use internally to run verification builds and generate releases. You can use this script to build D3 Embedded’s software, and it will handle all the below configuration for you:

# First time build (takes a good bit of time to compile the kernel)
CI=true ./.gitlab-ci.sh

# All future builds (skips compiling the kernel, much faster)
./.gitlab-ci.sh

The script assumes that you want to build everything in the source directory (all carrier boards/interface cards, all cameras, etc.). If that is not desired, follow the steps below to customize the build.

Note

.gitlab-ci.sh is currently the only way to build D3’s software documentation

4.5.4. Build With Automake

Under the hood of .gitlab-ci.sh is a series of automake calls which is used to take much of the headache out of cross-compiling and configuring. Follow the sections below to manually configure and build from source.

4.5.4.1. Configure

For D3 Embedded’s software, configuration takes place in two steps. First, configure the carrier board (or interface card) repository for your target hardware:

cd <carrier board repo>/
./bootstrap
./configure --with-cameras="../imx390"

Then, finish up the configuration in d3-jetson-common. Make sure to include all required kernel modules in the --with-linux-modules section:

cd d3-jetson-common/
./bootstrap
./configure \
    --with-linux-modules="../<cam-repo> ../<serdes-repo> ../<misc-other-modules>" \
    --with-d3-hardware="../<interface-card-or-carrier-board-repo>"

Examples of kernel modules:

  • <cam-repo>: ar0234, imx390, isx031

  • <serdes-repo>: ub9x, max9x, or both

  • <misc-other-modules>

    • reg_ctl - Used for register access via sysfs for our camera drivers

    • atlantic - Support for Marvell’s AQC113 10GbE chip

Examples for --with-d3-hardware:

  • d3-16x-gmsl

  • d3-16x-fpdlink

  • d3-orin-nx-8x-gmsl

4.5.4.2. Building the Kernel

In order to build D3 Embedded’s kernel modules out-of-tree, the target kernel must be built as well. The built kernel does not get included in any compiled packages, it exists to facilitate the out of tree build:

cd d3-jetson-common/
make linux-defconfig
make -j$(nproc) linux

4.5.4.3. Building D3 Embedded’s Software

To build the release .deb packages, which include the kernel module .ko file, device tree overlays, and corresponding scripts:

cd d3-jetson-common/
make release
ls artifacts/  # .deb packages can be found here

4.5.4.4. Known Issues With Build System

  1. Dependency tracking for devicetree source files isn’t handled automatically by automake. Each individual Makefile.am specifies local (within the same repo) dependencies, but modification of .dts/dtsi files under d3-jetson-common or in other included paths may require a clean build.