What should be in the root filesystem?
The kernel gets a root filesystem either as an initramfs
passed as a pointer from the bootloader, or by mounting the block device given on the kernel command line with the root=
parameter. Once it has a root filesystem, the kernel executes the first program – by default, named init
, as described in the Early user space section from Chapter 4. Then, as far as the kernel is concerned, its job is complete. It is up to the init
program to start other programs and bring the system to life.
To make a minimal root filesystem, you need these components:
- init: This is the program that starts everything off, usually by running a series of scripts. I will describe how
init
works in much more detail in Chapter 13. - shell: Gives you a command prompt and (more importantly) runs the shell scripts called by
init
and other programs. - daemons: These are background programs that provide services to others. Good examples are the system...