OpenEmbedded / Yocto Project / Poky: build from sources


How to build Poky for AT91

Note that building an entire distribution is a long process. It also requires a big amount of free disk space.

The support for Atmel AT91 SoC family is included in a particular Yocto layer: meta-atmel. The source for this layer are hosted on Linux4SAM GitHub account: https://github.com/linux4sam/meta-atmel

Building environment

A step-by-step comprehensive installation is explained in the Yocto Project Quick Start. The following lines have to be considered as an add-on that is AT91 specific or that can facilitate your setup.

Prerequisite

Here are the reference pages for setting up a Yocto building environment: What You Need and How You Get It.

Step by step build procedure

Note here is a copy of the README procedure available directly in the meta-atmel layer. This file in the meta-atmel layer repository must be considered as the reference and the following copy can be out-of-sync.

Supported SoCs / MACHINE names
==============================
- SAMA5D2 product family / sama5d2-xplained
- SAMA5D4 product family / sama5d4ek, sama5d4-xplained
- SAMA5D3 product family / sama5d3xek, sama5d3-xplained
- AT91SAM9x5 product family (AT91SAM9G15, AT91SAM9G25, AT91SAM9X25, AT91SAM9G35 and AT91SAM9X35) / at91sam9x5ek
- AT91SAM9RL / at91sam9rlek
- AT91SAM9G45 / at91sam9m10g45ek


Sources
=======
- meta-atmel
URI: git://github.com/linux4sam/meta-atmel.git
URI: https://github.com/linux4sam/meta-atmel.git
Branch: krogoth


Dependencies
============
This Layer depends on :
- meta-openembedded
URI: git://git.openembedded.org/meta-openembedded
URI: http://cgit.openembedded.org/meta-openembedded/
Branch: krogoth

Optionally:
- meta-qt5
URI: git://github.com/meta-qt5/meta-qt5.git
URI: https://github.com/meta-qt5/meta-qt5
Branch: krogoth


Build procedure
===============
0/ Create a directory
mkdir my_dir
cd my_dir

1/ Clone yocto/poky git repository with the proper branch ready
git clone git://git.yoctoproject.org/poky -b krogoth

2/ Clone meta-openembedded git repository with the proper branch ready
git clone git://git.openembedded.org/meta-openembedded -b krogoth

3/ Clone meta-qt5 git repository with the proper branch ready
git clone git://github.com/meta-qt5/meta-qt5.git -b krogoth

4/ Clone meta-atmel layer with the proper branch ready
git clone git://github.com/linux4sam/meta-atmel.git -b krogoth

5/ Enter the poky directory to configure the build system and start the build process
cd poky

6/ Initialize build directory
source oe-init-build-env build-atmel

7/ Add meta-atmel layer to bblayer configuration file
vim conf/bblayers.conf

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../../..')}"

BBLAYERS ?= " \
  ${BSPDIR}/poky/meta \
  ${BSPDIR}/poky/meta-poky \
  ${BSPDIR}/poky/meta-yocto-bsp \
  ${BSPDIR}/meta-atmel \
  ${BSPDIR}/meta-openembedded/meta-oe \
  ${BSPDIR}/meta-openembedded/meta-networking \
  ${BSPDIR}/meta-openembedded/meta-python \
  ${BSPDIR}/meta-openembedded/meta-ruby \
  ${BSPDIR}/meta-openembedded/meta-multimedia \
  ${BSPDIR}/meta-qt5 \
  "

BBLAYERS_NON_REMOVABLE ?= " \
  ${BSPDIR}/poky/meta \
  ${BSPDIR}/poky/meta-poky \
  "

8/ Edit local.conf to specify the machine, location of source archived, package type (rpm, deb or ipk)
Pick one MACHINE name from the "Supported SoCs / MACHINE names" chapter above
and edit the "local.conf" file. Here is an example:

vim conf/local.conf
[...]
MACHINE ??= "sama5d3-xplained"
[...]
DL_DIR ?= "your_download_directory_path"
[...]
PACKAGE_CLASSES ?= "package_ipk"
[...]
USER_CLASSES ?= "buildstats image-mklibs"

To get better performance, use the "poky-atmel" distribution by also adding that
line:
DISTRO = "poky-atmel"

9/ Build core minimal image
bitbake core-image-minimal

10/ We found that additional local.conf changes are needed for our QT demo
image. You can add these two lines at the end of the file:
vim conf/local.conf
[...]
LICENSE_FLAGS_WHITELIST += "commercial"
SYSVINIT_ENABLED_GETTYS = ""

11/ Build Atmel demo images
bitbake atmel-qt5-demo-image


Typical bitbake output
======================
Build Configuration:
BB_VERSION        = "1.30.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "sama5d2-xplained"
DISTRO            = "poky-atmel"
DISTRO_VERSION    = "2.1"
TUNE_FEATURES     = "arm armv7a vfp thumb neon       callconvention-hard       cortexa5"
TARGET_FPU        = "hard"
meta
meta-poky
meta-yocto-bsp    = "krogoth:6c1c01392d91f512e2949ad1d57a75a8077478ba"
meta-atmel        = "krogoth:28c4b5d70f3f7df6f8b108a01f621ca0cf23c1a4"
meta-multimedia
meta-networking
meta-python
meta-ruby
meta-oe           = "krogoth:abd1795729501a13608da67054b9cbf185404be3"
meta-qt5          = "krogoth:4ec27e218d725677279d265ac1fc256443d665f7"

Atmel Poky Qt-Embedded SDK

The meta-toolchain recipes build tarballs which contain cross compilation toolchain, cross compiled libraries, includes and configuration tools suitable for application development outside Poky.

The specific meta-toolchain-qte or meta-toolchain-qt5 recipe adds all Qt-Embedded/QT5 libraries and all need environment variables needed to cross compile Qt applications.

For more recent Yocto Project distributions, we use the even more handy target populate_sdk.

Build Atmel Poky Qt-Embedded SDK:

bitbake -c populate_sdk atmel-qt5-demo-image
or
bitbake -c populate_sdk atmel-xplained-demo-image

Install Atmel Poky Qt-Embedded SDK:

./tmp/deploy/sdk/poky-atmel-glibc-x86_64-atmel-qt5-demo-image-cortexa5hf-vfp-toolchain-2.1.1.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.1.1
===========================================
Enter target directory for SDK (default: /opt/poky-atmel/2.1.1):
You are about to install the SDK to "/opt/poky-atmel/2.1.1". Proceed[Y/n]?
Extracting SDK.....................................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/poky-atmel/2.1.1/environment-setup-cortexa5hf-vfp-poky-linux-gnueabi

Use Atmel Poky Qt-Embedded SDK:

The installation directory (/opt/poky-atmel/2.1.1) contains a setup script which can be sourced to initialize all required environment variables.

cd /opt/poky-atmel/2.1.1/
source environment-setup-cortexa5hf-neon-poky-linux-gnueabi 

You can check your new environment

export | less
[...]
declare -x AR="arm-poky-linux-gnueabi-ar"
declare -x AS="arm-poky-linux-gnueabi-as "
declare -x CC="arm-poky-linux-gnueabi-gcc  -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a5 --sysroot=/opt/poky-atmel/2.1.1/sysroots/cortexa5hf-neon-poky-linux-gnueabi"
declare -x CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
declare -x CPP="arm-poky-linux-gnueabi-gcc -E  -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a5 --sysroot=/opt/poky-atmel/2.1.1/sysroots/cortexa5hf-neon-poky-linux-gnueabi"
declare -x CROSS_COMPILE="arm-poky-linux-gnueabi-"
declare -x LD="arm-poky-linux-gnueabi-ld  --sysroot=/opt/poky-atmel/2.1.1/sysroots/cortexa5hf-neon-poky-linux-gnueabi"
declare -x LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
[...]
declare -x OECORE_DISTRO_VERSION="2.1.1"
declare -x OE_QMAKE_CC="arm-poky-linux-gnueabi-gcc  -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a5 --sysroot=/opt/poky-atmel/2.1.1/sysroots/cortexa5hf-neon-poky-linux-gnueabi"
[...]

Tips & tricks

BitBake

bitbake -c listtasks <package_name>

You can use one of those tasks to have a fine grained control over the package building.

Hello World example

Reference to the "Hello World" example.

Recent FAQ

r17 - 27 Oct 2016 - 12:12:36 - NicolasFerre
 
Linux & Open Source related information for AT91 Smart ARM Microcontrollers

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Atmel® and others, are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. This site is powered by the TWiki collaboration platform

ARM® and others are registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM