Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Embedded Linux Using the Yocto Project

You're reading from  Learning Embedded Linux Using the Yocto Project

Product type Book
Published in Jun 2015
Publisher
ISBN-13 9781784397395
Pages 334 pages
Edition 1st Edition
Languages
Authors (2):
Alexandru Vaduva Alexandru Vaduva
Profile icon Alexandru Vaduva
Vaduva Jan Alexandru Vaduva Jan Alexandru
View More author details

Table of Contents (20) Chapters

Learning Embedded Linux Using the Yocto Project
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Introduction Cross-compiling Bootloaders Linux Kernel The Linux Root Filesystem Components of the Yocto Project ADT Eclipse Plug-ins Hob, Toaster, and Autobuilder Wic and Other Tools Real-time Security Virtualization CGL and LSB Index

Chapter 5. The Linux Root Filesystem

In this chapter, you will learn about the root filesystem and its structure. You will also be presented with information about the root filesystem's content, the various device drivers available, and its the communication with the Linux kernel. We will slowly make the transition to the Yocto Project and the method used to define the Linux root filesystem's content. The necessary information will be presented to make sure that a user will be also able to customize the rootfs filesystem according to its needs.

The special requirements of the root filesystem will be presented. You will be given information on its content, subdirectories, defined purposes, the various filesystem options available, the BusyBox alternative, and also a lot of interesting features.

When interacting with an embedded environment, a lot of developers would start from a minimal root filesystem made available by a distribution provider, such as Debian, and using a cross-toolchain will...

Interacting with the root filesystem


A root filesystem consists of a directory and file hierarchy. In this file hierarchy, various filesystems can be mounted, revealing the content of a specific storage device. The mounting is done using the mount command, and after the operation is done, the mount point is populated with the content available on the storage device. The reverse operation is called umount and is used to empty the mount point of its content.

The preceding commands are very useful for the interaction of applications with various files available, regardless of their location and format. For example, the standard form for the mount command is mount –t type device directory. This command asks the kernel to connect the filesystem from the device that has the type format mentioned in the command line, along with the directory mentioned in the same command. The umount command needs to be given before removing the device to make sure the kernel caches are written in the storage point...

Understanding BusyBox


BusyBox was developed by Bruce Perens in 1999 with the purpose of integrating available Linux tools in a single executable. It has been used with great success as a replacement for a great number of Linux command line utilities. Due to this, and the fact that it is able to fit inside small embedded Linux distributions, it has gained a lot of popularity in the embedded environment. It provides utilities from file interactions, such as cp, mkdir, touch, ls, and cat, as well as general utilities, such as dmesg, kill, fdisk, mount, umount, and many others.

Not only is it very easy to configure and compile, but it is also very easy to use. The fact that it is very modular and offers a high degree of configuration makes it the perfect choice to use. It may not include all the commands available in a full-blown Linux distribution available on your host PC, but the ones that it does are more than enough. Also, these commands are just simpler versions of the full-blown ones used...

Minimal root filesystem


Now that all the information relating to the root filesystem has been presented to you, it would be good exercise to describe the must-have components of the minimal root filesystem. This would not only help you to understand the rootfs structure and its dependencies better, but also help with requirements needed for boot time and the size optimization of the root filesystem.

The starting point to describe the components is /sbin/init; here, by using the ldd command, the runtime dependencies can be found. For the Yocto Project, the ldd /sbin/init command returns:

linux-gate.so.1 (0xb7785000)
libc.so.6 => /lib/libc.so.6 (0x4273b000)
/lib/ld-linux.so.2 (0x42716000)

From this information, the /lib directory structure is defined. Its minimal form is:

lib
|-- ld-2.3.2.so
|-- ld-linux.so.2 -> ld-2.3.2.so
|-- libc-2.3.2.so
'-- libc.so.6 -> libc-2.3.2.so

The following symbolic links to ensure backward compatibility and version immunity for the libraries. The linux...

The Yocto Project


Moving to the Yocto Project, we can take a look at the core-image-minimal to identify its content and minimal requirements, as defined inside the Yocto Project. The core-image-minimal.bb image is available inside the meta/recipes-core/images directory, and this is how it looks:

SUMMARY = "A small image just capable of allowing a device to boot."

IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL} ldd"

IMAGE_LINGUAS = " "

LICENSE = "MIT"

inherit core-image

IMAGE_ROOTFS_SIZE ?= "8192"

You can see here that this is similar to any other recipe. The image defines the LICENSE field and inherits a bbclass file, which defines its tasks. A short summary is used to describe it, and it is very different from normal package recipes. It does not have LIC_FILES_CHKSUM to check for licenses or a SRC_URI field, mostly because it does not need them. In return, the file defines the exact packages that should be contained in the root filesystem...

Summary


In this chapter, you have learned about the Linux rootfs in general, and also about the communication with the organization of the Linux kernel, Linux rootfs, its principles, content, and device drivers. Since communication tends to become larger over time, information about how a minimal filesystem should look was also presented to you.

Besides this information, in the next chapter, you will be given an overview of the available components of the Yocto Project, since most of them are outside Poky. You will also be introduced to, and given a brief gist of, each component. After this chapter, a bunch of them will be presented to you and elaborated on.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Learning Embedded Linux Using the Yocto Project
Published in: Jun 2015 Publisher: ISBN-13: 9781784397395
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}