grub.xml 2.6 KB

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