SlideShare a Scribd company logo
Building your own embedded
system with Yocto
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Preface
● if you have any questions, don't hesitate to ask, comment, ...
● ⚠ 10 GB of free disk space ⚠
● ⚠ internet connection ⚠
● please pass the USB flash drives around and copy the contents to your
laptop
2
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
🙋‍♂ About me
● Marius Meisenzahl
● loves to tinker with hardware and software 🤓
● Linux enthusiast 🐧
● co-founder of
○ located in Bochum
○ we build software from embedded to web
3
/meisenzahl /msnzhl
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
🐧 Linux origin story
● first steps with Knoppix, Mandriva (formerly Mandrake)
● distro hopped: openSUSE, Debian, Ubuntu, Arch Linux, ...
○ interest in how things work
■ Gentoo
■ Linux From Scratch → Great for a rainy weekend
● Ubuntu Hardy Heron (8.04)
● several years Arch Linux
● for a long time elementary OS (Ubuntu based distribution)
● building own systems
○ Kernel + BusyBox
○ Buildroot
○ Yocto
4
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Quick Poll
● Who of you has ever built an embedded system before?
● Who of you has ever compiled a Linux kernel?
● Who of you has ever used a cross-compiler?
5
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Goals
➔ Building your own embedded system with Yocto
◆ How do embedded Linux systems work?
◆ What is Yocto?
◆ How does Yocto work?
6
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Agenda
1. Basic knowledge
○ Embedded systems
○ Yocto Project
2. Inner workings
○ Initial setup
○ Leaving the comfort zone
3. Getting used to it
○ DIY
○ Outlook
7
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
1. Basic knowledge
8
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Embedded systems
9
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
What is an embedded system?
● An embedded system is a computer system that has a dedicated function
within a larger mechanical or electrical system
● A distribution is an operating system based on a Linux kernel
10
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Architecture of embedded systems
11
Applications
Libraries
System Call Interface
IO
Management
Process
Management
Memory
Management
Device Driver Layer
Bootloader
Firmware
Userland
Kernel
Hardware
ConfigurationsApplications
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Hardware
12
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Firmware
● basic initialization of the hardware
● loads the bootloader
13
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Bootloader
● further initialization of the hardware
● loads kernel and userland into main memory
● additional features
○ read and write memory
○ define boot parameters
○ choose boot source (internal/external memory, network, …)
○ scripting (A/B booting, …)
○ image verification
○ ...
● common bootloader
○ Das U-Boot
14
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Kernel
15
System Call Interface
IO
Management
Process
Management
Memory
Management
Device Driver Layer
Kernel
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Kernel
16
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Kernel
● current LTS 5.4.25
○ allnoconfig 652 KB
○ allyesconfig 123 MB
17
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Kernel
18
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Userland
19
Applications
LibrariesConfigurations
Userland
● logic of the system apart from the kernel
● located on root file system
● contains
○ libraries
○ applications
○ configurations
○ …
Applications
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Userland
● kernel starts process with id 1
○ so called init process
● it can be a simple shell script
○ which starts other processes
● or a full blown process manager like systemd
○ starts so called services as background processes
20
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Userland
21
init
pid=1
httpd
pid=1038
login
pid=154
bash
pid=294
httpd
pid=1364
httpd
pid=1284
ls
pid=336
cowsay
pid=300
php
pid=1783
php
pid=1694
htop
pid=385
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Filesystem Hierarchy Standard (simplified)
22
/bin, /sbin system applications
/boot boot related files like kernels, ...
/dev, /proc, /sys devices, processes, ...
/etc configuration files
/home user related files
/lib libraries
/tmp temporary files
/usr user applications, libraries, ...
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Yocto Project
23
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
24
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
It’s not an embedded Linux distribution.
25
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
It’s not an embedded Linux distribution.
It creates a custom one for you.
26
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Yocto
● open source project of the Linux Foundation
● licensed under MIT and GPLv2
● helps developers create custom Linux-based systems regardless of the
hardware architecture
27
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Poky
● Poky is the reference distribution
● you can use it as a base
● tweak it to your needs
28
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Cooking
29
👨‍🍳
🍛
🍚🥕🧂🍠
📗📘📙
📄
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Engineering with Yocto
30
👨‍🍳 👨‍💻
🍛 embedded system
🍚🥕🧂🍠 libraries, applications, ...
📗📘📙 📁 layers
📄 📄 recipe
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Layers
📁 meta-embo
📁 meta-poky
📁 meta-selftest
📁 meta-skeleton
📁 meta-yocto-bsp
31
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Layer
meta-embo
├── conf
│ ├── distro
│ │ ├── embo.conf
│ │ └── embo-tiny.conf
│ └── layer.conf
└── recipes-core
├── hello-cmake
│ └── hello-cmake.bb
└── images
└── embo-image.bb
32
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb 
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "embo"
BBFILE_PATTERN_embo = "^${LAYERDIR}/"
BBFILE_PRIORITY_embo = "6"
LAYERSERIES_COMPAT_embo = "warrior"
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Recipe
meta-embo
├── conf
│ ├── distro
│ │ ├── embo.conf
│ │ └── embo-tiny.conf
│ └── layer.conf
└── recipes-core
├── hello-cmake
│ └── hello-cmake.bb
└── images
└── embo-image.bb
33
DESCRIPTION = "hello cmake"
SECTION = "examples"
LICENSE = "CLOSED"
DEPENDS = ""
SRC_URI = " file:./hello-cmake/"
S = "${WORKDIR}/hello-cmake"
inherit pkgconfig cmake
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Image
meta-embo
├── conf
│ ├── distro
│ │ ├── embo.conf
│ │ └── embo-tiny.conf
│ └── layer.conf
└── recipes-core
├── hello-cmake
│ └── hello-cmake.bb
└── images
└── embo-image.bb
34
require recipes-core/images/core-image-minimal.bb
IMAGE_INSTALL_append = "
hello-cmake 
hello-make 
hello-meson 
"
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
BitBake
● build tool
● reads .bb and .bbappend files
● resolves dependencies between recipes
● creates build order
● generates Python code to build packages
35
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
BitBake tasks
● fetch
● unpack
● patch
● configure
● compile
● populate
● install
● package
● package_write
36
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
2. Inner workings
37
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Initial setup
38
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
QEMU
● generic machine emulator and virtualizer
● licensed under GPLv2 and BSD
● we use qemu-system-i386 to test our embedded system
○ due to lack of embedded hardware
39
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
👷 Build Host
● linux distribution
○ Windows Subsystem for Linux (WSL) is not supported
○ but you can use Docker or a virtual machine (VirtualBox)
● Ubuntu 16.04, 18.04, 19.04
● Fedora 28, 29, 30
● CentOS 7.x
● Debian GNU/Linux 8.x, 9.x, 10.x
● OpenSUSE Leap 15.1
40
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
👷 Build Host
● initialize your build environment
○ Docker (recommended)
○ local (Linux only)
○ VirtualBox
41
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
🤞 Test if build environment works
● make embo-image
● make run-embo-image
42
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Important files and folders
● Makefile
○ BRANCH
○ DISTRO
○ MACHINE
● poky/build/conf/bblayers.conf
● poky/build/conf/local.conf
○ DL_DIR = downloads
○ SSTATE_DIR = sstate-cache
● poky/build/tmp/deploy/images
● poky/build/tmp/deploy/licenses
● poky/build/tmp/deploy/rpm
43
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Playtime
● login as user root
● ps
○ /init pid=1
● /init
○ /sbin/init
■ /bin/busybox.nosuid
● /bin/busybox.nosuid
● /bin/busybox.nosuid init
● hello-make
● hello-cmake
● hello-meson
44
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-make
● minimal example built with make
45
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-cmake
● minimal example built with cmake
46
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-meson
● minimal example built with meson
47
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Leaving the comfort zone
48
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
bitbake
● cd poky
● source oe-init-build-env
● export DISTRO=embo-tiny
● export MACHINE=qemux86
● bitbake embo-image
● bitbake hello-make -c build
● bitbake hello-make -c cleanall
● bitbake hello-make -c build
● bitbake -s
49
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Dependencies
🔗 https://layers.openembedded.org/layerindex/branch/warrior/recipes/
● git clone -b warrior git:./git.openembedded.org/meta-openembedded
● add to poky/build/conf/bblayers.conf
○ meta-openembedded/meta-oe
● bitbake nlohmann-json
50
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-json
● create a new example recipe which uses nlohmann-json
DESCRIPTION = "hello json"
SECTION = "examples"
LICENSE = "CLOSED"
DEPENDS = "nlohmann-json"
SRC_URI = " file:./hello-json/"
S = "${WORKDIR}/hello-json"
inherit pkgconfig cmake
51
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-json
● create a main.cpp which uses nlohmann-json
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann.:json;
int main() {
json j;
j["hello"] = "json";
std.:cout .< j.dump() .< std.:endl;
return 0;
}
52
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-json
● create a CMakeLists.txt to build example
cmake_minimum_required(VERSION 3.10)
project(hello-json)
find_package(nlohmann_json REQUIRED)
add_executable(hello-json main.cpp)
target_link_libraries(hello-json nlohmann_json.:nlohmann_json)
install(TARGETS hello-json DESTINATION bin)
53
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
embo-image
● add your new package to our image
require recipes-core/images/core-image-minimal.bb
IMAGE_INSTALL_append = "
hello-cmake 
hello-make 
hello-meson 
hello-json 
"
54
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
embo-image
● bitbake embo-image
● make run-embo-image
● hello-json
○ {"hello":"json"}
55
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Dependency graph
● bitbake -g hello-make
● less recipe-depends.dot
● ⚠ dot -Tpng recipe-depends.dot -o recipe-depends.png ⚠
● less task-depends.dot
56
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Dependency graph
● bitbake -g embo-image
● less recipe-depends.dot
● less task-depends.dot
57
👨‍💻
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
3. Getting used to it
58
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Add files to rootfs
base-files_%.bbappend
FILESEXTRAPATHS_prepend .= "${THISDIR}/files:"
SRC_URI += "file:./embo"
do_install_append() {
install -m 0644 ${WORKDIR}/embo ${D}/embo
}
59
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Add users
recipe
inherit useradd
USER .= "user"
PASSWORD .= "9PfNy0O1z0O5g"
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = ".-system .-create-home 
.-groups tty 
.-password ${PASSWORD} 
.-user-group ${USER}"
60
⚠ DISTRO = embo ⚠
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-boost
DESCRIPTION = "hello boost"
SECTION = "examples"
LICENSE = "CLOSED"
DEPENDS = "boost"
RDEPENDS_${PN} = "boost-thread"
SRC_URI = " file:./hello-boost/"
S = "${WORKDIR}/hello-boost"
inherit pkgconfig cmake
61
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-boost
#include <boost/thread.hpp>
#include <boost/chrono.hpp>
#include <iostream>
void wait(int seconds) {
boost.:this_thread.:sleep_for(boost.:chrono.:seconds{seconds});
}
void thread() {
for (int i = 0; i < 5; .+i) {
wait(1);
std.:cout .< i .< std.:endl;
62
}
}
int main() {
boost.:thread t{thread};
t.join();
return 0;
}
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
hello-boost
cmake_minimum_required(VERSION 3.10)
project(hello-boost)
find_package(Boost COMPONENTS thread REQUIRED)
add_executable(hello-boost main.cpp)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(hello-cmake ${Boost_LIBRARIES})
install(TARGETS hello-boost DESTINATION bin)
63
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
DIY
● try to build something yourself
● ask for help
64
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
Outlook
● bundle sources of packages used to build image
○ update your systems with a package manager
■ EXTRA_IMAGE_FEATURES += "package-management"
○ sign your packages
■ INHERIT += "sign_rpm"
● create a SDK to simplify development
○ bitbake <image> -c populate_sdk
● bundle list of licenses of packages used to build image
● license management
○ prohibit certain licenses
■ INCOMPATIBLE_LICENSE = "GPL-3.0 LGPL-3.0 AGPL-3.0"
● ...
65
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
What else can you do with Yocto?
● build custom Docker images
IMAGE_FSTYPES += " .tar.gz"
FROM scratch
ADD rootfs.tar.gz /
CMD ["/bin/sh"]
66
13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl
References
● https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.h
tml
● https://git.yoctoproject.org/
● https://www.yoctoproject.org/docs/what-i-wish-id-known/
67
Ad

More Related Content

What's hot (20)

Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
linuxlab_conf
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
Sherif Mousa
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded training
H Ming
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
Emertxe Information Technologies Pvt Ltd
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Project
rossburton
 
Linux Boot Process
Linux Boot ProcessLinux Boot Process
Linux Boot Process
darshhingu
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
linux device driver
linux device driverlinux device driver
linux device driver
Rahul Batra
 
Qt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoQt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with Yocto
Prabindh Sundareson
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto project
Yen-Chin Lee
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 
A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
Emertxe Information Technologies Pvt Ltd
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
SysPlay eLearning Academy for You
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
shimosawa
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
mukul bhardwaj
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
Linaro
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
linuxlab_conf
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
Sherif Mousa
 
Yocto project and open embedded training
Yocto project and open embedded trainingYocto project and open embedded training
Yocto project and open embedded training
H Ming
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Project
rossburton
 
Linux Boot Process
Linux Boot ProcessLinux Boot Process
Linux Boot Process
darshhingu
 
linux device driver
linux device driverlinux device driver
linux device driver
Rahul Batra
 
Qt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoQt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with Yocto
Prabindh Sundareson
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto project
Yen-Chin Lee
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
shimosawa
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
Linaro
 

Similar to Building your own embedded system with Yocto (20)

Embedded linux build systems
Embedded linux build systems  Embedded linux build systems
Embedded linux build systems
Mender.io
 
Yocto and IoT - a retrospective
Yocto and IoT - a retrospectiveYocto and IoT - a retrospective
Yocto and IoT - a retrospective
Open-RnD
 
run 64 bit on 32 bit
run 64 bit on 32 bitrun 64 bit on 32 bit
run 64 bit on 32 bit
ssuser1eca7d
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
Mender.io
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devices
Mender.io
 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
Sourabh Singh Tomar
 
An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018
ICS
 
Why the yocto project for my io t project elc_edinburgh_2018
Why the yocto project for my io t project elc_edinburgh_2018Why the yocto project for my io t project elc_edinburgh_2018
Why the yocto project for my io t project elc_edinburgh_2018
Mender.io
 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018
Mender.io
 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdf
ssuser30e7d2
 
Building Embedded Linux UDOONEO
Building Embedded Linux UDOONEOBuilding Embedded Linux UDOONEO
Building Embedded Linux UDOONEO
NEEVEE Technologies
 
Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Project
rossburton
 
14038356 installation-guide-of-centos-5
14038356 installation-guide-of-centos-514038356 installation-guide-of-centos-5
14038356 installation-guide-of-centos-5
Hind Sahel
 
Linux kernel booting
Linux kernel bootingLinux kernel booting
Linux kernel booting
Ramin Farajpour Cami
 
MikroTik User Guide
MikroTik User GuideMikroTik User Guide
MikroTik User Guide
seolangit4
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
ICS
 
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
Part 1 of 'Introduction to Linux for bioinformatics': IntroductionPart 1 of 'Introduction to Linux for bioinformatics': Introduction
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
Joachim Jacob
 
Windows 7
Windows 7Windows 7
Windows 7
Akul Kapadiya
 
IRJET - Development of Embedded Linux System from Bare Board
IRJET - Development of Embedded Linux System from Bare BoardIRJET - Development of Embedded Linux System from Bare Board
IRJET - Development of Embedded Linux System from Bare Board
IRJET Journal
 
CA_Module_3.pptx
CA_Module_3.pptxCA_Module_3.pptx
CA_Module_3.pptx
OnyemaobiAmarachi
 
Embedded linux build systems
Embedded linux build systems  Embedded linux build systems
Embedded linux build systems
Mender.io
 
Yocto and IoT - a retrospective
Yocto and IoT - a retrospectiveYocto and IoT - a retrospective
Yocto and IoT - a retrospective
Open-RnD
 
run 64 bit on 32 bit
run 64 bit on 32 bitrun 64 bit on 32 bit
run 64 bit on 32 bit
ssuser1eca7d
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
Mender.io
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devices
Mender.io
 
Crafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using BuilrootCrafting GNU/ linux distributions for embedded target using Builroot
Crafting GNU/ linux distributions for embedded target using Builroot
Sourabh Singh Tomar
 
An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018An Introduction to the Yocto Embedded Framework 2018
An Introduction to the Yocto Embedded Framework 2018
ICS
 
Why the yocto project for my io t project elc_edinburgh_2018
Why the yocto project for my io t project elc_edinburgh_2018Why the yocto project for my io t project elc_edinburgh_2018
Why the yocto project for my io t project elc_edinburgh_2018
Mender.io
 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018
Mender.io
 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdf
ssuser30e7d2
 
Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Project
rossburton
 
14038356 installation-guide-of-centos-5
14038356 installation-guide-of-centos-514038356 installation-guide-of-centos-5
14038356 installation-guide-of-centos-5
Hind Sahel
 
MikroTik User Guide
MikroTik User GuideMikroTik User Guide
MikroTik User Guide
seolangit4
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
ICS
 
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
Part 1 of 'Introduction to Linux for bioinformatics': IntroductionPart 1 of 'Introduction to Linux for bioinformatics': Introduction
Part 1 of 'Introduction to Linux for bioinformatics': Introduction
Joachim Jacob
 
IRJET - Development of Embedded Linux System from Bare Board
IRJET - Development of Embedded Linux System from Bare BoardIRJET - Development of Embedded Linux System from Bare Board
IRJET - Development of Embedded Linux System from Bare Board
IRJET Journal
 
Ad

Recently uploaded (20)

Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
Compiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptxCompiler Design Unit1 PPT Phases of Compiler.pptx
Compiler Design Unit1 PPT Phases of Compiler.pptx
RushaliDeshmukh2
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Ad

Building your own embedded system with Yocto

  • 1. Building your own embedded system with Yocto
  • 2. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Preface ● if you have any questions, don't hesitate to ask, comment, ... ● ⚠ 10 GB of free disk space ⚠ ● ⚠ internet connection ⚠ ● please pass the USB flash drives around and copy the contents to your laptop 2
  • 3. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 🙋‍♂ About me ● Marius Meisenzahl ● loves to tinker with hardware and software 🤓 ● Linux enthusiast 🐧 ● co-founder of ○ located in Bochum ○ we build software from embedded to web 3 /meisenzahl /msnzhl
  • 4. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 🐧 Linux origin story ● first steps with Knoppix, Mandriva (formerly Mandrake) ● distro hopped: openSUSE, Debian, Ubuntu, Arch Linux, ... ○ interest in how things work ■ Gentoo ■ Linux From Scratch → Great for a rainy weekend ● Ubuntu Hardy Heron (8.04) ● several years Arch Linux ● for a long time elementary OS (Ubuntu based distribution) ● building own systems ○ Kernel + BusyBox ○ Buildroot ○ Yocto 4
  • 5. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Quick Poll ● Who of you has ever built an embedded system before? ● Who of you has ever compiled a Linux kernel? ● Who of you has ever used a cross-compiler? 5
  • 6. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Goals ➔ Building your own embedded system with Yocto ◆ How do embedded Linux systems work? ◆ What is Yocto? ◆ How does Yocto work? 6
  • 7. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Agenda 1. Basic knowledge ○ Embedded systems ○ Yocto Project 2. Inner workings ○ Initial setup ○ Leaving the comfort zone 3. Getting used to it ○ DIY ○ Outlook 7
  • 8. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 1. Basic knowledge 8
  • 9. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Embedded systems 9
  • 10. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl What is an embedded system? ● An embedded system is a computer system that has a dedicated function within a larger mechanical or electrical system ● A distribution is an operating system based on a Linux kernel 10
  • 11. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Architecture of embedded systems 11 Applications Libraries System Call Interface IO Management Process Management Memory Management Device Driver Layer Bootloader Firmware Userland Kernel Hardware ConfigurationsApplications
  • 12. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Hardware 12
  • 13. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Firmware ● basic initialization of the hardware ● loads the bootloader 13
  • 14. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Bootloader ● further initialization of the hardware ● loads kernel and userland into main memory ● additional features ○ read and write memory ○ define boot parameters ○ choose boot source (internal/external memory, network, …) ○ scripting (A/B booting, …) ○ image verification ○ ... ● common bootloader ○ Das U-Boot 14
  • 15. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Kernel 15 System Call Interface IO Management Process Management Memory Management Device Driver Layer Kernel
  • 16. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Kernel 16
  • 17. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Kernel ● current LTS 5.4.25 ○ allnoconfig 652 KB ○ allyesconfig 123 MB 17
  • 18. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Kernel 18
  • 19. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Userland 19 Applications LibrariesConfigurations Userland ● logic of the system apart from the kernel ● located on root file system ● contains ○ libraries ○ applications ○ configurations ○ … Applications
  • 20. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Userland ● kernel starts process with id 1 ○ so called init process ● it can be a simple shell script ○ which starts other processes ● or a full blown process manager like systemd ○ starts so called services as background processes 20
  • 21. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Userland 21 init pid=1 httpd pid=1038 login pid=154 bash pid=294 httpd pid=1364 httpd pid=1284 ls pid=336 cowsay pid=300 php pid=1783 php pid=1694 htop pid=385
  • 22. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Filesystem Hierarchy Standard (simplified) 22 /bin, /sbin system applications /boot boot related files like kernels, ... /dev, /proc, /sys devices, processes, ... /etc configuration files /home user related files /lib libraries /tmp temporary files /usr user applications, libraries, ...
  • 23. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Yocto Project 23
  • 24. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 24
  • 25. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl It’s not an embedded Linux distribution. 25
  • 26. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl It’s not an embedded Linux distribution. It creates a custom one for you. 26
  • 27. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Yocto ● open source project of the Linux Foundation ● licensed under MIT and GPLv2 ● helps developers create custom Linux-based systems regardless of the hardware architecture 27
  • 28. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Poky ● Poky is the reference distribution ● you can use it as a base ● tweak it to your needs 28
  • 29. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Cooking 29 👨‍🍳 🍛 🍚🥕🧂🍠 📗📘📙 📄
  • 30. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Engineering with Yocto 30 👨‍🍳 👨‍💻 🍛 embedded system 🍚🥕🧂🍠 libraries, applications, ... 📗📘📙 📁 layers 📄 📄 recipe
  • 31. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Layers 📁 meta-embo 📁 meta-poky 📁 meta-selftest 📁 meta-skeleton 📁 meta-yocto-bsp 31
  • 32. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Layer meta-embo ├── conf │ ├── distro │ │ ├── embo.conf │ │ └── embo-tiny.conf │ └── layer.conf └── recipes-core ├── hello-cmake │ └── hello-cmake.bb └── images └── embo-image.bb 32 BBPATH .= ":${LAYERDIR}" BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "embo" BBFILE_PATTERN_embo = "^${LAYERDIR}/" BBFILE_PRIORITY_embo = "6" LAYERSERIES_COMPAT_embo = "warrior"
  • 33. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Recipe meta-embo ├── conf │ ├── distro │ │ ├── embo.conf │ │ └── embo-tiny.conf │ └── layer.conf └── recipes-core ├── hello-cmake │ └── hello-cmake.bb └── images └── embo-image.bb 33 DESCRIPTION = "hello cmake" SECTION = "examples" LICENSE = "CLOSED" DEPENDS = "" SRC_URI = " file:./hello-cmake/" S = "${WORKDIR}/hello-cmake" inherit pkgconfig cmake
  • 34. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Image meta-embo ├── conf │ ├── distro │ │ ├── embo.conf │ │ └── embo-tiny.conf │ └── layer.conf └── recipes-core ├── hello-cmake │ └── hello-cmake.bb └── images └── embo-image.bb 34 require recipes-core/images/core-image-minimal.bb IMAGE_INSTALL_append = " hello-cmake hello-make hello-meson "
  • 35. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl BitBake ● build tool ● reads .bb and .bbappend files ● resolves dependencies between recipes ● creates build order ● generates Python code to build packages 35
  • 36. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl BitBake tasks ● fetch ● unpack ● patch ● configure ● compile ● populate ● install ● package ● package_write 36
  • 37. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 2. Inner workings 37
  • 38. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Initial setup 38
  • 39. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl QEMU ● generic machine emulator and virtualizer ● licensed under GPLv2 and BSD ● we use qemu-system-i386 to test our embedded system ○ due to lack of embedded hardware 39
  • 40. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 👷 Build Host ● linux distribution ○ Windows Subsystem for Linux (WSL) is not supported ○ but you can use Docker or a virtual machine (VirtualBox) ● Ubuntu 16.04, 18.04, 19.04 ● Fedora 28, 29, 30 ● CentOS 7.x ● Debian GNU/Linux 8.x, 9.x, 10.x ● OpenSUSE Leap 15.1 40
  • 41. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 👷 Build Host ● initialize your build environment ○ Docker (recommended) ○ local (Linux only) ○ VirtualBox 41
  • 42. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 🤞 Test if build environment works ● make embo-image ● make run-embo-image 42
  • 43. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Important files and folders ● Makefile ○ BRANCH ○ DISTRO ○ MACHINE ● poky/build/conf/bblayers.conf ● poky/build/conf/local.conf ○ DL_DIR = downloads ○ SSTATE_DIR = sstate-cache ● poky/build/tmp/deploy/images ● poky/build/tmp/deploy/licenses ● poky/build/tmp/deploy/rpm 43 👨‍💻
  • 44. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Playtime ● login as user root ● ps ○ /init pid=1 ● /init ○ /sbin/init ■ /bin/busybox.nosuid ● /bin/busybox.nosuid ● /bin/busybox.nosuid init ● hello-make ● hello-cmake ● hello-meson 44 👨‍💻
  • 45. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-make ● minimal example built with make 45 👨‍💻
  • 46. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-cmake ● minimal example built with cmake 46 👨‍💻
  • 47. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-meson ● minimal example built with meson 47 👨‍💻
  • 48. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Leaving the comfort zone 48
  • 49. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl bitbake ● cd poky ● source oe-init-build-env ● export DISTRO=embo-tiny ● export MACHINE=qemux86 ● bitbake embo-image ● bitbake hello-make -c build ● bitbake hello-make -c cleanall ● bitbake hello-make -c build ● bitbake -s 49 👨‍💻
  • 50. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Dependencies 🔗 https://layers.openembedded.org/layerindex/branch/warrior/recipes/ ● git clone -b warrior git:./git.openembedded.org/meta-openembedded ● add to poky/build/conf/bblayers.conf ○ meta-openembedded/meta-oe ● bitbake nlohmann-json 50 👨‍💻
  • 51. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-json ● create a new example recipe which uses nlohmann-json DESCRIPTION = "hello json" SECTION = "examples" LICENSE = "CLOSED" DEPENDS = "nlohmann-json" SRC_URI = " file:./hello-json/" S = "${WORKDIR}/hello-json" inherit pkgconfig cmake 51 👨‍💻
  • 52. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-json ● create a main.cpp which uses nlohmann-json #include <iostream> #include <nlohmann/json.hpp> using json = nlohmann.:json; int main() { json j; j["hello"] = "json"; std.:cout .< j.dump() .< std.:endl; return 0; } 52 👨‍💻
  • 53. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-json ● create a CMakeLists.txt to build example cmake_minimum_required(VERSION 3.10) project(hello-json) find_package(nlohmann_json REQUIRED) add_executable(hello-json main.cpp) target_link_libraries(hello-json nlohmann_json.:nlohmann_json) install(TARGETS hello-json DESTINATION bin) 53 👨‍💻
  • 54. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl embo-image ● add your new package to our image require recipes-core/images/core-image-minimal.bb IMAGE_INSTALL_append = " hello-cmake hello-make hello-meson hello-json " 54 👨‍💻
  • 55. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl embo-image ● bitbake embo-image ● make run-embo-image ● hello-json ○ {"hello":"json"} 55 👨‍💻
  • 56. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Dependency graph ● bitbake -g hello-make ● less recipe-depends.dot ● ⚠ dot -Tpng recipe-depends.dot -o recipe-depends.png ⚠ ● less task-depends.dot 56 👨‍💻
  • 57. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Dependency graph ● bitbake -g embo-image ● less recipe-depends.dot ● less task-depends.dot 57 👨‍💻
  • 58. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl 3. Getting used to it 58
  • 59. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Add files to rootfs base-files_%.bbappend FILESEXTRAPATHS_prepend .= "${THISDIR}/files:" SRC_URI += "file:./embo" do_install_append() { install -m 0644 ${WORKDIR}/embo ${D}/embo } 59
  • 60. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Add users recipe inherit useradd USER .= "user" PASSWORD .= "9PfNy0O1z0O5g" USERADD_PACKAGES = "${PN}" USERADD_PARAM_${PN} = ".-system .-create-home .-groups tty .-password ${PASSWORD} .-user-group ${USER}" 60 ⚠ DISTRO = embo ⚠
  • 61. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-boost DESCRIPTION = "hello boost" SECTION = "examples" LICENSE = "CLOSED" DEPENDS = "boost" RDEPENDS_${PN} = "boost-thread" SRC_URI = " file:./hello-boost/" S = "${WORKDIR}/hello-boost" inherit pkgconfig cmake 61
  • 62. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-boost #include <boost/thread.hpp> #include <boost/chrono.hpp> #include <iostream> void wait(int seconds) { boost.:this_thread.:sleep_for(boost.:chrono.:seconds{seconds}); } void thread() { for (int i = 0; i < 5; .+i) { wait(1); std.:cout .< i .< std.:endl; 62 } } int main() { boost.:thread t{thread}; t.join(); return 0; }
  • 63. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl hello-boost cmake_minimum_required(VERSION 3.10) project(hello-boost) find_package(Boost COMPONENTS thread REQUIRED) add_executable(hello-boost main.cpp) include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(hello-cmake ${Boost_LIBRARIES}) install(TARGETS hello-boost DESTINATION bin) 63
  • 64. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl DIY ● try to build something yourself ● ask for help 64
  • 65. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl Outlook ● bundle sources of packages used to build image ○ update your systems with a package manager ■ EXTRA_IMAGE_FEATURES += "package-management" ○ sign your packages ■ INHERIT += "sign_rpm" ● create a SDK to simplify development ○ bitbake <image> -c populate_sdk ● bundle list of licenses of packages used to build image ● license management ○ prohibit certain licenses ■ INCOMPATIBLE_LICENSE = "GPL-3.0 LGPL-3.0 AGPL-3.0" ● ... 65
  • 66. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl What else can you do with Yocto? ● build custom Docker images IMAGE_FSTYPES += " .tar.gz" FROM scratch ADD rootfs.tar.gz / CMD ["/bin/sh"] 66
  • 67. 13.03.2020Building your own embedded system with Yocto • Marius Meisenzahl References ● https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.h tml ● https://git.yoctoproject.org/ ● https://www.yoctoproject.org/docs/what-i-wish-id-known/ 67