##### Page tree

Go to start of banner

# PhyCORE-OMAP44xx Linux Quickstart PD11.1.0

This document describes how to install and work with the Linux Board Support Package (BSP) for the phyCORE-OMAP4430 platform. This BSP provides a fundamental software platform for development, deployment and execution on the phyCORE-OMAP4430.

The Quickstart contains instructions for:

• Host Setup
• Building a BSP (Platform, Kernel, Root Filesystem)
• Flashing images to NAND (MLO, Barebox, Kernel, Root Filesystem)

## 2 Host Setup

The phyCORE-OMAP44xx (PCM-049) has been developed and tested with Ubuntu 10.04 LTS Lucid Lynx [Installation Guide]. Although it is possible to use a different OS, some setup information will contain OS-specific commands and paths for settings.

Update repositories and upgrade installed packages:

sudo apt-get update


### 2.1 Server Setup

Support for installing and setting up TFTP, NFS, and Samba server settings to enable communication between multiple systems and the target.

#### 2.1.1 TFTP

TFTP allows files to be downloaded from one machine to another. With most embedded Linux devices, TFTP is an efficient way to boot the kernel during development so that the user does not have to flash a new kernel every time it is modified. It is also helpful when updating images in flash from Barebox.

First, start by installing the TFTP server.

sudo apt-get install tftpd-hpa


Next, files can be accessed from another machine on the same network by simply using the IP address of the host. Specify a folder where the files will reside on the host by replacing the folder path for TFTP_DIRECTORY with whatever folder you wish to use as your TFTP file storage location, or leave the folder as the default.

sudo gedit /etc/default/tftpd-hpa

# /etc/default/tftpd-hpa

TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_OPTIONS="--secure"


If you made any changes to the settings of the TFTP server, you need to restart it for them to take effect.

sudo restart tftpd-hpa


Lastly, if you would like to grant every user on the system permission to place files in the TFTP directory, use the following command, replacing <TFTP_DIRECTORY> with your chosen location.

sudo chmod ugo+rwx <TFTP_DIRECTORY>


#### 2.1.2 NFS

A network file-system (NFS) server gives other systems the ability to mount a file-system stored on the host and exported over the network. In embedded development, this is essential for quickly testing applications and evaluating different file-system setups.

To begin the installation process use the following command:

sudo apt-get install nfs-kernel-server


Exported filesystems are designated in the "/etc/exports" file and allow you to choose both the directory to be exported and many settings for accessing the exports. Below is an example for exporting a folder called "nfs_export-ex" located in a user's home directory.

sudo gedit /etc/exports

# /etc/exports

/home/<user>/nfs_export-ex  *(rw,sync,no_root_squash,no_subtree_check)


The options (rw, sync, no_root_squash, no_subtree_check) for this folder are essential in setting up the NFS export correctly. For more information on additional options, refer to the man page for 'exports'.

• rw enables

read and write access when the directory is mounted

• sync

tells the file-system to handle local access calls before remote access

• no_root_squash

allows root access when mounting the file-system

• no_subtree_check

reduces the number of checks the server must make to ensure that an exported sub-directory is within an exported tree and also enables access to root files in conjunction with no_root_squash

After modifying this file, in order to mount the directories as an NFS, you must force the NFS server to export all of the directories listed in "/etc/exports".

sudo /usr/sbin/exportfs -va


#### 2.1.3 Samba

Samba servers are an excellent way to access a Linux file-system on a Windows machine via a network connection. Using a Samba server, it is quick and easy to transfer files between systems. To install a Samba server, use the following command:

sudo apt-get install samba


Before the Samba share can be mounted on another machine it's necessary to modify the configuration file to allow write access and access to home directories. Start by editing the "/etc/samba/smb.conf" file.

sudo gedit /etc/samba/smb.conf


Inside this file there are four specific things that need to be uncommented (remove the ';' at the beginning of the line) to enable the sharing of home folders and write access. Below is the section that must be modified:

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
;   comment = Home Directories
;   browseable = yes

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.


The outcomes after the changes are made follow:

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
comment = Home Directories
browseable = yes

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.


NOTE: It might also be necessary to change the "workgroup = " line to match the workgroup for your machine.

To apply the changes, the next step is to restart all Samba-related processes.

sudo restart smbd
sudo restart nmbd


Lastly, each user needs to have a password enabled to be able to use the Samba server. There are no rules for this password. The simplest method for choosing this password is to make it the same as the UNIX user's password, but it is not a requirement. After typing in the command below, you will be prompted to enter the password for the specified user.

sudo smbpasswd -a <user>


As mentioned in the configuration file, the samba share can be connected by accessing "\\<host machine ip>\\<user>" by either mounting a network share or using Windows explorer to navigate to it.

### 2.2 PTXdist

#### 2.2.1 General Information

PTXdist is a set of tools created by Pengutronix to help manage all of the BSP sources, from x-loader to the filesystem and its applications. It makes it easier for a user to manage everything for specific platforms and toolchains without manually repeating relatively complex commands every time it is necessary to build a new image. It is important to note the PTXdist version because more than one may be necessary for building the toolchain and BSP.

#### 2.2.2 Extracting Sources

Visit the phyCORE-OMAP44xx's BSP page for information on the current versions of BSP tools.

1. ptxdist-2011.02.0 for installing/constructing the cross-compile toolchain (Optional if using a pre-existing environment)
2. ptxdist-2011.10.0 for building the BSP with the toolchain mentioned above.

The following instructions correspond to downloading PTXdist for building the BSP, ptxdist-2011.10.0. Therefore, to download the PTXdist software for building the toolchain, ptxdist-2011.02.0, repeat the instructions replacing 2011.10.0 with 2011.02.0. In order to be built, extract the archive containing the PTXdist software:

tar -jxvf ptxdist-<bsp version number>.tar.bz2
cd ptxdist-<bsp version number>


Now that the source has been extracted, the next step is to configure it for building.

#### 2.2.3 Pre-Requisites

PTXdist checks for specific packages that must be installed before it can be successfully built. From the PTXdist source directory, ptxdist-2011.10.0, execute the command to begin a script that uses GNU autotools to help set up the environment for building the distribution.

./configure


This command automatically stops if it is missing a package and states why and what package to install to continue with the initial setup. After successfully running the configure script, build and install PTXdist.

From the PTXdist source directory, ptxdist-2011.10.0:

make
sudo make install


The install location is "/usr/local" by default, which is why the make install command must be run with root privileges. If another directory is preferred for the install, use the --prefix option when installing, but be sure to add the "bin/" directory of the installed tools in this new folder to $PATH by modifying and sourcing ~/.bashrc. source ~/.bashrc  Now that the install is complete, the PTXdist folder can be removed, as well as the original archive. Optional: cd .. rm -rf ptxdist-<bsp version number>*  #### 2.2.4 Using PTXdist PTXdist is a console command tool and different functions are run by extending parameters to the ptxdist base command. ptxdist <parameter>  To generate a full list of parameters and a description of the function, use the help command: ptxdist help  Since PTXdist versions can be installed in parallel it may be useful to view the version number corresponding to the ptxdist command: ptxdist --version  If the output of this command does not correlate to the desired version of PTXdist, affix the ptxdist command with the version number. For example, for the phyCORE-OMAP44xx BSP, affix all ptxdist commands with 2011.10.0 resulting in ptxdist-2011.10.0: ptxdist-<bsp version number> <parameter>  Alternatively, to correlate the ptxdist command with a specific version create a symbolic link. For example, for ptxdist to correlate to ptxdist-2011.10.0: sudo ln -fs /usr/local/lib/<ptxdist version number>/bin/ptxdist /usr/local/bin/ptxdist  Potential Issues: • Wrong PTXdist Version It is important to use the correct version of PTXdist when building the Toolchain or BSP. If the incorrect version is used, the following will result: error: The ptxconfig file version and ptxdist version do not match:configfile version: 2012.03.0ptxdist version: 2011.11.0 You can either migrate from an older ptxdist release with:'ptxdist migrate' or, to ignore this error, add '--force'to ptxdist's parameters, e.g.:'ptxdist --force go' The version of PTXdist used is noted as ptxdist version where the one required is specified as configfile version. Therefore, rerun the command with the correct version either appended to ptxdist or create a symbolic link. If the merge or force options were used on the Toolchain or BSP they will need to be removed and reinstalled to be built with the correct PTXdist version. Please note that the above is a generic example and may not apply directly to your BSP. ##### 2.2.4.1 Setup The first time PTXdist is used, there are some setup properties that have to be configured. To run PTXdist's setup, use the following command: ptxdist setup  Once in the ptxdist setup, the only settings that should be modified are the User->Name and User->eMail. This is mainly for general logging purposes. If you wish to modify any other settings, please refer to the Getting Help section for a link to PTXdist documentation. Since PTXdist works with sources only, it needs to grab source archives from the web using wget as it advances through its setup if they do not exist already. Therefore, an internet connection is required. ### 2.3 Toolchains In order to build images or applications for an embedded device, it is necessary to have a cross toolchain that will perform the necessary operations to compile code for a specified processor and system setup. Each toolchain will have a modified GNU Compiler Collection (gcc) designed for the desired setup. The phyCORE-OMAP44xx PD11.1.0 uses the arm-cortexa9 toolchain which can be built from the OSELAS.Toolchain-2011.02.0 and ptxdist-2011.02.0 sources. #### 2.3.1 Existing Toolchains If a working toolchain is already installed for a given architecture, it is possible to use this instead of building an OSELAS Toolchain. A pre-built cortex-a9 toolchain is available from the PHYTEC FTP [Here]. Do note that since external toolchains have not been tested it is possible that they may not work properly across all environments. An extra step needs to be taken if the plan is to use an external toolchain. By default, the software package will be set to check for the vendor toolchain that it was compiled with. In order to change this, use the following command inside the root directory of the BSP: ptxdist platformconfig architecture ---> toolchain ---> () check for specific toolchain vendor  #### 2.3.2 Building OSELAS Toolchains An OSELAS toolchain, managed by PTXdist, can be easily built for a target architecture. For the phyCORE-OMAP44xx, the arm-cortexa9 architecture based toolchain is built from OSELAS.Toolchain-2011.02.0 [Here] and PTXdist 2011.02.0 [Here]. See Section 2.2 for information regarding the installation of PTXdist sources. tar -jxvf OSELAS.Toolchain-2011.02.0.tar.bz2 cd OSELAS.Toolchain-2011.02.0  Be sure to use the correct ptxdist version for the toolchain by affixing all ptxdist commands with 2011.02.0 resulting in ptxdist-2011.02.0 or see Section 2.2.4 for information on creating a symbolic link between ptxdist and ptxdist-2011.02.0. ptxdist select ptxconfigs/arm-cortexa9-linux-gnueabi_gcc-linaro-4.5-2011.02-0_glibc-2.13_binutils-2.21_kernel-2.6.36-sanitized.ptxconfig ptxdist go  The toolchain is now built and installed in /opt/OSELAS.Toolchain-2011.02.0/arm-cortexa9-linux-gnueabi and ready to be used for building the BSP. If you wish to build applications outside of the BSP directory, add the toolchain location to your PATH. Use the following from the command line or permanently add to your PATH by including it in .bashrc: PATH=/opt/OSELAS.Toolchain-<toolchain version>/arm-<processor>-linux-gnueabi_gcc-linaro-<version>_glibc-<version>_binutils-<version>_kernel-<version>-sanitized/bin/:$PATH


Following a successful build, the OSELAS.Toolchain-2011.02.0 folder can be removed, as well as the original archive.

Optional:

cd ..
rm  -rf OSELAS.Toolchain-2011.02.0*

##### 2.3.2.1 Protecting Toolchains

It is recommended, although optional, to set the /opt/OSELAS.Toolchain-2011.02.0/arm-cortexa9-linux-gnueabi directory and its contents as read-only to prevent accidental modifications to the toolchain.

## 3 Board Setup-phyCORE-OMAP4430

### 3.1 Overview

The phyCORE-OMAP4430 comes pre-flashed with x-load, barebox, linux kernel, and jffs2 filesystem.

Note: If for any reason it is necessary to re-flash the example images, they are located on the PHYTEC America FTP [here]. Refer to Section 6 Flashing Images for information on flashing these images.

After the device is out of the box and setup, make sure that there is a DB9/DB25 cable attached between the host machine and UART3 (top DB9 connector) on the OMAP4430 carrier board to enable RS-232 serial communication. In a terminal on the host, access minicom and set it up, allowing console access over the serial port.

/* If minicom is not installed */
sudo apt-get install minicom

minicom -c on -s


Navigate to "Serial port setup" in minicom and modify line "A - Serial Device : " to read /dev/ttyS0.

Note: The serial device is dependent on what COM port you are connected to on your system, so /dev/ttySO is merely an example.

Next, modify "E - Bps/Par/Bits : " to have a speed of 115200 and 8-N-1 (8N1) for the stop bits. Return to the main menu of minicom and select "Save setup as dfl" to make this the default setup anytime minicom is loaded, meaning minicom -c on is all that needs to be done in the future for this machine to be able to communicate with the kit.

## 4 Building a BSP

### 4.1 Managing Configurations

PTXdist uses the KConfig files present throughout the BSP to allow users to easily configure individual settings and drivers.

NOTE: All target source code is located in the OSELAS.BSP-Phytec-phyCORE-OMAP4/platform-phyCORE-OMAP4/build-target/ directory. For driver development and general settings or carrier board design it is necessary to know about the following three files to help integrate and modify features on the system:

• linux kernel source is build-target/linux-3.0

linux-3.0/arch/arm/mach-omap2/board-omap4pcm049.c is the board config file

• barebox source is build-target/barebox-2011.07.0

barebox-2011.07.0/arch/arm/boards/pcm049/env/config is the barebox config file

#### 4.1.1 Platform

The platform config contains the default settings for each platform including what bootloaders, kernels, and filesystem images are to be built. The settings for the platform are modified using the following command:

ptxdist platformconfig


As a user, it is rare to ever modify these settings, but it may be useful to view them.

#### 4.1.2 Kernel

Use the kernel config to modify what drivers and support are included in a linux kernel build.

ptxdist kernelconfig


#### 4.1.3 Root Filesystem

In the overall menuconfig it is easy to modify the applications and content that is built into the filesystem by toggling options in the base configuration. This allows both minimal and more complete filesystem builds to be created easily.

ptxdist menuconfig


### 4.2 Building Images with PTXdist

Building images with PTXdist is very simple. The command ptxdist go does all of the required steps to compile all of the sources and make changes only where necessary. ptxdist images builds the filesystem images.

The first time you wish to build images with this BSP, download the following file http://museum.php.net/php5/php-5.3.3.tar.bz2 and place it in the OSELAS.BSP-Phytec-phyCORE-OMAP4/src directory then execute the following two essential commands:

ptxdist platform configs/phyCORE-OMAP4-2011.10.0/platformconfig
ptxdist toolchain /opt/OSELAS.Toolchain-2011.02.0/arm-cortexa9-linux-gnueabi/gcc-linaro-4.5-2011.02-0-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin


These select the base settings and toolchain for the BSP to use. The above commands must be used for each new development environment that is setup.

ptxdist go
ptxdist images


All images are then stored in OSELAS.BSP-Phytec-phyCORE-OMAP4/platform-phyCORE-OMAP4/images.

## 5 Flashing Images

### 5.1 Using SD Card

Configure SD-Card with 64MB fat partition

Copy files in this order:

• MLO
• barebox-image (rename to barebox.bin)
• linuximage (rename to uImage-pcm049)
• root.jffs2 (rename to root-pcm049.jffs2)

Configure boot-mode for SD: SW2 switches 2, 3, and 5 ON.

NOTE: If planning to boot Linux from the SD card and not copy the kernel or filesystem to NAND, make sure to extract the contents of root.tgz to the second partition of the SD card. e.g. sudo tar -zxf root.tgz -C /media/rootfs

With the current barebox environment, it is also a requirement to use the mmc_boot command in order to boot the Linux kernel from SD.

### 5.2 Install from SD

Configure boot-mode for SD: S2 switches 2, 3, and 5 ON.

erase /dev/nand0.bareboxenv.bb
save
nand_bootstrap

gpmc_nand0.eccmode=${kernel_eccmode} erase /dev/nand0.kernel.bb cp /mnt/uImage-pcm049 /dev/nand0.kernel.bb gpmc_nand0.eccmode=${root_eccmode}
erase /dev/nand0.root.bb
cp /mnt/root-pcm049.jffs2 /dev/nand0.root.bb


Configure boot-mode for NAND: S2 switches all OFF.