Version 2 (modified by 15 years ago) ( diff ) | ,
---|
Grub2
Needed Files
Grub2 ftp://alpha.gnu.org/gnu/grub/grub-1.97.1.tar.gz
Changed to boot method
These changes apply if you are using the boot method.
Builing Grub2
./configure --prefix=/usr \ --build=${CLFS_HOST} --host=${CLFS_TARGET} make 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 make make check make install
Installing Grub2
To install Grub2 onto the MBR you need to run the following command. Rember 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, both starting from zero. For example, partition hda1 is (hd0,0) to GRUB and hdb3 is (hd1,2). 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,1), remember to substitute this for your hard drive and parition.
cat > ${CLFS}/boot/grub/grub.cfg << "EOF" # Begin /boot/grub/grub.cfg set default=0 set timeout=5 set root=(hd0,2) menuentry "Linux 2.6.31.5" { linux /boot/kernel-2.6.31.5 root=/dev/sda2 } EOF
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 } EOF
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
References
Gentoo Wiki http://en.gentoo-wiki.com/wiki/Grub2 Cosmo's Example grub.cfg file http://cross-lfs.org/~cosmo/wiki_files/grub.cfg