Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Setting up OMAP-L137 Target File System

From Texas Instruments Wiki
Jump to: navigation, search

Purpose

The OMAP-L137 EVM does not come with a target file system pre-loaded. In order to develop Linux applications it is necessary to setup a target file system. In this section we cover setting up an NFS file system for this purpose. NFS is ideal during evaluation and development because it allows you to modify the contents of the target file system online without needed to reboot the EVM. Once you have tested your application, you can store it to a more permanent storage media such as SD/MMC or USB storage for standalone operation. For information on setting up an SD/MMC or USB file system please see the Creating File Systems on Removable Media

Prerequisites

  1. A Linux host system to serve the NFS file system
  2. A network connection between the Linux host and the EVM
  3. The MontaVista system tools installed as described in the Installing the SDK Software section of the OMAP-L137 Getting Started Guide

Exporting a Shared File System for Target Access

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. These instructions are based on the RedHat Enterprise Linux v4 distribution. For Ubuntu, please check this page. You may need to modify them for other Linux distributions.

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 sample MontaVista target file system. For example:
    host $ cd /home/<useracct>
    host $ mkdir -p workdir/filesys
    host $ cd workdir/filesys
  3. Switch user to root on the host Linux workstation.
    host $ su root
  4. Perform the following commands to create a copy of the target file system with permissions set for writing to the shared area as <useracct>. Substitute you user name for <useracct>. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.
    host $ cp -a /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/target/* .
    host $ chown -R <useracct> opt
  5. Edit the /etc/exports file on the host Linux workstation (not the exports file on the target file system). Add the following line for exporting the filesys directory, substituting your user name for <useracct>. Use the full path from root; ~ 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.
  6. Still as root, use the following commands to make the NFS server aware of the change to its configuration and to invoke an NFS restart.
    host $ /usr/sbin/exportfs -av
    host $ /sbin/service nfs restart

    NOTE: Use exportfs -rav to re-export all directories. Use /etc/init.d/nfs status to verify that the NFS status is running.
  7. Verify that the server firewall is turned off:
    host $ /etc/init.d/iptables status
    If the firewall is running, disable it:
    host $ /etc/init.d/iptables stop

For Ubuntu iptables settings, please check this page

Testing the Shared File System

To test your NFS setup, follow these steps:

  1. Copy the kernel Image (uImage) from the /home/<useracct>/OMAPL137_arm_#_#_#_#/REL_LSP_#_#_#_#/PSP_#_#_#_#/bin directory of the SDK software installation to the /tftpboot directory of your Linux host workstation. This kernel will be used to test the NFS target file system. If you do not have a TFTP server configured please see the Setting up a TFTP Server page.
    host $ cp /home/<useracct>/OMAPL137_arm_#_#_#_#/REL_LSP_#_#_#_#/PSP_#_#_#_#/bin/uImage /tftpboot
  2. Get the IP address of your host Linux workstation as follows. Look for the IP address associated with the eth0 ethernet port.
    host $ /sbin/ifconfig
  3. Open a terminal session to connect to the EVM board via RS-232 using the instructions in the Connecting to a Console Window section. If you have a Windows workstation, you can use TeraTerm. If you have a Linux workstation, you might use Minicom. (You may need to turn on line wrap)
  4. Power on the EVM board and abort the automatic boot sequence by pressing a key in the console window.
  5. Set the following environment variables in the console window:
    EVM # setenv nfshost <Linux Host IP address>
    EVM # setenv rootpath <directory to mount>
    NOTE: The <directory to mount> must match what you specified in step 5 of the Exporting a Shared File System for Target Access section. For example, /home/<useracct>/workdir/filesys.
    EVM # setenv serverip <Linux Host IP address>
    EVM # setenv bootfile uImage
    EVM # setenv bootcmd 'dhcp;bootm'
    EVM # setenv bootargs console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=${nfshost}:${rootpath},nolock mem=32M
    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 invisible characters.

    NOTE: The use of parenthesis for variable substitution is being deprecated for new U-boot releases - use curly braces {} instead. Check http://www.denx.de/wiki/view/DULG/CommandLineParsing

    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.
  6. Save the environment so that you do not have to retype these commands every time you cycle power on the EVM board:
    EVM # saveenv
  7. Boot the board using NFS:
    EVM # boot

    NOTE: The first boot of this file system may take a while to complete while security keys are being generated. Subsequent boots will not have this delay.
  8. You can now log in as "root" in the target with no password required.

Writing a Simple Program and Running it on the EVM

Make sure that you have performed the above steps to Export a Shared File System for Target Access and Adding MV Tools to Environment section.

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

  1. host $ mkdir /home/<useracct>/workdir/filesys/opt/hello
  2. host $ cd /home/<useracct>/workdir/filesys/opt/hello
  3. Create a file called hello.c with the following contents:

    #include <stdio.h>

    int main() {
    printf("Hello World!\n");
    return 0;
    }
  4. 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. target $ cd /opt/hello
  2. Run hello:
    target $ ./hello
    The output should be: Hello World!

What's Next?

See the Building the Linux Kernel section of the Getting Started Guide.