8.4. Making the LFS system bootable

In order to be able to boot the LFS system, we need to update our bootloader. We're assuming that your host system is using Lilo (since that's the most commonly used boot loader at the moment).

We will not be running the lilo program inside chroot. Running lilo inside chroot can have fatal side-effects which render your MBR useless and you'd need a boot disk to be able to start any Linux system (either the host system or the LFS system).

First we'll exit chroot and copy the lfskernel file to the host system:

logout
cp $LFS/boot/lfskernel /boot

The next step is adding an entry to /etc/lilo.conf so that we can choose LFS when booting the computer:

cat >> /etc/lilo.conf << "EOF"
image=/boot/lfskernel
        label=lfs
        root=<partition>
        read-only
EOF

<partition> must be replaced with the LFS partition's designation.

Also note that if you are using reiserfs for your root partition, the line read-only should be changed to read-write.

Now, update the boot loader by running:

/sbin/lilo

The last step is synchronizing the host system's lilo configuration files with the LFS system's:

cp /etc/lilo.conf $LFS/etc &&
cp <kernel images> $LFS/boot

To find out which kernel images files are being used, look at the /etc/lilo.conf file and look for the lines starting with image=. If your host system has kernel files in other places than the /boot directory, make sure you update the paths in the $LFS/etc/lilo.conf file so that it does look for them in the /boot directory.