Skip to content

Instantly share code, notes, and snippets.

@dgarciga
Last active June 10, 2019 09:10
Show Gist options
  • Save dgarciga/572d77043bdc99bba06dcf592db42601 to your computer and use it in GitHub Desktop.
Save dgarciga/572d77043bdc99bba06dcf592db42601 to your computer and use it in GitHub Desktop.
This Gist has the function to resume some important parts from Yocto related with the frist use of the tool.

Yocto

Install Os

Operating System Basic packages

I based this tutorial on some parts of this manual:

https://www.yoctoproject.org/docs/latest/brief-yoctoprojectqs/brief-yoctoprojectqs.html

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

Clone Yocto

To be updated it's necessary to check new versions in this url:

https://www.yoctoproject.org/software-overview/downloads/

The last version is warrior so we can checkout to version branch using this command

git clone -b warrior git://git.yoctoproject.org/poky.git

Clone meta-raspberrypi

We need to be inside poky directory with all the meta directories

cd poky
git clone -b warrior https://git.yoctoproject.org/git/meta-raspberrypi

Initialize the yocto environment

In this way we can declare all the necessary variables to run Yocto, every time we want to work with Yocto we must execute:

source oe-init-build-env

Modify conf/bblayers.conf and local.conf

These files are the main configuration files inside Yocto Project

bblayers

Include all layers that we want to add to the current project. When Yocto is executed, the file is readed and then all the recipes declared in every layer inside it.

Add the path to meta-raspberrypi in the list for BBLAYERS variable

local.conf

This file allow us to configure machine, distro and so on. If you are curious take a look a read the comments.

We are going to modify the variables to configure Yocto machine,

Change MACHINE ??= "qemux86" --> MACHINE ??= "raspberrypi3"

Add these lines to use all cpu cores to reduce the compilation time and free some disk space after compilation (rm_work)

BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()}"

PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count()}"

INHERIT +=rm_work

Reinitialize the yocto envieronment

With this we ensure that the variables modified before will load in or first execution.

source oe-init-build-env

Trigger the basic rpi-sdimg

At this point we have all to execute the Bitbake engine, this tool inside Yocto read all meta-layers declares and execute the necessary recipes to produce the image.

In this case the image (another recipe with specific syntax) core-image-base has all the recipes to make a file to directly load into a SDcard and put inside a RaspberryPi.

The first time that you execute this command it will takes along 2 hours, it depends on your internet connection and your cpu. It will execute first all the host tools for example the ARM crosscompiler that runs into your system and then all the recipes for your target machine.

Be sure that you have available about 35GB free disk space.

It's time to run Yocto!!

bitbake core-image-base

Go for a Coffee it's time to study!

https://www.yoctoproject.org/docs/latest/overview-manual/overview-manual.html#openembedded-build-system-workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment