For silicium ideas

Linux Yocto for Raspberry Pi

Linux Yocto for Raspberry Pi

Deploy Yocto 2.6 codename “Thud” on Raspberry Pi Zero Wireless

Yocto
Project Release
LTSI
Kernel Version
LTS
Kernel Version
Released
Kernel Version
Yocto Project 2.6 linux-yocto_4.9 linux-yocto_4.14 linux-yocto_4.18

GIT clone Yocto Layers

# Create your workspace
$ mkdir my_yocto && cd my_yocto

## Clone Git repos
# The build system
$ git clone -b thud git://git.yoctoproject.org/poky && cd poky

# Add specific meta for Raspberry Pi boards
$ git clone -b thud git://git.yoctoproject.org/meta-raspberrypi

Setup the environnement

# Setup the yocto environnement by sourcing the oe init script
$ . oe-init-build-env ../build

Then, the build directory should be automatically created and this screen should show up.

You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to, for
example, select a different MACHINE (target hardware). See conf/local.conf
for more information as common configuration options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you with some default values. To add additional metadata layers
into your configuration please add entries to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/

### Shell environment set up for builds. ###
You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

Before going further, the meta “Raspberry Pi” has to be declared into the build system of Yocto. Indeed, additional metas are not recognized automatically. To do so, edit the conf/bblayers file as the following.

$ vim build/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 ?= ""

BBLAYERS ?= " \
  /home/wp_user/workspace/my_yocto/poky/meta \
  /home/wp_user/workspace/my_yocto/poky/meta-poky \
  /home/wp_user/workspace/my_yocto/poky/meta-yocto-bsp \
  /home/wp_user/workspace/my_yocto/poky/meta-raspberrypi \
  "

Then, the last but most cool Yocto step is to choose the target machine. Raspberry Pi are ashamedly not mentioned among default machine choices because it comes from the meta-raspberrypi, so it must be added manually as showed below. All possible machines are available into “my_yocto/poky/meta-raspberrypi/conf/machine/”

Raspberry Pi machinesModelSOC version
raspberrypi0 Raspberry Pi Zero v1.3BCM2835
raspberrypi0-wifi Raspberry Pi Zero Wireless BCM2835
raspberrypi2Raspberry Pi 2 (model B)BCM2836
raspberrypi3-64Raspberry Pi 3 64 bits (model B)BCM2837
raspberrypi3Raspberry Pi 3 (model B) BCM2837
raspberrypi-cm3Raspberry Pi Compute module 3BCM2837
raspberrypi-cmRaspberry Pi Compute module 1BCM2835
raspberrypi??
$ vim build/conf/local.conf
[...]
# This sets the default machine to be qemux86 if no other machine is selected:
#MACHINE ??= "qemux86"
MACHINE ??= "raspberrypi3"
[...]

Install build dependencies (ubuntu and debian)

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

Build a very first image 🙂

$ bitbake core-image-base
Parsing recipes: 100% |#########################################################################################################################| Time: 0:03:04
Parsing of 817 .bb files complete (0 cached, 817 parsed). 1290 targets, 68 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.40.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "debian-9"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "raspberrypi"
DISTRO               = "poky"
DISTRO_VERSION       = "2.6.1"
TUNE_FEATURES        = "arm armv6 vfp arm1176jzfs callconvention-hard"
TARGET_FPU           = "hard"
meta
meta-poky
meta-yocto-bsp       = "thud:cc73390a75d98b96eb861ae0624283c1ea6ef1bd"
meta-raspberrypi     = "thud:a48743dc36e31170cf737e200cc88f273e13611a"

Troubleshooting

The first build is very time, memory and power consuming for your host machine !

≈ 50Go

≈ 1h of work

(with 8 cores CPU Intel Xeon 2620 v4 @ 2.1Ghz and 100Mbps internet bandwidth)



Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.