One of the last operations conducted by the Linux kernel during system startup is mounting the root filesystem. The Linux kernel itself doesn’t dictate any filesystem structure, but user space applications do expect to find files with specific names in specific directory structures. Therefore, it is useful to follow the de facto standards that have emerged in Linux systems.
In this chapter, we will start by discussing the basic root filesystem structure. Then, we will explain how and where to install the system libraries, the kernel modules, kernel images, device nodes, main system applications, and custom applications. Finally, we will discuss how to configure the system initialization scripts.
At the end of this chapter, you will have a fully functional root filesystem for your target. In the following chapters, we will talk about how you can place this root filesystem on an actual filesystem type on a storage device for use in your target.
The “official” rules to build a root filesystem are contained in the Filesystem Hierarchy Standard (FHS) introduced in Chapter 1. The document is less than 30 pages long and is fairly easy to read. If you are looking for answers or clarifications regarding how to build a root filesystem, the FHS, along with related standards documentation from the Linux Foundation, are probably the best places to start.
Each of the top-level directories in the root filesystem has ...