grub.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. <indexterm zone="ch-bootable-grub">
  10. <primary sortas="a-Grub">Grub</primary>
  11. <secondary>configuring</secondary></indexterm>
  12. <para>We highly recommend that you create a Grub boot floppy diskette just in case.
  13. Insert a blank floppy diskette and run the following commands:</para>
  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. <para>Remove the diskette and store it somewhere safe. Now we'll run the
  17. <command>grub</command> shell:</para>
  18. <screen><userinput>grub</userinput></screen>
  19. <para>First, tell Grub where to search for its <filename>stage{1,2}</filename>
  20. files -- you can use the Tab key everywhere to make Grub show the alternatives:</para>
  21. <screen><userinput>root (hd0,3)</userinput></screen>
  22. <para>Tell Grub to install itself into the MBR (Master Boot Record) of
  23. <filename class="partition">hda</filename>:</para>
  24. <screen><userinput>setup (hd0)</userinput></screen>
  25. <para>If all is well, Grub will have reported finding its files in
  26. <filename class="directory">/boot/grub</filename>. That's all there is to it:</para>
  27. <screen><userinput>quit</userinput></screen>
  28. <para>Now we need to create a <quote>menu list</quote> file, defining Grub's
  29. boot menu:</para>
  30. <screen><userinput>cat &gt; /boot/grub/menu.lst &lt;&lt; "EOF"
  31. # Begin /boot/grub/menu.lst
  32. # By default boot the first menu entry.
  33. default 0
  34. # Allow 30 seconds before booting the default.
  35. timeout 30
  36. # Use prettier colors.
  37. color green/black light-green/black
  38. # The first entry is for LFS.
  39. title LFS &version;
  40. root (hd0,3)
  41. kernel /boot/lfskernel-&linux-version; root=/dev/hda4
  42. EOF</userinput></screen>
  43. <para>You may want to add an entry for your host distribution. It might look
  44. like this:</para>
  45. <screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
  46. title Red Hat
  47. root (hd0,2)
  48. kernel /boot/kernel-2.4.20 root=/dev/hda3
  49. initrd /boot/initrd-2.4.20
  50. EOF</userinput></screen>
  51. <para>Also, if you happen to dual-boot Windows, the following entry should
  52. allow booting it:</para>
  53. <screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
  54. title Windows
  55. rootnoverify (hd0,0)
  56. chainloader +1
  57. EOF</userinput></screen>
  58. <para>The FHS stipulates that Grub's menu.lst file should be symlinked to
  59. /etc/grub/menu.lst. To satisfy this requirement, issue the following
  60. command:</para>
  61. <screen><userinput>mkdir /etc/grub &amp;&amp;
  62. ln -s /boot/grub/menu.lst /etc/grub</userinput></screen>
  63. </sect1>