NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

GSG: DVSDK 2.0 Software Setup in Ubuntu

From Texas Instruments Wiki
Jump to: navigation, search

Note: This article was written and tested for DM355 and DM365 using DVSDK 2.00 and DVSDK 2.10 respectively, it will still largely apply to other devices as well that use DVSDK 2.xx however some device specific settings may need to be adjusted, primarily build arguments and boot arguments. If you find any issues feel free to edit this page or to make a post on the E2E forum.

Installing the Target Linux Software[edit]

This section explains how to install Linux for use on the target board. This is a demonstration version of MontaVista Linux Pro v5.0. Note that separate versions of Linux are used by the target and your host Linux workstation. The Linux host operating system that is tested with the DVEVM is Red Hat Enterprise Linux v4 (RHEL4 Server Edition), however other Linux distributions such as Ubuntu will work as well, the instructions below assume Ubuntu 9.04.

To install the Linux software, follow these steps:

1) Open a new terminal window. You will need root privelages to allow you to successfully run the graphical installer to install MontaVista Linux so you will need to use the gksudo in addition to the normal sudo command which will ask for your password in the coming instructions.

2) We suggest that you create a directory called /opt/mv_pro_5.0 using the following command. This will be the directory into which you install the software.

host $ sudo mkdir /opt/mv_pro_5.0

3) Ensure that the installer files are executable using sudo chmod 777. For example:

host $ cd /tmp
host $ sudo chmod 777 mvl_5_0_#_demo_sys_setuplinux.bin
host $ sudo chmod 777 mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin

3) Execute each of the following bin files (where #_#_#_# is the current version number) from the temporary location that they were copied in order to extract the installers for the Linux tools, Linux kernel, and the file system. Instead of the default installation directory, change the installation directory to the new directory you created previously (/opt/mv_pro_5.0).

host $ cd /tmp
host $ gksudo ./mvl_5_0_#_demo_sys_setuplinux.bin
host $ gksudo ./mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin

4) After you execute these .bin files, make sure the following files are located in /opt/mv_pro_5.0 (or in the /mv_pro_5.0 subdirectory of the directory you chose in place of the default):

host $ ls /opt/mv_pro_5.0
DaVinciLSP_#_#_#_#.tar.gz  mvltools5_0_#######.tar.gz  uninstall

5) Go to the location where you will unpack the tar files. For example:

host $ cd /opt/mv_pro_5.0

6) Unpack the tar files with sudo by using the following commands:

host $ sudo tar -zxvf mvltools5_0_#######.tar.gz
host $ sudo tar -zxvf DaVinciLSP_#_#_#_#.tar.gz

This creates the MontaVista directory structure under the /opt/mv_pro_5.0/montavista/ directory. Note that unpacking these tar files will overwrite any existing files that were previously installed.

Note: The LSP shipped with the DVSDK is a multi-platform LSP; it is not configured for a particular platform. As shipped, this LSP cannot be used to build the demo or example applications. It must first be copied to a user area and configured/built for the EVM. Please see the Building a New Linux Kernel section for instructions.

Installing the DVSDK Software[edit]

The DVSDK software includes Codec Engine components, sample data files, xDAIS and xDM header files, and a contiguous memory allocator for Linux (CMEM). To install the DVSDK software using the Linux installer, follow these steps:

1) Open a new terminal window and move to the directory you have the install binaries located in. The user account must have execute permission for the dvsdk_setuplinux_#_#_#_#.bin and xdctools_setuplinux_#_#_#.bin files. In order to do this, you must utilize the sudo command on the host Linux workstation when changing the permissions of the files. Note that the sudo command will cause you to have to input your password when running these commands. For example:

host $ cd /tmp
host $ sudo chmod 777 dvsdk_setuplinux_#_#_#_#.bin
host $ sudo chmod 777 xdctools_setuplinux_#_#_#.bin

2) Execute the DVSDK installer that you previously copied from the DVSDK DVD. For example:

host $ ./dvsdk_setuplinux_#_#_#_#.bin

This installs the DVSDK in ~/dvsdk_#_#.

3) Execute the XDC installer that you previously copied from the DVSDK DVD. When you are prompted, do not use the default installation location. Instead, install the software in the directory created in Step 2, i.e. ~/dvsdk_#_#. For example:

host $ ./xdctools_setuplinux_#_#_#.bin

4) You can now delete the .bin files that you loaded into the temporary directory.

host $ rm dvsdk_setuplinux_#_#_#_#.bin
host $ rm xdctools_setuplinux_#_#_#.bin

Note: You can uninstall these components by using the rm -rf command on its directory. You should ignore the uninstall files created by the installer.

Installing the A/V Demo Files[edit]

Disk 2 contains the A/V files used by the demos. After following the instructions in the previous section, follow these instructions to install the A/V files:

1) Go to the "clips" subdirectory of the DVSDK directory that you set up previously. For example:

host $ cd ~/dvsdk_#_#/clips

2) Insert disk 2 and Ubuntu will automatically mount it for you in /media/cdrom0. Copy the data.tar.gz file from the mount directory to the clips directory. Alternatively download the appropriate A/V files package for your particular EVM and copy it to the clips directory. For example:

host $ cp /media/cdrom0/data.tar.gz ./

3) Extract the A/V data files. For example:

host $ tar -zxvf data.tar.gz

Installing the Linux Performance Test Bench[edit]

This section explains how to install the Linux Performance Test Bench (LPTB) for use on the target board. Follow these steps to install:

1) Log in to your host Linux workstation.

2) Execute the following bin file (where #_#_#_# is the current version number) from the temporary location to which you copied it. This extracts the installer for the Linux Performance Test Bench. If the bin file does not run, make sure the file is executable (use chmod +x *.bin). Instead of the default installation directory (/opt), you may use a different installation directory if you like. Note that by default you may not have write permissions to /opt anyway so installing this into your /home/user or /home/user/dvsdk... directory may make more sense.

host $ ./linux_performance_testbench_setup_#.#.#.#.bin

3) After you execute this .bin file, make sure linux_performance_test_bench_#_#_#_#.tar.gz is located in the installation directory:

4) Go to the location where you will unpack the tar file. For example:

host $ cd /home/user/

5) Unpack the tar file (as root) by using the following command. Note that unpacking this tar file will overwrite any existing LPTB files that were previously installed.

host $ sudo tar -zxvf linux_performance_test_bench_#_#_#_#.tar.gz

This creates the psp_test_bench directory structure under the /home/user/linux_performance_test_bench_#.#.#.# directory.

Exporting a Shared File System for Target Access[edit]

Although the board’s NAND flash contains a file system, during development it is more convenient to have the target board NFS mount a file system on a host Linux workstation. Once you have tested the application, you can store it on the board’s flash for a standalone demonstration.

Before the board can mount a target file system, you must export that target file system on the host Linux workstation. The file system uses an NFS (Network File System) server. The exported file system will contain the target file system and your executables. To export the file system from your NFS server, perform the following steps. You only need to perform these steps once.

1) Log in with a user account on the host Linux workstation.

2) Perform the following commands to prepare a location for the MontaVista file system. For example:

host $ cd ~
host $ mkdir -p workdir/filesys
host $ cd workdir/filesys

3) Perform the following commands to create a copy of the target file system with permissions set for writing to the shared area as $USER. Note that $USER will substitute your user name for $USER in the command, so you could also just type your user name instead. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ sudo cp -a /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/target/* .
host $ chown -R $USER opt

4) Install the NFS server package by running the following command.

host $ sudo apt-get install nfs-kernel-server

4) Edit the /etc/exports file on the host Linux workstation (not the exports file on the target filesystem). This can be done by running:

host $ gksudo gedit /etc/exports

Add the following line for exporting the filesys area, substituting your user name for <useracct>. Use the full path from root(/); ~ or $HOME may not work for exports on all file systems.

/home/<useracct>/workdir/filesys *(rw,no_root_squash,no_all_squash,sync)

Note: Make sure you do not add a space between the * and the ( in the above command.

5) Use the following commands to make the NFS server aware of the change to its configuration and to invoke an NFS restart.

host $ sudo /usr/sbin/exportfs -av
host $ sudo /etc/init.d/nfs-kernel-server restart
                                                     

Note: Use exportfs -rav to re-export all directories. Use sudo /etc/init.d/nfs-kernel-server status to verify that the NFS status is running.

6) Verify that the server firewall is turned off:

host $ sudo iptables -L

If the firewall is running, disable it:

host $ sudo iptables -F

Testing the Shared File System[edit]

To test your NFS setup, follow these steps:

1) Get the IP address of your host Linux workstations as follows. Look for the IP address associated with the eth0 Ethernet port.

host $ /sbin/ifconfig

2) Open a terminal emulation window to connect to the EVM board via RS-232 using the instructions in Section 2.2. If you have a Windows workstation, you can use HyperTerminal. If you have a Linux workstation, you might use Minicom. (You may need to turn on line wrap.)

3) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window (Section 2.2).

4) Set the following environment variables in the console window:

EVM # setenv nfshost <ip address of nfs host>
EVM # setenv rootpath <directory to mount>

For DM355:

EVM # setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=116M video=davincifb:vid0=0,2500K:vid1=0,2500K: osd0=720x576x16,2025K davinci_enc_mngr.ch0_output=COMPOSITE davinci_enc_mngr.ch0_mode=$(videostd)

For DM365:

EVM # setenv bootargs console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=76M video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4

For other device's bootargs please see the associated getting started guide.

Note that the setenv bootargs command should be typed on a single line. Also note that you should avoid using the numeric keypad to enter numbers, as it can sometimes insert extra invisiblecharacters.

The <directory to mount> must match what you specified in Step 5 of Section 4.3.5. For example, /home/<useracct>/workdir/filesys. Hints: You may want to use the printenv command to print a list of your environment variables. You can also save these setenv commands in a .txt file from which you can paste them in the future.

5) Save the environment so that you don't have to retype these commands every time you cycle power on the EVM board:

EVM # saveenv

6) Boot the board using NFS:

EVM # boot

7) During the boot process you should see a large amout of text come out of the board on the serial terminal providing various status information on the boot process, once this process has completed you should be given a prompt asking for a log in. You can now log in as "root" with no password required (i.e. type root and hit enter). See Section A.4, Alternate Boot Methods for information about booting with TFTP, NFS, or the board’s NAND flash.

Setting Up the Build/Development Environment[edit]

To set up the development and build environment, follow these steps:

1) Log in to your user account (and not as root) on the NFS host system.

2) Set your PATH so that the MontaVista tool chain host tools and cross compiler (arm_v5t_le-gcc) can be found. For example, in a default installation of the MontaVista LSP, you should add a definition like the following to your shell resource file (for example, home/user/.bashrc), typically this would be done using the export command. Note that there can be no spaces or carriage returns in the path definition. First we open the .bashrc file:

host $ gedit /home/user/.bashrc

Than add the export command below to the .bashrc file:

export PATH="/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_5.0/montavista/pro/bin:/opt/mv_pro_5.0/montavista/common/bin:$PATH"

If you installed in a location other than /opt/mv_pro_5.0, use your own location in the PATH.

NOTE: This is asking you to edit a file in your system, not just to run the export command directly, if you run the export command directly you will have to run it every time you open a new console, but if you edit the .bashrc file you will have your paths in place for every new console you open.
WARNING: Be sure to leave the :$PATH portion of the export command intact, or you will wipe out your existing paths making it troublesome to run any of your normal commands.

3) Remember to use the following command after modifying your .bashrc file to activate it:

host $ source ~/.bashrc

Writing a Simple Program and Running it on the EVM[edit]

Make sure you have performed the steps in 'Exporting a Shared File System for Target Access' and 'Setting Up the Build/Development Environment'.

Perform the following steps on the NFS host system as user (not as root):

1) Make a new directory for the simple program.

host $ mkdir ~/workdir/filesys/opt/hello

2) Move into the new directory just created.

host $ cd ~/workdir/filesys/opt/hello

3) Create a file named hello.c using a text editor by running 'gedit hello.c', and add the following contents to it:

#include <stdio.h>
int main() {
   printf("Buongiorno DaVinci!\n");
   return 0;
}

4) Build the newly created C file

host $ arm_v5t_le-gcc hello.c -o hello

Perform the following steps on the target board. You may use either the target's console window or a telnet session. 1) Move to the directory for the simple program.

target $ cd /opt/hello

2) Run ./hello. The output should be: "Buongiorno DaVinci!"

target $ ./hello

Building a New Linux Kernel[edit]

If you modify the target’s Linux kernel sources, you will need to rebuild it and then boot it up by either replacing the kernel that comes installed on the EVM board’s flash or by having the U-Boot utility use TFTP to boot the kernel over a network connection.

Make sure you have completed the 'Setting Up the Build/Development Environment' section and 'Writing a Simple Program and Running it on the EVM' section before attempting to build a new kernel.

To rebuild the Linux Kernel, follow these steps:

1) Log in to your user account (not as root).

2) Set the PLATFORM variable in the Rules.make file as described in 'Rebuilding the DVSDK Software for the Target'

3) Use commands like the following to make a local working copy of the MontaVista Linux Support Package (LSP) in your home directory. This copy contains the embedded Linux 2.6.18 kernel plus the DaVinci drivers. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ cd ~
host $ mkdir -p workdir/lsp
host $ cd workdir/lsp
host $ cp -R /opt/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci .

4) Use the following commands to configure the kernel using the DaVinci defaults for your device. Note that CROSS_COMPILE specifies a prefix for the executables that is used during compilation:

host $ cd ti-davinci/linux-2.6.18_pro500

for DM355:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- davinci_dm355_defconfig

for DM365:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- davinci_dm365_defconfig

etc...

5) To modify the kernel options, you will need to use a configuration command such as "make menuconfig" (suggested) or "make xconfig". Note that to use "make menuconfig" on Ubuntu that you must have ncurses installed, so run "sudo apt-get install libncurses5-dev". To verify the MontaVista default kernel options, use the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- checksetconfig

6) Compile the kernel using the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- uImage

7) If the kernel is configured with any loadable modules (that is, selecting <M> for a module in menuconfig), use the following commands to rebuild and install these modules:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- modules
host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- INSTALL_MOD_PATH=/home/<useracct>/workdir/filesys modules_install

8) If you have not already done so see the section on Setting Up the TFTP Server to have a TFTP server installed and running to boot the new kernel.

9) Use the following command to copy uImage to a place where U-Boot can use TFTP to download it to the EVM. These commands assume you are using the default TFTP boot area in Ubuntu, which is /var/lib/tftpboot. If you use another TFTP root location, please change /var/lib/tftpboot to your own TFTP root location.

host $ sudo cp ~/workdir/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /var/lib/tftpboot
host $ sudo chmod a+r /var/lib/tftpboot/uImage

See a standard Linux kernel reference book or online source for more about Linux build configuration options.

Rebuilding the DVSDK Software for the Target[edit]

To place demo files in the /opt/dvsdk directory, you need to rebuild the DVSDK software. To do this, follow these steps:

1) If you have not already done so, rebuild the Linux kernel as described in Building a New Linux Kernel.

2) Change directory to dvsdk_#_#.

host $ cd ~/dvsdk_<version>

3) Edit the Rules.make file in the dvsdk_#_#. directory with a command such as 'gedit Rules.make'. If you installed components in the default locations, the directory definitions may already be correct, but you should verify them in any case.

  • Set PLATFORM to match your EVM board as follows, for example:
PLATFORM=dm355

or

PLATFORM=dm365

etc...

  • Set DVSDK_INSTALL_DIR to the top-level DVSDK installation directory as follows:
DVSDK_INSTALL_DIR=$HOME/dvsdk_#_#
  • Modify the following variable as needed to match the location of XDCtools on your Linux host. We recommend that XDCtools be installed in the $HOME/dvsdk_#_# directory, but you may have installed it elsewhere.
XDC_INSTALL_DIR=$HOME/dvsdk_#_#/xdctools_#_#
  • Make sure LINUXKERNEL_INSTALL_DIR is defined as follows:
LINUXKERNEL_INSTALL_DIR=$HOME/workdir/lsp/ti-davinci/linux-2.6.18_pro500
  • Make sure MVTOOL_DIR points to the MontaVista Linux tools directory as follows:
MVTOOL_DIR=/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le
  • Make sure EXEC_DIR points to the opt directory on the NFS exported file system as follows:
EXEC_DIR=$HOME/workdir/filesys/opt/dvsdk

4) While in the same directory that contains Rules.make, use the following commands to build the DVSDK demo applications and put the resulting binaries on the target file system specified by EXEC_DIR.

host $ make clean
host $ make
host $ make install

5) You can test the rebuilt DVEVM software by booting your NFS file system and running the demos from the command line.

Booting the New Linux Kernel[edit]

After building the new kernel, in order to use it to boot the DaVinci board, you must transfer it to the board via TFTP. It is assumed you have completed the steps above in Building a New Linux Kernel and the boot file, uImage has been copied to /tftpboot (or some other site-specific TFTP accessible location).

1) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window.

2) Set the following environment variables. (This assumes you are starting from a default, clean U-Boot environment.)

EVM  # setenv bootcmd 'dhcp;bootm'
EVM  # setenv serverip <tftp server ip address>
EVM  # setenv bootfile uImage

Bootargs for DM365:

EVM # setenv bootargs mem=76M console=ttyS0,115200n8 root=/dev/mtdblock3 rw rootfstype=yaffs2 ip=dhcp video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4

Bootargs for DM355:

EVM # setenv bootargs mem=116M console=ttyS0,115200n8 root=/dev/mtdblock3 rw rootfstype=yaffs2 ip=dhcp video=davincifb:vid0=0,2500K:vid1=0,2500K:osd0=720x576x16,2025K davinci_enc_mngr.ch0_output=COMPOSITE davinci_enc_mngr.ch0_mode=$(videostd)

Save the environment changes:

EVM # saveenv

For other device's bootargs please see the associated getting started guide. Note that the setenv bootargs command should be typed on a single line, it may be easier to save this to a text file and paste it into your terminal program as necessary as opposed to typing into your terminal program by hand.

3) Boot the board:

EVM # boot

This configuration boots a new Linux kernel via TFTP with a NAND flash based file system. To boot using an NFS file system, see the Alternate Boot Methods page for your device (for example DM365). For instructions on how to verify that your host workstation is running a TFTP server, and for instructions on what to do if it isn’t, see below in Setting Up the TFTP Server. For more details on booting, see the Alternate Boot Methods page for your device (for example DM365).

Setting Up the TFTP Server[edit]

For instructions on setting up the TFTP server please see Setting up a TFTP Server or Installing a TFTP Server.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GSG: DVSDK 2.0 Software Setup in Ubuntu here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GSG: DVSDK 2.0 Software Setup in Ubuntu here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article GSG: DVSDK 2.0 Software Setup in Ubuntu here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity