% Linux Installation and Getting Started    -*- TeX -*-
% chap-sysadm.tex
% Copyright (c) 1993 by Matt Welsh and Lars Wirzenius
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by
% the copyright for the entire document, in the file "copyright.tex".

\section{ Booting the System }

\index{booting|(}
\index{system administration!booting Linux|(}
There are several ways to boot the system, either from floppy or from the
hard drive. 

\subsection{Using a boot floppy}

\index{booting Linux!with boot floppy}
Many people boot Linux using
a ``boot floppy'' which contains a copy of the Linux kernel. This kernel
has the Linux root partition coded into it, so it will know where to look
on the hard drive for the root filesystem. (The {\tt rdev} command
can be used to set the root partition in the kernel image; see below.)
This is the type of floppy created by Slackware during installation, 
for example.

\index{/Image@{\tt /Image}}
\index{/etc/Image@{\tt /etc/Image}}
\index{/vmlinix@{\tt /vmlinux}}
\index{boot floppy!creating}
\index{kernel image!file name of}
To create your own boot floppy, first locate the kernel image on your
hard disk. It should be in the file {\tt /Image} or {\tt /etc/Image}. Some
installations use the file {\tt /vmlinux} for the kernel. 

\index{kernel image!compressed}
\index{/zImage@{\tt /zImage}}
\index{/etc/zImage@{\tt /etc/zImage}}
You may instead have a compressed kernel. A compressed kernel uncompresses 
itself into memory at boot time, and takes up much less space on the hard 
drive.  If you have a compressed kernel, it may be found in the file
{\tt /zImage} or {\tt /etc/zImage}. 

\index{root device!setting name of with rdev@setting name of with {\tt rdev}}
\index{rdev@{\tt rdev}}
Once you know where the kernel is, set the root device in the
kernel image to the name of your Linux root partition with the {\tt rdev}
command. The format of the command is
\begin{tscreen}
rdev \cparam{kernel-name} \cparam{root-device}
\end{tscreen}
where \cparam{kernel-name} is the name of the kernel image, and 
\cparam{root-device} is the name of the Linux root partition. For
example, to set the root device in the kernel {\tt /etc/Image} to
{\tt /dev/hda2}, use the command
\begin{tscreen}
\# {\em rdev /etc/Image /dev/hda2}
\end{tscreen}

{\tt rdev} can set other options in the kernel as well, such as the default
SVGA mode to use at boot time. Just use ``{\tt rdev -h}'' to get a 
help message.

After setting the root device, you can simply copy the kernel image to
the floppy. Whenever copying data to a floppy, it's a good idea to MS-DOS 
format 
the floppy first. This lays down the sector and track information on the 
floppy, so it can be detected as either high or low density. 

For example, to copy the kernel in the file {\tt /etc/Image} to the 
floppy in {\tt /etc/fd0}, use the command
\begin{tscreen}
\# {\em cp /etc/Image /dev/fd0}
\end{tscreen}

This floppy should now boot Linux.

\subsection{Using LILO}\label{sec-lilo}

\index{LILO|(}
\index{booting!with LILO|(}
Another method of booting is to use LILO, a program which resides in the
boot sector of your hard disk. This program is executed when the system is
booted from the hard disk, and can automatically boot up Linux from a kernel
image stored on the hard drive itself.

\index{LILO!as boot loader}
\index{operating sytems!booting non-Linux}
\index{booting non-Linux systems}
LILO can also be used as a first-stage boot loader for several operating
systems, allowing you to select at boot time which operating system (such
as Linux or MS-DOS) to boot. When you boot using LILO, the default
operating system is booted unless you press \key{ctrl}, \key{alt}, or
\key{shift} during the bootup sequence. If you press any of these keys,
you will be provided with a boot prompt, at which you type the name of
the operating system to boot (such as ``{\tt linux}'' or ``{\tt msdos}''). 
If you press \key{tab} at the boot prompt, a listing of available
operating systems will be provided.

\index{LILO!installing}
The easy way to install LILO is to edit the configuration file, 
{\tt /etc/lilo.conf},
and then run the command
\begin{tscreen}
\# {\em /sbin/lilo}
\end{tscreen}

The LILO configuration file contains a ``stanza'' for each operating
system that you want to boot. The best way to demonstrate this is with
an example LILO config file. The below setup is for a system which has
a Linux root partition on {\tt /dev/hda1}, and an MS-DOS partition on
{\tt /dev/hda2}.

\begin{tscreen}\begin{verbatim}
# Tell LILO to modify the boot record on /dev/hda (the first
# non-SCSI hard drive). If you boot from a drive other than /dev/hda,
# change the following line. 
boot = /dev/hda

# Name of the boot loader. No reason to modify this unless you're doing
# some serious hacking on LILO.
install = /boot/boot.b

# Have LILO perform some optimization.
compact

# Stanza for Linux root partition on /dev/hda1.
image = /etc/Image   # Location of kernel
   label = linux     # Name of OS (for the LILO boot menu)
   root = /dev/hda1  # Location of root partition
   vga = ask         # Tell kernel to ask for SVGA modes at boot time

# Stanza for MSDOS partition on /dev/hda2.
other = /dev/hda2    # Location of partition
   table = /dev/hda  # Location of partition table for /dev/hda2 
   label = msdos     # Name of OS (for boot menu)
\end{verbatim}\end{tscreen}

\index{LILO!selecting default operating system for}
\index{operating sytems!booting non-Linux}
The first operating system stanza in the config file will be the default
OS for LILO to boot. You can select another OS to boot at the LILO boot 
prompt, as discussed above.

Remember that every time you update the kernel image on disk,
you should rerun {\tt /sbin/lilo} in order for the changes to be
reflected on the boot sector of your drive.

Also note that if you use the ``{\tt root =}'' line, above, there's no
reason to use {\tt rdev} to set the root partition in the kernel image.
LILO sets it for you at boot time.

The Linux FAQ (see Appendix~\ref{app-info}) provides more information on
LILO, including how to use LILO to boot with OS/2's Boot Manager.
\index{booting!with LILO|)}
\index{LILO|)}
\index{booting|)}
\index{system administration!booting Linux|)}
