Yocto with raspberry pi
The Yocto Project (YP) is an open source collaboration project that helps developers create custom Linux-based systems regardless of the hardware architecture. The project provides a flexible set of tools and a space where embedded developers worldwide can share technologies, software stacks, configurations, and best practices that can be used to create tailored Linux images for embedded and IOT devices, or anywhere a customized Linux OS is needed.
For more info visit yoctoproject
The build process
Below steps cover the environment setup and process to build yocto from the source tree for Raspberry Pi board.
Build Environment Setup
Install the following package
sudo apt-get update
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl12-dev xterm liblz4-tool python
Clone Yocto: kirkstone branch
Clone yocto git repo using below command
cd ~
mkdir yocto
cd yocto
git clone -b kirkstone git://git.yoctoproject.org/poky
cd poky
git checkout remotes/origin/kirkstone
cd ~/yocto/
git clone -b kirkstone git://git.yoctoproject.org/meta-raspberrypi
source oe-init-build-env
Clone custom repo
cd ~/yocto
git clone https://gitlab.com/vishalkuma/yocto-rpi.git
cd yocto-rpi
git switch develop
mv meta-rpilinux meta-vishal ~/yocto/
cd ~/yocto
rm -rf yocto-rpi
Editing bblayers.conf
The bblayers.conf file defines layers, which are directory trees, traversed (or walked) by BitBake. The bblayers.conf file uses the BBLAYERS variable to list the layers BitBake tries to find. for more info, visit info
By default the bblayers.conf file in ~/yocto/poky/build/conf/ should look like
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/vishal/yocto/poky/meta \
/home/vishal/yocto/poky/meta-poky \
/home/vishal/yocto/poky/meta-yocto-bsp \
"
Add meta-raspberrypi meta-rpilinux and meta-vishal to bblayers.conf. now bblayers.conf file should look like
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/vishal/yocto/poky/meta \
/home/vishal/yocto/poky/meta-poky \
/home/vishal/yocto/poky/meta-yocto-bsp \
/home/vishal/yocto/meta-raspberrypi \
/home/vishal/yocto/meta-rpilinux \
/home/vishal/yocto/meta-vishal \
"
Editing local.conf
This configuration file contains all the local user configurations for your build environment. The local.conf file contains documentation on the various configuration options. for more info, visit info
local.conf file will be in ~/yocto/poky/build/conf/
Add target machine for the build, Look for the MACHINE ??= "qemux86-64" line in the file and change it to:
MACHINE ??= "raspberrypi3-64"
The raspberrypi3-64 is pointing to an configuration file raspberrypi3-64.conf (for raspberry pi-3 64-bit) located at meta-raspberrypi/conf/machine/raspberrypi3-64.conf
Add image target to conf-notes.txt
By default yocto uses some common target, Here we have own custom targed image (named rpilinux-image) created in ~/yocto/meta-rpilinux/recipes-rpilinux/images/rpilinux-image.bb so it will be better for user prospective to add this image to config notes. conf-notes.txt located inside ~/yocto/poky/meta-poky/conf/
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-full-cmdline
core-image-sato
core-image-weston
meta-toolchain
meta-ide-support
rpilinux-image
You can also run generated qemu images with a command like 'runqemu qemux86'
Other commonly useful commands are:
- 'devtool' and 'recipetool' handle common recipe tasks
- 'bitbake-layers' handles common layer tasks
- 'oe-pkgdata-util' handles common target package tasks
Build image
cd ~/Yocto/poky
source oe-init-build-env
bitbake rpilinux-image
©2023-2024 rculock.com