LILO

How can I make a boot floppy or rescue disk?

Step 1.  Prepare a floppy disk.   (format and make a file system)

Directions Example
Mount the floppy as an ext2 disk. mount /mnt/floppy
Change to the floppy's root directory. cd /mnt/floppy
Create directories for etc and boot. mkdir etc
mkdir boot
Copy the boot code to the boot directory cp /boot/boot.b /mnt/floppy/boot
Copy the kernel to the boot directory cp /boot/kernel-2.0.34 /mnt/floppy/boot
Copy initrd if your system uses it. cp /boot/initrd /mnt/floppy/boot
Start editing etc/lilo.conf (make sure you edit
the one on the floppy).
joe /mnt/floppy/etc/lilo.conf or
joe etc/lilo.conf

Notes about the foregoing...

Step 2.  Create your lilo.conf

Enter the following commands, or copy-and-paste them, or download it.

boot=/dev/fd0
install=/boot/boot.b
MAP=/mnt/floppy/boot/map
read-only
  image=/mnt/floppy/boot/vmlinuz-2.0.34
  label=linux
  root=/dev/hda1

Read about each command! Make changes to fit your system:

boot=/dev/fd0
  Specifies that lilo is to install the bootstrap onto the boot sector of the floppy.
  Since bootstraps work outside a disk's normal file system, they are written to the device.

install=/mnt/floppy/boot/boot.b
  You could leave this line out and lilo would use it anyway as a default. Specifies the path to the secondary loader code, boot.b. Shown for illustration purposes, and you could relocate it if you had a reason to.  While it would seem you'd want to put this on the floppy like everything else, lilo still runs from your hard drive, so this may as well stay there too. When lilo is run this file is copied [problem: maybe boot.b is the primary loader?  Isn't it ~430 bytes? hmmm....MUST check this! Remember it says 'merging' something when it installs] consider...2ary--must be on fd or its not independent. 1ary--doesn't matter because it's copied.

MAP=/mnt/floppy/boot/map
  Specifies where to save the map file. If this line is not present the default is to use /boot/map.
  In this case we want to want to be sure it gets written to the floppy.

read-only
  Initially mounts the root file system read-only.
  Minimizes danger to the hard drive and should keep fsck happy.
  Linux will remount it read-write after the system comes up.

The preceeding commands are "global".  They affect all images specified.
The following is a kernel "image". By convention, commands following "image" are indented.
Indentation is for looks only.  It means nothing to lilo.

image=/mnt/floppy/boot/vmlinuz-2.0.34
  The path and file name of the Linux kernel. Use the name of your kernel.

  label=linux
    You can leave this out; then the label will be vmlinuz-2.0.34 as found in "image".
    The label can be any name you like (as long as it doesn't contain any illegal characters).
    The purpose of the label is the give you something easier to type in at bootup.
    The first (or only) image is the default and you can just hit Enter instead of typing its name.

  root=/dev/hda1
    Change hda1 to the device name of the root partition for your computer!
    If you don't know the location of your root partition, look in /etc/fstab for the '/' entry. 4 ways: (1) 'mount' (2) /etc/fstab (3) fdisk -l (4) rdev.

Save the file. Much can be added to it but at this minimum you will soon be able to use the floppy to bring up Linux on your computer.

Step 3.  Install the bootloader (that's LILO).

Make sure you are at /mnt/floppy (use pwd to check). Type
lilo -C /mnt/floppy/etc/lilo.conf
The -C parameter allows you to specify a lilo.conf file other than the customary one in /etc.

(Also--testing on another machine and common pitfalls like adressing a file on the host machine) Um, this would be characteristic of an E.B.D. Also, re-using the disk on another machine requires that paths agree--both the mnt/floppy and the path on the HD if used.  Also the root dir as mounted.

Back