Remove lfs-uefi.txt symlink
[linux_from_scratch_hints.git] / PREVIOUS_FORMAT / grub_boot_rescue.txt
blob590b2c069adc7ba55a62fdf43d3b34570964b143
1 TITLE:          GRUB Boot & Rescue Disk - HOWTO
2 LFS Version:    All
3 AUTHOR:         Daniel Armstrong <daniel_armstrong@sympatico.ca>
5 SYNOPSIS:
6         GRUB is the GRand Unified Bootloader, a boot loader program with many
7 cool features for the PC. It serves as a replacement for the more traditional
8 LILO. This hint shows how to use GRUB to make a combined boot loader and rescue 
9 disk for your LFS system.
11 HINT:
12 If you do not currently have GRUB installed on your system, you will need to 
13 download the most recent version (ftp://alpha.gnu.org/gnu/grub/grub-0.90.tar.gz)
14 and install it into your chosen working directory.
16 Now we unpack GRUB and install it on our system with the following commands:
18 tar xvzf grub-0.90.tar.gz
19 cd grub-0.90
20 ./configure --prefix=/usr
21 make
22 make install
24 This will create the necessary executables and support files to create our boot
25 and rescue disk.
27 Grab a spare floppy and do a fresh format and install a filesystem:
29 fdformat /dev/fd0
30 mkfs -t ext2 /dev/fd0
32 Now we need to mount our soon-to-be GRUB disk:
34 mount -t ext2 /dev/fd0 /mnt
36 Create the directory and install the files GRUB will need to serve as your boot
37 loader:
39 mkdir -p /mnt/boot/grub
40 cp /usr/share/grub/i386-pc/stage1 /mnt/boot/grub
41 cp /usr/share/grub/i386-pc/stage2 /mnt/boot/grub
43 Now we are going to setup our GRUB floppy to do double-duty as a rescue disk 
44 for our LFS system, by placing a copy of the kernel on our floppy. This way if 
45 kernel on the hard drive is ever corrupted or trashed, we can use our GRUB boot
46 and rescue disk to get our system up and running again.
48 Copy your kernel to the GRUB floppy:
50 cp /boot/vmlinuz-2.4.7 /mnt/boot        #Your kernel and location may vary.
52 The final step before we reboot and test our GRUB boot and rescue disk is to 
53 install the GRUB tools in the Master Boot Record (MBR) of the floppy. Unmount 
54 the floppy but leave it in the drive:
56 umount /dev/fd0
58 Now type at the command prompt:
60 grub
62 This starts up the GRUB shell environment and changes your # prompt to "grub>".
63 Now enter:
65 root (fd0)
66 setup (fd0)
67 quit
69 Your GRUB boot and rescue disk is now complete. Leave the floppy in the drive 
70 and reboot. When the GRUB shell returns type:
72 root (fd0)
73 kernel /boot/vmlinuz-2.4.7 root=/dev/hda3       #Replace MY boot image and root
74                                                 #partition with your own
75 boot
77 Voila! Your LFS system should be up and running now.
79 For a more complete description of GRUB's many features, configuration, and 
80 installing GRUB on your hard drive's MBR, see the "Grub-HOWTO" hint at the 
81 LFS-Hints website and/or type "info grub" at your command prompt.
83 Thanks to Fabio Fracassi, the author of the "GRUB-Howto" hint, for getting me 
84 started with GRUB.
86 August 2, 2001 Daniel Armstrong <daniel_armstrong@sympatico.ca>
89   
91