Yocto Support for NVIDIA Jetson Platforms - Adding NVIDIA Packages

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Accessing the Board Index Next: DeepStream


Nvidia-preferred-partner-badge-rgb-for-screen.png



Some packages outside the L4T (Linux For Tegra) BSP can only be downloaded with an NVIDIA Developer Network login, for example, the CUDA host-side tools. To use any packages that require a Devnet login, create a Devnet account, and download the JetPack packages needed for the builds using NVIDIA SDK Manager.

You need to download the Download alt font awesome.svg NVIDIA SDK Manager, and follow these instructions:

  1. Register and login with the NVIDIA Developer account.
  2. Select the target machine and click the Continue button.
  3. Select the packages you need, set the Download folder to /home/<USER>/Downloads/nvidia/sdkm_downloads, accept the terms, click the Download now checkbox and press Continue.


The packages will be stored in the specified directory.


If you need to include TensorRT in your builds, you must create the subdirectory and copy all of the TensorRT packages downloaded by the SDK Manager there.

mkdir -p /home/$USER/Downloads/nvidia/sdkm_downloads/NoDLA
cp /home/$USER/Downloads/nvidia/sdkm_downloads/libnv* /home/$USER/Downloads/nvidia/sdkm_downloads/NoDLA

Set the variable NVIDIA_DEVNET_MIRROR to download dir in your build configuration (local.conf) to make them available to your bitbake builds. This can be the NVIDIA SDK Manager downloads directory.

NVIDIA_DEVNET_MIRROR="file:///home/${USER}/Downloads/nvidia/sdkm_downloads"

CUDA

Some packages needed to compile CUDA and other dependencies are not compatible with the latest GCC (>=9.x) therefore it is needed to set up an older version (8.x).

1. Add the contrib layer of meta tegra to bblayers.conf

  • Run below commands at the terminal
cd $YOCTO_DIR/build
bitbake-layers add-layer ../meta-tegra/contrib/

2. Add the support for GCC 8

In $YOCTO_DIR/build/conf/local.conf file add the following line:

#Cuda support for gcc
GCCVERSION = "8.%"

3. Add cuda samples package

This package will install all the needed dependencies in the yocto image. Add the following line in: $YOCTO_DIR/build/conf/local.conf

IMAGE_INSTALL:append = " cuda-samples"
bitbake-layers show-recipes "*cuda*"

2. Add compilation tools

Include the extra compilation tools, such as gcc in the yocto image. Add the following line in: $YOCTO_DIR/build/conf/local.conf

EXTRA_IMAGE_FEATURES += " tools-sdk"

Troubleshoot

If you try to run the CUDA samples/programs with other user than root, you may face the following error:

jetson-tx2:/usr/local/cuda-10.0/samples/0_Simple/simplePrintf$ make
jetson-tx2:/usr/local/cuda-10.0/samples/0_Simple/simplePrintf$ ./simplePrintf
CUDA error at ../../common/inc/helper_cuda.h:708 code=38(cudaErrorNoDevice) "cudaGetDeviceCount(&device_count)"

The problem is caused by the device NVIDIA files that have incorrect permissions (Check that the device files/dev/nvidia* exist and have the correct (0666) file permissions) as stated in this post and on the documentation.


1. Check that files exist

ls /dev/nv*

Which will produce the following output:

/dev/nvhdcp0	      /dev/nvhost-ctrl-isp    /dev/nvhost-dbg-gpu  /dev/nvhost-nvcsi	 /dev/nvhost-sched-gpu	/dev/nvhost-vi
/dev/nvhost-as-gpu    /dev/nvhost-ctrl-nvcsi  /dev/nvhost-gpu	   /dev/nvhost-nvdec	 /dev/nvhost-tsec	/dev/nvhost-vic
/dev/nvhost-ctrl      /dev/nvhost-ctrl-nvdec  /dev/nvhost-isp	   /dev/nvhost-nvjpg	 /dev/nvhost-tsecb	/dev/nvidiactl
/dev/nvhost-ctrl-gpu  /dev/nvhost-ctxsw-gpu   /dev/nvhost-msenc    /dev/nvhost-prof-gpu  /dev/nvhost-tsg-gpu	/dev/nvmap

2. Change the default permissions

With root user, or with sudo priviledges run the following command:

chmod 666 /dev/nv*

3. Execute the sample/program

jetson-tx2:/usr/local/cuda-10.0/samples/0_Simple/simplePrintf$ make
jetson-tx2:/usr/local/cuda-10.0/samples/0_Simple/simplePrintf$ ./simplePrintf
GPU Device 0: "NVIDIA Tegra X2" with compute capability 6.2

Device 0: "NVIDIA Tegra X2" with Compute 6.2 capability
printf() is called. Output:

cuDNN

1. Add cuDNN package.

This package will install all the needed dependencies in the Yocto image.

  • Add the following line in: $YOCTO_DIR/build/conf/local.conf
IMAGE_INSTALL:append = " cudnn"

TensorRT

1. Add TensoRT package

This package will install all the needed dependencies in the Yocto image.

  • Add the following line in: $YOCTO_DIR/build/conf/local.conf
IMAGE_INSTALL:append = " tensorrt"

NVIDIA GStreamer Plugins

1. Add nvvideo4linux2 package

This package will install all the needed dependencies in the Yocto image.

  • Add the following line in: $YOCTO_DIR/build/conf/local.conf
IMAGE_INSTALL:append = " gstreamer1.0-plugins-nvvideo4linux2"

Jetson Multimedia API

1. Add the Tegra Multimedia API package

This package will install all the needed dependencies in the Yocto image.

  • Add the following line in: $YOCTO_DIR/build/conf/local.conf
IMAGE_INSTALL:append = " tegra-mmapi tegra-mmapi-dev"


Previous: Accessing the Board Index Next: DeepStream