
Recall first from L4T structure and the meta-tegra layer
- On Jetson Orin, MB1 and MB2 prepare the platform before UEFI runs.
- The Linux kernel image contains executable code, and the device tree describes the board Linux is running on.
- meta-tegra integrates Jetson board support into Yocto while Yocto assembles the target root filesystem.
Build the image for your Orin
4 min readYou have the Yocto layer. This lesson answers how to build an image with CUDA and TensorRT and customise the kernel and device tree.
An Orin can reach a login prompt while a CUDA program fails at device initialization. Linux brings up devices through individual driver probes, so a working console tells you little about whether the GPU probed or whether the application can load its libraries. Use the image manifest, the running device tree, and a target-side GPU test to answer those questions separately. The kernel documentation on driver binding describes where matching and probing occur.
Start in the initialized BitBake environment from the preceding lesson. Set MACHINE in conf/local.conf to the configuration for your module and carrier. For the NVIDIA Jetson Orin Nano developer kit, use jetson-orin-nano-devkit if that is the machine supplied for your kit by the pinned checkout. A different carrier can require a different machine configuration even with the same module. Use the layer revisions and distribution configuration together. Ubuntu 24.04 runs the build tools. The Jetson boots the kernel produced by the target build, with the corresponding target modules and firmware.
NVIDIA's Jetson Linux BSP, also called L4T, supplies release-specific artifacts such as firmware and NVIDIA user-space binaries. NVIDIA also publishes kernel and related driver source for its BSP releases. In a BSP-based meta-tegra build, recipes can fetch and package those binary artifacts and can compile a kernel from the selected NVIDIA source tree. Upstream Linux has its own Tegra support. Selecting an upstream kernel changes the driver code and potentially the bindings and interfaces available to the NVIDIA user-space stack. Treat a kernel-provider switch as a compatibility change. Use the configured provider for this lab.
Inspect the build configuration before choosing image packages.
bitbake-layers show-layers
bitbake-layers show-recipes '*cuda*'
bitbake-layers show-recipes '*tensorrt*'
bitbake -e virtual/kernel | grep -E '^(PN|PV|FILE|KERNEL_DEVICETREE)='
PN identifies the selected kernel recipe and FILE identifies its recipe file. KERNEL_DEVICETREE reports the configured device-tree artifacts where the kernel recipe uses that variable. Check the machine and deployment recipes as well, since they can select or deploy additional device-tree artifacts.
For a first build, use core-image-minimal with image-specific additions in conf/local.conf. The following line is a template. Replace all three uppercase tokens with binary package names from your checkout. Select the BSP package or package set that supplies the CUDA driver user space, the CUDA runtime package that ships libcudart, and the TensorRT runtime package that ships libnvinfer. Use additional package names where the selected software needs plugins or other components.
IMAGE_INSTALL:append:pn-core-image-minimal = " DRIVER_PKG CUDART_PKG TRT_PKG"
Read the recipes and their included files for package splits and dependencies. Where the split is unclear, build the relevant provider recipes by the names found above, then query the generated package data. This also gives you a way to find the package that contains libcuda.so, even when its recipe name contains neither “CUDA” nor “TensorRT”.
oe-pkgdata-util find-path '*/libcuda.so*'
oe-pkgdata-util find-path '*/libcudart.so*'
oe-pkgdata-util find-path '*/libnvinfer.so*'
bitbake core-image-minimal
Package data becomes available after the relevant recipes have produced it. If a search returns a development package containing an unversioned link and a runtime package containing the versioned shared object, select the runtime package for the image. Check that the machine configuration or the installed packages bring in the required firmware and any separately packaged GPU modules. A minimal image also needs a usable console login for the lab. Check the distro's login configuration before flashing.
Inspect the image manifest in tmp/deploy/images/<machine>/ under the default build layout, or in the expanded DEPLOY_DIR_IMAGE if your build sets a different location. Record the runtime package names and versions. Locate the flash bundle for that same image and machine, read the instructions it ships with, and follow its recovery and storage selection procedure. If the bundle supplies doflash.sh, run it from the extracted bundle directory using the invocation documented for that bundle. Confirm the destination boot medium before flashing because the procedure can overwrite it. A VM needs recovery USB passthrough for the device as it enumerates during flashing. You can build in WSL2 or a VM and move the bundle to a native Linux flash host if recovery USB is unavailable there.
Change the kernel and device tree together
4 min readKeep board changes in your own layer. Add a .bbappend matching the selected kernel recipe and carry kernel source changes as patches in SRC_URI. For a Kconfig change, use the configuration mechanism of that recipe. If it merges configuration fragments, include a fragment through the append. If it uses a maintained defconfig, patch that defconfig. A temporary configuration change can help you test an option, but the layer must express the change for subsequent builds. Verify the final kernel .config after configuration. A requested option can disappear when its Kconfig dependencies are unmet. For a driver built as a module, also verify its package reaches the image and that the module matches the booted kernel.
A device-tree change describes the hardware and how Linux should bind it. Work from the DTS and DTSI files for the selected BSP and board. For example, trace the Tegra host1x node and the multimedia engines described beneath it in the selected tree. Host1x provides command submission and synchronization infrastructure for Tegra engines. VIC is the video image compositor used for operations such as scaling and pixel format conversion. The ISP processes camera image data. Keep the release's descriptions for their registers, interrupts, clocks, resets, power domains, and IOMMU connections wherever the binding requires them. A node inherits constraints from its parent, so inspect the parent as well as the node's own status. CUDA needs the GPU device and its driver stack. A working VIC or ISP tells you about a different hardware engine.
For a carrier-specific sensor, trace the sensor's control bus and its media endpoints through NVCSI to the capture interface, commonly called VI. Use the sensor's binding and a matching board example from the BSP. Set properties for the wired I²C address, supplies, clock, and reset or power-down GPIOs as required by the driver. For the media graph, match the endpoints at both ends of each link and use the lane and port assignments for the actual connector. Some camera workflows also require NVIDIA user-space components. Confirm raw sensor capture and the expected media links before diagnosing an ISP-dependent application.
Patch the DTS in the recipe that owns it. If the branch builds board DTBs or overlays in a separate recipe, put the append there. Rebuild the image and verify which DTB and overlays the flash configuration or bootloader will actually load. After boot, inspect the live device tree under /sys/firmware/devicetree/base if exposed. Properties such as compatible can contain NUL-separated strings. The live tree shows the result of boot-time selection and overlay application. A deployed DTB on the build host only shows what the build generated.
Going deeperExplore the mechanism
Pinmux controls the functions and electrical settings of the SoC pads. For a custom carrier, use the pinmux spreadsheet and generated configuration for the matching Orin module and BSP. Where boot firmware applies the pinmux through MB1 BCT inputs, update the machine's flash inputs and deploy them through the supported flash procedure. Replacing the Linux DTB alone leaves those boot-time settings in place. For the camera, reconcile the carrier schematic with the pinmux for control signals such as I²C, reset, and any routed sensor clock. Then reconcile the sensor endpoints and NVCSI lane mapping in the Linux device tree. A media endpoint describes a connection and cannot configure a pad's electrical behavior by itself.
Apply the same distinction to display. Use the carrier and BSP configuration to check the display connector path and any hot-plug or auxiliary signals, then check the relevant display controller and output configuration. Preserve the lane and PHY assignments of the intended carrier. A headless CUDA lab needs no display reconfiguration. Handle changes to camera and display one at a time so the boot log and functional tests can be tied to a specific change.
Verify GPU access and build against the image
3 min readBoot the Orin and run these commands from its console. Use a privileged account to read the kernel log if access is restricted.
uname -r
find /dev -maxdepth 1 -type c \( -name 'nvidia*' -o -name nvmap -o -name 'nvhost-*gpu*' \) \
-exec stat -c '%n %F' {} +
dmesg | grep -Ei 'nvgpu|nvidia|host1x|vic|nvcs[i]|tegra.*(vi|isp)'
The find command selects character devices named /dev/nvidia*, plus /dev/nvmap and the nvhost-*gpu* nodes that Jetson BSPs can also create. Record the actual names from your board because the interfaces present depend on the BSP and driver. A successful find exit can also occur with zero matches, so look for actual lines. An empty result calls for inspecting the running kernel, module inclusion and loading, driver probe messages, and device creation. Logs can mention deferred probes while dependencies are coming up. Check whether the driver eventually binds. If nodes exist but a program fails, inspect the error from that program and check access as the account that will run it.
When available, run a target CUDA smoke test that initializes the runtime and executes a small GPU operation, checking its result. To verify TensorRT as well, run the branch's packaged inference tool or your application with a compatible test model and confirm that inference completes on the GPU. If using trtexec, install the package that supplies it and use trtexec --help to check the options for that release. Report the device check, CUDA execution, and TensorRT inference as distinct observations.
Going deeperExplore the mechanism
Add the application as a recipe in your layer. DEPENDS names the recipes that stage build inputs, including the providers of CUDA and TensorRT headers and link libraries. In the application's build system, compile the target CPU code for AArch64, compile CUDA device code for Orin's compute capability 8.7, and link the target versions of the libraries used by the program. For example, a TensorRT application using CUDA runtime APIs typically links nvinfer and cudart. Yocto can infer runtime dependencies from linked shared libraries. If your program loads a plugin dynamically or reads model files at runtime, explicitly package those files or depend on the packages that install them. Add the resulting application package to IMAGE_INSTALL.
To build outside BitBake, generate a standard SDK for the same image. Add the development packages that supply the required headers and link libraries to TOOLCHAIN_TARGET_TASK if the SDK configuration does not already select them. Use the actual names from the package data.
bitbake core-image-minimal -c populate_sdk
Run the generated installer in tmp/deploy/sdk/ under the default layout, then source the installed environment-setup-* script for the target toolchain. Use the resulting compiler settings and SDKTARGETSYSROOT for the AArch64 build. A sysroot provides target headers and libraries. For .cu sources you also need an executable nvcc on the SDK host. Include the host-side CUDA tool package via TOOLCHAIN_HOST_TASK if the pinned layer provides one for the SDK, or use a compatible NVIDIA cross-development toolkit. Configure nvcc to use the SDK's AArch64 C++ compiler as its host compiler and pass through the target sysroot and necessary compiler flags. Check that the CUDA release supports that compiler. The Ubuntu host's GCC version alone does not tell you which compiler this SDK will use.
Once the Orin boots and the GPU checks pass, Rootfs layout and OTA updates explains how the installed files and boot artifacts are arranged so a later update can preserve a working system.
Key takeaways
- The Yocto build host and the Jetson target use separate kernels and toolchains.
- BitBake recipes provide build inputs, while the image manifest lists installed binary packages.
- The running device tree and driver probe results determine whether described hardware is usable.
- NVIDIA character devices provide driver evidence, while a successful GPU inference run verifies more of the stack.
Reflect
- Explain to a colleague, in two sentences: identify the kernel provider and runtime packages for a pinned meta-tegra build
- Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
- What surprised you when you ran the commands yourself?
On a real board
Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.
References and further reading
- Kernel documentationLinux and the Devicetree: device population and platform identification
- Kernel documentationDriver Binding: device matching and probe
- Man pagestat(1): display file status
Official documentation first. Links checked when the lesson was published.