[955533b] | 1 | <sect1 id="ch08-grub">
|
---|
| 2 | <title>Making the LFS system bootable</title>
|
---|
| 3 | <?dbhtml filename="grub.html" dir="chapter08"?>
|
---|
| 4 |
|
---|
[1e163254] | 5 | <para>Now that we have our shiny new Linux-From-Scratch system completed,
|
---|
| 6 | we need to ensure we can boot it. To do this, we will run the
|
---|
| 7 | <userinput>grub</userinput> program.</para>
|
---|
[1561534] | 8 |
|
---|
| 9 | <para><screen><userinput>grub</userinput></screen></para>
|
---|
| 10 |
|
---|
[980599d] | 11 | <para>Grub uses its own naming structure for drives, in the form of (hdn,m),
|
---|
| 12 | where n is the hard drive number, and m is the partition number, both of which
|
---|
| 13 | start from zero. So, partition hda1 would be (hd0,0) to Grub, and hdb2 would
|
---|
[1e163254] | 14 | be (hd1,1). Also, Grub doesn't pay attention to CD-ROM drives at all, so if,
|
---|
[bc362d4] | 15 | for example, you have a CD on hdb, and a second hard drive on hdc, partitions
|
---|
[980599d] | 16 | on that second hard drive would still be (hd1,m).</para>
|
---|
[1561534] | 17 |
|
---|
| 18 | <para>So, using the information above, select the appropriate designator for
|
---|
[bc362d4] | 19 | your root partition. For the purposes of this, we will assume (hd0,3) for
|
---|
| 20 | your root partition. First, we tell grub where to find its files:</para>
|
---|
[1561534] | 21 |
|
---|
| 22 | <para><screen><userinput>root (hd0,3)
|
---|
| 23 | setup (hd0)
|
---|
| 24 | quit</userinput></screen></para>
|
---|
| 25 |
|
---|
[980599d] | 26 | <para>This tells Grub to look for its files on hda4 (hd0,3), and install itself
|
---|
[1561534] | 27 | into the MBR (Master Boot Record) of hda.</para>
|
---|
| 28 |
|
---|
| 29 | <para>Also, we need to create the <filename>menu.lst</filename> file, which
|
---|
[bc362d4] | 30 | Grub uses to designate its boot menu:</para>
|
---|
[1561534] | 31 |
|
---|
[15b436f] | 32 | <para><screen><userinput>cat > /boot/grub/menu.lst << "EOF"
|
---|
[1561534] | 33 | # Begin /boot/grub/menu.lst
|
---|
| 34 |
|
---|
| 35 | # Default to first menu entry
|
---|
| 36 | default 0
|
---|
| 37 |
|
---|
| 38 | # Allow 30 seconds before booting default
|
---|
| 39 | timeout 30
|
---|
| 40 |
|
---|
| 41 | # Use prettier colors
|
---|
| 42 | color green/black light-green/black
|
---|
| 43 |
|
---|
| 44 | # Default Entry for LFS
|
---|
| 45 | title LFS 5.0
|
---|
[bc362d4] | 46 | root (hd0,3)
|
---|
| 47 | kernel /boot/lfskernel root=/dev/hda4 ro
|
---|
[1561534] | 48 | EOF</userinput></screen></para>
|
---|
| 49 |
|
---|
| 50 | <para>You might also want to add in an entry for your host distribution. It
|
---|
| 51 | might look similar to this:</para>
|
---|
| 52 |
|
---|
[15b436f] | 53 | <para><screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
[1561534] | 54 | # Redhat Linux
|
---|
| 55 | title Redhat
|
---|
[bc362d4] | 56 | root (hd0,2)
|
---|
| 57 | kernel /boot/kernel-2.4.20 root=/dev/hda3 ro
|
---|
| 58 | initrd /boot/initrd-2.4.20
|
---|
[1561534] | 59 | EOF</userinput></screen></para>
|
---|
| 60 |
|
---|
| 61 | <para>Also, if you happen to dual-boot Windows, the following entry should
|
---|
| 62 | allow booting it:</para>
|
---|
| 63 |
|
---|
[15b436f] | 64 | <para><screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
[1561534] | 65 | # Windows
|
---|
[bc362d4] | 66 | title Windows
|
---|
| 67 | rootnoverify (hd0,0)
|
---|
| 68 | chainloader +1
|
---|
[1561534] | 69 | EOF</userinput></screen></para>
|
---|
| 70 |
|
---|
[c1cfddf] | 71 | <para>You can find more information regarding Grub on its website, located at:
|
---|
| 72 | <ulink url="http://www.gnu.org/software/grub"/>.</para>
|
---|
[955533b] | 73 |
|
---|
| 74 | </sect1>
|
---|
| 75 |
|
---|