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
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
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
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
These files are the main configuration files inside Yocto Project
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
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”
With this we ensure that the variables modified before will load in or first execution.
source oe-init-build-env
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!