%\documentclass[colorBG,slideColor,troispoints,pdf]{prosper} \documentclass[colorBG,total,slideColor,pdf]{prosper} %\documentclass[colorBG,slideColor,ps]{prosper} \usepackage{alltt,key,xr,cols,rcs,acro,nick,% graphicx,varioref,explanation,booktabs,multicol} \usepackage[nolineno,noindent]{lgrind} %\definecolor{green}{rgb}{0,1,0} \RCS $Revision: 1.1 $ \renewcommand*{\bs}{\texttt{\char '134}} % Backslash `\' %\newcommand*{\labTitle}{LDAP Directories}1 \newcommand*{\subject}{Operating Systems and Systems Integration} \newcommand*{\emphcolour}[1]{\emph{\red#1}} \providecommand*{\RPM}{\acro{RPM}\xspace} \providecommand*{\CD}{\acro{CD}\xspace} \providecommand*{\IPC}{\acro{IPC}\xspace} \providecommand*{\UID}{\acro{UID}\xspace} \providecommand*{\GID}{\acro{GID}\xspace} \providecommand*{\SMP}{\acro{SMP}\xspace} \providecommand*{\API}{\acro{API}\xspace} \providecommand*{\OK}{\acro{OK}\xspace} \providecommand*{\IETF}{\acro{OK}\xspace} \providecommand*{\MS}{\acro{MS}\xspace} \providecommand*{\LILO}{\acro{LILO}\xspace} \providecommand*{\HCI}{\acro{HCI}\xspace} \providecommand*{\KDE}{\acro{KDE}\xspace} \providecommand*{\MBR}{\acro{MBR}\xspace} \providecommand*{\BSD}{\acro{BSD}\xspace} \providecommand*{\MB}{\acro{MB}\xspace} \providecommand*{\LBA}{\acro{LBA}\xspace} \title{\mbox{}\blue{}The Bootloader}% \subtitle{How Grub works, booting other OSs} \author{Nick Urbanik \texttt{}\\ \footnotesize{}Copyright Conditions: GNU FDL (see \url{http://www.gnu.org/licenses/fdl.html})}% \institution{Department of Information and Communications Technology}% \slideCaption{OSSI --- Bootloader --- ver. \RCSRevision} \Logo{\includegraphics[width=15mm]{ict-logo-smaller}} \begin{document} \maketitle \begin{slide}{Grub: Grand Unified Bootloader} \begin{itemize} \item A bootloader can be very simple, provide minimal functionality \item Can pay money for tools such as System Commander, or BootMagic (with Partition Magic) \item Or use \LILO, or better still, Grub. \item Grub aims to boot anything on an Intel 86 architecture \end{itemize} \end{slide} \begin{slide}{Booting Windows on an Intel Computer} \begin{itemize} \item \BIOS loads \emphcolour{MBR} (Master Boot Record), first 512 bytes of ``first'' hard disk to \RAM \item \BIOS jumps to this code \item That code (by default) reads first sector of first active partition, the \emphcolour{boot sector} \item boot sector code then loads the operating system \end{itemize} \end{slide} \begin{slide}{Disk sectors, cylinders} \begin{minipage}[c]{0.3\slideWidth} \raggedright \begin{itemize} \item The rings are called \emphcolour{cylinders}: \end{itemize} \end{minipage}% \hspace{0.1\slideWidth}% \begin{minipage}[c]{0.5\slideWidth} \includegraphics[width=0.5\slideWidth]{disk} \end{minipage} \end{slide} \begin{slide}{Methods of Booting} \begin{itemize} \item \BIOS always loads \MBR \item \MBR can load a bootloader, such as grub's \texttt{stage2} or \LILO \item Booting \OS directly: \begin{itemize} \item bootloader can load an operating system kernel directly \end{itemize} \item \emphcolour{Chaining bootloaders}: \begin{itemize} \item bootloader can load another bootloader which in turn loads an operating system \end{itemize} \end{itemize} \end{slide} \begin{slide}{How grub works} \begin{itemize} \item We install ``\texttt{stage1}'' of grub into \MBR \item \texttt{stage1} reads \texttt{stage1\_5} or \texttt{stage2} from a list of disk blocks \item \texttt{stage1} loads \texttt{stage1\_5} from hard disk \item \texttt{stage1\_5} can now read files on the hard disk, and loads \texttt{stage2} \item \texttt{stage2} of grub provides commands to support many features \end{itemize} \end{slide} \begin{slide}{Features of grub} \begin{itemize} \item support directly loading many different operating system kernels \item can directly read many file system formats \item can load a configuration file from disk \item can decompress files automatically \item can read any device that the \BIOS recognises \item is independent of drive geometry \item can detect all \RAM \item supports Logical Block Address mode (\LBA) \item supports network booting \item supports remote (serial) terminals \end{itemize} \end{slide} \begin{slide}{Installing grub into \MBR from floppy} \begin{itemize} \item Create a grub installation disk \begin{itemize} \item see the lab sheet to see how \end{itemize} \item Boot computer with this disk, type: \begin{alltt} grub> \textbf{find /boot/grub/stage2} grub> \textbf{root (hd\emphcolour{x},\emphcolour{y})} grub> \textbf{setup (hd\emphcolour{x})} \end{alltt} \end{itemize} \end{slide} \begin{slide}{Installing grub into \MBR from floppy --- 2} \begin{itemize} \item What happens when type \begin{alltt} grub> \textbf{find /boot/grub/stage2} \end{alltt} \begin{itemize} \item grub searches all partitions for that file \item lists the partitions that contain \texttt{stage2} of grub \end{itemize} \item What happens when type \begin{alltt} grub> \textbf{root (hd\emphcolour{x},\emphcolour{y})} \end{alltt} \begin{itemize} \item The ``\emphcolour{x}'' and ``\emphcolour{y}'' were found in previous step \item grub mounts the partition, and determines file system type \end{itemize} \end{itemize} \end{slide} \begin{slide}{Installing grub into \MBR from floppy --- 3} \begin{itemize} \item What happens when type \begin{alltt} grub> \textbf{setup (hd\emphcolour{x})} \end{alltt} \begin{itemize} \item grub copies small \texttt{stage1} to \MBR of disk \emphcolour{x} \item installs a list of sectors containing the \texttt{stage1\_5} file \item aim is so \texttt{stage1} can load \texttt{stage1\_5} when booting \end{itemize} \end{itemize} \end{slide} \begin{slide}{Booting using grub} \begin{itemize} \item \BIOS loads \texttt{stage1} from \MBR \item \texttt{stage1} knows which sectors of hard disk contain \texttt{stage1\_5}, so \begin{itemize} \item loads \texttt{stage1\_5} into \RAM, \item jumps to that code \end{itemize} \item \texttt{stage1\_5} can now read the file system containing \texttt{stage2} \item reads \texttt{stage2} from hard disk \item \texttt{stage2} can read the menu in \texttt{/boot/grub/grub.conf} \item \texttt{stage2} can boot (almost?) any operating system from any disk \BIOS can read \end{itemize} \end{slide} \end{document}