source: chapter08/grub.xml@ 51c7e26f

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk v5_0 v5_1 v5_1_1 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 51c7e26f was 51c7e26f, checked in by Alex Gronenwoud <alex@…>, 21 years ago

Minor brush-ups, and splitting the basic-net section.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2956 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.0 KB
Line 
1<sect1 id="ch08-grub">
2<title>Making the LFS system bootable</title>
3<?dbhtml filename="grub.html" dir="chapter08"?>
4
5<para>Now that we have our shiny new Linux-From-Scratch system completed,
6we need to ensure we can boot it. To do this, we will run the
7<userinput>grub</userinput> program.</para>
8
9<para><screen><userinput>grub</userinput></screen></para>
10
11<para>Grub uses its own naming structure for drives and partitions, in the form
12of (hdn,m), where <emphasis>n</emphasis> is the hard drive number, and
13<emphasis>m</emphasis> the partition number, both starting from zero. This
14means, for instance, that partition <filename>hda1</filename> is (hd0,0) to
15Grub, and <filename>hdb2</filename> is (hd1,1). In contrast to Linux, Grub
16doesn't consider CD-ROM drives to be hard drives, so if you have a CD on
17<filename>hdb</filename>, for example, and a second hard drive on
18<filename>hdc</filename>, that second hard drive would still be (hd1).</para>
19
20<para>Using the above information, determine the appropriate designator for
21your root partition. For the following example, we'll assume your root
22partition is <filename>hda4</filename>.</para>
23
24<para>First, tell Grub where to search for its <filename>stage{1,2}</filename>
25files -- you can use Tab everywhere to make Grub show the alternatives:</para>
26
27<para><screen><userinput>root (hd0,3)</userinput></screen></para>
28
29<para>Then tell it to install itself into the MBR (Master Boot Record) of
30<filename>hda</filename>:</para>
31
32<para><screen><userinput>setup (hd0)</userinput></screen></para>
33
34<para>If all is well, Grub will have reported finding its files in
35<filename>/boot/grub</filename>. That's all there was to it:</para>
36
37<para><screen><userinput>quit</userinput></screen></para>
38
39<para>Now we need to create the <filename>menu.lst</filename> file, which
40defines Grub's boot menu:</para>
41
42<para><screen><userinput>cat &gt; /boot/grub/menu.lst &lt;&lt; "EOF"</userinput>
43# Begin /boot/grub/menu.lst
44
45# By default boot the first menu entry.
46default 0
47
48# Allow 30 seconds before booting the default.
49timeout 30
50
51# Use prettier colors.
52color green/black light-green/black
53
54# The first entry is for LFS.
55title LFS 5.0
56root (hd0,3)
57kernel /boot/lfskernel root=/dev/hda4 ro
58<userinput>EOF</userinput></screen></para>
59
60<para>You may want to add an entry for your host distribution. It might look
61like this:</para>
62
63<para><screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"</userinput>
64title Red Hat
65root (hd0,2)
66kernel /boot/kernel-2.4.20 root=/dev/hda3 ro
67initrd /boot/initrd-2.4.20
68<userinput>EOF</userinput></screen></para>
69
70<para>Also, if you happen to dual-boot Windows, the following entry should
71allow booting it:</para>
72
73<para><screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"</userinput>
74title Windows
75rootnoverify (hd0,0)
76chainloader +1
77<userinput>EOF</userinput></screen></para>
78
79<para>If <userinput>info grub</userinput> doesn't tell you all you want to
80know, you can find more information regarding Grub on its website, located at:
81<ulink url="http://www.gnu.org/software/grub"/>.</para>
82
83</sect1>
84
Note: See TracBrowser for help on using the repository browser.