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