0% found this document useful (0 votes)
1 views7 pages

Yocto Raspberry

This document provides a practical guide for training on the Yocto Project and OpenEmbedded using the Raspberry Pi 3 Model B+. It includes instructions for setting up the training environment, downloading necessary files, and building the first Yocto image. Additionally, it offers guidelines for troubleshooting and best practices during the labs.

Uploaded by

levannam872003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views7 pages

Yocto Raspberry

This document provides a practical guide for training on the Yocto Project and OpenEmbedded using the Raspberry Pi 3 Model B+. It includes instructions for setting up the training environment, downloading necessary files, and building the first Yocto image. Additionally, it offers guidelines for troubleshooting and best practices during the labs.

Uploaded by

levannam872003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Yocto Project and OpenEmbedded Training

Raspberry Pi 3 Model B+ variant

Practical Guide

[Link]

January 05, 2022


Yocto Project and OpenEmbedded Training

About this document


Updates to this document can be found on [Link]
master/[Link].
This document was generated from LaTeX sources found on [Link]
le-son/latex_doc.

Copying this document


© 2020, BanVien, [Link]
This document is released under the terms of the Creative Commons CC BY-SA
3.0 license . This means that you are free to download, distribute and even modify
it, under certain conditions.
Corrections, suggestions, contributions and translations are welcome!

2 © 2020 Banvien, CC BY-SA license


Yocto Project and OpenEmbedded Training

Training setup
Download files and directories used in practical labs

Install lab data


For the lab in this guide, your instructor has prepared a set of data ([Link], [Link]).
Download its from a terminal:
$ cd
$ git clone [Link]

git clone need account to finish, please enter Username ex: [Link]-son and Password ex:
xxxxxx. Lab data are now available in an directory in your home directory. This directory
contains files used in the this practical lab. It will also be used as working space, in particular
to keep generated files separate when needed.

Update your distribution


To avoid any issue installing packages during the practical labs, you should apply the latest
updates to the packages in your distro:

$ sudo apt update


$ sudo apt dist-upgrade

You are now ready to start the real practical labs!

Install extra packages


Feel free to install other packages you may need for your development environment. In particular,
we recommend to install your favorite text editor and configure it to your taste. The favorite text
editors of embedded Linux developers are of course Vim and Emacs, but there are also plenty
of other possibilities, such as Visual Studio Code1 , GEdit, Qt Creator, CodeBlocks, Geany, etc.
It is worth mentioning that by default, Ubuntu comes with a very limited version of the vi
editor. So if you would like to use vi, we recommend to use the more featureful version by
installing the vim package.

More guidelines
Can be useful throughout any of the labs
• Read instructions and tips carefully. Lots of people make mistakes or waste time because
they missed an explanation or a guideline.
• Always read error messages carefully, in particular the first one which is issued. Some
people stumble on very simple errors just because they specified a wrong file path and
didn’t pay enough attention to the corresponding error message.
• Never stay stuck with a strange problem more than 5 minutes. Show your problem to
your colleagues or to the instructor.
1 This tool from Microsoft is Open Source! To try it on Ubuntu: sudo snap install code --classic

© 2020 Banvien, CC BY-SA license 3


Yocto Project and OpenEmbedded Training

• You should only use the root user for operations that require super-user privileges, such
as: mounting a file system, loading a kernel module, changing file ownership, configuring
the network. Most regular tasks (such as downloading, extracting sources, compiling...)
can be done as a regular user.
• If you ran commands from a root shell by mistake, your regular user may no longer be
able to handle the corresponding generated files. In this case, use the chown -R command
to give the new files back to your regular user.
Example: $ chown -R [Link] linux/

4 © 2020 Banvien, CC BY-SA license


Yocto Project and OpenEmbedded Training

First Yocto Project build


Your first dive into Yocto Project and its build mechanism

During this lab, you will:


• Set up an OpenEmbedded environment
• Configure the project and choose a target
• Build your first Poky image

Setup
Before starting this lab, make sure your home directory is not encrypted. OpenEmbedded
cannot be used on top of an eCryptFS file system due to limitations in file name lengths.

$ cd
$ sudo mkdir $HOME/bv-labs

Go to the $HOME/bv-labs/ directory.

$ cd $HOME/bv-labs

Install the required packages:

$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 \
xterm python3-subunit mesa-common-dev zstd liblz4-tool

Download Yocto
Download the honister version of Poky:

$ git clone -b honister --single-branch git://[Link]/[Link]


$ cd $HOME/bv-labs/poky
$ git checkout 4ce984316d038eaed2f48533b31d0a1898942f0a

At poky directory ($HOME/bv-labs/poky), download the meta-openembedded and meta-security,


meta-raspberrypi layers:

$ git clone -b honister --single-branch git://[Link]/\


[Link]
$ git clone -b honister --single-branch git://[Link]/\
[Link]
$ git clone -b honister --single-branch git://[Link]/\
[Link]
$ cd $HOME/bv-labs/poky/meta-openembedded
$ git checkout a12eff7e3f6aa1d4150b0724d4b7939622aa598f

© 2020 Banvien, CC BY-SA license 5


Yocto Project and OpenEmbedded Training

$ cd $HOME/bv-labs/poky/meta-security
$ git checkout fb77606aef461910db4836bad94d75758cc2688c
$ cd $HOME/bv-labs/poky/meta-raspberrypi
$ git checkout 1584bddcf31f4bf3acc2304aa8dae927e8bec970

Set up the build environment


Check you’re using Bash. This is the default shell when using Ubuntu.

Export all needed variables and set up the build directory:

$ cd $HOME/bv-labs
$ source poky/oe-init-build-env

You must specify which machine is your target. By default it is qemu. We need to build an
image for a raspberrypi3-B+. Update the MACHINE configuration variable accordingly.

Also, if you need to save disk space on your computer you can add INHERIT += "rm_work" in
the previous configuration file. This will remove the package work directory once a package is
built.

Edit the layer configuration file ($BUILDDIR/conf/[Link]) and append the full path to
the meta-raspberrypi, meta-poky, meta-security, etc..., directories to the BBLAYERS variable.

To convenience for build a first example image, you need to use configuration file has cloned in
step above.

$ mv $HOME/yocto_config/[Link] $HOME/bv-labs/build/conf
$ mv $HOME/yocto_config/[Link] $HOME/bv-labs/build/conf

Build your first image


Now that you’re ready to start the compilation, simply run:

$ bitbake core-image-weston

Once the build finished, you will find the output images under

$HOME/bv-labs/build/tmp/deploy/images/raspberrypi3-64.

Set up the SD card


In this first lab we will use an SD card to store the bootloader, kernel and root filesystem
files. The SD card image has been generated and is named core-image-weston-raspberrypi3-
[Link].bz2.

Now uncompress and flash the image with the following command:

$ sudo bmaptool copy [Link].bz2 /dev/sdX

/dev/sdX you need to check check the name of SD card device by cmd lsblk

In case your SD card has mounted, you have to unmount the device:

For example:

6 © 2020 Banvien, CC BY-SA license


Yocto Project and OpenEmbedded Training

$ sudo umount /media/dy/boot


$ sudo umount /media/dy/root
$ sudo bmaptool copy [Link].bz2 /dev/sdX

Insert the SD card in the dedicated slot on the Raspberrypi3. Plug in the USB cable, HDMI
cable and plug in the power. You should see boot flash on the screen.
Congratulations! The board has booted.

© 2020 Banvien, CC BY-SA license 7

You might also like