13.4. Making the CLFS System Bootable

Your shiny new CLFS system is almost complete. One of the last things to do is to ensure that the system can be properly booted. The instructions below apply only to computers of x86 and x86_64 architecture, meaning mainstream PCs. Information on “boot loading” for other architectures should be available in the usual resource-specific locations for those architectures.

Boot loading can be a complex area, so a few cautionary words are in order. Be familiar with the current boot loader and any other operating systems present on the hard drive(s) that need to be bootable. Make sure that an emergency boot disk is ready to “rescue” the computer if the computer becomes unusable (un-bootable).

[Warning]

Warning

The following command will overwrite the current boot loader. Do not run the command if this is not desired, for example, if using a third party boot manager to manage the Master Boot Record (MBR). In this scenario, it would make more sense to install GRUB into the “boot sector” of the CLFS partition. In this case, this next command would become grub-install /dev/sda2 .

Instruct GRUB to install itself int othe MBR of sda:

grub-install /dev/sda

Next, we need to generate a configuration for GRUB. In previous versions of grub we could create the configuration manually here, but with GRUB2 we can generate grub.cfg automatically. You can do this with the following command:

grub-mkconfig -o /boot/grub/grub.cfg