Yocto

From ArchWiki
Revision as of 07:00, 5 August 2015 by Soderstrom (talk | contribs) (→‎Setup and build the minimal image: Added example output, and shortly described common warnings)
Jump to navigation Jump to search

Arch Linux is currently not validated to work with Yocto/Poky, and it used to require changing the build script. That is no longer the case. This guide is written with respect to YP Core 1.8 (Fido) and newer.

Installation

Multilib

Enable Multilib repository by uncommenting both of these lines in /etc/pacman.conf

[multilib]
Include = /etc/pacman.d/mirrorlist

Then update the package list and upgrade with pacman -Syu.

Install dependencies

pacman -S git diffstat unzip texinfo python2 chrpath \
          gcc-multilib wget xterm sdl socat cpio

You may recieve the following conflicts

:: gcc-multilib and gcc are in conflict. Remove gcc? [y/N] y
:: gcc-libs-multilib and gcc-libs are in conflict. Remove gcc-libs? [y/N] y

Resolve these by choosing 'y' (we actually want the multilib versions)


Test your installation

In order to test that yocto is properly working, we will build core-image-minimal

Clone the git repository

Before we begin we need to clone the official git repository. Here we will use the fido branch.

$ git clone --branch fido git://git.yoctoproject.org/poky.git poky

python2

Yocto currently requires the use of python2, but the default in Arch Linux is python3. In the Python page there is an explanation about how to trick the environment.

We will do almost the same, but also add a simple script file so that it can be easily sourced later.

$ mkdir -p ~/bin/python2
$ ln -s /usr/bin/python2 ~/bin/python2/python
$ ln -s /usr/bin/python2-config ~/bin/python2/python-config

Now create the file ~/bin/python2-env and insert the following text within it

export PATH=~/bin/python2:$PATH

Setup and build the minimal image

First you need to source the python2-env file we just created and then initialize the yocto environment. In the example below we create a folder named build-qemux86, the source command will also place you in this folder. From here we can now build the core-image-minimal.

$ cd poky
$ source ~/bin/python2-env && source oe-init-build-env build-qemux86
$ bitbake core-image-minimal
WARNING: Host distribution "Arch-Linux" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100%
|########################################################################################################################################################################################################################################################################################| Time: 00:02:42
Parsing of 884 .bb files complete (0 cached, 884 parsed). 1285 targets, 41 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.26.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Arch-Linux"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "1.8"
TUNE_FEATURES     = "m32 i586"
TARGET_FPU        = ""
meta              
meta-yocto        
meta-yocto-bsp    = "fido:08d32590411568e7bf11612ac695a6e9c6df6286"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL http://downloads.sourceforge.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1989 tasks of which 9 didn't need to be rerun and all succeeded.

Summary: There were 2 WARNING messages shown.

This will take some time to complete. For more details about yocto there is a Quick Start Guide

The first warning about Arch Linux not been validated is expected. The second warning can happen when failing to download a resource, the build system will then attempt to get that resource from the next mirror.