Mais conteúdo relacionado Semelhante a Debian or Yocto Project? Which is the best for your Embedded Linux project? (20) Mais de Chris Simmonds (15) Debian or Yocto Project? Which is the best for your Embedded Linux project?1. Debian or Yocto Project?
Which is the Best for your Embedded Linux Project?
Chris Simmonds
Embedded World 2020
Debian or Yocto Project? 1 Copyright © 2011-2020, 2net Ltd
2. License
These slides are available under a Creative Commons Attribution-ShareAlike 4.0 license. You can read the full
text of the license here
http://creativecommons.org/licenses/by-sa/4.0/legalcode
You are free to
• copy, distribute, display, and perform the work
• make derivative works
• make commercial use of the work
Under the following conditions
• Attribution: you must give the original author credit
• Share Alike: if you alter, transform, or build upon this work, you may distribute the resulting work only
under a license identical to this one (i.e. include this page exactly as it is)
• For any reuse or distribution, you must make clear to others the license terms of this work
Debian or Yocto Project? 2 Copyright © 2011-2020, 2net Ltd
3. About Chris Simmonds
• Consultant and trainer
• Author of Mastering Embedded Linux Programming
• Working with embedded Linux since 1999
• Android since 2009
• Speaker at many conferences and workshops
"Looking after the Inner Penguin" blog at http://2net.co.uk/
@2net_software
https://uk.linkedin.com/in/chrisdsimmonds/
Debian or Yocto Project? 3 Copyright © 2011-2020, 2net Ltd
4. Agenda
• The dilemma
• Debian
• Yocto Project
• Conclusions
Debian or Yocto Project? 4 Copyright © 2011-2020, 2net Ltd
5. The dilemma
• I am designing a new gizmo thing
• I want it to do many things
• I want to have it on the market as soon as possible - before the
other gizmo folks get there
• BUT
• I want it to be robust, updateable, maintainable
• What should I do????
Debian or Yocto Project? 5 Copyright © 2011-2020, 2net Ltd
6. Choices
Off-the-peg Use a Debian based distro (or another distro of your choice)
Debian or Yocto Project? 6 Copyright © 2011-2020, 2net Ltd
7. Choices
Off-the-peg Use a Debian based distro (or another distro of your choice)
Bespoke Build everything from scratch using a build system like Yocto
(or Buildroot)
Debian or Yocto Project? 6 Copyright © 2011-2020, 2net Ltd
8. Debian
• Debian is a full distro with tens of thousands of packages
• Stable, long term support
• Binary, so no need to cross-compile
Debian or Yocto Project? 7 Copyright © 2011-2020, 2net Ltd
9. Board support for Debian
Debian architectures most relevant to embedded devices:
Architecture Description
amd64 x86-64
arm64 ARMv8-A
armhf ARMv7-A with floating point unit
armel ARMv4T instruction set
Popular boards
• Raspberry Pi (Raspbian is Debain compiled for the Broadcom chipset)
• BeagleBoards of all sorts
• many others...
Debian or Yocto Project? 8 Copyright © 2011-2020, 2net Ltd
10. Building a Debian rootfs
Root filesystem
apt install xyz
Debian
repository
xyz_1.0+b1_armel.deb
/etc/apt/sources.list
Debian or Yocto Project? 9 Copyright © 2011-2020, 2net Ltd
11. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
12. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
• Strip out things you don’t want
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
13. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
• Strip out things you don’t want
• Add the things you do want
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
14. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
• Strip out things you don’t want
• Add the things you do want
• Compile natively (on the target) custom programs and libraries
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
15. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
• Strip out things you don’t want
• Add the things you do want
• Compile natively (on the target) custom programs and libraries
• Add any other tweaks you need
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
16. Developing on Debian: first pass
The overall procedure would be
• Take an existing "off-the-peg" image
• Strip out things you don’t want
• Add the things you do want
• Compile natively (on the target) custom programs and libraries
• Add any other tweaks you need
Resulting in a "Golden Master" image
Debian or Yocto Project? 10 Copyright © 2011-2020, 2net Ltd
17. The "Golden Master"
• Once development is done, use dd (or similar) to take a copy of the
filesystem
• Clone it to all units shipped
Debian or Yocto Project? 11 Copyright © 2011-2020, 2net Ltd
18. What can go wrong?
A Golden Master can become a millstone
• Steps to create it are almost certainly not documented
Debian or Yocto Project? 12 Copyright © 2011-2020, 2net Ltd
19. What can go wrong?
A Golden Master can become a millstone
• Steps to create it are almost certainly not documented
• so changes have to be incremental
• major changes, e.g. to a new distro release, are very difficult
Debian or Yocto Project? 12 Copyright © 2011-2020, 2net Ltd
20. What can go wrong?
A Golden Master can become a millstone
• Steps to create it are almost certainly not documented
• so changes have to be incremental
• major changes, e.g. to a new distro release, are very difficult
• Probably contains a finger-print of the person who created it
Debian or Yocto Project? 12 Copyright © 2011-2020, 2net Ltd
21. What can go wrong?
A Golden Master can become a millstone
• Steps to create it are almost certainly not documented
• so changes have to be incremental
• major changes, e.g. to a new distro release, are very difficult
• Probably contains a finger-print of the person who created it
• user accounts and passwords
• $HOME/.bash_history
• old system log files
Debian or Yocto Project? 12 Copyright © 2011-2020, 2net Ltd
22. Developing on Debian: second pass
You need a robust, reproducible build process
• Build a base system image using Rootstock, debootstrap, or similar
• Install only the packages you need
• Import your own software and configuration (ideally encapsulated as
Debian packages)
• Examples
• BeagleBoard Image Builder:
https://github.com/beagleboard/image-builder
• Raspberry Pi Gen https://github.com/RPi-Distro/pi-gen
Debian or Yocto Project? 13 Copyright © 2011-2020, 2net Ltd
23. A note about software update
• Updates to Debian systems would seem to be easy
Debian or Yocto Project? 14 Copyright © 2011-2020, 2net Ltd
24. A note about software update
• Updates to Debian systems would seem to be easy
• just apt update
Debian or Yocto Project? 14 Copyright © 2011-2020, 2net Ltd
25. A note about software update
• Updates to Debian systems would seem to be easy
• just apt update
• But, updates via apt are not atomic
Debian or Yocto Project? 14 Copyright © 2011-2020, 2net Ltd
26. A note about software update
• Updates to Debian systems would seem to be easy
• just apt update
• But, updates via apt are not atomic
• You will probably end up doing a full image update
Debian or Yocto Project? 14 Copyright © 2011-2020, 2net Ltd
27. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
28. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
• More software means more attack vectors
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
29. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
• More software means more attack vectors
• May not be compiled optimally for your platform (i.e. may not be using
some features of the CPU)
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
30. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
• More software means more attack vectors
• May not be compiled optimally for your platform (i.e. may not be using
some features of the CPU)
• Not optimized for flash memory - many disk writes wear it out
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
31. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
• More software means more attack vectors
• May not be compiled optimally for your platform (i.e. may not be using
some features of the CPU)
• Not optimized for flash memory - many disk writes wear it out
• Compiling natively on a low powered device is slow
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
32. Downsides of Debian
• Large image size (compared to equivalent Yocto system)
• More software means more attack vectors
• May not be compiled optimally for your platform (i.e. may not be using
some features of the CPU)
• Not optimized for flash memory - many disk writes wear it out
• Compiling natively on a low powered device is slow
• You still have to build the bootloader (e.g.U-Boot), kernel and kernel
modules - these are not updated as part of the distro update
Debian or Yocto Project? 15 Copyright © 2011-2020, 2net Ltd
33. Yocto Project/OpenEmbedded
• With OpenEmbedded/Yocto Project you create a distribution to your
own specification
Debian or Yocto Project? 16 Copyright © 2011-2020, 2net Ltd
34. Yocto Project/OpenEmbedded
• With OpenEmbedded/Yocto Project you create a distribution to your
own specification
• Build from up-stream source code
• Control over every stage of compiling and building the target
Debian or Yocto Project? 16 Copyright © 2011-2020, 2net Ltd
35. Support for Yocto Project
• Industry-wide support
• Chip vendors of ARM, MIPS, PowerPC and X86 architectures
• Board and System On Module vendors
• Commercial embedded Linux software vendors, such as ENEA, Mentor
Graphics, Montavista, Timesys and more
Debian or Yocto Project? 17 Copyright © 2011-2020, 2net Ltd
36. Building a rootfs with Yocto Project
Root filesystem
bitbake xyz
Uptream
source
zyx-1.0.tar.gz
Metadata xyz.rpm
do_rootfs
Debian or Yocto Project? 18 Copyright © 2011-2020, 2net Ltd
37. It’s all in the metadata
Distro
Machine Image
Debian or Yocto Project? 19 Copyright © 2011-2020, 2net Ltd
38. It’s all in the metadata
Distro
Machine Image
• Distro: how I want to put my
system together
Debian or Yocto Project? 19 Copyright © 2011-2020, 2net Ltd
39. It’s all in the metadata
Distro
Machine Image
• Distro: how I want to put my
system together
• Machine: the board I want to
build for
Debian or Yocto Project? 19 Copyright © 2011-2020, 2net Ltd
40. It’s all in the metadata
Distro
Machine Image
• Distro: how I want to put my
system together
• Machine: the board I want to
build for
• Image: the selection of
packages I want
Debian or Yocto Project? 19 Copyright © 2011-2020, 2net Ltd
41. Downsides of Yocto Project
• Steep learning curve
Debian or Yocto Project? 20 Copyright © 2011-2020, 2net Ltd
42. Downsides of Yocto Project
• Steep learning curve
• Community support window is only 12 months
• After that, you are responsible for monitoring and updating key packages
• ... or outsource to a third party
Debian or Yocto Project? 20 Copyright © 2011-2020, 2net Ltd
43. Downsides of Yocto Project
• Steep learning curve
• Community support window is only 12 months
• After that, you are responsible for monitoring and updating key packages
• ... or outsource to a third party
• Building the rootfs from source requires powerful hardware
Debian or Yocto Project? 20 Copyright © 2011-2020, 2net Ltd
44. Debian is best for...
• Proof Of Concept and prototypes
Debian or Yocto Project? 21 Copyright © 2011-2020, 2net Ltd
45. Debian is best for...
• Proof Of Concept and prototypes
• One-off projects
Debian or Yocto Project? 21 Copyright © 2011-2020, 2net Ltd
46. Debian is best for...
• Proof Of Concept and prototypes
• One-off projects
• ... using commodity hardware such as Raspberry Pi
Debian or Yocto Project? 21 Copyright © 2011-2020, 2net Ltd
47. Yocto Project is best for ...
• custom hardware (no distro available)
Debian or Yocto Project? 22 Copyright © 2011-2020, 2net Ltd
48. Yocto Project is best for ...
• custom hardware (no distro available)
• reduced attack surface
Debian or Yocto Project? 22 Copyright © 2011-2020, 2net Ltd
49. Yocto Project is best for ...
• custom hardware (no distro available)
• reduced attack surface
• optimized for minimal memory and storage
Debian or Yocto Project? 22 Copyright © 2011-2020, 2net Ltd
50. Yocto Project is best for ...
• custom hardware (no distro available)
• reduced attack surface
• optimized for minimal memory and storage
• full report of packages and their licenses (needed license compliance)
Debian or Yocto Project? 22 Copyright © 2011-2020, 2net Ltd