Book Image

Mastering Embedded Linux Programming

By : Chris Simmonds
Book Image

Mastering Embedded Linux Programming

By: Chris Simmonds

Overview of this book

Mastering Embedded Linux Programming takes you through the product cycle and gives you an in-depth description of the components and options that are available at each stage. You will begin by learning about toolchains, bootloaders, the Linux kernel, and how to configure a root filesystem to create a basic working device. You will then learn how to use the two most commonly used build systems, Buildroot and Yocto, to speed up and simplify the development process. Building on this solid base, the next section considers how to make best use of raw NAND/NOR flash memory and managed flash eMMC chips, including mechanisms for increasing the lifetime of the devices and to perform reliable in-field updates. Next, you need to consider what techniques are best suited to writing applications for your device. We will then see how functions are split between processes and the usage of POSIX threads, which have a big impact on the responsiveness and performance of the final device The closing sections look at the techniques available to developers for profiling and tracing applications and kernel code using perf and ftrace.
Table of Contents (22 chapters)
Mastering Embedded Linux Programming
About the Author
About the Reviewers

Creating filesystem images with device tables

The kernel has a utility, gen_init_cpio, that creates a cpio file based on format instructions set out in a text file, called a device table, which allows a non-root user to create device nodes and to allocate arbitrary UID and GID values to any file or directory.

The same concept has been applied to tools that create other filesystem image formats:

  • jffs2: mkfs.jffs2

  • ubifs: mkfs.ubifs

  • ext2: genext2fs

We will look at jffs2 and ubifs in Chapter 7, Creating a Storage Strategy, when we look at filesystems for flash memory. The third, ext2, is a fairly old format for hard drives.

They each take a device table file with the format <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count> in which the following applies:

  • name: Filename

  • type: One of the following:

    • f: A regular file

    • d: A directory

    • c: A character special device file

    • b: A block special device file

    • p: A FIFO (named pipe)

  • uid The...