source: BOOK/bootable/x86/grub.xml@ c01b0f33

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c01b0f33 was aa18ac0, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Updated trunk book sources to use DocBook-XML DTD 4.5.

  • Property mode set to 100644
File size: 5.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-bootable-grub">
9 <?dbhtml filename="grub.html"?>
10
11 <title>Making the CLFS System Bootable</title>
12
13 <indexterm zone="ch-bootable-grub">
14 <primary sortas="a-GRUB">GRUB</primary>
15 <secondary>configuring</secondary>
16 </indexterm>
17
18 <para os="a">Your shiny new CLFS system is almost complete. One of the last
19 things to do is to ensure that the system can be properly booted. The
20 instructions below apply only to computers of IA-32 architecture,
21 meaning mainstream PCs. Information on <quote>boot loading</quote> for
22 other architectures should be available in the usual resource-specific
23 locations for those architectures.</para>
24
25 <para os="b">Boot loading can be a complex area, so a few cautionary words
26 are in order. Be familiar with the current boot loader and any other
27 operating systems present on the hard drive(s) that need to be bootable.
28 Make sure that an emergency boot disk is ready to <quote>rescue</quote>
29 the computer if the computer becomes unusable (un-bootable).</para>
30
31 <para os="c">Earlier, we compiled and installed the GRUB boot loader software
32 in preparation for this step. The procedure involves writing some special
33 GRUB files to specific locations on the hard drive. We highly recommend
34 creating a GRUB boot floppy diskette as a backup. Insert a blank floppy
35 diskette and run the following commands:</para>
36
37<screen os="d"><userinput>dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1
38dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1</userinput></screen>
39
40 <para os="e">Remove the diskette and store it somewhere safe. Now, run the
41 <command>grub</command> shell:</para>
42
43<screen os="f"><userinput>grub</userinput></screen>
44
45 <para os="g">GRUB uses its own naming structure for drives and partitions in
46 the form of <emphasis>(hdn,m)</emphasis>, where <emphasis>n</emphasis>
47 is the hard drive number and <emphasis>m</emphasis> is the partition
48 number, both starting from zero. For example, partition <filename
49 class="partition">hda1</filename> is <emphasis>(hd0,0)</emphasis> to
50 GRUB and <filename class="partition">hdb3</filename> is
51 <emphasis>(hd1,2)</emphasis>. In contrast to Linux, GRUB does not
52 consider CD-ROM drives to be hard drives. For example, if using a CD
53 on <filename class="partition">hdb</filename> and a second hard drive
54 on <filename class="partition">hdc</filename>, that second hard drive
55 would still be <emphasis>(hd1)</emphasis>.</para>
56
57 <para os="h">Using the above information, determine the appropriate designator
58 for the root partition (or boot partition, if a separate one is used).
59 For the following example, it is assumed that the root (or separate boot)
60 partition is <filename class="partition">hda4</filename>.</para>
61
62 <para os="i">Tell GRUB where to search for its <filename>stage{1,2}</filename>
63 files. The Tab key can be used everywhere to make GRUB show the
64 alternatives:</para>
65
66<screen os="j"><userinput>root (hd0,3)</userinput></screen>
67
68 <warning os="k">
69 <para>The following command will overwrite the current boot loader.
70 Do not run the command if this is not desired, for example, if using
71 a third party boot manager to manage the Master Boot Record (MBR).
72 In this scenario, it would make more sense to install GRUB into the
73 <quote>boot sector</quote> of the CLFS partition. In this case, this
74 next command would become <userinput>setup (hd0,3)</userinput>.</para>
75 </warning>
76
77 <para os="l">Tell GRUB to install itself into the MBR of
78 <filename class="partition">hda</filename>:</para>
79
80<screen os="m"><userinput>setup (hd0)</userinput></screen>
81
82 <para os="n">If all went well, GRUB will have reported finding its files in
83 <filename class="directory">/boot/grub</filename>. That's all there is
84 to it. Quit the <command>grub</command> shell:</para>
85
86<screen os="o"><userinput>quit</userinput></screen>
87
88 <para os="p">Create a <quote>menu list</quote> file defining GRUB's boot
89 menu:</para>
90
91<screen><userinput>cat &gt; /boot/grub/menu.lst &lt;&lt; "EOF"
92<literal># Begin /boot/grub/menu.lst
93
94# By default boot the first menu entry.
95default 0
96
97# Allow 30 seconds before booting the default.
98timeout 30
99
100# Use prettier colors.
101color green/black light-green/black
102
103# The first entry is for CLFS.
104title CLFS &version;
105root (hd0,3)
106kernel /boot/clfskernel-&linux-version; root=/dev/hda4</literal>
107EOF</userinput></screen>
108
109
110 <para os="q">Add an entry for the host distribution if desired. It might look
111 like this:</para>
112
113<screen os="r"><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
114<literal>title Red Hat
115root (hd0,2)
116kernel /boot/kernel-2.6.5 root=/dev/hda3
117initrd /boot/initrd-2.6.5</literal>
118EOF</userinput></screen>
119
120 <para os="s">If dual-booting Windows, the following entry will allow
121 booting it:</para>
122
123<screen os="t"><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
124<literal>title Windows
125rootnoverify (hd0,0)
126chainloader +1</literal>
127EOF</userinput></screen>
128
129 <para os="u">If <command>info grub</command> does not provide all necessary
130 material, additional information regarding GRUB is located on its
131 website at: <ulink url="http://www.gnu.org/software/grub/"/>.</para>
132
133 <para os="v">The FHS stipulates that the bootloader's configuration file should
134 be symlinked to <filename class="symlink">/etc/{Bootloader Name}</filename>.
135 To satisfy this requirement for GRUB, issue the following command:</para>
136
137<screen os="w"><userinput>mkdir -v /etc/grub &amp;&amp;
138ln -sv /boot/grub/menu.lst /etc/grub</userinput></screen>
139
140</sect1>
Note: See TracBrowser for help on using the repository browser.