Building and Running the NvMedia Samples

The NvMedia samples installed on the Linux host development system are already compiled and ready to run. If you modify a sample, though, you must rebuild it on the host Linux system. This section explains how.
Additionally, before you can run a sample, you must define environment variables and optionally customize a configuration file.

Building the NvMedia Samples

Each sample comes with source code and a makefile. Use these procedures to build the desired sample.
To build a sample application
1. If you are running the sample on a non-standard windowing system, such as an EGLdevice or Wayland, enter:
export NV_WINSYS=<egldevice|wayland>
Each DRIVE AGX platform has a default windowing system. Most samples are set up to compile on multiple different windowing systems, depending on the platform.
2. On the host system, enter the commands:
cd <top>/drive-t186ref-linux/samples/nvmedia/<sample_dir>
make clean
make
Where <sample_dir> is the sample directory; for example img_play.
3. To copy all the samples to the host drive-t186ref-linux/targetfs samples directory, rerun the copytarget script, passing in the path to the target file system to ensure that the new executable is copied to the target.
<top>/drive-t186ref-linux/utils/scripts/copytarget-samples <targetfs_dir>
 
Caution:
If you run copytarget without specifying a <targetfs_dir>, the script corrupts the host system files.
4. Reflash to the DRIVE AGX platform to make the new samples available there.

Running the NvMedia Samples

Prerequisites
The shared libraries, executables, and configuration files or scripts required to configure the cameras. For details, refer to the specific sample application.
The video files in case of decode/encode samples.
To run a sample application
If the /home/username/drive-t186ref-linux/samples/nvmedia directory does not exist on the DRIVE AGX Platform, and you wish to copy all samples, us the copytarget-samples command and reflash the board as described previously in Building the NvMedia Samples.
If the /home/username/drive-t186ref-linux/samples/nvmedia directory does not exist on the DRIVE AGX platform, copy a single rebuilt sample:
1. Copy the sample to the target system. For example, from the target execute:
cd /home/<username>/
mkdir drive-t186ref-linux/samples/nvmedia
rcp -r <host_user>@<host_ip>:/<complete_host_install_path>/drive-t186ref-linux/samples/nvmedia/<sample_dir> /home/<username>/drive-t186ref-linux/samples/nvmedia
If the /home/username/drive-t186ref-linux/samples/nvmedia directory already exists, update a single rebuilt sample using the previous procedure without the mkdir command.
2. Navigate to the sample application directory.
3. Copy the default configuration file and modify your copy for your needs.
4. Run the sample application.