This document describes how to install and work with the Linux Board Support Package (BSP) for the phyCORE-AM335X platform. This BSP provides a fundamental software platform for development, deployment and execution on the phyCORE-AM335X.
The Quickstart contains instructions for:
The phyCORE-AM335X (PCM-051) 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.
Support for installing and setting up TFTP, NFS, and Samba server settings to enable communication between multiple systems and the target.
2.1.1 TFTPTFTP 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.
Next, files can be accessed from another machine on the same network by simply using the IP address of the host. You must 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.
If you made any changes to the settings of the TFTP server, you need to restart it for them to take effect.
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
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:
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.
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'.
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".
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:
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.
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:
The outcomes after the changes are made follow:
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.
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.
As mentioned in the configuration file, the samba share can be connected by accessing "\\
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.
2.2.2 Extracting SourcesNOTE: Visit the AM335X's BSP page [phyCORE-AM335X Linux BSP-PD12.1.0] for the correct BSP tools and images.
Note: If your BSP contains a different version of ptxdist (see BSP page), replace ptxdist-2010.11.1.tgz with the correct version as necessary in the instructions below
To install PTXdist you need to extract the archive with the PTXdist software "ptxdist-2010.11.1.tgz."
The PTXdist packet has to be extracted in order to be built before the installation. In this example, we assume that the "ptxdist-2010.11.1.tgz" file has been placed in the ~ (/home/
Now that the source has been extracted, the next step is to configure it for building.
2.2.3 Pre-RequisitesPTXdist checks for specific packages that must be installed before it can be successfully built. The following command begins a script that uses GNU autotools to help set up the environment for building the distribution.
This command will automatically stop if it is missing a package, and tell you why and what package to install to continue with the initial setup. After successfully running the configure script, PTXdist is ready to be built and installed.
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 your $PATH by modifying and sourcing ~/.bashrc.
Now that the install is complete, the PTXdist folder in the ~ (/home/
Optional:
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:
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.
2.3 ToolchainsIn 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.
For example, the following are all toolchains contained in the OSELAS Toolchain-1.99.3.7 distribution:
If a working toolchain is already installed for a given architecture, it is possible to use this instead of building an OSELAS Toolchain. 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:
Navigate to "architecture->toolchain" and clear the "check for specific toolchain vendor" field.
2.3.2 Building OSELAS ToolchainsDownload [OSELAS.Toolchain-2011.02.0] and place it in the ~ (/home/
Optional:
The toolchain is now built and installed in "/opt/OSELAS.Toolchain-2011.11.0/arm-cortexa8-linux-gnueabi" and ready to be used for building the BSP.
2.3.2.1 Protecting ToolchainsIt is recommended, although completely 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.
The phyCORE-AM335X comes pre-flashed with MLO, barebox, linux kernel, and root filesystem. After the device is out of the box and setup, simply applying power will boot the pre-installed images from NAND flash.
3.1 ConnectionsPower and host-PC connections must be made to the target device. The hardware manual, included with the Rapid Development Kit, may be referred to for specific connection information.
3.1.1 PowerThe primary input power for the phyCORE-AM335X Carrier Board comes from the wall adapter jack, X3 (+5 V). Upon application of power, LED D2 should light up (red) and initial serial data will be sent by UART0. The Carrier Board provides options for a warm reset or system power ON/OFF without the removal of the power source through push buttons S6 and S7, respectfully.
3.1.2 SerialA serial connection is used as system communication for boot-up interaction throughout start-up and as a monitoring/debugging interface. This connection is made between the Host and UART0 on the phyCORE-AM335X.
The following provides a summary of the serial settings required to allow console access over the serial port in a communications program on the host such as Minicom:
Setting | Value |
Bits per second | 115200 bsp |
Data bits | 8-bits |
Stop-bit | 1 |
Flow Control | None |
Minicom is the recommended communications program on the host for serial communication to the device.
To install Minicom, execute the following in a terminal on the host:
Start minicom from the terminal in the following way:
Minicom will be executed and the main menu will be displayed in the terminal:
Navigate to "Serial port setup" in the Minicom main menu and modify line A - Serial Device : to read /dev/ttyS0 and line E - Bps/Par/Bits : to have a speed of 115200 and 8-N-1 (8N1) for the stop bits:
Note: The serial device is dependent on what COM port you are connected to on your system, so /dev/ttyS0 is merely an example.
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. Be sure that permissions allow writing to minirc.dfl by:
sudo chmod ugo+rwx /etc/minicom3.1.3 EthernetThe Ethernet connection is used for flashing, downloading, and debugging images and applications. Connect the cross-over Ethernet cable to the Ethernet connector on the target, X12, and appropriate network card on the host. LED D15 (green) on the Carrier Board verifies the connection.
3.2 Image FormatThe bootloader, kernel, and root filesystem specific to the phyCORE-AM335X can be provided over a wide variety of sources such as the PHYTEC FTP, preloaded to NAND Flash, SD Card, TFTP Server, or NFS Server. Refer to the Flashing Images section for information on how to flash these images.
3.2.1 PHYTEC FTPIf for any reason it is necessary to re-flash the example images, they are located on the PHYTEC America FTP [here].
3.2.2 NAND FlashThe images on NAND Flash should be named in the following way:
File | File Name |
MLO | MLO |
barebox | u-boot.img |
barebox environment | bareboxenv |
Linux kernel | uImage |
Root filesystem | root.ubifs |
When used, SPI NOR Flash, suitable for small code footprint applications, can be used for booting. Since the MLO for SPI NOR Flash must be byte-swapped, the MLO is built under a different configuration (Section 4.2.1.1). The files on SPI NOR Flash should match the following format:
File | File Name |
MLO | MLO |
barebox | u-boot.img |
barebox environment | bareboxenv |
Linux kernel | uImage |
Root filesystem | root.ubifs |
NOTE: Do not use the newly created u-boot.bin, it will not work properly and has a known bug.
3.2.4 SD CardImages can be placed on a SD/MMC card in the following way:
User Intentions | File Order | File Name |
Boot from SD Card | MLO barebox Linux kernel root filesystem | MLO u-boot.img uImage root.tgz |
Flash NAND | MLO barebox Linux kernel root filesystem | MLO u-boot.img uImage root.ubifs |
Flash SPI NOR | MLO barebox Linux kernel root filesystem | MLO.spi u-boot.img uImage root.ubifs |
In the case of booting Linux from the SD Card, extract the contents of root.tgz to the second partition of the SD Card in the following way:
sudo tar -zxf root.tgz -C /media/rootfs3.2.5 TFTP ServerImages are available over the TFTP server, setup in Section 2.1.1.
The following files are present in a directory, such as
File | File Name |
MLO | MLO |
barebox | u-boot.img |
barebox environment | barebox-default-environment |
Linux kernel | uImage |
An entire root filesystem can be made accessible over the NFS Server, setup in Section 2.1.2.
To have the ability to mount the file system, root.tgz can be extracted to a NFS server directory such as /home/
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 boot mode, selected from the S5 dipswitch on the Carrier Board, determines the location of the x-loader, MLO. Commonly, the Carrier Board switches will also determine the location of barebox, which is booted by MLO. The S5 switch settings for the boot modes of NAND, SPI NOR, and MMC/SD Card are shown by the following:
3.3.1 NANDTo boot from NAND, using the following switch settings:
S2-1 to S2-8 OFF3.3.2 SPI NORTo boot from SPI NOR, use the following switch settings:
S5-1, S5-2, S5-5, S5-6 ONS5-3, S5-4, S5-7, S5-8 OFF3.3.3 SD CardTo boot from SD Card, use the following switch settings:
S5-1 to S5-4, S5-6 ONS5-5, S5-7, S5-8 OFF3.4 Working with BareboxThe phyCORE-AM335X uses barebox as its bootloader, which is provided with a predefined environment setup to support the target device. The boot loader allots approximately three seconds to halt autoboot and enter barebox, in which any key must be pressed:
In barebox there are a wide variety functions which can be viewed by using the help command:
Barebox can be customized with environment variables and scripts to support a wide variety of booting and flashing options.
3.4.1 Environment VariablesThe settings most necessary for operation are environment variables in barebox. To obtain a list of current environment variables, use the printenvcommand:
The configuration file provided by barebox is located in /env/config, this file allows the user among many things, to modify environment variables and setup networking parameters. To open and make edits to the /env/config file, do the following in barebox:
A part of setting network parameters is to enter the IP address of the TFTP and NFS servers, which is likely the IP address of the host if setup inSection 2.1.2. Therefore, search for the line beginning with eth0.serverip and modify to reflect the correct IP address, 192.168.3.10 is the default:
If intending to mount the root filesystem by NFS it is required to specify the path. The NFS root path is determined by the location of the files extracted from rootfs.tgz in Section 3.2.4, such as /home/
After making any changes, quit the program and return to the barebox prompt by pressing CTL+D, type saveenv to save changes:
saveenv3.4.3 Restore to DefaultIf the barebox environment variables need to be restored for any reason, simply delete the parameter save location in NAND, and the defaults will be restored with the next boot.
From barebox, the boot process continues by loading the kernel which then mounts the root filesystem. Both the kernel and root filesystem locations are determined from the barebox environment. The locations classify booting Linux stand-alone or remote, where the components required are provided in the onboard media (NAND, SPI NOR, SD/MMC Card) or via a network (TFTP or NFS).
3.4.4.1 Boot CommandSelection of the location to continue booting is provided as a boot command in the current barebox environment. This command allows the user to specify the mode over which it will boot with respect to the kernel, root filesystem, ip, and oftree options. The generic usage of this command is described by the following:
By typing _boot_help in the barebox prompt, a summary of the syntax, options, and parameters are provided.
3.4.4.2 Stand-Alone NAND BootingBy default, the kit comes setup for a standalone boot from NAND Flash. Therefore, without modification to environment variables and the correct NAND boot switch settings described in Section 3.3.1, barebox will boot the preloaded Linux kernel from NAND.
Alternatively, executing commands given by the following, tells the system to boot using the Linux kernel and/or filesystem located in NAND, which is useful in the case where the boot mode on the Carrier Board is set in a configuration other than NAND boot:
Description | Barebox |
Boot kernel from NAND Flash and mount rootfs from default | boot –k nand |
Boot kernel from default and mount rootfs from NAND Flash | boot -r nand |
Boot kernel and mount rootfs from NAND Flash | boot -k nand -r nand boot -m nand |
With the Linux kernel and root filesystem located on the SPI NOR Flash, uses of the boot command can be done in the following way:
Description | Barebox |
Boot kernel from SPI NOR Flash and mount rootfs from default | boot –k nor |
Boot kernel from default and mount rootfs from SPI NOR Flash | boot -r nor |
Boot kernel and mount rootfs from SPI NOR Flash | boot -k nor -r nor boot -m nor |
For the case of the Linux kernel and root filesystem located on the SD/MMC Card, a script included in barebox to perform the standalone boot is currently in development.
3.4.4.5 Remote BootingFor development it may be beneficial to modify the boot settings to allow the kernel to be loaded from TFTP, and/or mount a network filesystem hosted on the NFS, setup in Sections 3.2.3 and 3.2.4, respectfully. Examples of the wide variety of remote booting options the barebox boot command supports is given by the following:
Description | Barebox |
Boot kernel from TFTP and mount rootfs from default | boot –k tftp |
Boot kernel from default and mount rootfs from NFS | boot -r net |
Boot kernel from TFTP and mount rootfs from NFS | boot -k tftp -r net boot -m tftp |
After selecting the boot source, the target starts booting. When prompted, after the target has finished loading the system, the default login of rootcan be used:
NEED TO UPDATE THIS IMAGE TO REFLECT AM335X
4 Building a BSP4.1 Modifying the BSPThe BSP provided can be modified through the source code in the board files or through configuration management.
4.1.1 Board FilesAll source code is located in the BSP-phyCORE-AM335x-PD12.1.0/platform-phyCORE-AM335/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 three board files summarized by the following:
Board File | Location | Board Config File |
Linux kernel | linux3.3 | /arch/arm/mach-omap2/board-pcm051.c |
Barebox | INSERT: BAREBOX FILE NAME | /arch/arm/boards/pcm051/env/config |
Barebox MLO | INSERT: MLO FILE NAME | /arch/arm/boards/pcm051/env/config |
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.
4.2.1 PlatformThe platform configuration menu contains the default settings for each platform including what bootloaders, kernel, and filesystem images are to be built and located. The settings for the platform are modified using the following command:
This menu can be used to select the build configurations specific to the SPI NOR bootloader. Otherwise, as a user, it is very rare to modify these settings, but it may be useful to view them:
4.2.1.1 Creating MLO.spiSince the MLO used for SPI NOR Flash has to be byte-swapped, the u-boot target configuration settings must modified and the boot images will need to be rebuilt. In ptxdist platformconfig select bootloaders and then U-boot, by changing (pcm051) U-Boot config target to (pcm051_spiboot) U-Boot config target the required modifications are made. Save and exit platform config and rebuild the bootloader images:
This will create the SPI NOR Flash specific MLO.spi file. Also, it will create u-boot.bin, however, this file has a known bug and does not work properly, therefore use of it is not recommended.
4.2.2 KernelThe kernel configuration menu allows the user to adjust the drivers and support included in a linux kernel build. The settings are available by using the following command:
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. The following command will open the configuration menu:
Building and creating images with PTXdist is very simple. All the required steps to compile sources and build packages in the correct order are done using the ptxdist go command. Following a successful build, the command, ptxdist images, will create images to deploy on the target. Additional setup is required for the first build of the BSP images. The file, http://museum.php.net/php5/php-5.3.3.tar.bz2, must be downloaded and placed in the BSP-phyCORE-AM335x/src directory. Also, both the platform configuration and toolchain paths must be specified using the ptxdist platform and ptxdist toolchain commands, respectfully.
To build and create images, execute the following commands from the project directory:
All images are stored in BSP-phyCORE-AM335x/platform-phyCORE-AM335x/images, the following can be expected:
Flashing images can be relatively complex and there are two main ways to accomplish this, the barebox update command and MMC.
5.1 Update Command (Remote Flashing)To update the bootloader, kernel, or filesystem in flash, the current barebox environment provides the update command. This command allows the user to specify the file to be flashed, the mode over which it will be flashed, and the path to the image. The generic usage of this command is described by the following:
By typing _update_help or update in the barebox prompt, a summary of the syntax, options, and parameters are provided.
5.1.1 TFTPTFTP is one of the simplest ways to apply modifications during development; it is commonly used for single file updates such as the bootloader, kernel, and files from the root filesystem.
The update command in barebox can be used to flash images to NAND or NOR flash from the TFTP Server in the correct format and located, for example, at
Update file | NAND | NOR |
MLO | update -t xload -d nand –m tftp -f phyCORE-AM335x/images/MLO | update -t xload -d nor –m tftp -f phyCORE-AM335x/images/MLO |
barebox | update -t barebox -d nand –m tftp -f phyCORE-AM335x/images/u-boot.img | update -t barebox -d nor –m tftp -f phyCORE-AM335x/images/u-boot.img |
bareboxenv | update -t bareboxenv -d nand –m tftp -f phyCORE-AM335x/images/barebox-default-environment | update -t bareboxenv -d nor –m tftp -f phyCORE-AM335x/images/barebox-default-environment |
kernel | update -t kernel -d nand –m tftp -f phyCORE-AM335x/images/uImage | update -t kernel -d nor –m tftp -f phyCORE-AM335x/images/uImage |
NOTE : TFTP is the default mode, as set in /env/config in barebox, therefore, “-m tftp” can be omitted from update commands.
5.2 SD/MMC Flashing