FreeBSD 101: The Boot process - init scripts, bootloader, FreeBSD modes -


 

The boot process:




The Bootloader:

The bootloader is a small program (starts after the hardware check) that lets you choose when and how to launch the operating system.

Root filesystem:

The root filesystem is a relatively small filesystem, it contains all the important system files spread out in different directories under the root directory (top directory in the hierarchy of folders).

The Kernel:



The kernel sits between user-programs and the hardware. When a program wants to access memory for example, the kernel takes care of that task.
The standard kernel is normally located at /boot/kernel and is started by the bootloader.

The kernel does the hardware check and mounts the root filesystem (/), it passes control to the script init.

Init is the first program that runs and has the process ID 1. 

FreeBSD modes:

In FreeBSD we have two modes:
  •  Single-user : mode for debugging purposes , in that mode the root filesystem is mounted read-only.
  •  Multi-user : mode with the networking activated (default mode). 

Startup options are controlled by the configuration file rc.conf.

Init script:

Init is responsable for starting all the processes:
  • It checks if the clean flag is set on the hard drive, otherwise it runs fsck on it to correct the errors on it.
  • It mounts the filesytems as it is described in the file /etc/fstab.
  • It spawns the Shell and runs the scripts (programs written in Bash, Perl, Python, ...) in the directories /etc , /etc/defaults. It also starts the scripts related to other servers located in /usr/local/etc/rc.d (scripts for web servers for example).
  • It starts getty or xdm (graphical version of getty) so we could log into the system.

Comments

Leave as a comment:

Archive