1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
4 | %general-entities;
|
---|
5 | ]>
|
---|
6 | <sect1 id="ch-bootable-grub">
|
---|
7 | <title>Making the LFS system bootable</title>
|
---|
8 | <?dbhtml filename="grub.html"?>
|
---|
9 |
|
---|
10 |
|
---|
11 | <para>We highly recommend that you create a Grub boot floppy diskette just in case.
|
---|
12 | Insert a blank floppy diskette and run the following commands:</para>
|
---|
13 |
|
---|
14 | <screen><userinput>dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1
|
---|
15 | dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1</userinput></screen>
|
---|
16 |
|
---|
17 | <para>Remove the diskette and store it somewhere safe. Now we'll run the
|
---|
18 | <command>grub</command> shell:</para>
|
---|
19 |
|
---|
20 | <screen><userinput>grub</userinput></screen>
|
---|
21 |
|
---|
22 | <para>First, tell Grub where to search for its <filename>stage{1,2}</filename>
|
---|
23 | files -- you can use the Tab key everywhere to make Grub show the alternatives:</para>
|
---|
24 |
|
---|
25 | <screen><userinput>root (hd0,3)</userinput></screen>
|
---|
26 |
|
---|
27 | <para>Tell Grub to install itself into the MBR (Master Boot Record) of
|
---|
28 | <filename class="partition">hda</filename>:</para>
|
---|
29 |
|
---|
30 | <screen><userinput>setup (hd0)</userinput></screen>
|
---|
31 |
|
---|
32 | <para>If all is well, Grub will have reported finding its files in
|
---|
33 | <filename class="directory">/boot/grub</filename>. That's all there is to it:</para>
|
---|
34 |
|
---|
35 | <screen><userinput>quit</userinput></screen>
|
---|
36 |
|
---|
37 | <para>Now we need to create a <quote>menu list</quote> file, defining Grub's
|
---|
38 | boot menu:</para>
|
---|
39 |
|
---|
40 | <screen><userinput>cat > /boot/grub/menu.lst << "EOF"
|
---|
41 | # Begin /boot/grub/menu.lst
|
---|
42 |
|
---|
43 | # By default boot the first menu entry.
|
---|
44 | default 0
|
---|
45 |
|
---|
46 | # Allow 30 seconds before booting the default.
|
---|
47 | timeout 30
|
---|
48 |
|
---|
49 | # Use prettier colors.
|
---|
50 | color green/black light-green/black
|
---|
51 |
|
---|
52 | # The first entry is for LFS.
|
---|
53 | title LFS &version;
|
---|
54 | root (hd0,3)
|
---|
55 | kernel /boot/lfskernel-&linux-version; root=/dev/hda4
|
---|
56 | EOF</userinput></screen>
|
---|
57 |
|
---|
58 | <para>You may want to add an entry for your host distribution. It might look
|
---|
59 | like this:</para>
|
---|
60 |
|
---|
61 | <screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
62 | title Red Hat
|
---|
63 | root (hd0,2)
|
---|
64 | kernel /boot/kernel-2.4.20 root=/dev/hda3
|
---|
65 | initrd /boot/initrd-2.4.20
|
---|
66 | EOF</userinput></screen>
|
---|
67 |
|
---|
68 | <para>Also, if you happen to dual-boot Windows, the following entry should
|
---|
69 | allow booting it:</para>
|
---|
70 |
|
---|
71 | <screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
72 | title Windows
|
---|
73 | rootnoverify (hd0,0)
|
---|
74 | chainloader +1
|
---|
75 | EOF</userinput></screen>
|
---|
76 |
|
---|
77 | <para>The FHS stipulates that Grub's menu.lst file should be symlinked to
|
---|
78 | /etc/grub/menu.lst. To satisfy this requirement, issue the following
|
---|
79 | command:</para>
|
---|
80 |
|
---|
81 | <screen><userinput>mkdir /etc/grub &&
|
---|
82 | ln -s /boot/grub/menu.lst /etc/grub</userinput></screen>
|
---|
83 |
|
---|
84 | </sect1>
|
---|