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.

GSG: Setting up OMAP-L1/AM1x Target File System

From Texas Instruments Wiki
Jump to: navigation, search

^ Up to main Getting Started Guide for OMAP-L138 Table of Contents

^ Up to main Getting Started Guide for AM18x Table of Contents

^ Up to main Getting Started Guide for AM17x Table of Contents

ATTENTION OMAP-L138 DEVELOPERS: The Generally Available (GA) Linux DVSDK 4.x for the OMAP-L138 device is now available here. There are various capabilities and improvements that have been added to this version. This is the recommended release kit for development which supersedes the SDK 1.00.xx Beta. The majority of the information below is only applicable to the SDK 1.00.xx Beta.

The AM17x/AM18x/OMAP-L138 EVM comes with a target file system pre-loaded on the SD card (see EVM installation guide). However, in order to develop Linux applications it may be necessary to set up a target file system that is NFS mounted to your development workstation. 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.

Prerequisites

  • A Linux host system to serve the NFS file system
  • A network connection between the Linux host and the EVM
  • The Arago file system that is available at Arago Repository. (Dead Link)

Exporting a Shared File System for Target Access

OMAP-L138 DEVELOPERS - See attention note at the top of the page.

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 the steps if you are using another Linux distribution.

To export the file system from your NFS server, perform the following steps. You only need to perform these steps once. Following <target_name> needs to be replaced in the below mentioned path corresponding to specific target:

Target <target_name>
OMAP-L137 OMAPL137_arm_#_#_#_#
OMAP-L138 OMAPL138_arm_#_#_#_#
AM18x AM1x_arm_#_#_#_#
AM17x AM1x_arm_#_#_#_#


  1. Log in with a user account on the host Linux workstation
  2. Perform the following commands to prepare a location for the Arago 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>.
    For PSP versions earlier than 3.20.00.11, the file system is found in the images/fs directory. Use the following commands:
    host $ cp -a /home/<useracct>/<target_name>/DaVinci-PSP-SDK-03.#.#.#/images/fs/nfs.tar.gz .
    host $ tar xvfz nfs.tar.gz
    host $ chmod 777 -R /home/<useracct>/workdir/filesys

    For PSP versions 3.20.00.11 or later, the file system needs to be downloaded sepeartely from the product download page into a temporary directory, such as /tmp. After downloading, use the following commands:
    host $ cp -a /tmp/arago-demo-image-*.tgz .
    host $ tar xvfz arago-demo-image-*.tgz
    host $ chmod 777 -R /home/<useracct>/workdir/filesys
  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.

For Ubuntu NFS setting, please check this page

  1. 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
    host $ exit

For Ubuntu iptables settings, please check this page

Testing the Shared File System

OMAP-L138 DEVELOPERS - See attention note at the top of the page.

To test your NFS setup, follow these steps:

  1. Copy the kernel Image (uImage) from the /home/<useracct>/<target_name>/DaVinci-PSP-SDK-03.#.#.#/images/kernel/<Platform> 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>/<target_name>/DaVinci-PSP-SDK-03.#.#.#/images/kernel/<Platform>/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 4 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;tftp;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.

Mounting Root File System

OMAP-L138 DEVELOPERS - See attention note at the top of the page.

This section will cover how to set the U-Boot environment variables to mount the root file system from various storage media.

From NFS

In order to boot Linux with the file system mounted from NFS you will need to have first exported an NFS target file system. For more information on how to do this please see the page here. This section also assumes that you are using DHCP to obtain the ip address for the board. If you are using static IP you will need to modify the bootargs to set the ipaddr variable appropriately.

EVM # setenv nfshost <ip address on nfs host>
EVM # setenv rootpath <directory to mount>
EVM # setenv bootargs console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=${nfshost}:${rootpath},nolock mem=32M

From USB Storage

In order to boot Linux with the root file system mounted from a USB storage device you will need to set the following bootargs. For more information on configuring a USB storage device with a root file system please see Creating file systems on removable media

EVM # setenv bootargs console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/sda2 rootfstype=ext2 mem=32M

From SD/MMC

In order to boot Linux with the root file system mounted from a USB storage device you will need to set the following bootargs. For more information on configuring a USB storage device with a root file system please see Creating file systems on removable media

EVM # setenv bootargs console=ttyS2,115200n8 noinitrd rw ip=dhcp root=/dev/mmcblk0p1 rootfstype=ext2 mem=32M

Writing a Simple Program and Running it on the EVM

OMAP-L138 DEVELOPERS - See attention note at the top of the page.

Make sure that you have performed the steps to export a shared file system for target access and install the Code Sourcery Tools.

Perform the following steps on the NFS host system as user (not as root). The steps below assume that the CodeSourcery tools are already present in your $PATH variable. Information on how to add the tools to your $PATH can be obtained form the Getting Started Guide for the CodeSourcery tools.

  1. host $ mkdir -p /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-none-linux-gnueabi-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?

Please continue on to the Building software components for OMAP-L1 or to Building software components for AM18x section of the Getting Started Guide.