After the kernel has booted
We saw in Chapter 4, Configuring and Building the Kernel, how the kernel bootstrap code seeks to find a root filesystem, either initramfs
or a filesystem specified by root=
on the kernel command line, and then executes a program that, by default, is /init
for initramfs
and /sbin/init
for a regular filesystem. The init
program has root
privilege, and since it is the first process to run, it has a process ID (PID) of 1
. If, for some reason, init
cannot be started, the kernel will panic.
The init
program is the ancestor of all other processes, as shown here by the pstree
command running on a simple embedded Linux system:
# pstree -gn init(1)-+-syslogd(63) Â Â Â Â Â Â Â Â |-klogd(66) Â Â Â Â Â Â Â Â |-dropbear(99) Â Â Â Â Â Â Â Â `-sh(100)---pstree(109)
The job of the init
program is to take control of the boot process in user space and set it running. It...