This Quickstart provides you with the tools and know-how to install and work with the Linux Yocto Board Support Package (BSP) for the phyBOARD-WEGA-AM335x kit. This Quickstart shows you how to do everything from installing the appropriate tools and source, to building custom kernels, to deploying the OS, to exercising the software and hardware. Please refer to the phyCORE-AM335x Hardware Manual for specific information on SOM-level features such as jumper configuration, memory mapping and pin layout for the phyCORE-AM335x System on Module (SOM). Additionally, gain access to the SOM, mapper board, and baseboard schematics for the phyBOARD-WEGA-AM335x by registering at the following: http://phytec.com/support/registration/.

 

Requirements

 

The following system requirements are necessary to successfully complete this Quickstart. Deviations from these requirements may suffice, or may have other workarounds.

 

Hardware

 

  • phyBOARD-WEGA-AM335x (Part No. PB-00802)
  • Evaluation Module (Part No. PEB-EVAL-01)
  • Serial Cable (RS-232) - Not included
  • Ethernet cable - Not included
  • Power source - Not included. There are two power options for the phyBOARD-WEGA, the board can be populated with a two-pin phoenix connector which uses a 5V power supply, or come with the Power Module 12-24V (PEB-POW-01) which uses a 12/24V power supply. The 2-pin phoenix connector included can be used to connect the power input of the phyBOARD-WEGA to a lab power supply or Wall Adapter. Wall Adapter solutions are orderable through PHYTEC for the 5V version (LQP-5V1.5A-Adapter-P) and 12-24V version (LQP-12V1.25A-Adapter-P).

 

Software

 

  • A modern GNU/Linux Operating host system either natively or via a virtual machine:

 

- Ubuntu 14.04 LTS 64-bit recommended. Other distributions will likely work, please note that some setup information as well as OS-specific commands and paths may differ.- If using a virtual machine, VMWare Workstation, VMWare Player, and VirtualBox are all viable solutions.

 

  • Root access to your Linux Host PC. Some commands in the Quickstart will not work if you don’t have sudo access (ex. package installation, formatting SD card).
  • At least 40-50GB free on target build partition.
  • SD card reader operational under Linux.

 

- If you do not have SD card access under Linux then formatting, copying the bootloader, and mounting the root file system on an SD card will not be possible.

 

  • Active Internet connection

 

Getting Started

 

This section is designed to get the board up-and-running with pre-built images.

 

Connector Interfaces

 

Use the following as a reference for the connector interfaces on the phyBOARD-WEGA-AM335x that will be used in this Quickstart.

 

 

Booting the Pre-built Images

 

The section was designed to show you how to boot the phyBOARD-WEGA-AM335x with the pre-built demo images.

 

1. Insert a bootable SD card into the microSD card slot on the underside of the baseboard. Since the default boot mode for the PD14.1-rc1 release loads the kernel and root filesystem from the Barebox bootsource selected, configure the board to boot from SD/MMC (Selecting Boot Modes). A bootable SD card with barebox.binMLOzImagezImage-am335x-wega-rdk.dtb, and phytec-hwbringup-image-phyboard-wega-am335x-1.tar.gz extracted on the SD card is required. Instructions for creating an SD card are provided in the Creating a Bootable SD card section of the Quickstart.

 

2. Connect the serial cable from a free serial port on your host PC to the DB9 connector labelled UART0 on the module PEB-EVAL-01. This is the UART0 communication channel with the phyBOARD-WEGA-AM335x at RS-232 levels.

 

3. Connect the Ethernet cable from the Ethernet connector Eth0 to your network hub, router, or switch. If you do not have an Ethernet connection you can postpone this step, Linux will boot without the need for Ethernet connectivity but having the connection will significantly reduce your boot time.

 

4. Start your favorite terminal software (such as Minicom or TeraTerm) on your host PC and configure it for 115200 baud, 8 data bits, no parity, and 1 stop bit (8n1) with no handshake.

 

5. Plug the power supply into the power connector on the phyBOARD-WEGA. You will instantly see the red power LED D58 light up. You will also start to see console output on your terminal window. If everything was done correctly the board should boot completely into Linux, arriving at aroot@phyboard-wega-am335x-1 prompt. The default login account is root with an empty password. Note that the first time the board is booted it will takes a little while for the SSH server to generate new keys. Subsequent boots should be faster.

 

 

Troubleshooting:

Not seeing any output on the console?

  • Check that you have setup the terminal software correctly per step 4.
  • Flash the release images from the PHYTEC FTP by creating a bootable SD/MMC card (Creating a Bootable SD card), then configure the board to boot from SD/MMC (Selecting Boot Modes).

 

Development Host Setup

 

The following notes assume a Ubuntu 14.04 64-bit build machine.

 

Packages

 

Yocto development requires certain packages to be installed. Run the following commands to ensure you have the packages installed:

 

sudo apt-get install gawk wget git-core diffstat unzip texinfo \
                 gcc-multilib build-essential chrpath socat \
                 libsdl1.2-dev xterm

 

Note:

The above is the recommended package installation for phyBOARD-WEGA development on a Ubuntu 14.04 LTS Linux distribution. For a breakdown of the packages as well as a list of packages required for other Linux distributions, see the "Required Packages for the Host Development System" section in the Yocto Project Reference Manual: http://www.yoctoproject.org/docs/1.7/ref-manual/ref-manual.html#required-packages-for-the-host-development-system

 

Verify that the preferred shell for your Host PC is bash and not dash:

 

sudo dpkg-reconfigure dash 
# Respond "No" to the prompt asking "Install dash as /bin/sh?"

 

Download and install the repo tool. This tool is used to obtain Yocto source from Git.

 

cd /opt
sudo mkdir bin

# /opt/ directory has root permission, change the permissions so your user account can access this folder. In the following replace <user> with your specific username
sudo chown –R <user>: bin

cd bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./repo
#add directory that contains repo to your path
chmod a+x repo

 

Add the repo directory in your PATH, using export from the command line or permanently by including it in .bashrc:

 

PATH=/opt/bin/:$PATH

 

Server Setup

 

The following steps describe the setup for TFTP, NFS, and Samba servers. Server setup is not required for working with the phyBOARD-WEGA, however they will significantly reduce time and are highly recommended during the building and development phase.

 

TFTP

 

TFTP is a "trivial" file transfer protocol used to transfer individual files across a network. Setting up a TFTP server on your Linux Host PC will allow you to exchange files with the target board. Some examples where this will be advantageous include:

 

  • Modifying and doing development on the Linux kernel. Barebox can be configured to remotely boot the kernel so you have access to the latest build without needing to continually reflash the target board.
  • Updating images from the bootloader. Transferring files over a network in Barebox is an alternative to using an SD card which eliminates some time consuming steps such as formatting an SD card.
  • Individual file transfer to the root fileystem. When Linux has been fully booted you may want to copy a specific file from your Host PC to the target board (images, application executables).

 

Install the TFTP server on your Host PC:

 

sudo apt-get install tftpd-hpa

 

Specify a folder where the files will reside on your Host PC 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_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
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

 

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>

 

Files in the <TFTP_DIRECTORY> on your Host PC can now be accessed from another machine on the same network such as the target board by simply using the IP address of the Host PC. Take note of this IP address, in a typical wired connection this will be inet addr listed under eth0.

 

ifconfig

 

NFS

 

A network filesystem (NFS) server gives other systems the ability to mount a filesystem stored on the Host PC and exported over the network. Setting up an NFS server on your Linux Host PC gives you access to the target boards root filesystem which will allow you to quickly test applications and evaluate different filesystem setups for the target board. That is, the root filesystem for the phyBOARD-WEGA will actually be located on the remote host Linux machine. This enables easy access and modifications to the root filesystem during development.

 

Install the NFS server on your Host PC:

 

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

 

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.
;   read only = no

 

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.
   read only = no

 

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.

 

Building the BSP

 

Create a directory which will house your BSP development. In this example the BSP directory is /opt/PHYTEC_BSPs/. This is not a requirement and if another location is preferred (ex. ~/PHYTEC_BSPs) feel free to modify. We recommend using /opt over your HOME directory to avoid errors attributed to ~ syntax as well as the sudo requirement for the root filesystem and automation package building. We also recommend creating a package download directory (yocto_dl) separate from the yocto tree (yocto_ti), as it makes resetting the build environment easier and subsequent build times much faster.

 

sudo mkdir /opt/PHYTEC_BSPs
cd /opt/

# /opt/ directory has root permission, change the permissions so your user account can access this folder. In the following replace <user> with your specific username
sudo chown –R <user>: PHYTEC_BSPs

cd PHYTEC_BSPs
mkdir yocto_ti
mkdir yocto_dl
cd yocto_ti
export YOCTO_DIR=`pwd`

 

At this point you will now be able to navigate to the Yocto directory using the $YOCTO_DIR environment variable.

 

Download the BSP Meta Layers

 

Download and run the init script phyLinux. This script will use the repo tool to manage the various git repositories used in this BSP. Repo will automatically be detected by phyLinux if it is found in the PATH. During the execution of the script, you need to choose your processor platform, BSP release and hardware. The following are the available machine configurations:

 

  • phyboard-maia-am335x-1: PB-00702-002
  • phyboard-wega-am335x-1: PB-00802 with HDMI Adapter PEB-AV-01
  • phyboard-wega-am335x-2: PB-00802 with GLYN Display AV-Adapter PEB-AV-02
  • phycore-am335x-1: PCM-051-12102F0C.A1/PCM-953 (Standard Rapid Development Kit)
  • phycore-am335x-2: 1GiB RAM, 1GiB NAND SOM variant with PCM-953 Carrier Board
  • phyflex-am335x-1: PFL-A-03-12113F8I.A1/PBA-B-01 (Standard phyFLEX i.MX6 Rapid Development Kit)

 

The rest of the Quickstart assumes that the standard phyboard-wega-am335x-1 is used, although the other phyBOARD-WEGA configurations may be used as well.

 

cd $YOCTO_DIR
wget ftp://ftp.phytec.de/pub/Software/Linux/Yocto/Tools/phyLinux
chmod +x phyLinux
						
# You can provide the SoC platform, BSP release, and hardware as arguments: 
./phyLinux init -p am335x -r PD14.1-rc1 -m phyboard-wega-am335x-1

# Or simply run the init script and you will be prompted to choose the desired settings from a list of options
./phyLinux init

 

After the configuration is set up, you can view the current settings by running:

 

 ./phyLinux info

 

Start the Build

 

Run the Yocto build directory setup:

 

cd $YOCTO_DIR
MACHINE=phyboard-wega-am335x-1 source sources/poky/oe-init-build-env build

 

Add the the new download directory to build/conf/local.conf:

 

DL_DIR ?= "/opt/PHYTEC_BSPs/yocto_dl"

 

The setup is complete and you now have everything to complete a build. The following will start a build from scratch including installation of the toolchain as well as barebox, Linux kernel, and root filesystem images.

 

cd $YOCTO_DIR/build
MACHINE=phyboard-wega-am335x-1 bitbake --continue phytec-hwbringup-image

 

Note:

If the package fetch fails, you will need to manually download the linuxptp IEEE 1588 stack to $DL_DIR (http://sourceforge.net/projects/linuxptp/files/). Once you've downloaded the archive (e.g. linuxptp-1.3.tgz), you will need to create a "done" file so fetch doesn't delete the file and try to refetch it:

cd yocto_dl
touch linuxptp-1.3.tgz.done

Because of a race condition in the build system, sometimes barebox or the linux kernel will not get configured correctly and the system will not boot. The fix will be available in the next release; in the meantime there is a workaround for this which only needs to be done after the very fist build:

  • Rebuild barebox after the image has been generated:
bitbake -c cleanall barebox barebox-ipl linux-ti && bitbake phytec-hwbringup-image -c rootfs -f

 

Images

 

All images generated by bitbake are deployed to $YOCTO_DIR/build/deploy/images/phyboard-wega-am335x-1:

 

  • SD Image: phytec-hwbringup-image-phyboard-wega-am335x-1.sdimg-phy
  • Bootloader: barebox.bin, MLO
  • Kernel: zImage
  • Kernel device tree file: zImage-am335x-wega-rdk.dtb
  • Root Filesystem: phytec-hwbringup-image-phyboard-wega-am335x-1.tar.gz

 

 

 

The Linux kernel source is located in: $YOCTO_DIR/build/tmp/work/phyboard_wega_am335x_1-poky-linux-gnueabi/linux-ti/3.12.24-phy1-r0/git/. The device tree file to modify within the linux kernel source is: arch/arm/boot/dts/am335x-wega-rdk.dts and its dependencies.

 

Build Time Optimizations

 

The build time will vary depending on the package selection and Host performance. Beyond the initial build, after making modifications to the BSP, a full build is not required. Use the following as a reference to take advantage of optimized build options and reduce the build time.

 

To rebuild Barebox:

 

bitbake barebox -f -c compile && bitbake barebox

 

To rebuild the Linux kernel:

 

bitbake linux-ti -f -c compile ; bitbake linux-ti

 

The Yocto project's Bitbake User Manual provides useful information regarding build options: http://www.yoctoproject.org/docs/1.7/bitbake-user-manual/bitbake-user-manual.html

 

Creating a Bootable SD card

 

The process requires an SD card reader operational under Linux to format and access the Linux partition of the card. If you do not have SD card access under Linux then copying the bootloader and mounting the root filesystem on SD/MMC card will not be possible.

 

1. 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.

 

2. Unmount all partitions of the SD card, using the SD card device name from Step 1:

 

umount /dev/sd[b|c|d|e]*

 

3. Load the sd-card image onto the SD card from the linux command line. This will format the /media/boot and /media/root partitions, as well as add Barebox, the kernel image, and the root filesystem to the card:

 

sudo dd if=phytec-hwbringup-image-phyboard-wega-am335x-1.sdimg-phy of=/dev/sd[b|c|d|e] bs=1MB

 

Once the SD card has been formatted, you may update the kernel, root filesystem, and barebox individually as well:

 

Kernel

 

4. If modifying the kernel, remove the existing linuximage and device tree binary files:

 

rm -rf /media/boot/*

 

5. Load the new Linux kernel and device tree binary to the SD Card. Note that the default bootloader environment is configured to recognize "linuximage" and "oftree" as the kernel and dts respectively:

 

cp zImage /media/boot/linuximage; sync
cp zImage-am335x-wega-rdk.dtb /media/boot/oftree; sync

 

Root Filesystem

 

6. If modifying the root filesystem, remove the existing:

 

sudo rm -rf /media/rootfs/*

 

7. Load the new filesystem to the SD Card:

 

sudo tar -zxf phytec-hwbringup-image-phyboard-wega-am335x-1.tar.gz -C /media/root/; sync

 

Bootloader

 

cp barebox.bin /media/boot/; sync
cp MLO /media/boot/; sync

 

Note:

Unmount each partition before removing the SD Card:

umount /media/boot /media/rootfs

 

Additionally, if you plan on using the SD/MMC card to flash images, copy the files to the /boot partition. Since the /boot partition is FAT32 file copying can be handled using a Windows machine and a Linux machine is not required.

 

Boot Configurations

 

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 boot mode determines the location of the primary bootloader. The way the bootmode is selected depends on the revision of the carrier board. This is printed on the board, and is either 1405.0 or 1405.1.

 

If using 1405.0, short pin 8 of X70 (X_LCD_D2) to pin 13 of X71 (VCC3v3) as shown in the picture below:

 

 

Otherwise, if you are using 1405.1, set the switch S1 on the baseboard to ON to force booting from SD card.

 

 

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 files to modify environment variables, select boot settings, and setup networking parameters.

 

Expansion Board Settings

 

This BSP supports enabling and disabling various expansion boards that may be used along with the carrier board via the bootloader. This functionality allows for certain pin configurations to be added or removed from the device tree without needing to recompile the kernel. Please note that not all of these will be compatible with your specific board.

 

  • To view the available expansion boards:

 

barebox@Phytec phyCORE AM335x:/ ls /env/expansions/
.                                  ..
am335x-phytec-lcd-018-pba-b-01     am335x-phytec-lcd-018-pba-c-01
am335x-phytec-lcd-018-pcm-953      am335x-phytec-lcd-018-peb-av-02
am335x-wega-peb-av-01              am335x-wega-peb-eval-01

 

Enable an expansion board by adding it to /env/config-expansions:

 

edit /env/config-expansions

 

  • You should see something similar to the following. By default, Barebox built with the phyBOARD-WEGA-AM335x configures the kernel to enable the HDMI adapter PEB-AV-01 as well as the user leds and buttons on the PEB-EVAL-01 expansion:

 

#!/bin/sh

global linux.bootargs.dyn.video

. /env/expansions/am335x-wega-peb-av-01
. /env/expansions/am335x-wega-peb-eval-01

global.linux.bootargs.dyn.video="video=HDMI-A-1:1024x768-32@60"

 

Note:

The 3.12 kernel used by this BSP does not support device tree overlays.

 

Network Settings

 

You can check the target's network settings by running the following:

 

devinfo eth0

 

The ethaddr variable is the MAC id of the target. This is a pre-programmed value which is read from the EEPROM and matches the sticker on the SOM. To modify any of the network settings, type:

 

edit /env/network/eth0

 

You should see something similar to the following, modify the variables to specify your network configuration for ETH0:

 

ipaddr=###.###.###.###
netmask=###.###.###.###
gateway=###.###.###.###
serverip=###.###.###.###

 

  • ipaddr

 

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

 

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 TFTP directory, if it exists, is located.

 

Saving Configurations

 

From any of the Barebox scripts, 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

 

Boot Options

 

The target can be booted from on-board media or from a development host via network. In our standard configuration, the PD14.1-rc1 BSP release loads the kernel and root filesystem from the bootsource selected in the hardware.

 

For booting via network, the development host is connected to the phyCORE-AM335x with a serial cable and via Ethernet; the embedded board boots into the bootloader, then issues a TFTP request on the network and boots the kernel from the TFTP server on the host. Then, after decompressing the kernel into RAM and starting it, the kernel mounts its root filesystem via the NFS server on the host. This method is especially useful for development purposes as it provides a quick turnaround while testing the kernel and root filesystem.

 

Stand-Alone NAND Boot

 

To use the target stand-alone, the kernel and root filesystem have to be made persistent in the on-board media of the phyBOARD-WEGA. This is done by default in the kit, however if the kernel and root filesystem are not available in the on-board media or you would like to update them, refer toFlashing Images for information on flashing images.

 

When set in the dipswitch (Selecting Boot Modes), the phyBOARD-WEGA is configured by default to boot the kernel and mount the root filesystem from flash. By simply resetting or power cycling the board the target will boot into Linux.

 

The nand boot entry can also be run from the Barebox shell:

 

boot nand

 

Remote Boot

 

The network-remote boot variant is intended to be used during development because of the frequent need to rebuild the Linux kernel and root filesystem. TFTP and NFS accelerate the development process. Reflashing the newest kernel and root file system to the SOM after every new build would be very cumbersome and time consuming. All that is needed is an Ethernet connection and a network aware bootloader which can fetch the kernel from a TFTP server.

 

Restart the board and stop autoboot to go into the Barebox shell. Run the command:

 

boot net

 

Stand-Alone SD/MMC card Boot

 

The SD/MMC card boot variant is an alternative stand-alone boot option. All that is needed is a properly formatted (see the Creating a Bootable SD card section of the Quickstart) SD/MMC card

 

Restart the board and stop autoboot by pressing m. You'll get a menu:

 

 Main menu
       1: Boot default
       2: Detect bootsources
       3: Settings
       4: Save environment
       5: Shell
       6: Reset

 

Press 2 and then the Enter key to descend into "Detect bootsources". From this menu you can select the interface in which to boot from. Press 3 and then the enter key.

 

The SD/MMC card boot entry can also be run from the Barebox shell:

 

boot mmc

 

Custom Boot

 

You may have custom boot requirements that are not covered by the four available boot files (nand, net, mmc, spi). If this is the case you can create your own custom boot entry specifying the kernel and root filesystem location.

 

  • In Barebox, create your own boot entry, for example named custom:

 

edit /env/boot/custom

 

  • Use the following template to specify the location of the Linux kernel and root filesystem. Please note that the text in <> such as <kernel_loc_bootm.image><rootfs_loc_dyn.root>, and <nfs_root_path> are intended to be replaced with user specified values.

 

#!/bin/sh

global.bootm.image="<kernel_loc_bootm.image>"
global.bootm.oftree="<dts_loc_bootm.oftree>"

nfsroot="<nfs_root_path>"
bootargs-ip
/env/config-expansions

global.linux.bootargs.dyn.root="<rootfs_loc_dyn.root>"

 

  • <kernel_loc_bootm.image>

 

Specifies the location of the Linux kernel image/dev/nand0.kernel.bb - To boot the Linux kernel from NAND${path}/linuximage - To boot the Linux kernel via TFTP/boot/linuximage - To boot the Linux kernel from SD/MMC card

 

  • <dts_loc_bootm.oftree>

 

Specifies the location of the device tree binary/dev/nand0.oftree.bb - To boot the device tree binary from NAND${path}/oftree - To boot the device tree binary via TFTP/boot/oftree - To boot the device tree binary from SD/MMC card

 

  • <rootfs_loc_dyn.root>

 

Specifies the location of the root filesystemroot=ubi0:root ubi.mtd=root rootfstype=ubifs - To mount the root filesystem from NANDroot=/dev/nfs nfsroot=$nfsroot,vers=3,udp rw consoleblank=0 - To mount the root filesystem via NFSroot=/dev/mmcblk0p2 rootfstype=ext3 rootwait - To mount the root filesystem from SD/MMC card

 

  • <nfs_root_path>

 

Only required if mounting the root filesystem from NFS. Replace with the following:nfsroot="/home/${global.user}/nfsroot/${global.hostname}"

 

Once complete with file modifications exit the editor using CTRL+D. Save the environment:

 

saveenv

 

To run your custom boot entry from the Barebox shell:

 

boot custom

 

Default Boot

 

The phyBOARD-WEGA is configured by default to boot the kernel and mount the root filesystem from the bootsource set for Barebox in the dipswitch (Selecting Boot Modes). This default setting can be changed by adding or modifying the global.boot.default environment variable.

 

edit /env/config-board

 

Comment out the if else statements which set the boot sequence depending on the Barebox bootsource, and add the global.boot.default variable to set to the desired boot source. This variable can be set to any of the entries in /env/boot. For example, to set the default boot configuration to net,global.boot.default should be set in the following way:

 

global.boot.default=net

 

Exit the editor by CTRL+D and save the environment (saveenv). On a reset or power cycle the new default boot source will take affect. Similarly it will be used in the Barebox shell when executing the following:

 

boot

 

Flashing Images

 

The phyBOARD-WEGA Development Kit is delivered with a pre-flashed bootloader. The following instructions for flashing images from TFTP or SD card will be useful if you want to:

 

  • Flash images because NOR is empty
  • Upgrade to a new release
  • Use custom built images

 

The images to be flashed will need to be copied to the exported TFTP directory or the /boot partition of a properly formatted SD card as described in the Creating a Bootable SD card section of the Quickstart.

 

After making all required connections, power on the board and enter Barebox:

 

  • If flashing from TFTP, connect an Ethernet cable from the Ethernet connector ETH0 on the board to your network hub, router, or switch.
  • If flashing from SD card, insert a correctly formatted microSD card into the SD/MMC card slot connector on the underside of the Carrier Board.
  • Connect a serial RS-232 cable from a free port on your Host PC to the connector UART0 on the Carrier Board.
  • Start your favorite terminal software (Windows: PuTTY or TeraTerm; Linux: Minicom) on your Host PC and configure it for 115200 baud, 8 data bits, no parity, and 1 stop bit (8n1).
  • Power on your board by connecting the wall adapter to the Carrier Board.
  • After application of power, within approximately three seconds, hit any key to halt autoboot and enter Barebox. If an Ethernet cable is connected and the network has been configured, TFTP will automount to /mnt/tftp. If an SD card was inserted and Barebox was booted from MMC, the /bootpartition will automount to /boot.

 

Note:

If booting the bootloader from a source other than MMC, the /boot partition of the SD/MMC card will not automatically mount. To mount, execute the following commands each time you stop autoboot from Barebox or add them to /env/init/automount so this is done automatically:

mkdir -p boot
mount /dev/mmc0.0 boot

 

If flashing from TFTP, additional setup to configure the Barebox environment variables to meet your network environment and development host settings is required. The current network settings can be checked in /env/network/eth0.

 

If you need to change you network configuration, type:

 

edit /env/network/eth0

 

Edit the settings as described in the Network Configuration section of the Quickstart. Save the environment and reboot the board, this will automount your tftp server at boot to /mnt/tftp.

 

Barebox

 

If you would like to upgrade, have custom Barebox requirements, or are interested in seeing the version you built in action, follow the steps below:

 

barebox.bin should be copied to your TFTP exported directory or the /boot partition of the SD card depending on your chosen flashing procedure.

 

  • Copy the new Barebox from your tftp-server or SD card into the module's RAM:

 

Method: TFTP

 

cp /mnt/tftp/barebox.bin .

 

Method: SD/MMC

 

cp /boot/barebox.bin .

 

  • Store the Barebox into NAND Flash:

 

erase /dev/nand0.barebox.bb
cp barebox.bin /dev/nand0.barebox.bb

 

  • Copy the MLO and barebox.env into the module's RAM in the same manner as barebox.bin. To store the MLO in NAND Flash:

 

erase /dev/nand0.xload.bb
cp MLO /dev/nand0.xload.bb

 

  • To restore the barebox environment in NAND Flash to the default environment:

 

erase /dev/nand0.bareboxenv.bb

 

Note:

If something goes wrong and you don’t have a bootloader anymore on your module you need to boot from an SD card into Barebox (set the DIP-switch as stated in Boot Configurations) and then do the flashing. See the Creating a Bootable SD card section of this Quickstart for a description of how to create a bootable SD card.

 

Kernel

 

Placing the kernel into NAND Flash allows booting the system without the need for the TFTP hosted kernel image. This is the most common place to put the kernel in a stand-alone application. Normally development is done using a TFTP hosted kernel image until the configuration has become more stable and is unlikely to change frequently. Once stable, the kernel image can be moved to NAND Flash. This section assumes a Linux kernel with file name linuximage is available on the exported TFTP directory or /boot partition of the SD card depending on your chosen flashing procedure.

 

  • Erase the area of NAND Flash reserved for the kernel image and device tree binary partitions:

 

erase /dev/nand0.kernel.bb
erase /dev/nand0.oftree.bb

 

  • Copy the Linux kernel from your tftp-server or SD card and store it into the NAND Flash:

 

Method: TFTP

 

cp /mnt/tftp/linuximage /dev/nand0.kernel.bb
cp /mnt/tftp/oftree /dev/nand0.oftree.bb

 

Method: SD/MMC

 

cp /boot/linuximage /dev/nand0.kernel.bb
cp /boot/oftree /dev/nand0.oftree.bb

 

Root Filesystem

 

Similar to the Linux kernel, placing the root filesystem into NAND Flash allows booting the system without the need for a remote connection to the NFS server. This section assumes a root filesystem of the form root.ubifs available on the exported TFTP directory or /boot partition of the SD card depending on your chosen flashing procedure. Note that you should not flash Linux’s root filesystem into NAND the same way as you did with Linux kernel.

 

  • Ubifs keeps erase counters within the NAND in order to be able to balance write cycles equally over all NAND sectors. So if there’s already an ubifs on your module and you want to replace it with a new one, using erase and cp will also erase these erase counters, and this should be avoided. Instead, execute the following:

 

ubiformat /dev/nand0.root
ubiattach /dev/nand0.root
ubimkvol /dev/ubi0 root 0

 

  • Copy the root filesystem from your tftp-server or SD card and store it into the NAND Flash:

 

Method: TFTP

 

cp /mnt/tftp/phytec-hwbringup-image-phyboard-wega-am335x-1.ubifs /dev/ubi0.root

 

Method: SD/MMC

 

cp /boot/phytec-hwbringup-image-phyboard-wega-am335x-1.ubifs /dev/ubi0.root