grub.xml 2.5 KB

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