7.12. GRUB-0.97

#### Cross-Compiled Linux From Scratch - Version 1.0.0rc1-x86

### Chapter 7. If You Are Going to Boot

- Prev

  Linux-2.6.17.1

- Next

  Setting Up the Environment

- Up.
- Home

# 7.12. GRUB-0.97

The GRUB package contains the GRand Unified Bootloader.

## 7.12.1. Installation of GRUB

GRUB has an issue where it sometimes doesn't detect the disk geometry correctly when used with Linux 2.6. This results in the error message `Error 24: Attempt to access block outside partition`. The following patch fixes this issue:

    patch -Np1 -i ../grub-0.97-disk_geometry-1.patch

This package is known to have issues when its default optimization flags (including the `-march` and `-mcpu` options) are changed. If any environment variables that override default optimizations have been defined, such as `CFLAGS` and `CXXFLAGS`, unset them when building GRUB.

Prepare GRUB for compilation:

    ./configure --prefix=/usr \
       --host=${LFS_TARGET}

Compile the package:

    make

Install the package:

    make DESTDIR=${LFS} install
    mkdir -v ${LFS}/boot/grub
    cp -v ${LFS}/usr/lib/grub/i386-pc/stage{1,2} ${LFS}/boot/grub

The `i386-pc` directory contains a number of `*stage1_5` files, different ones for different file systems. Review the files available and copy the appropriate ones to the `${LFS}/boot/grub` directory. Most users will copy the `e2fs_stage1_5` and/or `reiserfs_stage1_5` files.

Details on this package are located in Section 10.54.2, “Contents of GRUB.”

- Prev

  Linux-2.6.17.1

- Next

  Setting Up the Environment

- Up.
- Home.