tar xvf $LFS/grub-0.97.tar.gz
cd grub-0.97
patch -Np1 -i $LFS/grub-0.97-disk_geometry-1.patch
./configure --prefix=/usr
make
make check
make install
mkdir -v /boot/grub
cp -v /usr/lib/grub/i386-pc/stage{1,2}/boot/grub
cd ..
rm -rf grub-0.97
cat >/boot/grub/menu.lst <<"EOF"# Begin /boot/grub/menu.lst# By default boot the first menu entry.default0# Allow 30 seconds before booting the default.
timeout 30# Use prettier colors.
color green/black light-green/black
# The first entry is for LFS.
title LFS 6.3
root (hd0,1)
kernel /boot/lfskernel-2.6.22.5 root=/dev/hda2
EOF
/usr # ls -R
.:
bin info lib man sbin
./bin:
mbchk
./info:
dir grub.info multiboot.info
./lib:
grub
./lib/grub:
i386-pc
./lib/grub/i386-pc:
e2fs_stage1_5 ffs_stage1_5 jfs_stage1_5 reiserfs_stage1_5 stage2 ufs2_stage1_5 xfs_stage1_5
fat_stage1_5 iso9660_stage1_5 minix_stage1_5 stage1 stage2_eltorito vstafs_stage1_5
./man:
man1 man8
./man/man1:
mbchk.1./man/man8:
grub.8 grub-install.8 grub-md5-crypt.8 grub-terminfo.8./sbin:
grub grub-install grub-md5-crypt grub-set-default grub-terminfo
安装文件类型
# find . -type f | xargs file./lib/grub/i386-pc/stage2: GRand Unified Bootloader stage2 version 3.2, identifier 0x0, GRUB version 0.97, configuration file /boot/grub/menu.lst
./lib/grub/i386-pc/stage2_eltorito: data
./lib/grub/i386-pc/e2fs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x2, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/fat_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x3, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/ffs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x1, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/iso9660_stage1_5: data
./lib/grub/i386-pc/jfs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x7, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/minix_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x4, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/reiserfs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x5, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/ufs2_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0xa, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/vstafs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x6, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/xfs_stage1_5: GRand Unified Bootloader stage1_5 version 3.2, identifier 0x8, GRUB version 0.97, configuration file /boot/grub/stage2
./lib/grub/i386-pc/stage1: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, code offset 0x48./sbin/grub: ELF 32-bit LSB executable, Intel 80386, version 1(SYSV),for GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
./sbin/grub-install: Bourne shell script text executable
./sbin/grub-md5-crypt: Bourne shell script text executable
./sbin/grub-terminfo: Bourne shell script text executable
./sbin/grub-set-default: Bourne shell script text executable
./bin/mbchk: ELF 32-bit LSB executable, Intel 80386, version 1(SYSV),for GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
./info/dir: data
./info/grub.info: data
./info/multiboot.info: data
./man/man1/mbchk.1: troff or preprocessor input text
./man/man8/grub.8: troff or preprocessor input text
./man/man8/grub-install.8: troff or preprocessor input text
./man/man8/grub-md5-crypt.8: troff or preprocessor input text
./man/man8/grub-terminfo.8: troff or preprocessor input text
安装的可执行文件
二进制可执行文件 /usr/bin/mbchk
root:/sources/grub-0.97# mbchk /boot/grub/stage1
/boot/grub/stage1: No Multiboot header.# mbchk /usr/lib/grub/i386-pc/xfs_stage1_5 /usr/lib/grub/i386-pc/xfs_stage1_5: No Multiboot header.
root:/sources/grub-0.97# mbchk /boot/grub/stage2
/boot/grub/stage2: The Multiboot header is found at the offset 5630./boot/grub/stage2: Bad checksum (0x2818d04).