NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux SDK

Developer Guide
5.1.12.0 Release


 
NVIDIA Build-Kit
 
Installing NVIDIA Build-Kit
Edit NVIDIA Build-Kit CONFIG
Execute NVIDIA Build-Kit With the Updated CONFIG
Flash the Customized Target Filesystem
NVIDIA Build-Kit Architecture
Command Line Arguments
Environment Configuration
CONFIG Semantics
Sample CONFIG
Example Use Cases
NVIDIA Build-Kit is a tool for creating and customizing Linux filesystems. It is a common filesystem interface tool for automotive programs. NVIDIA Build-Kit:
Supports target filesystem image and tarball (uncompressed archive).
Supports upstream mirrors.
Supports target filesystem users, groups and memberships.
Supports pre/post install scripts.
Generates the manifest file.
Prerequisites
Refer to requirements specified in the SDK Manager System Requirements.
Installing NVIDIA Build-Kit
NVIDIA Build-Kit is supplied as a Debian package file (.deb) that can be installed on host.
1. Download nvidia-driveos-<release>-build-kit.deb.
2. Install the Debian package nvidia-driveos-<release>-build-kit.deb using the apt package manager.
# Change directory to where you have downloaded the nvidia-driveos build-kit and copytarget debian packages.
nvidia@test-pc:~$ cd ~/nvidia/driveos/
# This is a prerequisite required for copytarget tool usage by NVIDIA Build-Kit.
nvidia@test-pc:~/nvidia/driveos$ apt-get install ./nvidia-driveos-<RELEASE>-copytarget.deb
nvidia@test-pc:~/nvidia/driveos$ apt-get install ./nvidia-driveos-<RELEASE>-build-kit.deb
# The following hierarchy will be obtained once it is installed.
# Please check if NVIDIA Build-Kit is working by running
nvidia@test-pc:~/nvidia/driveos/$ /opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/bin/build_kit.py --version
Build-Kit Version: 3
Edit NVIDIA Build-Kit CONFIG
1. Edit the CONFIG.json of the target filesystem to customize.
# Change directory to NVIDIA Build-Kit configs
nvidia@test-pc:~$ cd /opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/configs/
# Edit CONFIG file of the target filesystem to be customized. E.g.: customizing driveos-core-rfs
nvidia@test-pc:/opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/configs$ vim driveos-core-rfs-user.CONFIG.json
2. For the semantics of the CONFIG.json file, see CONFIG Semantics.
Execute NVIDIA Build-Kit With the Updated CONFIG
Generate a customized target filesystem image file by executing NVIDIA Build-Kit with the updated CONFIG.
nvidia@test-pc:~$ mkdir output_folder/
nvidia@test-pc:~$ export PDK_INSTALL_DIR=${PDK_TOP} # Directory where NVIDIA DRIVEOS LINUX SDK is installed.
nvidia@test-pc:~$ /opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/bin/build_kit.py -i /opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/configs/driveos-core-rfs-user.CONFIG.json -o output_folder/
Flash the Customized Target Filesystem
1. Update symlink of drive-t186ref-linux/targetfs.img to point to your customized target filesystem image.
2. Enable image flashing. See use_rootfs_img instructions.
3. Flash the target. See bootburn.sh instructions.
nvidia@test-pc:~$ mv output_folder/driveos-core-rfs-user.img ${PDK_INSTALL_DIR}/drive-t186ref-linux/targetfs-images/
nvidia@test-pc:~$ rm -f ${PDK_INSTALL_DIR}/drive-t186ref-linux/targetfs.img
nvidia@test-pc:~$ ln -sf targetfs-images/driveos-core-rfs-user.img ${PDK_INSTALL_DIR}/drive-t186ref-linux/targetfs.img
NVIDIA Build-Kit Architecture
NVIDIA Build-Kit tool is a Python program that takes in a json CONFIG file as input and outputs a filesystem image.
NVIDIA Build-Kit is configured via its configuration file in:
/opt/nvidia/driveos/<RELEASE>/filesystems/build-kit/build-kit.config
It reads the input CONFIG.json to understand the OS selected and initializes an OS specific build-kit class object to handle the image creation process.
The image creation process is broken into four stages:
pre-build
build
post-build
process-output
These stages are present for all supported operating systems, but the commands vary depending on the OS.
OS
pre-build
build
post-build
process-output
Linux
Set up binfmt for executing different arch binaries.
Extract base filesystem.
Update mirrors in the filesystem with values
provided in the CONFIG.json.
Update resolv.conf of target filesystem with host's
resolv.conf.
Run preinstall scripts.
Generate manifest of packages to be installed
Convert CONFIG.json into MANIFEST.json
for version locking.
Install packages using package manager (apt).
Create users/groups and update user memberships.
Execute copytarget scripts provided in the
Restore mirrors to original in the target filesystem.
Restore resolv.conf to original in target filesystem.
Run postinstall scripts.
Create EXT image file of the target filesystem.
Command Line Arguments
These options are available when you execute build_kit.py.
Short Option
Long Option
Defaults
Required
Description
-h
--help
N/A
No
Show help message and exit.
-v
--version
N/A
No
Print version and exit.
-i JSON_PATH
--input=JSON_PATH
No defaults
Yes
Input NVIDIA Build-Kit CONFIG file.
-o OUTPUT_FOLDER
--output=OUTPUT_FOLDER
${PWD}
No
Output folder.
-m
--manifest-only
False
No
Generates manifest only. Do not install.
 
--create-tar
False
No
Creates output tarball along with image file creation.
 
--skip-image
False
No
Skip image file creation.
 
Note:
Defaults are used if options aren't used in the NVIDIA Build-Kit command line.
Environment Configuration
The /opt/nvidia/driveos/<release>/filesystems/build-kit/build-kit.config file controls the execution environment of NVIDIA Build-Kit.
It is a json file with fields:
common
Variables defined in this field are always present in the tool's execution environment.
linux
Variables defined in this field are defined if NVIDIA Build-Kit CONFIG has OS set to linux. For more information, see CONFIG semantics.
These sections define the environment variables required for proper functioning of the NVIDIA Build-Kit tool. The following variables must not be defined in the environment configuration file. These variables are unset in the program's environment if defined in the shell environment where Build-Kit is executed.
Forbidden Variables
Section
Value
Default
Use case
REQUIRED_VARIABLES
all
Comma separated variable names
-
Checks if the variables names in value are defined, exits the tool if it isn't.
QEMU_PATH
common, linux
Path to qemu-aarch64-static binary
/usr/bin/
This variable controls the path to qemu-aarch64-static binary used for chrooting into the Linux filesystem.
BUILD_KIT_DIR
all
Path to NVIDIA Build-Kit directory
/opt/nvidia/driveos/<RELEASE>/filesystems/build-kit
Helper scripts for installing packages inside chroot environment are copied from ${BUILD_KIT_DIR}/helpers
Mirror setup scripts for setting up Nvidia repositories and downloading Nvidia Packages are copied
from ${BUILD_KIT_DIR}/mirror-setup
COPYTARGET
all
Path to Copytarget binary
/opt/nvidia/driveos/<RELEASE>/filesystems/copytarget/copytarget.py
This variable specifies the copytarget binary to be executed for processing copytarget yaml files.
PYTHON3
all
Path to python3 binary
/usr/bin/python3
This variable specifies the python binary that should be used for invoking the copytarget.py tool.
CONFIG Semantics
Entries in the NVIDIA Build-Kit CONFIG file required as input to build_kit.py.
Field
Acceptable Values
Required
Instructions
OS
"linux"
Yes
Specify "linux" for generating Linux target filesystem image.
Output
valid Unix filename
Yes
Specify the output file name.
Recommended characters =
a-zA-Z0-9_-.
The outputs generated will be filename.img and filename.tar.bz2 (if create-tar option is provided).
Base
valid Unix filename with extension .img, .img.tar.<compression>, .tar, .tar.<compression>
Yes
Specify the input file name
Input can be image, compressed image, or tarball (uncompressed archive), or compressed tarball
Mirrors
comma separated values of mirrors as written in /etc/apt/sources.list file.

Value: Array of mirrors
 
Can be left empty
Specify the mirrors where the packages specified in DebianPackages will be obtained.
Ensure these values adhere to the package manager's syntax of mirrors.
E.g.
"Mirrors": [
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic main universe restricted",
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main universe restricted",
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main universe restricted"
],
Users
dict of username to tuple of (UID, password)

Key: username
Value: Array of 2 items - UID and passwd
Can be left empty
Specify the users to be added to the target filesystem being created.
Ensure username is a valid username as per ubuntu standards.
UID recommended to be above 1000 .
Ensure the UID is available in the Base, as conflicting UIDs will error the tool.
E.g.
"Users": {
"nvidia": [
"1000",
"nvidia"
],
"test": [
"1001",
"testpassword"
]
},
Groups
dict of groupname to GID
Key: groupname
Value: GID
 
Can be left empty
Ensure groupname is a valid groupname as per ubuntu standards.
GID recommended to be above 1000.
Ensure the GID is available in the Base. as conflicting GIDs will error the tool.

E.g.
"Groups": {
"weston-launch": "1010"
}
Memberships
dict of username to array of groups
Key:
username
Value: Array of groups
Each item: group
Can be left empty
Ensure the username is available from the Base tarball / Created via NVIDIA Build-Kit, as absent username will error the tool.
Ensure the groups are available from the Base tarball / Created via NVIDIA Build-Kit, as absent groups will error the tool.
E.g.
"Memberships": {
"nvidia": [
"adm",
"audio",
"cdrom",
"dialout",
"dip",
"floppy",
"plugdev",
"sudo",
"video",
"weston-launch"
]
}
Preinstall
dict of file to value "" or "target"
Key:
Paths to files, can use env variables in this.
Value: 
"" or
"target"
Can be left empty
Provide bash scripts that need to be executed before debian packages are installed.
E.g. conditional setting up of mirrors, updating DNS servers, Executing something on the host.
"" empty value implies running on the host.
"target" value implies running on FS chroot.

FILESYSTEM_WORK_DIR variable is available for the bash script for getting Target Filesystem directory in the host.
WORK_DIR variable is available for the bash script for getting the Build-Kit Work Directory
E.g.
"PreInstalls": {
"${BUILD_KIT_DIR}/mirror-setup/setup-cuda-cudnn-tensorrt-mirror.sh": ""
},
The above one is used to setup cuda, cudnn, trt mirrors for downloading their debian packages.
It is executed on the host as the second field is empty.
CopyTargets
Array of Copytargets to be executed
Each item:
Paths to copytarget files, can use env variables in this.
Can be left empty
Provide the list of copytarget yaml files/scripts to be executed to copy files into the target filesystem.
Note: If writing script $1 is target directory,
Note: If writing yaml, in the export section $targetdir gives the target directory.
PostInstalls
dict of file to value "" or "target"
Key:
Paths to files, can use env variables in this.

Value:
"" or
"target"
 
Can be left empty
Provide bash scripts that need to be executed after debian packages are installed and CopyTargets are executed. Example: running run-once scripts, running post install checks
"" empty value implies running on the host
"target" value implies running on FS chroot
E.g.,
"PostInstalls": {
"/root/run-once/X01-nv-run-once-add-user": "target",
"/etc/systemd/scripts/nv_run_once_run_ldconfig": "target"
},
The above section runs the run-once scripts on the target as they aren't dependent on running on a target board.
FilesystemCleanup
Array of files to remove
 
Each item: 
Paths of files to be removed
Can be left empty
Itemized list of intermediate files generated which are to be removed once the postinstall scripts are done executing.
E.g.
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*",
"/var/cache/apt/srcpkgcache.bin",
"/var/cache/apt/pkgcache.bin",
"/etc/apt/sources.list.d/cuda.list",
"/etc/apt/sources.list.d/cudnn.list",
"/etc/apt/sources.list.d/tensorrt.list",
"/etc/apt/sources.list.d/local-apt-repos.list"
],
DebianPackages
Array of debian packages (same name as the ones used in apt-get install)

Each item:
Valid debian package names.
Can be left empty
List out the debian packages to be installed into the target filesystem
E.g.
"DebianPackages": [
"cuda-libraries-10-2",
"cuda-gdb-10-2",
"cuda-memcheck-10-2",
"libcudnn7",
"libnvinfer5"
]
ImageSize
Unsigned Number of bytes.
No
The size of the partition to which the current image will be expanded to (defaults to 8GB).
E.g.
"ImageSize":"4294967296"
Sample CONFIG
The CONFIG.json below customizes the existing driveos-core-rfs.img.
Note:
Before using, remove all comments from the file, as json does not support comments. Comments appear after # until end of line.
{
"OS": "linux", # Creating Linux image
"Output": "sample-image2", # Output name of the .img / .tar.bz2 file
"Distro": "bionic", # Distro name
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [], # Don't use any public mirrors
"Users": { # Create users
"drive": [
"1001",
"drive"
]
},
"Groups": { # Create groups
"restricted": "1011"
},
"Memberships": { # Create Memberships to user drive
"drive": [
"adm",
"audio",
"cdrom",
"dialout",
"dip",
"floppy",
"plugdev",
"restricted",
"sudo",
"video"
]
},
"PreInstalls": { # Setting Up mirror based on dynamic values in preinstall (This is required if Mirrors aren't standard paths but are dependent on variable values)
"${BUILD_KIT_DIR}/mirror-setup/setup-cuda-cudnn-tensorrt-mirror.sh": ""
},
"CopyTargets": [ # Calling copytarget scripts to copy files to target
"${COPYTARGET_DIR}/copytarget-setup-rootfs",
"${COPYTARGET_DIR}/copytarget-configs",
"${COPYTARGET_DIR}/copytarget-firmware",
"${COPYTARGET_DIR}/copytarget-headers",
"${COPYTARGET_DIR}/copytarget-kernel-modules",
"${COPYTARGET_DIR}/copytarget-libraries",
"${COPYTARGET_DIR}/copytarget-others",
"${COPYTARGET_DIR}/copytarget-tools",
"${COPYTARGET_DIR}/copytarget-dpx",
"${COPYTARGET_DIR}/copytarget-aurix"
],
"PostInstalls": { # Post install scripts running on the target as denoted by the second field
"/root/run-once/X01-nv-run-once-user": "target", # Run some setup files copied by copytarget offline only
"/etc/systemd/scripts/nv_run_once_run_ldconfig": "target" # Run some setup files copied by copytarget offline only
},
"FilesystemCleanup": [ # Remove these files at the end before cleanup
"/tmp/*",
"/var/tmp/*",
"/var/cache/apt/srcpkgcache.bin",
"/var/cache/apt/pkgcache.bin",
"/etc/apt/sources.list.d/cuda.list", # Generated by the mirror setup preinstall script
"/etc/apt/sources.list.d/cudnn.list", # Generated by the mirror setup preinstall script
"/etc/apt/sources.list.d/tensorrt.list", # Generated by the mirror setup preinstall script
"/etc/apt/sources.list.d/local-apt-repos.list"
],
"DebianPackages": [ # Install these packages
"cuda-libraries-10-2",
"cuda-gdb-10-2",
"cuda-memcheck-10-2",
"libcudnn7=7.6.2.21-1+cuda10.2",
"libnvinfer6"
]
}
Example Use Cases
The following examples illustrate how to modify CONFIG.json for your use case.
Adding users/groups to the filesystem
This example demonstrates how to add users/groups to the filesystem. In addition, it shows:
Addition of users drive and otaupload to the filesystem with UID 1001 and 1002, respectively.
Addition of group restricted with GID 1011.
Addition of the user drive to different groups in the target filesystem.
Note:
Before using, remove all comments from the file, as json does not support comments. Comments appear after # until end of line.
{
"OS": "linux",
"Output": "sample-image", # Output name of the .img / .tar.bz2 file
"Distro": "bionic",
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [],
"Users": { # Create users
"drive": [ # username
"1001", # UID
"drive" # password
],
"otaupload": [ # username
"1002", # UID
"otapasswd" # password
]
},
"Groups": { # Create groups
"restricted": "1011" # groupname:GID
},
"Memberships": { # Create Memberships to user test
"drive": [ # username
"adm", # group names
"audio",
"cdrom",
"dialout",
"dip",
"floppy",
"plugdev",
"sudo",
"video"
]
},
"PreInstalls": {},
"CopyTargets": [],
"PostInstalls": {},
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*"
],
"DebianPackages": []
}
To install packages from ubuntu/external fixed mirrors
The following example shows how to install packages from Ubuntu mirrors to enable gdbserver in the target.
{
"OS": "linux",
"Output": "sample-image2", # Output name of the .img / .tar.bz2 file
"Distro": "bionic",
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [ # Using ubuntu mirrors
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic main universe restricted",
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main universe restricted",
"deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main universe restricted"
],
"Users": {},
"Groups": {},
"Memberships": {},
"PreInstalls": {},
"CopyTargets": [],
"PostInstalls": {},
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*",
"/var/cache/apt/srcpkgcache.bin", # For cleaning up apt after installation of packages
"/var/cache/apt/pkgcache.bin" # For cleaning up apt after installation of packages
],
"DebianPackages": [
"nano",
"gdbserver"
]
}
To copy files to the target filesystem
If instead of a Debian package, there are files to be copied into locations inside the target filesystem from the host, utilize copytarget to copy the files into the target filesystem.
A copytarget manifest file must be created, which specifies the details of the files to be copied.
A path to the manifest file must be specified in the CONFIG.json.
Environment variables are supported, and environment variables can be defined in build-kit.config. For more information, see NVIDIA Build-Kit Environment Configuration.
{
"OS": "linux",
"Output": "sample-image2", # Output name of the .img / .tar.bz2 file
"Distro": "bionic",
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [],
"Users": {},
"Groups": {},
"Memberships": {},
"PreInstalls": {},
"CopyTargets": [
# COPYTARGETYAML_DIR is defined in build-kit.config see NVIDIA Build-Kit Environment Configuration section (above).
"${COPYTARGETYAML_DIR}/wallpaper-service.yaml",
"${COPYTARGETYAML_DIR}/setup-wizard.yaml"
],
"PostInstalls": {},
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*"
],
"DebianPackages": []
}
The wallpaper-service.yaml file used above:
version: '1.4'
# Exports environment variables
exports:
# targetdir is provided as first argument to CopyTarget tool.
- SYSTEMD_ETC: ${targetdir}/etc/systemd/system/ # Exporting variables to avoid long entries in fileList.
- SYSTEMD_LIB: ${targetdir}/lib/systemd/system/
- SOURCE_DIR: ${SDKPLATDIR}/modules/scripts/ # SDKPLATDIR is defined in build-kit.config see NVIDIA Build-Kit Environment Configuration section (above).
# Itemized file list
fileList:
# The following item creates a directory "${SYSTEMD_ETC}/tegra.target.wants/"
# with metadata (permission, owner, group) set as specified here.
# UID and GID will automatically be determined by mapping the
# values of "owner" and "group" below to what is present in
# ${targetdir}/etc/passwd
- destination: ${SYSTEMD_ETC}/tegra.target.wants/
perm: 755
owner: root
group: root
# The following item copies a file from source to
# destination.
- destination: ${SYSTEMD_LIB}/nv_wallpaper_set.service
source: ${SOURCE_DIR}/nv_wallpaper_set.service
perm: 644
owner: root
group: root
# This creates a symlink "$targetdir/etc/systemd/system/tegra.target.wants/nv_wallpaper_set.service" ->
# "/lib/systemd/system/nv_wallpaper_set.service"
- destination: ${SYSTEMD_ETC}/tegra.target.wants/nv_wallpaper_set.service
source: /lib/systemd/system/nv_wallpaper_set.service
owner: root
group: root
create_symlink: true
# This removes a file from target FS.
# Remove masking symlink/file of nv_wallpaper_set.service
- destination: ${targetdir}/etc/systemd/system/nv_wallpaper_set.service
remove: true
To run PostInstall scripts
If some script must be executed on the target/host after Debian package installation, use copytarget.
Then PostInstall sections can be used.
The example below runs ldconfig on the target after copying libraries via copytarget to have updated library cache on first boot.
Utilize copytarget to copy the bash script, which runs the required commands.
Environment variables are supported, and environment variables can be defined in build-kit.config. For more information, see NVIDIA Build-Kit Environment Configuration.
{
"OS": "linux",
"Output": "sample-image2", # Output name of the .img / .tar.bz2 file
"Distro": "bionic",
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [],
"Users": {},
"Groups": {},
"Memberships": {},
"PreInstalls": {},
"CopyTargets": [],
"PostInstalls": {
"/etc/systemd/scripts/nv_run_once_run_ldconfig": "target"
},
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*"
],
"DebianPackages": []
}
The PostInstall script used above:
#!/bin/sh
# Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
mkdir -p /etc/nvidia
echo "/usr/lib" > /etc/nvidia/00_nvidia_lib.conf
 
update-alternatives --force --install /etc/ld.so.conf.d/00_nvidia.conf nvidia_lib_conf /etc/nvidia/00_nvidia_lib.conf 1000
 
ldconfig
 
if [ -L "$0" ];then
rm -f $0
fi
To use internal/external mirrors, depending on execution use case environment
If the packages you want to install come from mirrors whose locations aren’t determinable at the time of CONFIG file creation, you can use a script in PreInstalls to make the filesystem package manager aware of the mirror at filesystem creation time.
This is useful in scenarios where you want to download the packages from a staging mirror for internal automation, but use the production mirror for production use case.
{
"OS": "linux",
"Output": "sample-image3", # Output name of the .img / .tar.bz2 file
"Distro": "bionic",
"Base": "${BASE_DIR}/targetfs-images/driveos-core-rfs.img", # Customizing existing target filesystem image
"Mirrors": [], # If none of the packages in DebianPackages require public mirrors, leave this empty
"Users": {},
"Groups": {},
"Memberships": {},
"PreInstalls": { # Setting Up mirror based on dynamic values in preinstall. (This is required if Mirrors aren't standard paths but are dependent on variable values)
# BUILD_KIT_DIR is defined inside the tool , see Forbidden Variables in NVIDIA Build-Kit Environment Configuration section. (above)
# "" signifies this is executed from the host
"${BUILD_KIT_DIR}/mirror-setup/setup-cuda-cudnn-tensorrt-mirror.sh": ""
},
"CopyTargets": [],
"PostInstalls": {},
"FilesystemCleanup": [
"/tmp/*",
"/var/tmp/*",
"/var/cache/apt/srcpkgcache.bin",
"/var/cache/apt/pkgcache.bin",
"/etc/apt/sources.list.d/cuda.list", # Generated by the mirror setup preinstall script
"/etc/apt/sources.list.d/cudnn.list", # Generated by the mirror setup preinstall script
"/etc/apt/sources.list.d/tensorrt.list" # Generated by the mirror setup preinstall script
],
"DebianPackages": [ # Install these packages
"cuda-libraries-10-2",
"cuda-gdb-10-2",
"cuda-memcheck-10-2",
"libcudnn7=7.6.2.21-1+cuda10.2", # Install this version of the package, provided it is available in the mirror and doesn't lead to package conflicts.
"libnvinfer6"
]
}
The script for setting up the mirror:
#!/bin/bash
#
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
 
BUILD_KIT_DEBUG=
if (( BUILD_KIT_DEBUG )); then
BUILD_KIT_DEBUG=-xu
set ${BUILD_KIT_DEBUG}
fi
set -eu
# BUILD_KIT_DIR is exported from the build_kit.py
# mirror_config.conf provides CUDA_PATH,TENSORRT_PATH,CUDNN_PATH used below.
# Also specifies if the mirror is Trusted or not.
# Also specifies the path from which key can be downloaded to sign the mirror.
source ${BUILD_KIT_DIR}/mirror-setup/mirror_config.conf
# FILESYSTEM_WORK_DIR points to the temporary targetfs root directory used to build the image.
targetdir=${FILESYSTEM_WORK_DIR}
 
#Setup chroot
sudo cp ${QEMU_PATH}/qemu-aarch64-static ${targetdir}/usr/bin
sudo chmod +x ${targetdir}/usr/bin/qemu-aarch64-static
 
if [ "${TRUSTED_MIRROR,,}" == "no" ];then
wget -O ${targetdir}/tmp/ ${NVIDIA_KEY_URL}/${NVIDIA_KEY}
sudo chroot ${targetdir} apt-key add /tmp/${NVIDIA_KEY}
fi
 
# Add mirrors
echo "deb [trusted=${TRUSTED_MIRROR}] ${CUDA_PATH}/ /" | sudo tee $targetdir/etc/apt/sources.list.d/cuda.list
echo "deb [trusted=${TRUSTED_MIRROR}] ${TENSORRT_PATH}/ /" | sudo tee $targetdir/etc/apt/sources.list.d/tensorrt.list
echo "deb [trusted=${TRUSTED_MIRROR}] ${CUDNN_PATH}/ /" | sudo tee $targetdir/etc/apt/sources.list.d/cudnn.list
sudo chroot ${targetdir} apt-get update
 
#Cleanup chroot
sudo rm -f ${targetdir}/usr/bin/qemu-aarch64-static