Book Image

Embedded Linux Development Using Yocto Project - Third Edition

By : Otavio Salvador, Daiane Angolini
Book Image

Embedded Linux Development Using Yocto Project - Third Edition

By: Otavio Salvador, Daiane Angolini

Overview of this book

The Yocto Project is the industry standard for developing dependable embedded Linux projects. It stands out from other frameworks by offering time-efficient development with enhanced reliability and robustness. With Embedded Linux Development Using Yocto Project, you’ll acquire an understanding of Yocto Project tools, helping you perform different Linux-based tasks. You’ll gain a deep understanding of Poky and BitBake, explore practical use cases for building a Linux subsystem project, employ Yocto Project tools available for embedded Linux, and uncover the secrets of SDK, recipe tool, and others. This new edition is aligned with the latest long-term support release of the aforementioned technologies and introduces two new chapters, covering optimal emulation in QEMU for faster product development and best practices. By the end of this book, you’ll be well-equipped to generate and run an image for real hardware boards. You’ll gain hands-on experience in building efficient Linux systems using the Yocto Project.
Table of Contents (20 chapters)

Running images in QEMU

We can use hardware emulation to speed up the development process, as it enables a test run without involving any actual hardware. Fortunately, most projects have only a tiny portion that is hardware-dependent.

QEMU is a free, open source software package that performs hardware virtualization. QEMU-based machines allow testing and development without real hardware. ARMv5, ARMv7, ARMv8, MIPS, MIPS64, PowerPC, PowerPC 64, RISC-V 32, RISC-V 64, x86, and x86-64 emulations are currently supported. We will go into more detail about QEMU usage in sw, Speeding Up Product Development through Emulation – QEMU.

OpenEmbedded Core provides the runqemu script tool, which is a wrapper to make use of QEMU easier. The way to run the script tool is as follows:

$ runqemu <machine> <zimage> <filesystem>

Here, <machine> is the machine/architecture to be used as qemux86-64, or any other supported machine. Also, <zimage> is the path to a kernel (for example, bzImage-qemux86-64.bin). Finally, <filesystem> is the path to an ext4 image (for example, filesystem-qemux86-64.ext4) or an NFS directory. All parameters in the preceding call to runqemu <zimage> and <filesystem> are optional. Just running runqemu is sufficient to launch the image in the shell where the build environment is set, as it will automatically pick up the default settings from building the environment.

So, for example, if we run runqemu qemux86-64 core-image-full-cmdline, we can see something similar to that shown in the following screenshot:

Figure 2.5 – The QEMU screen during the Linux kernel boot

Figure 2.5 – The QEMU screen during the Linux kernel boot

After finishing booting Linux, you will see a login prompt, as shown in Figure 2.6:

Figure 2.6 – The QEMU screen during user login

Figure 2.6 – The QEMU screen during user login

We can log in to the root account using an empty password. The system behaves as a regular machine, even when executed inside the QEMU. The process to deploy an image in real hardware varies, depending on the type of storage used, the bootloader, and so on. However, the process of generating the image is the same. We explore how to build and run an image in real hardware in Chapter 15, Booting Our Custom Embedded Linux.