\input{gl2.slide-header-beamer}
\errorcontextlines=99
%% Subtopic Number = '1.106.1'
%% Title from filename: 'Boot the system'
%% Weight: 3
%% Description:
%% Candidates should be able to guide the system through the
%%        booting process. This includes giving commands to the boot loader and
%%        giving options to the kernel at boot time, and checking the events in
%%        the log files.
%% Key files, terms, and utilities include:
%%        /var/log/messages
%%        /etc/conf.modules or /etc/modules.conf
%%        dmesg
%%        LILO
%%        GRUB
\title{1.106.1\\Boot the system\\Weight 3}%
\author[Angus Lees]{Angus Lees \texttt{gus@inodes.org} \and Nick Urbanik \texttt{nicku@nicku.org}\\
 {\tiny This document Licensed under GPL---see section~\ref{sec:license}}}%
\subtitle{Linux Professional Institute Certification --- 102}
\mode<article>{\chead{1.106.1}}

% TODO: Nick

% Improve coverage of LILO and GRUB.

\begin{document}
\maketitle
\mode<article>{\thispagestyle{empty}}

\begin{frame}
  \frametitle{Outline}
  \mode<presentation>
  {%
    %\footnotesize
    \begin{multicols}{2}
      \tableofcontents
    \end{multicols}
    % You might wish to add the option [pausesections]
  }%
  \mode<article>
  {%
    \tableofcontents
  }%
\end{frame}

\section{Context}
\label{sec:context}

\begin{frame}
  \frametitle{Topic 106 Boot, Initialization, Shutdown and Runlevels [6]}%
  \framesubtitle{Where we are up to}%
    \begin{description}
    % \uline depends on \usepackage[normalem]{ulem}:
    \item[1.106.1] \textbf{\uline{Boot the system [3]}}
    \item[1.106.2] Change runlevels and shutdown or reboot system [3]
    \end{description}
\end{frame}

\section{Objective}
\label{sec:objective}

\begin{frame}
  \frametitle{Description of Objective}%
  \framesubtitle{1.106.1\ \ Boot the system}%
  \mode<presentation>{\Large}%
  Candidates should be able to guide the system through the booting
  process. This includes giving commands to the boot loader and giving
  options to the kernel at boot time, and checking the events in the
  log files.
\end{frame}

\begin{frame}[fragile]
  \frametitle{Key files, terms, and utilities include:}
  \framesubtitle{1.106.1\ \ Boot the system}%
  {\mode<presentation>{\large}%
    \begin{description}
    \item[\texttt{dmesg}] --- command to show kernel message ring buffer
    \item[\texttt{/var/log/messages}] --- main syslog file
    \item[\texttt{/etc/conf.modules \textnormal{or} /etc/modules.conf}]
      --- \texttt{modprobe} configuration file
    \item[\texttt{LILO}] --- older bootloader system, less used now
    \item[\texttt{GRUB}] --- newer, more flexible bootloader system
    \end{description}
  }
  \begin{itemize}
  \item Note that with Red Hat systems, 2.6 kernels use the file
    \texttt{/etc/modprobe.conf}, not \texttt{/etc/modules.conf}
  \item The name \texttt{/etc/conf.modules} has been out of favour for
    some years
  \end{itemize}
\end{frame}


\section{Boot Process}
\label{sec:boot-process}



\begin{frame}[fragile]
  \frametitle{Booting}
  \begin{itemize}
  \item Machine powers up, \textsc{BIOS POST}, spin up \textsc{SCSI}
    drives, etc
  \item \textsc{BIOS} boots boot loader
  \item \emph{(Boot loader may load its ``second stage'' from
      somewhere else)}
    \begin{itemize}
    \item e.g., grub loads \texttt{/boot/grub/stage2}
    \end{itemize}
  \item Boot loader loads Linux kernel
  \item Linux kernel starts up, detects hardware, etc
  \item Linux kernel creates a ram disk with kernel modules from
    initrd image file
    \begin{itemize}
    \item The drivers in the \texttt{/boot/initrd.img} file are often
      needed to access the hard disk.
    \end{itemize}
  \item After loading the 
  \item Linux kernel mounts /
  \item Linux kernel starts \texttt{init}(8)
  \item \texttt{init}(8) starts up rest of system
  \end{itemize}
\end{frame}


\section{How BIOS finds boot loader}
\label{sec:-bios-finds-bootloader}


\begin{frame}
  \frametitle{Finding the boot loader}
  \begin{itemize}
  \item (i386-specific)
  \item BIOS boots Master Boot Record (MBR), located at the beginning
    of the disk.
  \item Usual DOS MBR looks for ``active'' partition and loads the boot
    loader found in that partition.
  \item You can either install your boot loader
    \begin{itemize}
    \item in the MBR, replacing the DOS boot loader, or 
    \item use a DOS-compatible boot loader and install your boot loader in
      the active partition.
    \end{itemize}
  \end{itemize}
\end{frame}

\section{Boot Loaders}
\label{sec:boot-loaders}

\subsection{LILO}
\label{sec:lilo}

\begin{frame}[fragile]
  \frametitle{Boot Loaders}
  \framesubtitle{LILO}
  \begin{itemize}
  \item ``Usual'' i386 boot loader
    \begin{itemize}
    \item at least it was a few years ago.
    \end{itemize}
  \item \texttt{lilo}(8) install command generates suitable assembly
    code and installs it into either the MBR or a partition.
    Configured through \texttt{/etc/lilo.conf}
  \item Remembers actual disk blocks of kernel and uses that to access
    the file directly (using BIOS disk routines).
  \item Because the calculations are done at install time, LILO can
    get confused by changes in disk configuration.
  \end{itemize}
\end{frame}


\subsection{GRUB}
\label{sec:GRUB}

\begin{frame}[fragile]
  \frametitle{Boot Loaders}
  \framesubtitle{GRUB}
  \begin{itemize}
  \item The Grand United boot loader.
  \item Unlike LILO, GRUB understands some partition formats and reads
    files through ``normal'' means.
  \item GRUB has drivers for a number of different file systems
  \item depends on BIOS to be able to access the hard disk
  \item Reads the menu file \texttt{/boot/grub/menu.lst} directly from
    the hard disk
  \item No need to change MBR when install a new kernel
  \end{itemize}
\end{frame}

\subsection{Other boot loaders}
\label{sec:other-boot-loaders}


\begin{frame}
  \frametitle{Boot loaders}
  \framesubtitle{\texttt{isolinux}, \texttt{loadlin}}
  \begin{itemize}
  \item CDROMs often use \red{\texttt{isolinux}} as the bootloader
  \item \red{\texttt{loadlin}} allows booting Linux after having booted
    MSDOS.
  \end{itemize}
\end{frame}

\section{Chaining Boot Loaders}
\label{sec:chaining-boot-loaders}

\begin{frame}
   \frametitle{Chaining Boot loaders} 
   \begin{itemize}
   \item One bootloader can load another bootloader
   \item This is how GRUB or LILO start Windows
     \begin{itemize}
     \item Windows has its own bootloader at the start of its partition
     \item We tell GRUB or LILO to ``chainload'' that boot loader
     \end{itemize}
   \item It is often useful to have one GRUB bootloader start another
     bootloader
     \begin{itemize}
     \item For example, if you have several distributions on one disk,
       have one's GRUB install its \texttt{stage1} into the MBR
     \item Other distributions install GRUB at start of their partition
     \item The first GRUB chainloads the other GRUBs
     \item Keeps maintenance local within each distribution
     \end{itemize}
   \end{itemize}
\end{frame}

\section{\texttt{dmesg}}
\label{sec:dmesg}

\begin{frame}
  \frametitle{Snarfing kernel output}
  \begin{itemize}
  \item \texttt{dmesg}(8) gives you the last 16k of kernel messages.
  \item This is written to \texttt{/var/log/dmesg} to refer to after
    \texttt{syslog} starts up
    % The following is not correct: Nick:
  %\item \texttt{syslog} usually logs this to
  %  \texttt{/var/log/messages} and \texttt{/var/log/dmesg} or
  %  \texttt{/var/log/kern.log} for posterity.
  \item \texttt{syslog} gathers messages from many daemons as well as
    the kernel, and sends them to \texttt{/var/log/messages}
  \end{itemize}
\end{frame}

\section{\texttt{/etc/modules.conf}}
\label{sec:/etc/modules.conf}

\begin{frame}
  \frametitle{/etc/modules.conf}
  \begin{itemize}
  \item Configuration for \texttt{modprobe}(8)
  \item AKA \texttt{/etc/modules.conf}, or with the 2.6 kernel on Red
    Hat/Fedora systems,
    \texttt{/etc/modprobe.conf}
    \begin{itemize}
    \item Used to be called \texttt{/etc/conf.modules} till people
      realised that seems back to front
    \end{itemize}
  \item Gives kernel module options, module aliases and a few more
    exotic options (like module pre/post load commands).
  \end{itemize}
\end{frame}

\mode<presentation>
{%
\begin{frame}
  \frametitle{Topics Covered}
  %\footnotesize
  %\begin{multicols}{2}
    \tableofcontents[pausesections,pausesubsections]
  %\end{multicols}
  % You might wish to add the option [pausesections]
\end{frame}
}

\section{License Of This Document}
\label{sec:license}

\begin{frame}
  \frametitle{License Of This Document}%
  \raggedright%
  Copyright \copyright\ 2005, 2003 Angus Lees <gus@inodes.org> and
  Nick Urbanik <nicku@nicku.org>.
  \par
  Permission is granted to make and distribute verbatim copies or
  modified versions of this document provided that this copyright
  notice and this permission notice are preserved on all copies under
  the terms of the GNU General Public License as published by the Free
  Software Foundation---either version 2 of the License or (at your
  option) any later version.
\end{frame}
\end{document}
