The bootup process (or "boot sequence") varies in details among systems, but can be roughly divided into phases controlled by the following components:
This program normally performs a basic self-test of the machine and accesses nonvolatile memory to read further parameters. This memory in the PC is battery-backed CMOS memory, so most people refer to it as "the CMOS"; outside of the PC world, it is usually called "the NVRAM" (nonvolatile RAM).
The parameters stored in the NVRAM vary among systems, but as a minimum, they should specify which device can supply an OS loader, or at least which devices may be probed for one; such a device is known as "the boot device". The hardware boot stage loads the OS loader from a fixed position on the boot device, and then transfers control to it.
In a traditional PC, the OS loader is located in the initial 512-byte block of the boot device; this block is known as "the MBR" (Master Boot Record).
In most systems, the OS loader is very limited due to various constraints. Even on non-PC systems, there are some limitations on the size and complexity of this loader, but the size limitation of the PC MBR (512 bytes, including the partition table) makes it almost impossible to squeeze much functionality into it.
Therefore, most systems split the role of loading the OS between a primary OS loader and a secondary OS loader; this secondary OS loader may be located within a larger portion of persistent storage, such as a disk partition.
Some of the parameters that may be passed to the kernel relate to these activities (for example, the default root filesystem can be overridden); for further information on Linux kernel parameters, read bootparam(7).
Only then does the kernel create the initial userland process, which is given the number 1 as its PID (process ID). Traditionally, this process executes the program /sbin/init, to which are passed the parameters that haven't already been handled by the kernel.
When /sbin/init starts, it reads /etc/inittab for further instructions. This file defines what should be run when the /sbin/init program is instructed to enter a particular run-level, giving the administrator an easy way to establish an environment for some usage; each run-level is associated with a set of services (for example, run-level S is single-user mode, and run-level 2 entails running most network services).
For each managed service (mail, nfs server, cron, etc.), there is a single startup script located in a specific directory (/etc/init.d in most versions of Linux). Each of these scripts accepts as a single argument the word "start" (causing it to start the service) or the word "stop" (causing it to stop the service). The script may optionally accept other "convenience" parameters (e.g., "restart" to stop and then start, "status" to display the service status, etc.). Running the script without parameters displays the possible arguments.
A primary script (usually /etc/rc) is called from inittab(5); this primary script calls each service's script via a link in the relevant sequencing directory. Each link whose name begins with 'S' is called with the argument "start" (thereby starting the service). Each link whose name begins with 'K' is called with the argument "stop" (thereby stopping the service).
To define the starting or stopping order within the same run-level, the name of a link contains an order-number. Also, for clarity, the name of a link usually ends with the name of the service to which it refers. For example, the link /etc/rc2.d/S80sendmail starts the sendmail service on runlevel 2. This happens after /etc/rc2.d/S12syslog is run but before /etc/rc2.d/S90xfs is run.
To manage these links is to manage the boot order and run-levels; under many systems, there are tools to help with this task (e.g., chkconfig(8)).
In older UNIX systems, such a file contained the actual command line options for a daemon, but in modern Linux systems (and also in HP-UX), it just contains shell variables. A boot script in /etc/init.d reads and includes its configuration file (that is, it "sources" its configuration file) and then uses the variable values.