< Previous | Contents | Next >
8.4.3. Setting Up the Configuration
GRUB works by writing data to the first physical track of the hard disk. This area is not part of any file system. The programs there access GRUB modules in the boot partition. The default location is /boot/grub/.
The location of the boot partition is a choice of the user that affects the configuration. One recommendation is to have a separate small (suggested size is 100 MB) partition just for boot information. That way each build, whether LFS or some commercial distro, can access the same boot files and access can be made from any booted system. If you choose to do this, you will need to mount the separate partition, move all files in the current /boot directory (e.g. the linux kernel you just built in the previous section) to the new partition. You will then need to unmount the partition and remount it as /boot. If you do this, be sure to update /etc/fstab.
Using the current lfs partition will also work, but configuration for multiple systems is more difficult.
Using the above information, determine the appropriate designator for the root partition (or boot partition, if a separate one is used). For the following example, it is assumed that the root (or separate boot) partition is sda2.
Install the GRUB files into /boot/grub and set up the boot track:
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).
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).
grub-install /dev/sda
grub-install /dev/sda
Note
If the system has been booted using UEFI, grub-install will try to install files for the x86_64-efi target, but those files have not been installed in chapter 6. If this is the case, add --target i386-pc to the command above.
Note
If the system has been booted using UEFI, grub-install will try to install files for the x86_64-efi target, but those files have not been installed in chapter 6. If this is the case, add --target i386-pc to the command above.