Embedded Linux Development Using Yocto Project Cookbook - Second Edition
eBook - ePub

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

Alex Gonzalez, Javier Viguera

Share book
  1. 456 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

Alex Gonzalez, Javier Viguera

Book details
Book preview
Table of contents
Citations

About This Book

Over 79 hands-on recipes for professional embedded Linux developers to optimize and boost their Yocto Project know-howAbout This Book• Optimize your Yocto setup to speed up development and debug build issues• Use what is quickly becoming the standard embedded Linux product builder framework—the Yocto Project• Recipe-based implementation of best practices to optimize your Linux systemWho This Book Is ForIf you are an embedded Linux developer with the basic knowledge of Yocto Project, this book is an ideal way to broaden your knowledge with recipes for embedded development.What You Will Learn• Optimize your Yocto Project setup to speed up development and debug build issues• Use Docker containers to build Yocto Project-based systems• Take advantage of the user-friendly Toaster web interface to the Yocto Project build system• Build and debug the Linux kernel and its device trees• Customize your root filesystem with already-supported and new Yocto packages• Optimize your production systems by reducing the size of both the Linux kernel and root filesystems• Explore the mechanisms to increase the root filesystem security• Understand the open source licensing requirements and how to comply with them when cohabiting with proprietary programs• Create recipes, and build and run applications in C, C++, Python, Node.js, and JavaIn DetailThe Yocto Project has become the de facto distribution build framework for reliable and robust embedded systems with a reduced time to market.You'll get started by working on a build system where you set up Yocto, create a build directory, and learn how to debug it. Then, you'll explore everything about the BSP layer, from creating a custom layer to debugging device tree issues. In addition to this, you'll learn how to add a new software layer, packages, data, scripts, and configuration files to your system. You will then cover topics based on application development, such as using the Software Development Kit and how to use the Yocto project in various development environments. Toward the end, you will learn how to debug, trace, and profile a running system. This second edition has been updated to include new content based on the latest Yocto release.Style and approachThis recipe-based book will guide you through all the development stages of an embedded Linux product design using the Yocto Project.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Embedded Linux Development Using Yocto Project Cookbook - Second Edition an online PDF/ePUB?
Yes, you can access Embedded Linux Development Using Yocto Project Cookbook - Second Edition by Alex Gonzalez, Javier Viguera in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781788392921
Edition
2

Application Development

In this chapter, we will cover the following recipes:
  • Introducing toolchains
  • Preparing an SDK
  • Using the extensible SDK
  • Using the Eclipse IDE
  • Developing GTK+ applications
  • Using the Qt Creator IDE
  • Developing Qt applications
  • Describing workflows for application development
  • Working with GNU make
  • Working with the GNU build system
  • Working with the CMake build system
  • Working with the SCons builder
  • Developing with libraries
  • Working with the Linux framebuffer
  • Using the X Windows system
  • Using Wayland
  • Adding a web browser application
  • Adding Python applications
  • Integrating the Open Java Development Kit
  • Integrating Java applications
  • Integrating Node.js applications
  • Running Docker application containers

Introduction

Dedicated applications are what define an embedded product and Yocto offers helpful application development tools, as well as the functionality to integrate with popular Integrated Development Environments (IDE) such as Eclipse and Qt Creator. It also provides a wide range of utility classes to help in the integration of finished applications into the build system and target images. A normal embedded Linux software development team is logically divided into the following roles:
  • BSP developers in charge of the Board Support Package, which is the bootloader and Linux kernel. This team has the greatest exposure to the hardware. As we have seen in Chapter 2, The BSP layer, BSP development uses primarily the Yocto SDK.
  • Application developers will work on the Linux user space applications that define the product, including user interfaces. Developing applications for embedded Linux is not that different from developing applications for a Linux server or desktop, as the kernel abstracts most of the embedded device particularities. Application developers will also use the Yocto SDK to develop their applications.
  • System integrators who release an SDK for the other teams to use and integrate both the applications and BSP changes into the Yocto build system. They also create the final product images.
In summary, the Yocto SDK is the interface between the Yocto Project, BSP and application developers and allows the work of the different developers to be shared and developed simultaneously. Some teams have the same engineers covering all roles, while some others prefer to specialize. This chapter will introduce the Yocto SDK, an important component on the application development workflow when using the Yocto Project. The SDK contains the cross-compilation toolchain, but also the header files and libraries used to cross-compile root filesystem applications. We will also introduce IDEs and show how they are used to build and debug C and C++ applications on real hardware and will explore application development, including graphical frameworks and Yocto integration, not only for C and C++ but also other languages.

Introducing toolchains

A toolchain is a set of tools, binaries, and libraries used to build applications to run on a computer platform. In Yocto, the default toolchains are based on GNU components with GPL licenses.

Getting ready

A GNU toolchain contains the following components:
  • Assembler (GNU as): This is part of the binutils package
  • Linker (GNU ld): This is also part of the binutils package
  • Compiler (GNU gcc): Latest versions have support for C, C++, Java, Ada, Fortran, Go, and Objective C/C++
  • Debugger (GNU gdb): This is the GNU debugger
  • Binary file tools (objdump, nm, objcopy, readelf, strip, and so on): These are part of the binutils package.
These components are enough to build bare-metal applications, bootloaders like U-Boot, or operating systems like the Linux kernel, as they don't need a C library and they implement the C library functions they need. However, for Linux user space applications, a POSIX-compliant C library is needed. The GNU C library, glibc, is the default C library used in the Yocto Project, and musl, a smaller C library, is a supported alternative popular for resource-constrained devices. On embedded systems, it is not just a toolchain we need, but a cross-compilation toolchain. This is because we build in a host computer but run the resulting binaries on the target, which is usually a different architecture. In reality, there are several types of toolchain, based on the architecture of the machine building the toolchain (build machine), running the toolchain (host machine), and running the binaries built by the toolchain (target machine). The most common combinations are:
  • Native: An example of this is an x86 machine running a toolchain that has also been built on an x86 machine producing binaries to run on an x86 machine. This is common in desktop computers.
  • Cross-compilation: This is the most common on embedded systems; for example, an x86 machine running a toolchain that has also been built on an x86 machine but producing binaries to run on a different architecture, like ARM.
  • Cross-native: This is typically the toolchain running on targets. An example of this is where a toolchain has been built on an x86 machine but runs on ARM and produces binaries for ARM.
  • Canadian: This is rarely seen and is where the build, host, and target machines are all different.
The process of building a cross-compilation toolchain is complex and fault-prone, so automated tools for toolchain building have emerged, like crosstool-NG. The Yocto build system also compiles its own toolchain on every bui...

Table of contents