335 lines
10 KiB
HTML
335 lines
10 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of BOOT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>BOOT</H1>
|
|
Section: Linux Programmer's Manual (7)<BR>Updated: 2015-03-11<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
boot - System bootup process based on UNIX System V Release 4
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
The <B>bootup process</B> (or "<B>boot sequence</B>") varies in details
|
|
among systems, but can be roughly divided into phases controlled by
|
|
the following components:
|
|
<DL COMPACT>
|
|
<DT id="1">1.<DD>
|
|
hardware
|
|
<DT id="2">2.<DD>
|
|
operating system (OS) loader
|
|
<DT id="3">3.<DD>
|
|
kernel
|
|
<DT id="4">4.<DD>
|
|
root user-space process (<I>init</I> and <I>inittab</I>)
|
|
<DT id="5">5.<DD>
|
|
boot scripts
|
|
</DL>
|
|
<P>
|
|
|
|
Each of these is described below in more detail.
|
|
<A NAME="lbAD"> </A>
|
|
<H3>Hardware</H3>
|
|
|
|
After power-on or hard reset, control is given
|
|
to a program stored in read-only memory (normally
|
|
PROM); for historical reasons involving the personal
|
|
computer, this program is often called "the <B>BIOS</B>".
|
|
<P>
|
|
|
|
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 <B>CMOS</B>"; outside
|
|
of the PC world, it is usually called "the <B>NVRAM</B>"
|
|
(nonvolatile RAM).
|
|
<P>
|
|
|
|
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
|
|
<B>boot device</B>".
|
|
The hardware boot stage loads the OS loader from a fixed position on
|
|
the boot device, and then transfers control to it.
|
|
<DL COMPACT>
|
|
<DT id="6">Note:<DD>
|
|
The device from which the OS loader is read may be attached via a network, in which
|
|
case the details of booting are further specified by protocols such as
|
|
DHCP, TFTP, PXE, Etherboot, etc.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H3>OS loader</H3>
|
|
|
|
The main job of the OS loader is to locate the kernel
|
|
on some device, load it, and run it.
|
|
Most OS loaders allow
|
|
interactive use, in order to enable specification of an alternative
|
|
kernel (maybe a backup in case the one last compiled
|
|
isn't functioning) and to pass optional parameters
|
|
to the kernel.
|
|
<P>
|
|
|
|
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 <B>MBR</B>"
|
|
(Master Boot Record).
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
In Linux, the OS loader is often either
|
|
<B><A HREF="/cgi-bin/man/man2html?8+lilo">lilo</A></B>(8)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?8+grub">grub</A></B>(8).
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Kernel</H3>
|
|
|
|
When the kernel is loaded, it initializes various components of
|
|
the computer and operating system; each portion of software
|
|
responsible for such a task is usually consider "a <B>driver</B>" for
|
|
the applicable component.
|
|
The kernel starts the virtual memory
|
|
swapper (it is a kernel process, called "kswapd" in a modern Linux
|
|
kernel), and mounts some filesystem at the root path,
|
|
<I>/</I>.
|
|
|
|
<P>
|
|
|
|
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
|
|
<B><A HREF="/cgi-bin/man/man2html?7+bootparam">bootparam</A></B>(7).
|
|
|
|
<P>
|
|
|
|
Only then does the kernel create the initial userland
|
|
process, which is given the number 1 as its
|
|
<B>PID</B>
|
|
|
|
(process ID).
|
|
Traditionally, this process executes the
|
|
program
|
|
<I>/sbin/init</I>,
|
|
|
|
to which are passed the parameters that haven't already been
|
|
handled by the kernel.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Root user-space process</H3>
|
|
|
|
<DL COMPACT>
|
|
<DT id="7">Note:<DD>
|
|
The following description applies to an OS based on UNIX System V Release 4.
|
|
However, a number of widely used systems have adopted a related but
|
|
fundamentally different approach known as
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
|
|
for which the bootup process is detailed in its associated
|
|
<B><A HREF="/cgi-bin/man/man2html?7+bootup">bootup</A></B>(7).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
When
|
|
<I>/sbin/init</I>
|
|
|
|
starts, it reads
|
|
<I>/etc/inittab</I>
|
|
|
|
for further instructions.
|
|
This file defines what should be run when the
|
|
<I>/sbin/init</I>
|
|
|
|
program is instructed to enter a particular <I>run-level</I>, 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 <B>S</B> is <I>single-user</I> mode,
|
|
and run-level <B>2</B> entails running most network services).
|
|
<P>
|
|
|
|
The administrator may change the current
|
|
run-level via
|
|
<B><A HREF="/cgi-bin/man/man2html?1+init">init</A></B>(1),
|
|
|
|
and query the current run-level via
|
|
<B><A HREF="/cgi-bin/man/man2html?8+runlevel">runlevel</A></B>(8).
|
|
|
|
<P>
|
|
|
|
However, since it is not convenient to manage individual services
|
|
by editing this file,
|
|
<I>/etc/inittab</I>
|
|
|
|
only bootstraps a set of scripts
|
|
that actually start/stop the individual services.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Boot scripts</H3>
|
|
|
|
<DL COMPACT>
|
|
<DT id="8">Note:<DD>
|
|
The following description applies to an OS based on UNIX System V Release 4.
|
|
However, a number of widely used systems (Slackware Linux, FreeBSD, OpenBSD)
|
|
have a somewhat different scheme for boot scripts.
|
|
</DL>
|
|
<P>
|
|
|
|
For each managed service (mail, nfs server, cron, etc.), there is
|
|
a single startup script located in a specific directory
|
|
(<I>/etc/init.d</I>
|
|
|
|
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 NAME="lbAI"> </A>
|
|
<H3>Sequencing directories</H3>
|
|
|
|
To make specific scripts start/stop at specific run-levels and in a
|
|
specific order, there are <I>sequencing directories</I>, normally
|
|
of the form <I>/etc/rc[0-6S].d</I>.
|
|
In each of these directories,
|
|
there are links (usually symbolic) to the scripts in the <I>/etc/init.d</I>
|
|
directory.
|
|
<P>
|
|
|
|
A primary script (usually <I>/etc/rc</I>) is called from
|
|
<B><A HREF="/cgi-bin/man/man2html?5+inittab">inittab</A></B>(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).
|
|
<P>
|
|
|
|
To define the starting or stopping order within the same run-level,
|
|
the name of a link contains an <B>order-number</B>.
|
|
Also, for clarity, the name of a link usually
|
|
ends with the name of the service to which it refers.
|
|
For example,
|
|
the link <I>/etc/rc2.d/S80sendmail</I> starts the sendmail service on
|
|
runlevel 2.
|
|
This happens after <I>/etc/rc2.d/S12syslog</I> is run
|
|
but before <I>/etc/rc2.d/S90xfs</I> is run.
|
|
<P>
|
|
|
|
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.,
|
|
<B><A HREF="/cgi-bin/man/man2html?8+chkconfig">chkconfig</A></B>(8)).
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Boot configuration</H3>
|
|
|
|
A program that provides a service is often called a "<B>daemon</B>".
|
|
Usually, a daemon may receive various command-line options
|
|
and parameters.
|
|
To allow a system administrator to change these
|
|
inputs without editing an entire boot script,
|
|
some separate configuration file is used, and is located in a specific
|
|
directory where an associated boot script may find it
|
|
(<I>/etc/sysconfig</I> on older Red Hat systems).
|
|
<P>
|
|
|
|
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 <I>/etc/init.d</I> reads and includes its configuration
|
|
file (that is, it "<B>sources</B>" its configuration file) and then uses
|
|
the variable values.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
<P>
|
|
|
|
<I>/etc/init.d/</I>,
|
|
|
|
<I>/etc/rc[S0-6].d/</I>,
|
|
|
|
<I>/etc/sysconfig/</I>
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+init">init</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+inittab">inittab</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+bootparam">bootparam</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+bootup">bootup</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+runlevel">runlevel</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+shutdown">shutdown</A></B>(8)
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="11"><A HREF="#lbAD">Hardware</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">OS loader</A><DD>
|
|
<DT id="13"><A HREF="#lbAF">Kernel</A><DD>
|
|
<DT id="14"><A HREF="#lbAG">Root user-space process</A><DD>
|
|
<DT id="15"><A HREF="#lbAH">Boot scripts</A><DD>
|
|
<DT id="16"><A HREF="#lbAI">Sequencing directories</A><DD>
|
|
<DT id="17"><A HREF="#lbAJ">Boot configuration</A><DD>
|
|
</DL>
|
|
<DT id="18"><A HREF="#lbAK">FILES</A><DD>
|
|
<DT id="19"><A HREF="#lbAL">SEE ALSO</A><DD>
|
|
<DT id="20"><A HREF="#lbAM">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:07 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|