Version 7 (modified by r4$K19nlypCPX8kt, 4 months ago) (diff)

Updated url for Gentoo wiki.


Needed Files


Changes to boot method

These changes apply if you are using the boot method.

Building Grub2

./configure --prefix=/usr \
   --build=${CLFS_HOST} --host=${CLFS_TARGET}
make DESTDIR=${CLFS} install

Changes to Final-System

These changes apply to the final-system section of the book.

Building Grub2

The 'make check' is optional.

./configure --prefix=/usr --sysconfdir=/etc
make check
make install

Installing Grub2

To install Grub2 onto the MBR you need to run the following command. Remember to substitute 'sda' for your boot hard drive.

grub-install /dev/sda

Creating the Boot Menu

GRUB uses its own naming structure for drives and partitions in the form of (hdn,m), where n is the hard drive number and m is the partition number. The hard drive numbers start from zero and the partition numbers from one. For example, partition hda1 is (hd0,1) to GRUB and hdb3 is (hd1,3). In contrast to Linux, GRUB does not consider CD-ROM drives to be hard drives. For example, if using a CD on hdb and a second hard drive on hdc, that second hard drive would still be (hd1).

Create a "Boot Menu" for grub by defining the boot menu; ${CLFS} is only required if you are using the boot method. The menu below uses the second partition on the first hard drive, (hd0,2); remember to substitute this for your hard drive and partition.

cat > ${CLFS}/boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg

set default=0
set timeout=5

set root=(hd0,2)
menuentry "Linux" {
  linux /boot/kernel- root=/dev/sda2


If dual-booting with Windows, then following entry will allow booting it:

cat >> ${CLFS}/boot/grub/grub.cfg << "EOF"
menuentry "Microsoft Windows" {
        set root=(hd0,1)
        chainloader +1

Setting the Frame Buffer Resolution

Add the following to the start of your grub.cfg file.

set gfxpayload=1280x800 (put your desired resolution here)
insmod gfxterm
insmod vbe


Gentoo Wiki
Cosmo's Example grub.cfg file