[webinar] an introduction to the yocto embedded framework
TRANSCRIPT
© Integrated Computer Solutions, Inc. All Rights Reserved
An Introduction to the Yocto Embedded
Framework
Jeff Tranter <[email protected]>Integrated Computer Solutions, Inc.
© Integrated Computer Solutions, Inc. All Rights Reserved
Agenda
• What is Yocto?• Why is it Needed?• What Yocto Provides• Benefits/Advantages• Limitations/Disadvantages• Yocto Versions• Other Framework Options• Yocto Architecture• Major Components• Using Yocto - Basic Steps• OpenEmbeddedBuild System
• Bitbake Metadata• Example - Emulator• Example - Beaglebone Black• Building an SDK• Packaging• Toaster GUI• Qt Yocto Support• Doing More• Tips For Getting Started• References• Summary• Q&A
© Integrated Computer Solutions, Inc. All Rights Reserved
What is Yocto?
• Project to provide templates, tools and methods to create custom Linux-based embedded systems• Founded in 2010• Open Source, managed by The Linux Foundation• Vendor and platform neutral• Collaborative effort among participants• Members/participants/sponsors include Intel, AMD, Broadcom, TI,
Freescale, LG Electronics, Huawei, Mentor Graphics, Dell, The Qt Company
© Integrated Computer Solutions, Inc. All Rights Reserved
Why Is It Needed?
• Embedded development is significantly harder than native/desktop development• Cross-compilation• Wide scope: boot loader, kernel, BSP/device drivers, packaging
format, utilities, applications, SDK• Large, time consuming to build• Desire for repeatability, automation• Licensing issues• Regular need for security and other updates
© Integrated Computer Solutions, Inc. All Rights Reserved
What Yocto Provides
• Framework for creating embedded Linux systems• Targets supported: ARM, PPC, MIPS, x86, x86-64• Hosted on common Linux x86 desktop platforms (CentOS, Fedora,
openSUSE, Ubuntu)• OpenEmbedded build system with bitbake build engine• IDE• Graphical interface to build system
© Integrated Computer Solutions, Inc. All Rights Reserved
Benefits/Advantages
• Reduced development effort/time• Improved quality• Automation• Stability• Repeatability
© Integrated Computer Solutions, Inc. All Rights Reserved
Limitations/Disadvantages
• Embedded Linux targets only• Development tools run on desktop Linux only (or in a Linux vm
hosted on e.g. Windows or MacOS)• Doesn't dictate a specific Linux distribution (but offers Poky as a
reference distribution)• Large, complex, can have steep learning curve
© Integrated Computer Solutions, Inc. All Rights Reserved
Other Embedded Frameworks
• Baserock• Buildroot• Crosstool/CrosstoolNG• Embedded Debian/Fedora/Gentoo/SUSE/Ubuntu
© Integrated Computer Solutions, Inc. All Rights Reserved
Major Components
• bitbake• Poky Linux distribution• Emulator• Toaster GUI• SDK• Eclipse IDE plugin• Build Appliance
© Integrated Computer Solutions, Inc. All Rights Reserved
Using Yocto - Basic Steps
1. Set up tools on a Linux host machine.2. Configure bitbake for embedded hardware.3. Build software components, bootloader, root fs, image.4. Write boot image and file system.5. Set up SDK.6. Develop and iterate.
© Integrated Computer Solutions, Inc. All Rights Reserved
bitbake Build System
Steps:• fetch• extract• patch• configure• build• install• package
© Integrated Computer Solutions, Inc. All Rights Reserved
Example - Building For Emulator
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
© Integrated Computer Solutions, Inc. All Rights Reserved
Example - Building For Emulator
$ mkdir yocto$ cd yocto$ wget http://downloads.yoctoproject.org/releases/yocto/yocto-2.2/poky-morty-16.0.0.tar.bz2$ tar xjvf poky-morty-16.0.0.tar.bz2$ cd poky-morty-16.0.0
$ source oe-init-build-env$ edit conf/local.conf$ bitbake core-image-sato
$ runqemu qemuarm
© Integrated Computer Solutions, Inc. All Rights Reserved
Example - Building for Beaglebone BlackDevice Boot Start End Blocks Id System/dev/mmcblk0p1 * 2048 146570 72261+ c W95 FAT32(LBA)/dev/mmcblk0p2 146571 8535178 4194304 83 Linux
$ sudo mkfs.vfat -F 16 -n "boot" /dev/mmcblk0p1$ sudo mke2fs -j -L "root" /dev/mmcblk0p2
© Integrated Computer Solutions, Inc. All Rights Reserved
Example - Building for Beaglebone Black$ cp tmp/deploy/images/beaglebone/MLO-beaglebone /media/$LOGNAME/boot/MLO
$ cp tmp/deploy/images/beaglebone/u-boot-beaglebone.img /media/$LOGNAME/boot/u-boot.img
$ sudo tar x -C /media/$LOGNAME/root -f tmp/deploy/images/beaglebone/core-image-sato-beaglebone.tar.bz2
© Integrated Computer Solutions, Inc. All Rights Reserved
Building an SDK
$ bitbake core-image-sato -c populate_sdk
Output is:
tmp/deploy/sdk/poky-glibc-x86_64-core-image-sato-armv5e-toolchain-2.2.sh
© Integrated Computer Solutions, Inc. All Rights Reserved
Building an SDK
$ ~/yocto/poky-morty-16.0.0/build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-sato-armv5e-toolchain-2.2.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.2===============================================================Enter target directory for SDK (default: /opt/poky/2.2): ~/sdkYou are about to install the SDK to "/home/tranter/sdk". Proceed[Y/n]? YExtracting SDK......................................................................doneSetting it up...doneSDK has been successfully set up and is ready to be used.Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.$ . /home/tranter/sdk/environment-setup-armv5e-poky-linux-gnueabi
© Integrated Computer Solutions, Inc. All Rights Reserved
Building an SDK
$ . /home/tranter/sdk/environment-setup-armv5e-poky-linux-gnueabi
$ echo $CXXarm-poky-linux-gnueabi-g++ -march=armv5e -marm --sysroot=/home/tranter/sdk/sysroots/armv5e-poky-linux-gnueabi
$ $CXX helloworld.cpp
$ file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0
© Integrated Computer Solutions, Inc. All Rights Reserved
Packaging
• Not required, but often useful even for embedded systems.• Yocto doesn't impose a packaging format.• Common package formats include:• rpm• deb/dpkg• ipkg• opkg
© Integrated Computer Solutions, Inc. All Rights Reserved
Yocto Qt Support
Yocto Qt 5 recipes:• https://github.com/meta-qt5/meta-qt5
Qt for Device Creation (boot2qt):• http://code.qt.io/cgit/yocto/meta-boot2qt.git/• http://code.qt.io/cgit/yocto/meta-qt5.git/
© Integrated Computer Solutions, Inc. All Rights Reserved
More About Bitbake
• Python based language for configuration files.• Supports variables, include files, functions, inheritance.• Uses scripts called "recipes".• Many command line options.• Configuration files in build/conf• Understands dependencies.• Multithreaded, runs a server process in the background.
© Integrated Computer Solutions, Inc. All Rights Reserved
Doing More - Writing Recipes
• Needed to build your own components with bitbake• Shell or Python scripts (.bb files)• Standardized format
© Integrated Computer Solutions, Inc. All Rights Reserved
Doing More - Kernel Recipes
• Recipes to configure, patch, and build the Linux kernel• More complex
© Integrated Computer Solutions, Inc. All Rights Reserved
Doing More - BSPs
• BSP = Board Support Package.• Adaptations for specific hardware.• Hardware vendor, OS vendor, or third party may provide this.
© Integrated Computer Solutions, Inc. All Rights Reserved
References
1. Embedded Linux Systems with the Yocto Project, Rudolf Streif2. https://www.yoctoproject.org/3. https://github.com/meta-qt5/meta-qt54. http://code.qt.io/cgit/yocto/meta-boot2qt.git/5. http://code.qt.io/cgit/yocto/meta-qt5.git/6. http://www.ics.com/blog/yocto-quick-start
© Integrated Computer Solutions, Inc. All Rights Reserved
An Introduction to the Yocto Embedded
Framework
Jeff Tranter <[email protected]>Integrated Computer Solutions, Inc.