How lilo assembles the bootstrap

The lilo boot installer uses all the component files to build the bootstrap. Do you have a picture of all the files being gathered together and written into the boot sector?  Not so!  They wouldn't fit. Here's what actually happens.

First, lilo opens the file lilo.conf to see which files are used to create the boot "image". lilo.conf can contain a number of boot methods and each of these is called an "image". Note that lilo can read parameters from the command line, but reading lilo.conf is much more practical, and we will stick to that method for this illustration.

Next, lilo asks Linux for the location of each of the listed files. Linux reponds with the location on disk for each of these files. This is important because if you know where a file is located you do not have to perform any directory searches to find it. It is these locations that are collected and written to the map file. An image may contain startup parameters to be passed to the kernel (append= ) and these as well are copied into the map file.

The map file is now saved to disk. Then the boot program is read from that first little segment of boot.b. This piece is called the primary loader. This will be written to the disk's boot sector (we will use the Master Boot Record (MBR) here; variations are possible.) The rest of the boot.b file contains what is called the secondary loader--it does most of the real work during startup. But that can only be found by looking inside the map file. So the map file's location is inserted into the primary loader code and then it is written to the MBR.

Note that the MBR has a little piece on the end of it. This is where the partition table is located. All boot installers must be careful to leave those last 66 bytes intact.

To see how the system boots up, see the L-I-L-O section.

Back