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.

This layer provides support for Microchip microprocessors (aka AT91)
====================================================================

For more information about the Microchip MPU product line see:
http://www.microchip.com/design-centers/32-bit-mpus
Linux & Open Source on Microchip microprocessors:
http://www.linux4sam.org


Supported SoCs / MACHINE names
==============================
- SAMA5D2 product family / sama5d2-xplained, sama5d27-som1-ek-sd
- 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: morty


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

Optionally:
- meta-qt5
URI: git://code.qt.io/yocto/meta-qt5.git
URI: http://code.qt.io/cgit/yocto/meta-qt5.git/
Tag: v5.9.1


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 morty

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

3/ Clone meta-qt5 git repository with the proper branch ready
git clone git://code.qt.io/yocto/meta-qt5.git
cd meta-qt5
git checkout v5.9.1
cd ..

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

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.32.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "sama5d2-xplained"
DISTRO            = "poky-atmel"
DISTRO_VERSION    = "2.2.2"
TUNE_FEATURES     = "arm armv7a vfp thumb neon       callconvention-hard       cortexa5"
TARGET_FPU        = "hard"
meta              
meta-poky         
meta-yocto-bsp    = "morty:7d5822bf4cb2089687c3c9a908cf4a4ef4e9a53a"
meta-atmel        = "morty:13c6c4f63a2c7a3c24f1d59152689193700c3d6b"
meta-oe           
meta-networking   
meta-python       
meta-ruby         
meta-multimedia   = "morty:fe5c83312de11e80b85680ef237f8acb04b4b26e"
meta-qt5          = "HEAD:5df9d273194e89498ea7fa93ac4ec987007253d2"


Contributing
============
To contribute to this layer you should submit the patches for review to:
the github pull-request facility directly or the forum. Anyway, don't forget to
Cc the maintainers.

AT91 Forum:
http://www.at91.com/discussions/

for some useful guidelines to be followed when submitting patches:
http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Maintainers:
Nicolas Ferre 
Patrice Vilchez 

When creating patches insert the [meta-atmel] tag in the subject, for example
use something like:
git format-patch -s --subject-prefix='meta-atmel][PATCH' 

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

YoctoProject

Yocto Project FAQ: Some Yocto Project FAQ entries. (Sama5d27Som1EK, Sama5d2Xplained, Sama5d4Xplained, Sama5d4ek, Sama5d3Xplained, Sama5d3xek, AT91sam9x5-ek)
Gui Solutions: Presentation of some GUI solutions. (Sama5d27Som1EK, Sama5d2Xplained, Sama5d4Xplained, Sama5d4ek, Sama5d3Xplained, Sama5d3xek)
r20 - 13 Oct 2017 - 14:53:14 - 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