NVIDIA Tegra Tegra Linux Driver Package
Developers' Guide

November 29, 2011
R12 Beta Release


Getting Started
This section contains information to help you get started using this pre-release of NVIDIA® Tegra® Linux Driver Package. It covers the following topics:
Requirements
The following lists the requirements to use this Tegra Linux Driver Package release:
Boot Options
It is currently possible to boot Tegra Linux Driver Package Tegra 2 series Harmony or Ventana developer board, as well as Tegra 3 series Cardhu with a root file system from:
Setting Up Your Environment
The following subsections contain information to help you get started using this pre-release of Tegra Linux Driver Package. They cover the following topics:
Extracting Tegra Linux Driver Package
Note: The procedures in this document assume you extract the release package in ~/.
To extract Tegra Linux Driver Package
$ sudo tar -vxjf Tegra-linux-12.beta.1.0.tbz2
Setting Up Your Board
Tegra Linux Driver Package requires a Tegra 2 series developer board (Harmony with a NAND module or Ventana), or a Tegra 3 series (Cardhu) as well as a host PC running Linux. The procedure in this section describes the steps to configure the Tegra 2 series Harmony board. Please consult your board documentation for steps on how to setup and configure your board.
Prerequisites
$ export TARGET_BOARD=harmony
$ export TARGET_BOARD=ventana
$ export TARGET_BOARD=cardhu
To set up your Harmony developer board
1.
2.
3.
The Harmony developer board UART can be found on the satellite board.
4.
Setting Up Your File System
This section describes the steps for setting up your file system. You must set up the root file system and copy the file system to USB disk.
About the Root File System
To replicate the sample file system, the ttyS0.conf and nv.conf files have been added. Both are accessible from the provided sample file system and are placed in the user-generated file system, should you decide to replicate the rootfs.
The provided sample root file system was created with Rootstock 0.1.99.4 using this command:
$ sudo rootstock --fqdn tegra-ubuntu --login ubuntu --password ubuntu --imagesize 1G -d natty --seed ubuntu-minimal,xserver-xorg-core,xinit,xterm,alsa-utils,wireless-tools,wpasupplicant,x11-xserver-utils,openssh-client,openssh-server
This creates a file system with the hostname tegra-ubuntu, the username ubuntu, and the password ubuntu.
We have also made the following changes:
Added: /etc/init/{ttyS0.conf, nv*, wpa_supplicant.conf}
Modified: /etc/{init/ssh.conf, X11/Xwrapper.conf, resolve.conf}
Deleted: /etc/ssh/ssh_host_*
To replicate these changes in your own rootstock file-system, copy or make similar modifications from those files to your own rootstock filesystem.
The following packages are installed by default:
Installing Additional Packages
You may want to install additional packages as described in this section. For example, ssh will be useful if you need remote login.
Prerequisite
You must attach an Ethernet cable to the device through either the Ethernet port (if available) or through the USB Ethernet adaptor, or connect through Wi-Fi if the appropriate driver and firmware are enabled and installed.
To install more packages
1.
2.
$ sudo dhclient
3.
Install packages using apt-get. For example, to install wget execute this command:
$ sudo apt-get install wget
Setting Up the Root File System
The next step in booting the target board is to configure the root file system. Follow the procedures in this section to set up the rootfs and to copy the file system to the rootfs device.
Note: The instructions below use the sample file system that is provided by NVIDIA as the base. If you would like to use your own, set the LDK_ROOTFS_DIR environment variable to point to where your rootfs is located and skip Steps 1 and 2.
To set up the rootfs
1.
2.
3.
Run the apply_binaries.sh script to copy the NVIDIA user space libraries into the target file system:
$ ./apply_binaries.sh
If you are using a different rootfs, or if you already have configured your rootfs, you can apply the NVIDIA user space libraries by setting the LDK_ROOTFS_DIR environment variable to point to your rootfs. Then run the script, as shown above, to copy the binaries into your target file system.
To install a different X driver Application Binary Interface (ABI):
Use the apply_binaries.sh script and pass the –abi <NUMBER> flag by executing:
$ sudo ./apply_binaries.sh –abi <NUMBER>
where <NUMBER> is the ABI version to install, either 5, 6, 7, 8, 10, or 11. The ABI default value for the X driver is ‘X ABI version 10’ and it is the version that works in the provided sample file system. You can find the version to use in the sample file system by following the directions listed below.
To determine the X driver ABI of the X server used in the root file system:
Examine the resulting file /var/log/Xorg.0.log, which will contain something like the following:
(II) Module ABI versions:
X.Org ANSI C Emulation: 0.4
X.Org Video Driver: 8.0
The X.Org Video Driver line reports the ABI version. The sample Ubuntu 11.04-based root file system uses X driver ABI 10.
4.
5.
6.
To copy the file system to the external rootfs device
1.
2.
3.
$ sudo cp -r -p $LDK_ROOTFS_DIR/* <mntpoint>
If it is not set, copy the rootfs directory that is included in the release by executing the following command:
$ sudo cp -r -p <<LDK-directory>>/rootfs/* <mntpoint>
Once you have flashed your board, you can then unmount the disk and plug it to the board. For more information about flashing, see the Flashing the Boot Loader and Kernel in this section. For information about plugging in the board, see the hardware documentation for your developer board.
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 machine. The procedure in this section describes the basic steps to do so.
Prerequisites
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.
Modify /etc/exports to look somewhat like this:
$ /nfsroot *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
$ sudo /etc/init.d/nfs-kernel-server restart
3.
Create an /nfsroot directory on your Linux host machine:
$ sudo mkdir /nfsroot
4.
$ cd ./rootfs
$ sudo tar -cpf - * | ( cd /nfsroot ; sudo tar -xpf - )
5.
$ sudo exportfs -a
Alternatively, you can export or unexport all directories by using the -a and -u flags. The following command un-exports all directories:
$ sudo exportfs -au
6.
$ sudo ufw disable
7.
$ 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.
To boot the target with the NFS root point, see Flashing the Boot Loader and Kernel section and be sure to include the -N option for the nfs root point.
Flashing the Boot Loader and Kernel
This section describes the steps that must be taken to boot the target board (Harmony, Ventana, or Cardhu) and provides usage information for the flash.sh script.
Flash Procedure
The first step is to flash the board with the boot loader and kernel.
Prerequisites
The following directories must be present:
/nv_tegra—NVIDIA® Tegra® user space binaries
To flash the boot loader and kernel
1.
2.
Now run the flash.sh script that is in the top level directory of this release. The script must be supplied with the device name that it will have in the root file system:
$ sudo ./flash.sh <target_board> <rootdev>
$ sudo ./flash.sh <target_board> sda1
Otherwise, if the root file system will be on an SD card, execute the script as follows:
$ sudo ./flash.sh <target_board> mmcblk0p1
Where <target_board> is harmony, ventana, or cardhu depending upon your target device.
The boot loader and kernel will load.
Flash Script Usage
You can find the most up-to-date usage information by running the flash.sh script included in the release. The basic usage information is as follows.
Usage
sudo ./flash.sh [options] <target_board> <rootdev>
Where you specify the required parameters and one or more of the options shown in the following table.
Specifies the kernel command line. Warning: This manual kernel command line should be *FULL SET*. Upon detecting the manual command line, the boot loader overrides the entire kernel command line with this <cmdline> input.
Specifies initrd file. Null initrd is the default.
Specifies the xorg.conf file to override the default.
Synchronizing the Kernel Sources and Tool Chain
You can manually rebuild the kernel used for this package. Internet access is required to do so. All the related scripts are located in the kernel directory.
Prerequisites
$ sudo apt-get install git-core
To rebuild the kernel
1.
$ cd ./kernel/
$ ./kernel_sync.sh
—Or—
You can also manually sync the sources, as follows:
$ cd <myworkspace>
$ git clone git://nv-tegra.nvidia.com/linux-2.6.git kernel_sources
$ cd kernel_sources
$ git checkout <LDK_KERNEL_CHANGEID>
Where <LDK_KERNEL_CHANGEID> is the LDK_KERNEL_CHANGEID variable inside of the kernel_sync.sh script.
You can also sync to known Linux tags. To see a list of the available release tags, use:
$ git tag –l ‘tegra-l4t*
2.
Install the tool chain by running the install_3rdparty.sh script:
$ ./install_3rdparty.sh
Building the NVIDIA Kernel
Follow the steps in this procedure to build the NVIDIA kernel.
Prerequisites
To build the Tegra Kernel
1.
$ export CROSS_COMPILE=<crossbin>
$ export TEGRA_KERNEL_OUT=<outdir>
$ export ARCH=arm
where:
<crossbin> is the prefix applied to form the path to the tool chain for cross compilation, e.g., gcc. For the CodeSourcery tool chain, it will look something like:
<csinstall>/arm-2009q1-203-arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
2.
$ cd <myworkspace>/kernel
$ mkdir $TEGRA_KERNEL_OUT
$ make O=$TEGRA_KERNEL_OUT tegra_defconfig
$ make O=$TEGRA_KERNEL_OUT tegra3_defconfig
Where <myworkspace> is the parent of the Git root.
Using Example Applications
This section describes two example applications you can use to test multimedia and OpenGL/EGL functionality on NVIDIA Tegra platforms.
OpenGL/EGL Gears Test Application
If you would like to run a sample OpenGL/EGL test application, you can run the open-source Gears application.
To install and run Gears test application
1.
$ sudo apt-get install mesa-utils-extra
2.
Manually create the sym-links in the target root file-system for /usr/lib/libEGL.so.1 and /usr/lib/libGLESv2.so.2.
$ ln -s /usr/lib/libEGL.so /usr/lib/libEGL.so.1
$ln -s /usr/lib/libGLESv2.so /usr/lib/libGLESv2.so.2
3.
$ export DISPLAY=:0
$ X&
$ /usr/bin/es2gears
GStreamer and NvGstPlayer
You can use the GStreamer open source multimedia framework and NvGstPlayer for testing multimedia. This section tells you how to install and use these applications. This section includes the following sub-topics.
Installing GStreamer
You install the GStreamer pipleline from the Internet directly on target. There is a wrapper library called gst-openmax that is an interface between GStreamer and OpenMAX, which enables us to encapsulate the accelerated NVIDIA plug-ins in the GStreamer framework
For more information about GStreamer, see the following website:
http://gstreamer.freedesktop.org
NvGstPlayer is a multimedia player test application.
To install GStreamer on the target
1.
$ sudo apt-get -y install gstreamer-tools
$ sudo apt-get -y install gstreamer0.10-plugins-good
$ sudo apt-get install gstreamer0.10-plugins-base
$ sudo apt-get -y install alsa-utils
$ sudo apt-get -y install gstreamer0.10-alsa
2.
gst-inspect | grep qtdemux
To install GStreamer-0.10 on Cardhu
1.
$ sudo apt-get install gstreamer-tools gstreamer0.10-alsa gstreamer0.10-plugins-good gstreamer0.10-plugins-base
2.
Place nvgstplayer from the libraries dir to /home/ubuntu.
3.
xinit &
export DISPLAY=:0
amixer cset numid=45 1
amixer cset numid=38 63,63
Using NvGstPlayer
NvGstPlayer is a command line media file player. It will play audio/video files encapsulated in MP4, 3GP, AVI, ASF, WMA, MKV, M2TS, WEBM, MOV. This section describes NvGstPlayer usage, runtime commands, default settings, and important notes.
Usage
./nvgstplayer [OPTIONS]
Where you can specify one or more of the options shown in the following table.
Runtime Commands
You can execute the following commands while running the test.
Default Settings
The following shows the default settings.
Important Notes
If p is -1 then playback will pause until the end of segment (EOS) with the interval of gap seconds.
./nvgstplayer -u uri -e elem --no-audio
specifies all the streams in the URIs file will play without audio.
NvGstPlayer Examples
This section provides example commands, elements file, and URIs file.
Example Commands
Example Elements File
The following shows an example of an elems file, which is used in Number 2 in the below execution description.
#Decoders
[decode_videompeg4]
name=nv_omx_mpeg4dec
 
[decode_audioaac]
name=nv_omx_aacdec
 
[decode_audiomp3]
name=nv_omx_mp3dec
 
[decode_videoh264]
name=nv_omx_h264dec
 
#Sinks
[sink_video]
name=nv_gl_eglimagesink
 
[sink_audio]
name=alsasink
In the previous example name is the property of element. You can mention other properties of element followed by name property, each on separate line, if they exist. For example, you can mention as follows:
#Sinks
[sink_video]
name=nv_gstbin_videosink
rendertarget=1
Example URIs File
The following shows an example of uris file, which is used in Number 2 and Number 3 in the below execution descriptions.
[/home/ubuntu/All_streams/<filename>_h263_aac.3gp]
seekper=1
seeks=25;0;65
 
[/home/ubuntu/All_streams/<filename>_mpeg2_mp2.mpg]
pauses = 5
gap = 7
 
[/home/ubuntu/All_streams<filename>_wmv9_wma9.wmv]
startper = 1
start = 50
 
[/home/ubuntu/All_streams/<filename>30fps_4M_mp3_128_44_1min.avi]
start = 20000
duration= 10000
Execution Descriptions
1.
The application will play the <filename>_900.mp4 stream until end of stream (EOS) and will exit.
2.
The stream <filename>_h263_aac.3gp will play with seeks to 25% duration, then 0% duration (i.e., start of stream) and then 65% duration of the stream. And then will play until EOS.
Then the next stream from uris file will be taken up, (i.e., <filename>_mpeg2_mp2.mpg). This stream will pause 5 times with the gap of 7seconds between two consecutive pauses.
3.
All the streams from uris file will play without AV sync. All command line arguments will apply to all streams in the uris file, unless explicitly specified for a stream in uris file.
4.
Nokia.mp4 will be played 3 times, and each playback will pause for 4 times and will seek to 10th sec, then 0th sec, and then 45th sec of the playback.
5.
This playback will have 2 pauses and seeks to 10th second, then 20th second, then 30th second, then 40th second, and the consecutive pauses and seeks will have a gap of 3 seconds.
6.
Player provides RTSP/HTTP streaming support. The stream <filename>_80kbps_44khz_s.mp4 will be played until EOS.