Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Embedded Linux Development using Yocto Projects - Second Edition

You're reading from  Embedded Linux Development using Yocto Projects - Second Edition

Product type Book
Published in Nov 2017
Publisher
ISBN-13 9781788470469
Pages 162 pages
Edition 2nd Edition
Languages
Authors (2):
Otavio Salvador Otavio Salvador
Profile icon Otavio Salvador
Daiane Angolini Daiane Angolini
Profile icon Daiane Angolini
View More author details

Table of Contents (22) Chapters

Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Meeting the Yocto Project Baking Our Poky-Based System Using Toaster to Bake an Image Grasping the BitBake Tool Detailing the Temporary Build Directory Assimilating Packaging Support Diving into BitBake Metadata Developing with the Yocto Project Debugging with the Yocto Project Exploring External Layers Creating Custom Layers Customizing Existing Recipes Achieving GPL Compliance Booting Our Custom Embedded Linux Index

Chapter 14. Booting Our Custom Embedded Linux

It's time! We are now ready to boot our custom-made embedded Linux, as we have learned the required concepts and gained enough knowledge about the Yocto Project and Poky. In this chapter, we will practice what we have learned so far about using Poky with external BSP layers, use it to generate an image for use with BeagleBone Black, Raspberry Pi 3, and Wandboard machines, and boot it using the SD card.

The same concepts can be applied to every other board, as long as the vendor provides a BSP layer to use with the Yocto Project.

We will see a list of the most commonly used BSP layers in this chapter. This should not be taken as a complete list, or as a definitive one, but we want to facilitate your search for the needed layer in case you have one board of a specific vendor next to you. This list is as follows, in alphabetic order:

  • Allwinner: This has the meta-allwinner layer
  • BeagleBoard: This has the meta-ti layer
  • CuBox-i: This has the meta-freescale...

Exploring the boards


To ease the exploration of the Yocto Project's capabilities, it is good to have a real board so we can enjoy the experience of booting our customized embedded system. For such, we have tried to collect the most commonly used and widely available boards so the chances of you owning one are higher.

This chapter will cover the steps for the following boards:

  • BeagleBone Black: The BeagleBone Black is community based, with members all around the world. Further information is available at https://beagleboard.org/black/.
  • Raspberry Pi 3: The most famous ARM-based board, with the widest community gathered around the world. See more information at https://www.raspberrypi.org/.
  • Wandboard: The Wandboard is supported by the Wandboard community. More information is available at http://www.wandboard.org/.

All the boards listed are maintained by non-profitable organizations based on education and mentoring, which makes the community a fertile place to discover the world of embedded Linux...

Discovering the right BSP layer


In Chapter 10, Exploring External Layer, we learned that the Yocto Project allows for the split of its metadata among different layers. It organizes the metadata so we can choose which exact meta layer to add to our project.

The way to find the BSP for a board varies, but generally we can find it by visiting http://layers.openembedded.org/. We can search for the machine name and the website finds on its database which layer contains it.

In the next sections, we will describe the steps needed to go from source code to the final binary to be copied to the board. Feel free to skip a section if the board isn't available to you.

Baking for the hardware


After discovering the BSP layer for the hardware we are going to use for the build, we need to download all of the needed meta layers and create the build environment.

Before starting this, we need to make sure all system requirements are met. We discussed these requirements in Chapter 2, Baking Our Poky-Based System.

The use of meta layers forces us to deal with many Git repositories of metadata. One good way to avoid confusion is putting all of the sources related to those meta layers in a specific directory. The following figure shows an example of this:

It is advisable to keep the layers inside the sources up to date, as it brings security fixes, bug fixes, and new features.

Note

There are multiple ways of managing the multiple layers when making a product. One option is to use the combo-layer (https://wiki.yoctoproject.org/wiki/Combo-layer), which replicates the commits onto a single Git tree, as well as git submodules and repo to manage multiple Git repositories...

Booting our baked image


The build process will likely take some time. There is a huge amount of work being done behind the scenes but it is a straightforward process.

After the build finishes, we need to deploy the generated image to the board, this is a process that varies from one board to another. We will cover the instructions for each board in the following sections.

Booting BeagleBone Black from the SD card

After the build process is over, the image will be available inside the build/tmp/deploy/images/beaglebone/ directory. There are many files, but the Texas Instrument BSP generates a ready-to-use SD card image.

The file we want to use is core-image-sato-beaglebone.wic.

Make sure you point to the right device and double check to not write in your hard disk.

In order to copy the core-image-sato image to the SD card, we should use the dd utility, as follows:

$ sudo dd if=core-image-sato-beaglebone.wic of=/dev/sdX bs=1M

After copying the content to the SD card, insert it into the SD card slot...

Next steps


Pheew! We got it done! Now you should know the basics of the Yocto Project build system and be capable of extending your knowledge about it to cover other areas with much less hassle. We tried to cover the most common tasks in daily work using the Yocto Project, and there are few things you might want to practice:

  • Creating bbappend files to apply patches or do other changes on a recipe
  • Make your custom images
  • Change the Linux kernel configuration file (defconfig)
  • Change the busybox configuration and include the configuration fragments to add or remove a feature in a layer
  • Add a new recipe for a package
  • Make a product layer with your product-specific machines, recipes, and images

Remember, the source code is the ultimate knowledge source, so use it. When looking for how to do something, finding a similar recipe buys you a lot of time testing different approaches to solve the problem.

Eventually, you’ll likely see yourself in a position to fix or enhance something on OpenEmbedded-Core,...

Summary


In this final chapter, we learned how to discover the BSP for a board we want to use in our project. We consolidated our Yocto Project knowledge by adding external BSP layers and using these in real boards with a generated image.

Throughout the book, we learned the necessary background information for you to learn any other aspect of the Yocto Project that you may need on your own. You have a general understanding of what is happening behind the scenes when you ask BitBake to build a recipe or an image. From now on, you are ready to free your mind and try new things. There are plenty of boards available, waiting for you to give them life. The ball is in your court now; here's where the fun begins!

 

lock icon The rest of the chapter is locked
You have been reading a chapter from
Embedded Linux Development using Yocto Projects - Second Edition
Published in: Nov 2017 Publisher: ISBN-13: 9781788470469
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}