grub.xml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 hd(0,0) to grub, and hdb2 would
  10. be hd(1,2). Also, Grub doesn't pay attention to CDROM drives at all, so if,
  11. for example, if you have a CD on hdb, and a second hard drive on hdc, partitions
  12. on that second hard drive would still be hd(1,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 hd(0,3) for
  15. your root partition. First, we tell grub where to find it's 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 it's 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 it's 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. kernel (hd0,3)/boot/lfskernel root=/dev/hda4 ro
  34. EOF</userinput></screen></para>
  35. <para>You might also want to add in an entry for your host distribution. It
  36. might look similar to this:</para>
  37. <para><screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
  38. # Redhat Linux
  39. title Redhat
  40. kernel (hd0,2)/boot/kernel-2.4.20 root=/dev/hda3 ro
  41. initrd (hd0,2)/boot/initrd-2.4.20
  42. EOF</userinput></screen></para>
  43. <para>Also, if you happen to dual-boot Windows, the following entry should
  44. allow booting it:</para>
  45. <para><screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
  46. # Windows
  47. chainloader (hd0,0)+1
  48. EOF</userinput></screen></para>
  49. <para>You can find more info regarding Grub on it's web site, located at:
  50. <ulink url="http://www.gnu.org/software/grub"/>, as well as the LFS Grub HOWTO
  51. located at: <ulink url="http://www.linuxfromscratch.org/hints/downloads/files/grub-howto.txt"/>.</para>
  52. </sect1>