Book Image

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

By : Alex Gonzalez
Book Image

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

By: Alex Gonzalez

Overview of this book

The 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.
Table of Contents (13 chapters)
Title Page
Dedication
Packt Upsell
Foreword
Contributors
Preface
Index

Working with the CMake build system


The GNU make system is a great tool when you build exclusively for Linux systems. However, some packages are multiplatform and need a way to manage Makefile files on different operating systems. CMake is a cross-platform build system that can work not only with GNU make, but also Microsoft Visual Studio and Apple's Xcode.

Getting ready

The CMake tool parses CMakeLists.txt files in every directory to control the build process. An example CMakeLists.txt file, to compile the helloworld example, follows:

cmake_minimum_required(VERSION 2.8.10) 
project(helloworld) 
add_executable(helloworld helloworld.c) 
install(TARGETS helloworld RUNTIME DESTINATION bin) 

How to do it...

The Yocto build system also contains classes with the required knowledge to build CMake packages. All your recipe needs to do is inherit the cmake class and configure the arguments to be passed to the configure script in the EXTRA_OECMAKE variable. Usually, the CMake system understands how to...