[673b0d8] | 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 | ]>
|
---|
[3be4d97] | 6 | <sect1 id="ch-bootable-grub">
|
---|
[955533b] | 7 | <title>Making the LFS system bootable</title>
|
---|
[673b0d8] | 8 | <?dbhtml filename="grub.html"?>
|
---|
| 9 |
|
---|
[955533b] | 10 |
|
---|
[e0a04e8] | 11 | <para>We highly recommend that you create a Grub boot floppy diskette just in case.
|
---|
[e3a72b1] | 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
|
---|
[0719866] | 18 | <command>grub</command> shell:</para>
|
---|
[1561534] | 19 |
|
---|
[21ba4e3] | 20 | <screen><userinput>grub</userinput></screen>
|
---|
[1561534] | 21 |
|
---|
[54ff0b9] | 22 | <para>First, tell Grub where to search for its <filename>stage{1,2}</filename>
|
---|
[673b0d8] | 23 | files -- you can use the Tab key everywhere to make Grub show the alternatives:</para>
|
---|
[1561534] | 24 |
|
---|
[21ba4e3] | 25 | <screen><userinput>root (hd0,3)</userinput></screen>
|
---|
[1561534] | 26 |
|
---|
[673b0d8] | 27 | <para>Tell Grub to install itself into the MBR (Master Boot Record) of
|
---|
[0719866] | 28 | <filename class="partition">hda</filename>:</para>
|
---|
[1561534] | 29 |
|
---|
[21ba4e3] | 30 | <screen><userinput>setup (hd0)</userinput></screen>
|
---|
[54ff0b9] | 31 |
|
---|
| 32 | <para>If all is well, Grub will have reported finding its files in
|
---|
[0719866] | 33 | <filename class="directory">/boot/grub</filename>. That's all there is to it:</para>
|
---|
[54ff0b9] | 34 |
|
---|
[21ba4e3] | 35 | <screen><userinput>quit</userinput></screen>
|
---|
[54ff0b9] | 36 |
|
---|
[673b0d8] | 37 | <para>Now we need to create a <quote>menu list</quote> file, defining Grub's
|
---|
| 38 | boot menu:</para>
|
---|
[54ff0b9] | 39 |
|
---|
[0719866] | 40 | <screen><userinput>cat > /boot/grub/menu.lst << "EOF"
|
---|
[1561534] | 41 | # Begin /boot/grub/menu.lst
|
---|
| 42 |
|
---|
[54ff0b9] | 43 | # By default boot the first menu entry.
|
---|
[1561534] | 44 | default 0
|
---|
| 45 |
|
---|
[54ff0b9] | 46 | # Allow 30 seconds before booting the default.
|
---|
[1561534] | 47 | timeout 30
|
---|
| 48 |
|
---|
[54ff0b9] | 49 | # Use prettier colors.
|
---|
[1561534] | 50 | color green/black light-green/black
|
---|
| 51 |
|
---|
[54ff0b9] | 52 | # The first entry is for LFS.
|
---|
[52216a8] | 53 | title LFS &version;
|
---|
[bc362d4] | 54 | root (hd0,3)
|
---|
[eb443a3] | 55 | kernel /boot/lfskernel-&linux-version; root=/dev/hda4
|
---|
[0719866] | 56 | EOF</userinput></screen>
|
---|
[1561534] | 57 |
|
---|
[17476c5] | 58 | <para>You may want to add an entry for your host distribution. It might look
|
---|
[54ff0b9] | 59 | like this:</para>
|
---|
[1561534] | 60 |
|
---|
[0719866] | 61 | <screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
[54ff0b9] | 62 | title Red Hat
|
---|
[bc362d4] | 63 | root (hd0,2)
|
---|
[1969cea] | 64 | kernel /boot/kernel-2.4.20 root=/dev/hda3
|
---|
[bc362d4] | 65 | initrd /boot/initrd-2.4.20
|
---|
[0719866] | 66 | EOF</userinput></screen>
|
---|
[1561534] | 67 |
|
---|
| 68 | <para>Also, if you happen to dual-boot Windows, the following entry should
|
---|
| 69 | allow booting it:</para>
|
---|
| 70 |
|
---|
[0719866] | 71 | <screen><userinput>cat >> /boot/grub/menu.lst << "EOF"
|
---|
[bc362d4] | 72 | title Windows
|
---|
| 73 | rootnoverify (hd0,0)
|
---|
| 74 | chainloader +1
|
---|
[0719866] | 75 | EOF</userinput></screen>
|
---|
[1561534] | 76 |
|
---|
[205af12] | 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 |
|
---|
[955533b] | 84 | </sect1>
|
---|