##### Page tree

Go to start of banner

# PhyCORE-OMAP44xx Linux Quickstart-PD13.1.0

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

The Quickstart contains instructions for:

• Getting Started
• Host Setup
• Building a BSP
• Booting Configurations

## 2 System Requirements

### 2.1 Hardware

• phyCORE-OMAP44xx System on Module (PCM-049A)
• phyCORE-OMAP44xx Carrier Board (PCM-959)
• AC adapter supplying 12 VDC / min. 2 A
• Serial cable (RS-232)
• Straight Ethernet cable
• Optional Display

Prime View PM070WL4 LVDS (LCD-017-070W) with resistive touchscreenPrime View PD104SLF LVDS (LCD-017-104S) with resistive touchscreenEDT ETM0700G0DH6 TTL (LCD-018-070-KAP) with capacitive touchscreen

### 2.2 Software

To successfully build a customized Linux distribution using PTXdist, your host machine must be running a modern GNU/Linux Operating System either natively or via a virtual machine. This Quickstart was authored and tested with Ubuntu 12.04 LTS 32-bit Virtual Machine on a Windows 7 Host PC.

## 3 Getting Started

This section is designed to get the board up-and-running with the demo images included in the kit.

### 3.1 Making Connections

Make all required connections and then apply power to begin booting the device.

1. (optional) Connect the serial cable between top RS232 DB-9 connector (P1) and host - 115200 baud, 1 start bit, 8 data bits, 1 stop bit, no parity, no flow control

2. (optional) Connect the Ethernet cable to the RJ-45 connector (X9) and appropriate network card on the host

3. (optional) Connect the LCD power and data connectors to X12 and X13, respectfully

4. (optional) Connect a USB keyboard or mouse to the USB Standard A port (X8)

5. Connect the provided 12 VDC suppy to the power jack (X6)

Locations of the corresponding ports for Steps 1-5 are depicted in the following:

### 3.2 Kit Demos

After the target boots, Linux will be entered. A serial connection is recommended for all demos to interact with the kit and at least ensure proper shutdown. Additionally, connect a LCD to run fluid launcher, a Qt demo application launcher for embedded platforms.

Serial Communication

Requires a connected serial cable -- See Step 1

Open a terminal, such as TeraTerm (Windows) or Minicom (Linux), and setup a serial port connection.

Follow the instructions below to enable Minicom on your Linux host:1. Install Minicom via a terminal

/* if Minicom is not installed */
sudo apt-get install minicom


2. Start Minicom from the terminal:

minicom -c on -s


3. From the Minicom main menu, navigate to "Serial port setup" in the Minicom. Press Enter.4. Verify the line A - Serial Device : reads the proper serial port, ex. /dev/ttyS05. Modify the line E - Bps/Par/Bits : to have a speed of 115200 and 8-N-1 (8N1) for the stop bits.6. Press Enter to return to the main menu7. Press Esc to exit this menu

After providing power with Step 5, the system will boot into Linux.

Login as root and begin using the Linux command prompt.

When finished with the kit demo, from the Linux command line use the reboot command to restart, or the poweroff command to shutdown the system. Please note that failure to use these commands to end a session could result in a corrupted filesystem.

Fluid Launcher

• Requires a connected LCD -- see Step 3
• Highly recommended serial connection -- see Step 1 and serial communication above
• Recommended USB keyboard and mouse -- see Step 4

After providing power with Step 5, the system will boot into Linux and run fluid launcher.

Note: The default images boot directly into the fluid launcher. If the filesystem has been modified/rewritten, the system will run ts_calibrate before loading fluid launcher. Press the boxes on the screen as they appear to calibrate the touchscreen controller.

Interact with the fluid launcher on the display by touching the screen to browse through applications. When an application is highlighted, positioned in the center of the main screen and name displayed above the icon, simply clicking on it will open the application. Fluid launcher contains the following applications:

• Calculator

Use the calculator application to perform basic arithmetic. Enter operations by touching the screen or using a USB mouse or keyboard.

• Calendar

By month calendar display. Customize the view with formatting options.

• Image Viewer

View an image of choice and adjust the viewing perspective once it is loaded.

• Scribble Paint

The Scribble Paint application allows a user to draw an image in real time as well as to open and edit an existing image. Use the Options menu to select the pen width and color and begin drawing by touching the screen or clicking on the open area using a USB mouse. The following file types are supported: bmp, ico, jpeg, png, ppm, xbm, and xpm.

Customized table that supports dynamic content in cells. Supports addition of two cells, subtraction of one cell from another, multiplication of two cells, dividing one cell from another, and summing contents from an arbitrary number of cells.

• Game of Tetrix

Qt version of the classic Tetrix game. The goal of the game is to fill every square in a row to clear a line. As blocks are dropped from the top of the playing area, move, rotate, and stack the blocks to fill entire rows at the bottom of the playing area. To control the blocks, connect a USB keyboard:Left cursor - move the piece one space to the leftRight cursor - move the piece one space to the rightUp cursor - rotates the piece 90 degrees counter-clockwiseDown cursor - rotates the piece 90 degrees clockwiseD - immediately move the piece down by one rowSpace - drop a piece as close to the bottom of the board as possibleUse the buttons to control the game flow, press Start to begin; Quit to end; and Pause to freeze the game but retain its state.

• Rich-Text Editor

The Text Edit demonstration shows Qt's rich text editing facilities in action, providing an example document to experiment with. Connect a USB keyboard and mouse to insert and format text.

• Wiggly Animated Text

This example demonstrates how to animate text. Use a USB keyboard to dynamically modify the text displayed.

• Exit Embedded Demo

Exit fluid launcher. The demo can be relaunched by running the following from the Linux command line:

fluidlauncher &


If necessary, recalibrate the touchscreen from the Linux command line:

ts_calibrate


When finished with the kit demo, use the reboot command to restart, or the poweroff command to shutdown the system. Please note that failure to use these commands to end a session could result in a corrupted file system.

## 4 Host Setup

The phyCORE-OMAP44xx (PCM-049) has been developed and tested with Ubuntu 12.04 LTS Precise Pangolin [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


### 4.1 Server Setup

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

#### 4.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>


#### 4.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


#### 4.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.

### 4.2 PTXdist

#### 4.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.

#### 4.2.2 Extracting Sources

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

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

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

tar -jxvf ptxdist-2013.01.0.tar.bz2
cd ptxdist-2013.01.0


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

#### 4.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-2013.01.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-2013.01.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-2013.01.0*  #### 4.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 2013.01.0 resulting in ptxdist-2013.01.0: ptxdist-2013.01.0 <parameter>  Alternatively, to correlate the ptxdist command with a specific version create a symbolic link. For example, for ptxdist to correlate to ptxdist-2013.01.0: sudo ln -fs /usr/local/lib/ptxdist-2013.01.0/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. ##### 4.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. ### 4.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 PD13.1.0 uses the arm-cortexa9 toolchain which can be built from the OSELAS.Toolchain-2011.11.1 and ptxdist-2011.11.0 sources. #### 4.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  #### 4.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.11.1 [Here] and PTXdist 2011.11.0 [Here]. See Section 2.2 for information regarding the installation of PTXdist sources. tar -jxvf OSELAS.Toolchain-2011.11.1.tar.bz2 cd OSELAS.Toolchain-2011.11.1  Be sure to use the correct ptxdist version for the toolchain by affixing all ptxdist commands with 2011.11.0 resulting in ptxdist-2011.11.0 or see Section 2.2.4 for information on creating a symbolic link between ptxdist and ptxdist-2011.11.0. ptxdist select ptxconfigs/arm-cortexa9-linux-gnueabi_gcc-4.6.2_glibc-2.14.1_binutils-2.21.1a_kernel-2.6.39-sanitized.ptxconfig ptxdist go  The toolchain is now built and installed in /opt/OSELAS.Toolchain-2011.11.1/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.11.1 folder can be removed, as well as the original archive.

Optional:

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

##### 4.3.2.1 Protecting Toolchains

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

## 5 Building a BSP

Management of the phyCORE-OMAP44xx BSP is provided by PTXdist version 2013.01.0. If a symbolic link was not created between ptxdist and ptxdist-2013.01.0 affix all ptxdist commands with 2013.01.0 resulting in ptxdist-2013.01.0, see Section 2.2 for additional information on using PTXdist.

### 5.1 PTXdist Project Setup

Note: Replace <bsp-release-version> with the BSP release version downloaded, ex. for phyCORE-OMAP44xx PD13.1.0 BSP release, replace phyCORE-OMAP4-<bsp-release-version> with phyCORE-OMAP4-PD13.1.0. Replace <ptxdist-version> with the PTXdist version for building the BSP, ex. for phyCORE-OMAP44xx PD13.1.0 BSP release PTXdist 2013.01.0 is used, replace phyCORE-OMAP4-<ptxdist-version> with phyCORE-OMAP4-2013.01.0.

tar -xvzf phyCORE-OMAP4-<bsp-release-version>.tar.gz
cd phyCORE-OMAP4-<bsp-release-version>


Use the pre-defined ptxconfig to select a software platform and select phyCORE-OMAP4 for the hardware platform.

ptxdist-2013.01.0 select configs/ptxconfig
ptxdist-2013.01.0 platform configs/phyCORE-OMAP4-<ptxdist-version>/platformconfig


PTXdist should automatically detect the toolchain:

found and using toolchain:
'/opt/OSELAS.Toolchain-2011.11.1/arm-cortexa9-linux-gnueabi/gcc-4.6.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/bin'


Note: If the toolchain was not installed in the OSELAS.Toolchain() default location, PTXdist will not automatically detect it. The toolchain will need to be selected manually, see PTXdist User Manual Section 3.2.4 for additional information.

Update the Linux kernel MD5SUM

Due to a change of the Linux kernel source from linux-3.4.tar.bz2 to linux-3.4.tar.xz the MD5SUM must be updated before building the BSP. Change the kernel source md5sum from "146af0160fc7a60cf9acf44aec13482b" to "967f72983655e2479f951195953e8480" in the Platform.

From the phyCORE-OMAP4-<bsp-release-version> directory:

ptxdist-2013.01.0 platformconfig
[*] Linux kernel --->
(967f72983655e2479f951195953e8480) kernel source md5sum


### 5.2 Managing Configurations

All source code is located in the phyCORE-OMAP4-<bsp-release-version>/platform-phyCORE-OMAP4/build-target directory. To help integrate and modify features on the system for both driver development and general settings or carrier board design, it is necessary to know about the files summarized by the following:

• Linux Kernel Source (linux-3.4)

Board File: linux-3.4/arch/arm/mach-omap2/board-omap4pcm049.c

• Barebox Source (barebox-2013.06.0)

Board File: barebox-2013.06.0/arch/arm/boards/pcm049/board.cConfiguration File: barebox-2013.06.0/arch/arm/boards/pcm049/env/config

Note: The files located in <bsp_install_dir>/platform-phyCORE-OMAP4/ are not generated until after the first successful build of the BSP.

PTXdist uses the kernel configuration, KConfig, files present throughout the BSP for straightforward user configuration of individual settings and drivers. The platform, kernel, and project’s root filesystem configuration menus will be the most beneficial.

#### 5.2.1 Platform

The platform configuration menu contains the default settings for each platform including what bootloaders, kernel, and filesystem images are to be built and located.

ptxdist-2013.01.0 platformconfig


#### 5.2.2 Kernel

The kernel configuration menu allows the user to adjust the drivers and support included in a Linux kernel build.

ptxdist-2013.01.0 kernelconfig


#### 5.2.3 Root Filesystem

Configuration of the project’s filesystem can be done in the overall menuconfig. By toggling the options in the base configuration, the applications and content built into the filesystem can be modified directly. This allows both minimal and more complete filesystem builds to be created easily.

ptxdist-2013.01.0 menuconfig


### 5.3 Building Images

Building and creating images with PTXdist is very simple. All the required steps to download sources and build packages in the correct order are done using the ptxdist go command. Following a successful build, the ptxdist images command will create images to deploy on the target.

ptxdist-2013.01.0 go
ptxdist-2013.01.0 images

Potential Issues:

The PTXdist build process relies on obtaining source information from the web, therefore in some cases the content to be downloaded may no longer exist and ptxdist go will fail. PHYTEC cannot guarantee the accessibility of all the webpages that are needed to build a BSP.

Find an alternative download link for the file as it appears in the build output, download the file, place it in phyCORE-OMAP4-<bsp-release-version>/src directory in its compressed form, and restart the build process by calling ptxdist go again. To find a missing source package check our ftp-server via ftp://ftp.phytec.de/pub/BSP_PACKAGES/EXTERNALS. If you come across a missing source package, try using a search engine to find the file or visit PHYTEC's Support Portal

Files that have known dead links for the phyCORE-OMAP44xx PD13.1.0 Linux BSP include:

All images are stored in phyCORE-OMAP4-<bsp-release-version>/platform-phyCORE-OMAP4/images.

### 5.4 Enabling Interfaces

This section shows the configuration settings for common interfaces.

#### 5.4.1 WiFi

To build an image which includes WiFi support:

Important:

Before enabling WiFi apply the 0001-pcm049-wl12xx-use-set_power-to-control-WL_EN.patch patch to the Linux source directory:

cd platform-phyCORE-OMAP4/build-target/linux-3.4/
patch -p1 < 0001-pcm049-wl12xx-use-set_power-to-control-WL_EN.patch


Before completing the following return to the BSP base directory (cd ../../../), phyCORE-OMAP4-<release version>.

ptxdist kernelconfig
Device Drivers --->
Network device support --->
[*] Wireless LAN --->
[*] TI Wireless LAN support --->
<M> TI wl12xx support
-M- TI wlcore support
< >   TI wlcore SPI support
<M>   TI wlcore SDIO support

ptxdist menuconfig
Project Specific Configuration --->
[*] Wifi module support


The file /etc/wpa_supplicant.conf on the target will need to have the appropriate configuration for your network.

Note: To use WiFi on the target, an inserted SD Card at SDMMC1 (X11) is required.

## 6 Managing Images

The phyCORE-OMAP44xx is pre-loaded with kit demo images in NAND Flash. Images located on the PHYTEC FTP or built images can be run on the target.

To boot the board, the following images will be required:

FileName
MLOMLO
Linux kerneluImage-pcm049
Root Filesystemroot-pcm049.ubi (NAND or NOR Flash)
root-pcm049.tgz (SD Card)

The following instructions describe how to create a bootable SD card for the phyCORE-OMAP44xx. Atleast a 4 GB SDHC SD card is recommended but larger may be required depending on the size of the root filesystem.

If using an SD card that has already been formatted with this script or a similar method, skip to the appropriate steps below-- Step 6 if updating MLO, Barebox, or the Linux kernel; Step 7 if only updating the root filesystem and continue the steps from there.

1. Make a script to correctly format the card and mark as bootable.

The following is contents of a script from OMAPpedia [Here], omap3-mkcard.sh, that correctly partitions the card and marks it as bootable.

#!/bin/bash
if [ ! "$1" = "/dev/sda" ] ; then unset LANG DRIVE=$1
if [ -b "$DRIVE" ] ; then dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=fdisk -l $DRIVE | grep Disk | awk '{print$5}'
echo DISK SIZE - $SIZE bytes CYLINDERS=echo$SIZE/255/63/512 | bc
echo CYLINDERS - $CYLINDERS { echo ,9,0x0C,* echo ,,,- } | sfdisk -D -H 255 -S 63 -C$CYLINDERS $DRIVE mkfs.vfat -F 32 -n "boot"${DRIVE}1
mke2fs -j -L "rootfs" ${DRIVE}2 fi fi  2. Determine the SD card device name The SD card device name is of the form /dev/sd[b|c|d|e]. Run the following without and with the SD card connected: ls /dev/sd*  The device that appeared on the call to ls with the SD card but not the call without is the SD card device. 3. Unmount all partitions of the SD card, using the SD card device name from Step 2: umount /dev/sd[b|c|d|e]*  4. Run the script created in Step 1, omap3-mkcard.sh, specifying the SD card device name from Step 2: sudo ./omap3-mkcard.sh /dev/sd[b|c|d|e]  5. Mount all partitions Remove and reinsert the SD card, automount will mount /media/boot and /media/rootfs 6. Copy the files in this order to the first partition of the SD card (/media/boot) MLObarebox-image (rename to barebox.bin)linuximage (rename to uImage-pcm049) cp MLO /media/boot cp barebox.bin /media/boot cp uImage-pcm049 /media/boot  7. Place the root filesystem on the MCC/SD Card depending on if the intention is to Flash to NAND or Boot from SD/MMC Root Filesystem for flashing - When flashing the root filesystem to NAND from SD card, following successful placement of MLO, Barebox, and the Linux kernel, copy root.ubi (renamed to root-pcm049.ubi) to the first partition of the SD Card. Note that if your build options produce an image which is too large to fit on the SD Card, a tftp server must be used as outlined below. cp root-pcm049.ubi /media/boot  SD Card Boot - In the case of booting Linux from the SD Card, extract the contents of root.tgz to the second partition of the SD Card (/media/rootfs). sudo tar -zxf root.tgz -C /media/rootfs; sync  8. Unmount each partition before removing the SD Card umount /media/boot /media/rootfs  ## 7 Booting Configurations ### 7.1 Selecting Boot Modes The bootloader, one of the key software components included in the BSP, completes the required hardware initializations to download and run operating system images. The location of the primary bootloaders, MLO and barebox, is determined by the boot mode. The boot mode is selected from the S2 dipswitch on the Carrier Board, set the S2 dipswitch corresponding to the supported boot modes: NAND S2-1 to S2-8 OFF SD Card S2-2, S2-3, and S2-5 ONS2-1, S2-4, S2-6 to S2-8 OFF ### 7.2 Basic Settings After application of power, approximately three seconds are allotted for the user to hit any key which will halt autoboot and enter Barebox. Note: help is a useful tool in Barebox to show available commands and usage. Use the Barebox configuration file to modify environment variables, select boot settings, and setup networking parameters. edit /env/config  From the configuration file, return to the Barebox prompt by pressing CTL+D to apply changes or CTL+C to cancel. To retain changes, at the Barebox prompt save the environment. saveenv  #### 7.2.1 Network Settings serverip=###.###.###.### eth0.ipaddr=###.###.###.### eth0.netmask=###.###.###.### eth0.gateway=###.###.###.### eth0.serverip=###.###.###.### eth0.ethaddr=##:##:##:##:##:## nfsroot=$serverip:<NFS mount location>


A dedicated IP address for the SOM. This is crucial if TFTP will be used for updating the device's images at any point.

Netmask for the network: typically 255.255.255.0. This is only necessary if the TFTP directory is located on another network.

• gateway

Gateway IP for the network. This is only necessary if the TFTP directory is located on another network.

• serverip

IP address of the host or another machine. serverip corresponds to where the NFS directory, if it exists is located; eth0.serverip corresponds to where the TFTP directory, if it exists, is located.

MAC address for the device. Set this to the MAC ID, which is printed on the sticker on the SOM.

• nfsroot

Location of the path to the NFS directory of the host or another machine, setup in Section 4.1.2. For example: /home//phyCORE-NFS

#### 7.2.2 Boot Settings

By default, the phyCORE-OMAP44xx kit is setup to boot the Linux kernel and root filesystem from NAND. Boot settings are determined by the following environment variables:

kernel_loc=<tftp|disk|nor|nand>
rootfs_loc=<net|disk|nor|nand>
rootfs_type=<ext3|jffs2|ubifs>

• kernel_loc

Specifies the location of the Linux kernel. Set this to be:tftp - To boot the Linux kernel via TFTPdisk - To boot the Linux kernel from the SD Cardnand - To boot the Linux kernel from NAND (default)

• rootfs_loc

Specifies the location of the root filesystem. Set this to be:net - To mount the root filesystem via NFSdisk - To mount the root filesystem from the SD Cardnand - To mount the root filesystem from NAND Flash (default)

• rootfs_type

Specifies the root filesystem type. Set this depending on the location of the root filesystem:ext3 - If rootfs_loc=diskubifs - If rootfs_loc=nand (default)

#### 7.2.3 Display Settings

Display either via DVI or LCD is supported and selected in the Display section of the configuration file.

To use DVI as your primary output, set display to dvi. Additionally, select the resolution by setting dvi_resolution to one of the following:

• 640x480-60
• 800x600-60
• 1024x768-60
display=dvi
dvi_resolution=1024x768-60


To use the PHYTEC display connector as your display, set display to one of the five supported. For example, the file should resemble the following if the 7" EDT display with capacitive touch and adapter board, ETM0700G0DH6 (LCD-018-070KAP) screen is to be used on the target device:

display='edt_etm0700G0dh6'

DisplayPHYTEC Display Part NumberDescriptionResolution
'pd050vl1'LCD-017-050V5" VGA LCD with resistive touch640x480
'pm070wl4'LCD-017-070W7" WVGA LCD with resistive touch800x480
'pd104slf'LCD-017-104S10.4" SVGA LCD with resistive touch800x600
'edt_etm0700G0dh6'LCD-018-070KAP7" WVGA LCD with capacitive touch800x480

### 7.3 Booting Options

From the Barebox prompt, continue the boot process using the locations for the Linux kernel and root filesystem defined in the configuration file.

boot


This command also allows the user specify the location of the kernel and root filesystem without modifying the configuration file.

boot [-m <mode>] [-k <kernel_option>] [-r <rootfs_option>] [-i <ip_mode>] [-o <oftree_option>]


Note: By typing _boot_help in the barebox prompt, a summary of the syntax, options, and parameters are provided.

The following provides examples to show the different uses of the boot command.

DescriptionKernelRoot FilesystemCommand
Fixed kernel and root filesystem, same locationTFTPNFSboot -m net
Fixed kernel, default root filesystemNANDdefaultboot -k nand
Default kernel and fixed root filesystemdefaultNFSboot -r net
Fixed kernel and root filesystem, different locationTFTPNANDboot -k net -r nand

Note: The rootfs_type parameter will need to be modified prior to running the boot command.

SD/MMC card Boot

To boot the Linux kernel and root filesystem from SD card use the script use the provided mmc_boot script:

mmc_boot


## 8 Flashing Images

Images that were built or the example images located on the PHYTEC America FTP [Here] can be flashed to the NAND Flash on the target from a TFTP server using the Barebox command line or from an SD/MMC Card.

### 8.1 Remote Flashing

TFTP is one of the simplest ways to apply modifications during development. The following provides detailed steps to remotely flash images to NAND.

• Make a serial connection, see Step 2 and Serial Communication
• Connect an Ethernet cable, see Step 3
• Power the target, see Step 5
• Halt autoboot and enter Barebox
• Verify the network settings in the environment configuration file

eth0.ipaddr, eth0.serverip, eth0.netmask, and eth0.gateway should match that of the TFTP serverNote: Use CRTL+D to exit; store the environment changes by executing saveenv

• Use the Barebox update command to download an image from the TFTP server, erase the required amount of flash, and then write the image from RAM into the flash.
update -t <kernel|rootfs|barebox|bareboxenv|xload|oftree> -d <nor|nand> [-m tftp|xmodem] [-f imagename] –c


Note: Enter _update_help or update in the Barebox prompt to generate a summary of the syntax, options, and parameters.

• If the bootloader, Barebox or the Barebox default environment, was updated reboot the target for the changes to take effect.
reset


The commands used to update each individual file to NAND is detailed by the following:

MLO

A valid MLO must be available on the TFTP server, <TFTP_DIRECTORY>/phyCORE-OMAP4/images/MLO.

Note: Use caution when updating MLO. If it is not updated with a valid image, the target will not boot. This can be rectified by preparing an SD Card and using it to Flash NAND.

update -t xload -d nand –m tftp -f phyCORE-OMAP4/images/MLO


Barebox

A valid barebox-image must be available on the TFTP server, <TFTP_DIRECTORY>/phyCORE-OMAP4/images.

Note: Use caution when updating Barebox. If it is not updated with a valid image, the target will not boot. This can be rectified by preparing an SD Card and using it to Flash NAND.

update -t barebox -d nand –m tftp -f phyCORE-OMAP4/images/barebox-image


Barebox Default Environment

To restore the default Barebox environment, simply delete the Barebox environment partition.

erase /dev/nand0.bareboxenv.bb
saveenv


Kernel

A valid uImage-pcm049 must be available on the TFTP server, <TFTP_DIRECTORY>/phyCORE-OMAP4/images.

update -t kernel -d nand –m tftp -f phyCORE-OMAP4/images/uImage-pcm049


Root Filesystem

A valid root-pcm049.ubi must be available on the TFTP server, <TFTP_DIRECTORY>/phyCORE-OMAP4/images.

update -t rootfs -d nand –m tftp -f phyCORE-OMAP4/images/root-pcm049.ubi


### 8.2 SD/MMC Flashing

The storage device, SD/MMC, of the target provides a method for flashing the bootloader, kernel, and root filesystem to NAND. SD/MMC Flashing is most beneficial for updating the primary bootloaders if they have been corrupted. The following provides detailed steps to flash from SD/MMC Card.

• Create a SD Card and copy the images that will be flashed to the first partition of the SD Card (/media/boot).
• Make a serial connection, see Step 2 and Serial Communication
• Connect an Ethernet cable, see Step 3
• Plug the SD Card into SDMMC1 (X11) on the Carrier Board
• Power the target, see Step 5
• Halt autoboot and enter Barebox
• Mount the SD/MMC Card
mkdir mnt
mount /dev/disk0.0 fat /mnt

• Use the Barebox command line to

For convenience, the provided barebox includes a script that will complete all required steps for flashing MLO and barebox:

nand_bootstrap


Alternatively, individual files can be flashed which allows the more freedom to what they need to flash. The general procedure is to set eccmode (error-correction-code mode), erase the NAND flash at the target location, and copy the file from SD/MMC Card to NAND Flash. The following provides examples of individual files flashed to NAND from SD/MMC in Barebox:

MLO

A valid MLO must be available on the first partition of the SD Card, /media/boot.

gpmc_nand0.eccmode=${xload_eccmode} erase /dev/nand0.xload.bb cp /mnt/MLO /dev/nand0.xload.bb  Barebox A valid barebox-image must be available on the first partition of the SD Card, /media/boot. gpmc_nand0.eccmode=${barebox_eccmode}
erase /dev/nand0.barebox.bb
cp /mnt/barebox-image /dev/nand0.barebox.bb


Barebox Default Environment

To restore the default Barebox environment, simply delete the Barebox environment partition.

erase /dev/nand0.bareboxenv.bb


Kernel

A valid uImage-pcm049 must be available on the first partition of the SD Card, /media/boot.

gpmc_nand0.eccmode=${kernel_eccmode} erase /dev/nand0.kernel.bb cp /mnt/uImage-pcm049 /dev/nand0.kernel.bb  Root Filesystem A valid root-pcm049.ubi must be available on the first partition of the SD Card, /media/boot. gpmc_nand0.eccmode=${root_eccmode}
erase /dev/nand0.root.bb
cp /mnt/root-pcm049.ubi /dev/nand0.root.bb