Introduction

Angstrom is a Linux distribution, targetting Embedded Systems. More information can be found on the Angstrom web site. Enabling Angstrom on SoCFPGA brings up the flexibility of a distribution: Instead of a fixed root file system as built with Yocto, the features of the file system can be changed at run time.

Preliminary note

Known Issues:
  • Booting Angstrom over NFS requires a change to the connman startup script connman.service (in /lib/systemd/system).
    The daemon should be called as follows:

    ExecStart=/usr/sbin/connmand -n -I ethX

    if you plan to mount the Angstrom RFS over NFS, please make sure to update the connman service script first. Otherwise, ethX gets reset and the NFS connection is lost. ethX corresponds to the Ethernet interface used when mounting a RFS over NFS. Usually this is eth0, but could be any Ethernet interface supported and available in a particular application. This could be the case if using a soft Ethernet controller configured into the FPGA such as the Altera Triple Speed Ethernet controller.

How to Build Angstrom for SoCFPGA

Follow these steps to build the components required to run Angstrom on SoCFPGA:
  • preloader
  • boot loader
  • kernel
  • root file system
The steps to follow depends on the Angstrom version.

Angstrom v2016.12 / Yocto 2.2

These instructions will not go into the setup of the repo command, please look here.

Known Issues

  1. U-Boot v2014.10 fails to build due to incompatibility with GCC6
  2. SDCard image generation is untested for Arria10, but should work
  3. U-Boot environment setup needs modification, specifically setting the devicetree name. I am looking into adding support to generate uboot environments using mkenvimage to populate the uboot environment

How to get the build scripts

First we get the new angstrom-manifests
$ mkdir angstrom-manifests
$ cd angstrom-manifests
$ repo init -u git://github.com/Angstrom-distribution/angstrom-manifest -b angstrom-v2016.12-yocto2.2

I have currently (2017.01.11) tested this revision of the meta-altera layer which is newer then the default manifest. My suggestion is to use it or master. To do this, we need to edit manifests.xml

$ vi .repo/manifest.xml

Change the meta-altera entry to:

<project name="kraj/meta-altera" path="layers/meta-altera" remote="github" revision="0c6e036fdfec58b69903a10e886a9dfae8fe4c9f" upstream="master"/>

Next we need to download all of the layers, etc.

$ repo sync

Setting up the build environment

Now we setup the environment and select the board we are targeting. The new script will popup a menu by default, just select the board you want.

setup-environment.png

Without the menu:

MACHINE=cyclone5 . ./setup-environment

or

MACHINE=arria5 . ./setup-environment

or

MACHINE=arria10 . ./setup-environment

In addition to the above, you can add any modifications you would like in your local.conf. In this instance, let's build for the Atlas DE0 board.

$ vi conf/local.conf

At the bottom of the file add:

UBOOT_CONFIG = "de0-nano-soc"                                 
KERNEL_DEVICETREE = "socfpga_cyclone5_de0_sockit.dtb"                           
IMAGE_FSTYPES += "socfpga-sdimg"

The above selects a uboot machine as defined in the machine configuration, the devicetree to be used, and adds generation of an sdcard image.

How to build the kernel

In the newer opensource meta layer (https://github.com/kraj/meta-altera) there are a few choices for the kernel provider which can be broken into "stable" and "development". The "stable" versions are just tied to specific hashed in the kernel git tree, the "development" versions follow the head of the specific branch.

"Stable"
  • linux-altera (As of 3/16/2016 these are 4.2 → 4.7 kernels)
  • linux-altera-ltsi (As of 1/11/2017 these are 4.1 and current 4.1.22 kernels. Please use 4.1.22)
  • linux-altera-ltsi-rt (As of 1/11/2017 these are 4.1 and current 4.1.22 kernels. Please use 4.1.22)

"Development"
  • linux-altera-dev (As of 3/16/2016 HEAD of the 4.7 kernel)
  • linux-altera-ltsi-dev (As of 3/16/2016 HEAD of the 4.1.22 ltsi

There are a few ways of selecting the kernel version, my preference is to set the PREFERRED_PROVIDER and PREFERRED_VERSION in conf/local.conf. If PREFERRED_VERSION is not specified, bitbake will default to the newest version.

For example:
PREFERRED_PROVIDER_virtual/kernel = "linux-altera"
PREFERRED_VERSION_linux-altera = "4.7%"

Note that the % in the PREFERRED_VERSION is important!

Would select the 4.7 "stable" kernel.

Alternatively, you can use environment variables to specify the kernel provider, but note that setting the PREFERRED_PROVIDER has precedence.

For example:
$ export KERNEL_PROVIDER="linux-altera"
$ export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} KERNEL_PROVIDER"

With the above, you can still set the PREFERRED_VERSION.

Finally, we actually build the kernel

bitbake virtual/kernel

How to build the root file system

bitbake console-image

Where are the binaries once the build is finished?

The binaries can be found in ${ANGSTROM_TOP}/deploy/glibc/images/

Angstrom v2015.12 / Yocto 2.0

New Angstrom-manifests

Please be aware that Angstrom has moved away from its former setup-scripts and moved to using the new angstrom-manifests. This requires that the repo command be installed. These instructions will not go into the setup of the repo command, please look here.

How to get the build scripts

First we get the new angstrom-manifests
$ mkdir angstrom-manifests
$ cd angstrom-manifests
$ repo init -u git://github.com/Angstrom-distribution/angstrom-manifest -b angstrom-v2015.12-yocto2.0

At this stage you have a choice to make to either stick to the older opensource meta-altera layer that is setup in the angstrom-manifest, or move to the latest head (for now). I recommend using the master branch for now (11/27/2015) as it has recipes for newer kernel versions. To move to the newer version, we will need to edit the manifests.xml.

$ vi .repo/manifest.xml

Change the meta-altera entry to:

<project name="kraj/meta-altera" path="sources/meta-altera" remote="github" revision="jethro"/>

Next we need to download all of the layers, etc.

$ repo sync

Setting up the build environment

Now we setup the environment and select the board we are targeting. The new script will popup a menu by default, just select the board you want.

setup-environment.png

Without the menu:

MACHINE=cyclone5 . ./setup-environment

or

MACHINE=arria5 . ./setup-environment

or

MACHINE=arria10 . ./setup-environment

I have found that a few layers are causing issues, since we dont actually need them….

$ sed -i '/meta-photography/d' conf/bblayers.conf
$ sed -i '/meta-atmel/d' conf/bblayers.conf
$ sed -i '/meta-uav/d' conf/bblayers.conf

This is personal preference, but I like to change the locations of the downloads directory and the state cache.

$ sed -i '/DL_DIR/d' conf/site.conf
$ sed -i '/SSTATE_DIR/d' conf/site.conf
$ echo "DL_DIR = \"\${TOPDIR}/../angstrom-manifest-downloads\"" >> conf/site.conf
$ echo "SSTATE_DIR = \"\${TOPDIR}/../angstrom-manifest-sstate-cache\"" >> conf/site.conf

How to build the kernel

In the newer opensource meta layer (https://github.com/kraj/meta-altera) there are a few choices for the kernel provider which can be broken into "stable" and "development". The "stable" versions are just tied to specific hashed in the kernel git tree, the "development" versions follow the head of the specific branch.

"Stable"
  • linux-altera (As of 3/16/2016 these are 4.2, 4.3, and 4.4 kernels)
  • linux-altera-ltsi (As of 3/16/2016 these are 3.10 and 4.1 kernels)
  • linux-altera-ltsi-rt (As of 3/16/2016 these are 3.10 only)

"Development"
  • linux-altera-dev (As of 3/16/2016 HEAD of the 4.4 kernel)
  • linux-altera-ltsi-dev (As of 3/16/2016 HEAD of the 4.1 ltsi

There are a few ways of selecting the kernel version, my preference is to set the PREFERRED_PROVIDER and PREFERRED_VERSION in conf/local.conf. If PREFERRED_VERSION is not specified, bitbake will default to the newest version.

For example:
PREFERRED_PROVIDER_virtual/kernel = "linux-altera"
PREFERRED_VERSION_linux-altera = "4.2%"

Note that the % in the PREFERRED_VERSION is important!

Would select the 4.2 "stable" kernel which according to the bb file is tied to hash tag "be211eb308a6383da2042863ac070bc6e7d0add2"

Alternatively, you can use environment variables to specify the kernel provider, but note that setting the PREFERRED_PROVIDER has precedence.

For example:
$ export KERNEL_PROVIDER="linux-altera"
$ export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} KERNEL_PROVIDER"

With the above, you can still set the PREFERRED_VERSION.

Please note that older kernels require the 4.9 toolchain which is not the default. To specify the toolchain version to be used add the following to conf/local.conf
ANGSTROM_GCC_VERSION_arm = "linaro-4.9%"

Finally, we actually build the kernel

bitbake virtual/kernel

How to build the root file system

bitbake console-image

Where are the binaries once the build is finished?

The binaries can be found in ${ANGSTROM_TOP}/deploy/eglibc/images

Angstrom v2014.06

How to get the build scripts

First, the repository with the angstrom build scripts must be cloned:
$ git clone git://git.rocketboards.org/angstrom-socfpga.git

Then, checkout the branch matching the v2014.06 version:
$ cd angstrom-socfpga
# from now on, we will refer to this directory as ${ANGSTROM_TOP}
$ git checkout -b angstrom-v2014.06-socfpga origin/angstrom-v2014.06-socfpga

Setting up the build environment

The build environment can then be prepared. The exact instructions depend on the machine to build for (Arria V, Cyclone V). The reason of this difference is the preloader.

Arria 5

Follow these instructions to setup the environment for Arria 5
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Arria 5:
#  1/ Configure the build environment for Arria5
$  MACHINE=socfpga_arria5 ./oebb.sh config socfpga_arria5

#  2/ Setup the Shell Environment
$  source environment-angstrom-v2014.06

Cyclone 5

Follow these instructions to setup the environment for Cyclone 5
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Cyclone 5:
#  1/ Configure the build environment for Cyclone5
$  MACHINE=socfpga_cyclone5 ./oebb.sh config socfpga_cyclone5

#  2/ Setup the Shell Environment
$  source environment-angstrom-v2014.06

The following instructions are common to both Arria and Cyclone.

How to build the kernel

There are two kernel versions available from the linux-socfpga repository:
  • the latest stable kernel
  • the latest LTSi kernel, the default kernel built by the kernel recipe in the meta-altera layer.
The instructions vary depending on the kernel version.

LTSi

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2014.06

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera-ltsi
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera-ltsi

Latest Stable kernel

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2014.06
# We need to override the default kernel that the Yocto recipe builds.
$ export KERNEL_PROVIDER="linux-altera"
$ export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} KERNEL_PROVIDER"

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera

How to build the boot loader and the preloader

Follow these steps:
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2014.06

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake virtual/bootloader
# or
$ MACHINE=socfpga_arria5 bitbake virtual/bootloader

How to build the root file system

Follow these steps:
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2014.06

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake console-image
# or
$ MACHINE=socfpga_arria5 bitbake console-image

Where are the binaries once the build is finished?

The binaries can be found in ${ANGSTROM_TOP}/deploy/eglibc/images

Angstrom v2013.12

How to get the build scripts

First, the repository with the angstrom build scripts must be cloned:
$ git clone git://git.rocketboards.org/angstrom-socfpga.git

Then, checkout the branch matching the v2013.12 version:
$ cd angstrom-socfpga
# from now on, we will refer to this directory as ${ANGSTROM_TOP}
$ git checkout -b angstrom-v2013.12-socfpga origin/angstrom-v2013.12-socfpga

Setting up the build environment

The build environment can then be prepared. The exact instructions depend on the machine to build for (Arria V, Cyclone V). The reason of this difference is the preloader.

Arria 5

Follow these instructions to setup the environment for Arria 5
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Arria 5:
#  1/ Configure the build environment for Arria5
$  MACHINE=socfpga_arria5 ./oebb.sh config socfpga_arria5

#  2/ Setup the Shell Environment
$  source environment-angstrom-v2013.12

Cyclone 5

Follow these instructions to setup the environment for Cyclone 5
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Cyclone 5:
#  1/ Configure the build environment for Cyclone5
$  MACHINE=socfpga_cyclone5 ./oebb.sh config socfpga_cyclone5

#  2/ Setup the Shell Environment
$  source environment-angstrom-v2013.12

The following instructions are common to both Arria and Cyclone.

How to build the kernel

There are two kernel versions available from the linux-socfpga repository:
  • the latest stable kernel
  • the latest LTSi kernel, the default kernel built by the kernel recipe in the meta-altera layer.
The instructions vary depending on the kernel version.

LTSi

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2013.12

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera-ltsi
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera-ltsi

Latest Stable kernel

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2013.12
# We need to override the default kernel that the Yocto recipe builds.
$ export KERNEL_PROVIDER="linux-altera"
$ export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} KERNEL_PROVIDER"

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera

How to build the boot loader and the preloader

Follow these steps:
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2013.12

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake virtual/bootloader
# or
$ MACHINE=socfpga_arria5 bitbake virtual/bootloader

How to build the root file system

Follow these steps:
$ cd ${ANGSTROM_TOP}
$ source environment-angstrom-v2013.12

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake console-image
# or
$ MACHINE=socfpga_arria5 bitbake console-image

Where are the binaries once the build is finished?

The binaries can be found in ${ANGSTROM_TOP}/deploy/eglibc/images

Angstrom v2012.12

How to get the build scripts

First, the repository with the angstrom build scripts must be cloned:
$ git clone git://git.rocketboards.org/angstrom-socfpga.git

Then, checkout the branch matching the v2012 version:
$ cd angstrom-socfpga
# from now on, we will refer to this directory as ${ANGSTROM_TOP}
$ git checkout -b angstrom-v2012.12-socfpga origin/angstrom-v2012.12-socfpga

Setting up the build environment

The build environment can then be prepared. The exact instructions depend on the machine to build for (Arria V, Cyclone V). The reason of this difference is the preloader.

Arria 5

Follow these instructions to setup the environment for Arria 5
#  Angstrom v2012.12 keeps an environment file in the home directory
#! of the user. Just in case a build was previously run, it's a good
#! idea to remove it, as it includes build directories.
$ rm -f ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Arria 5:
#  1/ Configure the build environment for Arria5
$  MACHINE=socfpga_arria5 ./oebb.sh config socfpga_arria5

#  2/ Setup the Shell Environment
$  source ~/.oe/environment-angstromv2012.12

Cyclone 5

Follow these instructions to setup the environment for Cyclone 5
#  Angstrom v2012.12 keeps an environment file in the home directory
#! of the user. Just in case a build was previously run, it's a good
#! idea to remove it, as it includes build directories.
$ rm -f ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# 
# Instructions for Cyclone 5:
#  1/ Configure the build environment for Cyclone5
$  MACHINE=socfpga_cyclone5 ./oebb.sh config socfpga_cyclone5

#  2/ Setup the Shell Environment
$  source ~/.oe/environment-angstromv2012.12

The following instructions are common to both Arria and Cyclone.

How to build the kernel

There are two kernel versions available from the linux-socfpga repository:
  • the latest stable kernel
  • the latest LTSi kernel, the default kernel built by the kernel recipe in the meta-altera layer.
The instructions vary depending on the kernel version.

LTSi

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ source ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera-ltsi
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera-ltsi

Latest Stable kernel

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ source ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# We need to override the default kernel that the Yocto recipe builds.
$ export KERNEL_PROVIDER="linux-altera"
$ export BB_ENV_EXTRAWHITE="${BB_ENV_EXTRAWHITE} KERNEL_PROVIDER"

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake linux-altera
# or
$ MACHINE=socfpga_arria5 bitbake linux-altera

How to build the boot loader and the preloader

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ source ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake virtual/bootloader
# or
$ MACHINE=socfpga_arria5 bitbake virtual/bootloader

How to build the root file system

Follow these steps:
# this first step is not necessary if the environment file was sourced before...
$ source ~/.oe/environment-angstromv2012.12
$ cd ${ANGSTROM_TOP}

# move on to building the kernel
$ MACHINE=socfpga_cyclone5 bitbake console-image
# or
$ MACHINE=socfpga_arria5 bitbake console-image

Where are the binaries once the build is finished?

The binaries can be found in ${ANGSTROM_TOP}/build/tmp-angstrom_v2012_12-eglibc/deploy/images/

Using Angstrom

Here's a quick introduction to Angstrom. For more information, please check out their web site and check their package feeds for the ARMv7 architecture.

Booting Angstrom

There is nothing special to do from a kernel command line point of view. Angstrom uses udev, so make sure your kernel configuration includes the following options:
      CONFIG_DEVTMPFS=y
CONFIG_HOTPLUG=y
CONFIG_INOTIFY_USER=y
CONFIG_NET=y
CONFIG_PROC_FS=y
CONFIG_SIGNALFD=y
CONFIG_SYSFS=y
CONFIG_UEVENT_HELPER_PATH=""

Interacting with the package manager

The Angstrom distribution relies on 'opkg' as the package manager

Here are a few useful commands:
# list available packages
$ opkg list

# search for a particular package, e.g. gcc
$ opkg list | grep gcc

# install a package
$opkg install gcc

# list the installed packages
$ opkg list-installed

# getting updated information from the package feeds
$ opkg update

This is just a quick introduction to opkg.


Give us your feedback

© 1999-2017 RocketBoards.org by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Privacy.