NVIDIA Tegra
NVIDIA Jetson Linux Developer Guide
32.4.3 Release

 

BSP Customization

 
Boot Options
Linux Host System Prerequisites
Setting Up a TFTP Server on the Host System
Extracting Jetson Linux Driver Package
Installing Additional Packages
Rebuilding the Kernel Debian Package
Building Debian Packages Yourself
Working with the Packages
Configuring NFS Root on the Linux Host
Determining Version and Platform Information
Improving System Performance
You can customize NVIDIA® Jetson™ Linux Driver Package (L4T) by:
Manually configuring and setting up the software drivers before use.
Using NVIDIA® SDK Manager to perform a customized setup.
 
Note:
NVIDIA SDK Manager performs the following:
• Installs NVIDIA® Jetson™ Linux Driver Package
• Configures or flashes your Jetson device
• Runs samples
If you installed using SDK Manager, skip these topics. For more information, see the section “Installing JetPack” in the Jetson Developer Kit User Guide for your platform.

Boot Options

 
Choosing a Boot Device for Jetson AGX Xavier Series Platforms
Node Properties
Examples
Rebuilding the DTB
Choosing a Boot Device for Other Platforms
On a NVIDIA® Jetson reference board, Linux boots from a root file system (rootfs) on integrated memory (eMMC or QSPI), attached memory (SD card or USB device), or network-accessible storage.
The bootloader must be loaded from the internal eMMC.
The kernel and DTB can be loaded from:
An SD card (formatted to GPT)
A USB drive (formatted to GPT)
A network (via DHCP/TFTP)

Choosing a Boot Device for Jetson AGX Xavier Series Platforms

Applies to: Jetson AGX Xavier series
CBoot Boot Options (CBO) is a device tree that can be used to set certain boot configuration options, such as boot device priority and IP addresses used to boot from a network.
The name of the CBO device tree node is boot-configuration.

Node Properties

boot-order
The boot-order property contains a list of boot devices in order of priority. Each device is specified by its name and controller information. Possible entries are:
sd: Represents an SD card on any controller.
usb: Represents an external USB mass storage device on any controller and port.
net: Represents network boot.
emmc: Represents built-in MMC storage.
For example:
boot-order = "sd", "usb", "net", "emmc";
tftp-server-ip
The tftp-server-ip property specifies the IP address of the TFTP server.
The property is specified as:
tftp-server-ip = /bits/ 8 <a b c d>
Where <a b c d> are the four parts of a V4 IP address.
dhcp-enabled
The dhcp-enabled property has no value. If it is present, the device obtains its IP configuration from a DHCP server. If it is absent, the device obtains its IP configuration from the static-ip, ip-netmask, and ip-gateway properties.
static-ip, ip-netmask, and ip-gateway
The static-ip property specifies the static IP address in the IP configuration.
The ip-netmask property specifies the IP address’s subnet mask in the IP configuration.
The ip-gateway property specifies the gateway’s IP address in the IP configuration.
All three properties are required if dhcp-enabled is false or unspecified; otherwise they are not needed and are ignored if present.
The properties are specified as:
static-ip = /bits/ 8 <a b c d>
ip-netmask = /bits/ 8 <a b c d>
ip-gateway = /bits/ 8 <a b c d>
Where <a b c d> are the four parts of a V4 IP address or subnet mask.

Examples

This topic presents examples of complete boot-configuration definitions.
Example: DHCP Enabled
/dts-v1/;
 
 
/ {
compatible = "nvidia,cboot-options-v1";
boot-configuration {
boot-order = "sd", "usb", "emmc", "net";
tftp-server-ip = /bits/ 8 <10 1 2 3>;
dhcp-enabled;
};
};
Example: Static IP Configuration Specified
/dts-v1/;
 
/ {
compatible = "nvidia,cboot-options-v1";
boot-configuration {
boot-order = "sd", "usb", "net", "emmc";
tftp-server-ip = /bits/ 8 <10 1 2 3>;
static-ip = /bits/ 8 <10 1 2 2>;
ip-netmask = /bits/ 8 <255 255 255 0>;
ip-gateway = /bits/ 8 <10 1 2 1>;
};
};

Rebuilding the DTB

If you modify the DTS, you must rebuild the DTB.
To modify the DTS and rebuild the DTB
1. Locate the cbo.dts file in this directory:
$ cd <bsp>/Linux_for_Tegra/bootloader/
Where <bsp> is the location of Jetson Board Support Package BSP.
2. Modify the file as necessary. For more information, see Node Properties and Examples above.
3. Enter this command to convert the DTS to a DTB:
dtc -I dts -O dtb -o cbo.dtb cbo.dts
The dtc executable is available in:
<bsp>/Linux_for_tegra/kernel/dtc
4. Flash the partition CPUBL-CFG. See Flashing and Booting the Target Device for instructions.

Choosing a Boot Device for Other Platforms

Applies to: Jetson Nano, Jetson TX2 series, and Jetson TX1
On platforms other than NVIDIA® Jetson AGX Xavier™ series, CBoot uses U‑Boot to perform the booting process. Boot device priority is determined by U‑Boot.
For more information, see the section Boot Sequence and Sysboot Configuration Files in the topic U‑Boot Customization.

Linux Host System Prerequisites

To use L4T on a Linux host system, the following hardware and software prerequisites must be met:
Host PC running Linux
A kernel image
L4T contains a kernel image for your use. Alternatively, you can download and rebuild the kernel image from source.
Bootloader
Flashing on a NVIDIA® Jetson developer board requires a bootloader, which is NVIDIA T-Boot (nvtboot).
Network file system
If you intend to boot Linux on the reference board from your Linux host system or a network-accessible server.
A USB cable to plug into the recovery port.

Setting Up a TFTP Server on the Host System

The host system must provide a TFTP server for use by the target.
To set up a TFTP server
1. Install the tftp package and its dependencies by entering this command:
$ sudo apt-get install xinetd tftpd tftp
2. Create the text file /etc/xinetd.d/tftp, for example by entering the command:
$ sudo vim /etc/xinetd.d/tftp
3. Put this content in the file, then save it:
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = ~/tftpboot
disable = no
}
4. Create the directory ~/tftpboot (specify the pathname defined by server_args) and copy the kernel image to it:
$ mkdir ~/tftpboot
$ cp /Linux_for_Tegra/bootloader/boot_sigheader.img.encrypt ~/tftpboot/boot.img
5. Copy the .dtb file to the same directory.
For NVIDIA Jetson Xavier™ NX:
$ cp /Linux_for_Tegra/bootloader/tegra194-p3668-p3509-0000_sigheader.dtb.encrypt ~/tftpboot/jetson.dtb
For Jetson AGX Xavier series:
$ cp /Linux_for_Tegra/bootloader/tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt ~/tftpboot/jetson.dtb
6. Restart the xinetd server:
$ sudo service xinetd restart

Extracting Jetson Linux Driver Package

 
Login Credentials
Use these procedures to extract the Jetson Linux Driver Package (L4T). Commands in the examples assume you extracted the release package in ~/.
To extract Jetson Linux Driver Package
Extract the package manually by executing the command:
$ sudo tar -vxjf Jetson_Linux_R<release_num>_aarch64.tbz2
Where <release_num> is the release number of the current release.

Login Credentials

L4T does not provide default log-in credentials. Create your own log-in credentials the first time you boot.

Installing Additional Packages

NVIDIA provides additional L4T software components and updates in APT (Debian) repositories, accessible through the apt utility.
NVIDIA maintains the following APT repositories:
For NVIDIA® Jetson™ Nano and Jetson TX1: https://repo.download.nvidia.com/jetson/t210
For Jetson TX2 series: https://repo.download.nvidia.com/jetson/t186
For Jetson AGX Xavier series: https://repo.download.nvidia.com/jetson/t194
Packages used on all Jetson platforms: https://repo.download.nvidia.com/jetson/common
The package nvidia-l4t-apt-source is pre-installed in the L4T root filesystem. It identifies the platform it is running on and adds the appropriate repositories to the software source list.
The packages in the APT repositories are signed with GPG keys. The corresponding public key is pre-installed in the L4T root filesystem. Once the repositories are added to the source list, apt can download and install packages.
 
Note:
The APT repositories described here are also used to upgrade existing packages and install packages that NVIDIA adds to the set initially installed with L4T. For more information, see L4T Over-the-Air (OTA) Updates in the topic Quick Start Guide.

Rebuilding the Kernel Debian Package

This section discusses the process of rebuilding the kernel from the L4T kernel Debian packages. That is the usual way of rebuilding the kernel when it is being customized.
Prerequisites
You are using L4T release 32.4.2 or newer.
Debian Packages required
Download and extract the L4T driver package (BSP) on your host PC. (See Preparing a Jetson Developer Kit for Use in the Quick Start Guide.)
To customize kernel and device tree, you may need to update the Debian packages shown in the following table.
Package
Location in Linux_for_Tegra directory
Description
nvidia-l4t-kernel
kernel/
L4T kernel
nvidia-l4t-kernel-dtbs
kernel/
Device tree blobs (DTBs)
nvidia-l4t-kernel-headers
kernel/
Kernel header files
nvidia-l4t-jetson-io
nv_tegra/l4t_deb_package/
Jetson I/O package
To rebuild nvidia-l4t-kernel
Note:
You can rebuild the other kernel Debian packages in a similar manner.
1. Extract the original Debian package:
$ dpkg -x nvidia-l4t-kernel*.deb origin
$ dpkg -e nvidia-l4t-kernel*.deb origin/debian
Extracting the package places these files in origin/debian/:
control
md5sum
postinst
postrm
triggers
2. Create a directory in which to build your customized Debian package, and in it, a subdirectory named debian for preparing metadata.
For example, this command creates a directory named repack/ in the current directory, and the debian/ subdirectory in it:
$ mkdir -p repack/debian/
Note:
The following steps use the directory name repack/. If you give the directory a different name, change the instructions accordingly.
3. Prepare the required Debian package metadata in debian. When you are done, debian contains these files and directories:
repack/
    debian/
changelog
    compat
     control
    copyright
     install
    postinst
     rules
    source/
         format
     triggers
1. Open rules in a text editor and add these lines; save the file.
#!/usr/bin/make -f
 
.PHONY: binary
 
clean:
dh clean
 
binary:
dh binary
 
build:
 
override_dh_strip:
override_dh_shlibdeps:
2. Open control in a text editor and add these lines; save the file.
Source: nvidia-l4t-kernel
Section: kernel
Priority: standard
Maintainer: NVIDIA Corporation
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Homepage: http://developer.nvidia.com/jetson
 
Package: nvidia-l4t-kernel
Architecture: arm64
Pre-Depends: nvidia-l4t-core (>> 32.4-0), nvidia-l4t-core (<< 32.5-0)
Depends:
Recommends:
Description: NVIDIA Kernel Package
3. Copy these files from the original nvidia-l4t-kernel package to debian:
postinst
triggers
copyright
4. Extract changelog from its archive:
$ gunzip -c origin/usr/share/doc/nvidia-l4t-kernel/changelog.Debian.gz > repack/debian/changelog
Open the change log in a text editor. Find the version number and change it, if necessary, to reflect your changes to the package. Then save the file.
5. Open install in a text editor. Add the following line, which specifies the location where files are to be installed, then save the file:
debian/out/* /
6. Open compat and replace its contents with the single digit ‘9’; save the file.
7. Open source/format in a text editor and add the following line; save the file.
3.0 (native)
4. To install the files needed to build the kernel Debian package in debian/out/, enter the command:
$ mkdir -p repack/debian/out/
5. Add your customizations by creating directories and installing files as necessary. Follow the directory structure in the original Debian package.
The following steps assume that you create and install the following directories and files:
boot/Image
lib/modules/<release>/kernel/
lib/modules/<release>/modules.*
Where <release> is the release number of the current release of L4T.
6. Copy the kernel license file from the original Debian package:
$ mkdir -p repack/debian/out/usr/share/doc/nvidia-l4t-kernel/
$ gunzip -c origin/usr/share/doc/nvidia-l4t-kernel/LICENSE.kernel.gz > repack/debian/out/usr/share/doc/nvidia-l4t-kernel/LICENSE.kernel
7. Enter these commands to build the package:
cd repack
CC=aarch64-linux-gnu-gcc dpkg-buildpackage -uc -b -d -a arm64
(Setting CC to aarch64-linux-gnu-gcc specifies building arm64 packages.)

Building Debian Packages Yourself

Note:
This procedure is an alternative to the procedure To rebuild nvidia-l4t-kernel, above.
You can customize the L4T kernel by getting the kernel source packages, making your changes, and building the Debian packages.
This section describes the package dependencies and scripts that NVIDIA uses to build the kernel packages. You may use it as a reference to create your own Debian packages.

Working with the Packages

 
Package Dependencies
nvidia-l4t-kernel
Pre-Dependencies and Dependencies
Package Scripts
nvidia-l4t-kernel-dtbs
Pre-Dependencies and Dependencies
Package Scripts
nvidia-l4t-kernel-headers
Pre-Dependencies and Dependencies
Package Scripts
nvidia-l4t-jetson-io
Pre-Dependencies and Dependencies
Package Scripts
The kernel packagesa re all open source. Three of the four kernel packages are are in public_sources.tbz2. You can download this archive from the NVIDIA Developer Center with the following links:
For Jetson Xavier family and Jetson TX2 family
For Jetson Nano and Jetson TX1
This archive contains another archive named kernel_src.tbz2, which in turn contains three directories of header files:
nvidia-l4t-kernel/
nvidia-l4t-kernel-dtbs/
nvidia-l4t-kernel-headers/
The debian.org Guide for Debian Maintainers gives guidelines for modifying the open source files and creating new Debian packages from them.
The fourth kernel package, nvidia-l4t-jetson-io, is discussed in nvidia-l4t-jetson-io, below.

Package Dependencies

Most L4T Debian packages pre-depend on nvidia-l4t-core. This package prevents package installation on an incompatible Jetson platform, e.g., installing a Jetson TX2 kernel on a Jetson Nano device. nvidia-l4t-core does not perform the installation if it detects an incompatible platform.
nvidia-l4t-core also prevents a partial upgrade, in which one L4T package upgrades to a new major release (e.g. release 32.4 to release 32.5), but other L4T packages that depend on it are not upgraded as well. Partial upgrades can cause compatibility issues between firmware, programs, and libraries that have been upgraded and ones that have not.

nvidia-l4t-kernel

nvidia-l4t-kernel contains files for the L4T kernel itself.

Pre-Dependencies and Dependencies

This package’s pre-dependencies are:
nvidia-l4t-core (must match this package’s major release)
This package’s dependencies are:
None

Package Scripts

This package has a post-installation script, which you can get by extracting the .deb file. It performs these actions:
1. Executes depmod -a.
2. Creates a dpkg trigger file named /usr/lib/linux/triggers/<release>. The trigger invokes actions defined in /etc/kernel/postinst.d to update initramfs/grub configs/… when the kernel is updated. This conforms to the standard Ubuntu kernel update procedure.

nvidia-l4t-kernel-dtbs

nvidia-l4t-kernel-dtbs contains files for L4T’s device tree blobs (DTBs).
The package installs all of the .dtb files in /boot/. When you flash the board, it installs the .dtb file used by the board in /boot/dtb/ by checking the board specification against the DTBs’ compatibility information.

Pre-Dependencies and Dependencies

This package’s pre-dependencies are:
nvidia-l4t-core (must match this package’s major release)
This package’s dependencies are:
device-tree-compiler
nvidia-l4t-kernel

Package Scripts

This package has a post-installation script, which you can get by extracting the .deb file.
The post-installation script performs these actions:
1. Decompiles the .dtb file used by the board in /boot/dtb/ and gets the bootargs property in the /chosen node.
2. Decompiles the corresponding .dtb file in /boot/ and substitutes the bootargs property from step 1 in the resulting .dts file.
3. Recompiles the .dts file to a .dtb file and puts it in /boot/dtb/.

nvidia-l4t-kernel-headers

nvidia-l4t-kernel-headers contains L4T kernel header files.

Pre-Dependencies and Dependencies

This package’s pre-dependencies are:
nvidia-l4t-core (must match this package’s major release)
This package’s dependencies are:
nvidia-l4t-kernel

Package Scripts

This package has a post-installation script, which you can get by extracting the .deb file. The script performs these actions:
1. Extracts the kernel header tarball to /usr/src/.
2. Updates two symbolic link files, build and source, to point to the correct kernel header files directory.

nvidia-l4t-jetson-io

nvidia-l4t-jetson-io contains Python scripts concerned with Jetson I/O functions.

Pre-Dependencies and Dependencies

This package’s pre-dependencies are:
nvidia-l4t-core (must match this package’s major release)
This package’s dependencies are:
mount
python3
util-linux
nvidia-l4t-kernel
device-tree-compiler
You can also get the dependencies by extracting the Debian file.

Package Scripts

This package has no package scripts.

Configuring NFS Root on the Linux Host

To boot the target device from NFS, you must provide an NFS root mount point on your Linux host system.
Prerequisites
An Ethernet connection to install packages on the host.
An Ethernet connection on the target.
To configure NFS root on the Linux host
1. Install the NFS components on your host machine:
$ sudo apt-get install nfs-common nfs-kernel-server
2. The NFS server must know which directories you want to export for clients. This information is specified in the /etc/exports file.
Modify /etc/exports to look somewhat like this:
$ /nfsroot *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
After adding the entry, restart with the command:
$ sudo /etc/init.d/nfs-kernel-server restart
3. Create an /nfsroot directory on your Linux host system:
$ sudo mkdir /nfsroot
4. Copy the file system to the nfsroot directory:
$ cd ./rootfs
$ sudo cp –a * /nfsroot
5. Export the root point:
$ sudo exportfs -a
Alternatively, you can export or un-export all directories by using the -a and -u flags. The following command un-exports all directories:
$ sudo exportfs -au
6. Optionally, if the Ubuntu firewall blocks NFS root access, it must be disabled, depending on your configuration, with the following command:
$ sudo ufw disable
7. If there are issues performing the NFS boot, verify that everything on the host system is configured properly by executing the following step on a booted target board through USB/SD/internal eMMC. It should be possible to mount the host NFS root point on the target device:
$ mkdir rootfs
$ sudo mount -v -o nfsvers=3 <IP-ADDR>:/nfsroot rootfs
Where <IP-ADDR> is the IP address of the Linux Host machine as taken from the ifconfig command. This proves that the host configuration is correct.
Note:
Before executing the mount command on the target system, install the nfs-common package with the command:
$ sudo apt-get install nfs-common
To boot the target with the NFS root point, see Flashing and Booting the Target Device. Be sure to include the -N option for the NFS root point.

Determining Version and Platform Information

Use these procedures to determine:
The flashed BSP version
The kernel version
Other platform information
To determine the BSP version and other platform information
Execute command:
head -1 /etc/nv_tegra_release
Output is similar to the following:
# R31, REVISION: 0.0, GCID: , BOARD: t186ref, EABI: aarch64, DATE: Wed Aug  1 23:57:14 UTC 2018"
To determine the kernel version
Execute this command in the kernel directory:
head -22 Makefile | tail -3
Output is similar to the following:
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 140
If the system is running, determine the kernel version with the command:
uname -a
Output is similar to the following:
Linux tegra-ubuntu 4.9.140-tegra #16 SMP PREEMPT Mon Jun 3 12:08:39 PDT 2019 aarch64 GNU/Linux
To determine boot configuration
All boot configuration is present in the flashing configuration. For example, jetson-xavier.conf provides the following information:
CHIPID=0x19;
EMMC_CFG=flash_t194_sdmmc.xml;
BOOTPARTSIZE=8388608;
EMMCSIZE=31276924928;
ITS_FILE=;
SYSBOOTFILE=p2972-0000/extlinux.conf;
BPFDTB_FILE=tegra194-a01-bpmp-p2888-a01.dtb;
DTB_FILE=tegra194-p2888-0001-p2822-0000.dtb;
TBCDTB_FILE=tegra194-p2888-0001-p2822-0000.dtb;
The full definition of the boot configuration is in p2792-0000.conf.common. Files like jetson-xavier.conf reference that file, then specify additions and changes.
The default kernel build configuration is as follows:
arch/arm64/configs/tegra18_defconfig

Improving System Performance

 
Lightweight Window Manager Alternatives
This section discusses types of customization that you can use to improve the performance of a Jetson platform.

Lightweight Window Manager Alternatives

The window manager installed with L4T is Gnome, the standard Linux window manager. In many cases you can reduce boot time, response time, memory consumption, and CPU utilization by replacing Gnome with a lightweight window manager. NVIDIA recommends the LXDE environment with Compton compositing manager for this purpose.
To install and enable LXDE and Compton
1. Enter the commands:
sudo apt-get update
sudo apt-get install lxde compton
2. Create the configuration file /etc/xdg/autostart/lxde-compton.desktop, containing these commands:
[Desktop Entry]
Type=Application
Name=Compton (X Compositor)
GenericName=X compositor
Comment=A X compositor
TryExec=compton
Exec=compton --backend glx -b
OnlyShowIn=LXDE