xref: /onnv-gate/usr/src/grub/grub-0.97/docs/grub.info-1 (revision 8044:b3af80bbf173)
1*8044SWilliam.Kucharski@Sun.COMThis is grub.info, produced by makeinfo version 4.0 from grub.texi.
2*8044SWilliam.Kucharski@Sun.COM
3*8044SWilliam.Kucharski@Sun.COMINFO-DIR-SECTION Kernel
4*8044SWilliam.Kucharski@Sun.COMSTART-INFO-DIR-ENTRY
5*8044SWilliam.Kucharski@Sun.COM* GRUB: (grub).                 The GRand Unified Bootloader
6*8044SWilliam.Kucharski@Sun.COM* grub-install: (grub)Invoking grub-install.    Install GRUB on your drive
7*8044SWilliam.Kucharski@Sun.COM* grub-md5-crypt: (grub)Invoking grub-md5-crypt.        Encrypt a password
8*8044SWilliam.Kucharski@Sun.COM                                                        in MD5 format
9*8044SWilliam.Kucharski@Sun.COM* grub-terminfo: (grub)Invoking grub-terminfo.  Generate a terminfo
10*8044SWilliam.Kucharski@Sun.COM                                                command from a
11*8044SWilliam.Kucharski@Sun.COM                                                terminfo name
12*8044SWilliam.Kucharski@Sun.COM* grub-set-default: (grub)Invoking grub-set-default.    Set a default boot
13*8044SWilliam.Kucharski@Sun.COM                                                        entry
14*8044SWilliam.Kucharski@Sun.COM* mbchk: (grub)Invoking mbchk.  Check for the format of a Multiboot kernel
15*8044SWilliam.Kucharski@Sun.COMEND-INFO-DIR-ENTRY
16*8044SWilliam.Kucharski@Sun.COM
17*8044SWilliam.Kucharski@Sun.COM   Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
18*8044SWilliam.Kucharski@Sun.COM
19*8044SWilliam.Kucharski@Sun.COM   Permission is granted to make and distribute verbatim copies of this
20*8044SWilliam.Kucharski@Sun.COMmanual provided the copyright notice and this permission notice are
21*8044SWilliam.Kucharski@Sun.COMpreserved on all copies.
22*8044SWilliam.Kucharski@Sun.COM
23*8044SWilliam.Kucharski@Sun.COM   Permission is granted to copy and distribute modified versions of
24*8044SWilliam.Kucharski@Sun.COMthis manual under the conditions for verbatim copying, provided also
25*8044SWilliam.Kucharski@Sun.COMthat the entire resulting derived work is distributed under the terms
26*8044SWilliam.Kucharski@Sun.COMof a permission notice identical to this one.
27*8044SWilliam.Kucharski@Sun.COM
28*8044SWilliam.Kucharski@Sun.COM   Permission is granted to copy and distribute translations of this
29*8044SWilliam.Kucharski@Sun.COMmanual into another language, under the above conditions for modified
30*8044SWilliam.Kucharski@Sun.COMversions.
31*8044SWilliam.Kucharski@Sun.COM
32*8044SWilliam.Kucharski@Sun.COM
33*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Top,  Next: Introduction,  Up: (dir)
34*8044SWilliam.Kucharski@Sun.COM
35*8044SWilliam.Kucharski@Sun.COMGRUB manual
36*8044SWilliam.Kucharski@Sun.COM***********
37*8044SWilliam.Kucharski@Sun.COM
38*8044SWilliam.Kucharski@Sun.COM   This is the documentation of GNU GRUB, the GRand Unified Bootloader,
39*8044SWilliam.Kucharski@Sun.COMa flexible and powerful boot loader program for PCs.
40*8044SWilliam.Kucharski@Sun.COM
41*8044SWilliam.Kucharski@Sun.COM   This edition documents version 0.95.
42*8044SWilliam.Kucharski@Sun.COM
43*8044SWilliam.Kucharski@Sun.COM* Menu:
44*8044SWilliam.Kucharski@Sun.COM
45*8044SWilliam.Kucharski@Sun.COM* Introduction::                Capturing the spirit of GRUB
46*8044SWilliam.Kucharski@Sun.COM* Naming convention::           Names of your drives in GRUB
47*8044SWilliam.Kucharski@Sun.COM* Installation::                Installing GRUB on your drive
48*8044SWilliam.Kucharski@Sun.COM* Booting::                     How to boot different operating systems
49*8044SWilliam.Kucharski@Sun.COM* Configuration::               Writing your own configuration file
50*8044SWilliam.Kucharski@Sun.COM* Network::                     Downloading OS images from a network
51*8044SWilliam.Kucharski@Sun.COM* Serial terminal::             Using GRUB via a serial line
52*8044SWilliam.Kucharski@Sun.COM* Preset Menu::                 Embedding a configuration file into GRUB
53*8044SWilliam.Kucharski@Sun.COM* Security::                    Improving the security
54*8044SWilliam.Kucharski@Sun.COM* Images::                      GRUB image files
55*8044SWilliam.Kucharski@Sun.COM* Filesystem::                  Filesystem syntax and semantics
56*8044SWilliam.Kucharski@Sun.COM* Interface::                   The menu and the command-line
57*8044SWilliam.Kucharski@Sun.COM* Commands::                    The list of available builtin commands
58*8044SWilliam.Kucharski@Sun.COM* Troubleshooting::             Error messages produced by GRUB
59*8044SWilliam.Kucharski@Sun.COM* Invoking the grub shell::     How to use the grub shell
60*8044SWilliam.Kucharski@Sun.COM* Invoking grub-install::       How to use the GRUB installer
61*8044SWilliam.Kucharski@Sun.COM* Invoking grub-md5-crypt::     How to generate a cryptic password
62*8044SWilliam.Kucharski@Sun.COM* Invoking grub-terminfo::      How to generate a terminfo command
63*8044SWilliam.Kucharski@Sun.COM* Invoking grub-set-default::   How to set a default boot entry
64*8044SWilliam.Kucharski@Sun.COM* Invoking mbchk::              How to use the Multiboot checker
65*8044SWilliam.Kucharski@Sun.COM* Obtaining and Building GRUB:: How to obtain and build GRUB
66*8044SWilliam.Kucharski@Sun.COM* Reporting bugs::              Where you should send a bug report
67*8044SWilliam.Kucharski@Sun.COM* Future::                      Some future plans on GRUB
68*8044SWilliam.Kucharski@Sun.COM* Internals::                   Hacking GRUB
69*8044SWilliam.Kucharski@Sun.COM* Index::
70*8044SWilliam.Kucharski@Sun.COM
71*8044SWilliam.Kucharski@Sun.COM
72*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Introduction,  Next: Naming convention,  Prev: Top,  Up: Top
73*8044SWilliam.Kucharski@Sun.COM
74*8044SWilliam.Kucharski@Sun.COMIntroduction to GRUB
75*8044SWilliam.Kucharski@Sun.COM********************
76*8044SWilliam.Kucharski@Sun.COM
77*8044SWilliam.Kucharski@Sun.COM* Menu:
78*8044SWilliam.Kucharski@Sun.COM
79*8044SWilliam.Kucharski@Sun.COM* Overview::                    What exactly GRUB is and how to use it
80*8044SWilliam.Kucharski@Sun.COM* History::                     From maggot to house fly
81*8044SWilliam.Kucharski@Sun.COM* Features::                    GRUB features
82*8044SWilliam.Kucharski@Sun.COM* Role of a boot loader::       The role of a boot loader
83*8044SWilliam.Kucharski@Sun.COM
84*8044SWilliam.Kucharski@Sun.COM
85*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Overview,  Next: History,  Up: Introduction
86*8044SWilliam.Kucharski@Sun.COM
87*8044SWilliam.Kucharski@Sun.COMOverview
88*8044SWilliam.Kucharski@Sun.COM========
89*8044SWilliam.Kucharski@Sun.COM
90*8044SWilliam.Kucharski@Sun.COM   Briefly, a "boot loader" is the first software program that runs when
91*8044SWilliam.Kucharski@Sun.COMa computer starts.  It is responsible for loading and transferring
92*8044SWilliam.Kucharski@Sun.COMcontrol to an operating system "kernel" software (such as Linux or GNU
93*8044SWilliam.Kucharski@Sun.COMMach).  The kernel, in turn, initializes the rest of the operating
94*8044SWilliam.Kucharski@Sun.COMsystem (e.g. a GNU system).
95*8044SWilliam.Kucharski@Sun.COM
96*8044SWilliam.Kucharski@Sun.COM   GNU GRUB is a very powerful boot loader, which can load a wide
97*8044SWilliam.Kucharski@Sun.COMvariety of free operating systems, as well as proprietary operating
98*8044SWilliam.Kucharski@Sun.COMsystems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is
99*8044SWilliam.Kucharski@Sun.COMdesigned to address the complexity of booting a personal computer; both
100*8044SWilliam.Kucharski@Sun.COMthe program and this manual are tightly bound to that computer platform,
101*8044SWilliam.Kucharski@Sun.COMalthough porting to other platforms may be addressed in the future.
102*8044SWilliam.Kucharski@Sun.COM
103*8044SWilliam.Kucharski@Sun.COM   One of the important features in GRUB is flexibility; GRUB
104*8044SWilliam.Kucharski@Sun.COMunderstands filesystems and kernel executable formats, so you can load
105*8044SWilliam.Kucharski@Sun.COMan arbitrary operating system the way you like, without recording the
106*8044SWilliam.Kucharski@Sun.COMphysical position of your kernel on the disk. Thus you can load the
107*8044SWilliam.Kucharski@Sun.COMkernel just by specifying its file name and the drive and partition
108*8044SWilliam.Kucharski@Sun.COMwhere the kernel resides.
109*8044SWilliam.Kucharski@Sun.COM
110*8044SWilliam.Kucharski@Sun.COM   When booting with GRUB, you can use either a command-line interface
111*8044SWilliam.Kucharski@Sun.COM(*note Command-line interface::), or a menu interface (*note Menu
112*8044SWilliam.Kucharski@Sun.COMinterface::). Using the command-line interface, you type the drive
113*8044SWilliam.Kucharski@Sun.COMspecification and file name of the kernel manually. In the menu
114*8044SWilliam.Kucharski@Sun.COMinterface, you just select an OS using the arrow keys. The menu is
115*8044SWilliam.Kucharski@Sun.COMbased on a configuration file which you prepare beforehand (*note
116*8044SWilliam.Kucharski@Sun.COMConfiguration::). While in the menu, you can switch to the command-line
117*8044SWilliam.Kucharski@Sun.COMmode, and vice-versa. You can even edit menu entries before using them.
118*8044SWilliam.Kucharski@Sun.COM
119*8044SWilliam.Kucharski@Sun.COM   In the following chapters, you will learn how to specify a drive, a
120*8044SWilliam.Kucharski@Sun.COMpartition, and a file name (*note Naming convention::) to GRUB, how to
121*8044SWilliam.Kucharski@Sun.COMinstall GRUB on your drive (*note Installation::), and how to boot your
122*8044SWilliam.Kucharski@Sun.COMOSes (*note Booting::), step by step.
123*8044SWilliam.Kucharski@Sun.COM
124*8044SWilliam.Kucharski@Sun.COM   Besides the GRUB boot loader itself, there is a "grub shell" `grub'
125*8044SWilliam.Kucharski@Sun.COM(*note Invoking the grub shell::) which can be run when you are in your
126*8044SWilliam.Kucharski@Sun.COMoperating system. It emulates the boot loader and can be used for
127*8044SWilliam.Kucharski@Sun.COMinstalling the boot loader.
128*8044SWilliam.Kucharski@Sun.COM
129*8044SWilliam.Kucharski@Sun.COM
130*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Overview-Footnotes,  Up: Overview
131*8044SWilliam.Kucharski@Sun.COM
132*8044SWilliam.Kucharski@Sun.COM   (1) "chain-load" is the mechanism for loading unsupported operating
133*8044SWilliam.Kucharski@Sun.COMsystems by loading another boot loader. It is typically used for
134*8044SWilliam.Kucharski@Sun.COMloading DOS or Windows.
135*8044SWilliam.Kucharski@Sun.COM
136*8044SWilliam.Kucharski@Sun.COM
137*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: History,  Next: Features,  Prev: Overview,  Up: Introduction
138*8044SWilliam.Kucharski@Sun.COM
139*8044SWilliam.Kucharski@Sun.COMHistory of GRUB
140*8044SWilliam.Kucharski@Sun.COM===============
141*8044SWilliam.Kucharski@Sun.COM
142*8044SWilliam.Kucharski@Sun.COM   GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
143*8044SWilliam.Kucharski@Sun.COMHurd with the University of Utah's Mach 4 microkernel (now known as GNU
144*8044SWilliam.Kucharski@Sun.COMMach).  Erich and Brian Ford designed the Multiboot Specification
145*8044SWilliam.Kucharski@Sun.COM(*note Multiboot Specification: (multiboot)Top.), because they were
146*8044SWilliam.Kucharski@Sun.COMdetermined not to add to the large number of mutually-incompatible PC
147*8044SWilliam.Kucharski@Sun.COMboot methods.
148*8044SWilliam.Kucharski@Sun.COM
149*8044SWilliam.Kucharski@Sun.COM   Erich then began modifying the FreeBSD boot loader so that it would
150*8044SWilliam.Kucharski@Sun.COMunderstand Multiboot. He soon realized that it would be a lot easier to
151*8044SWilliam.Kucharski@Sun.COMwrite his own boot loader from scratch than to keep working on the
152*8044SWilliam.Kucharski@Sun.COMFreeBSD boot loader, and so GRUB was born.
153*8044SWilliam.Kucharski@Sun.COM
154*8044SWilliam.Kucharski@Sun.COM   Erich added many features to GRUB, but other priorities prevented him
155*8044SWilliam.Kucharski@Sun.COMfrom keeping up with the demands of its quickly-expanding user base. In
156*8044SWilliam.Kucharski@Sun.COM1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
157*8044SWilliam.Kucharski@Sun.COMofficial GNU package, and opened its development by making the latest
158*8044SWilliam.Kucharski@Sun.COMsources available via anonymous CVS. *Note Obtaining and Building
159*8044SWilliam.Kucharski@Sun.COMGRUB::, for more information.
160*8044SWilliam.Kucharski@Sun.COM
161*8044SWilliam.Kucharski@Sun.COM
162*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Features,  Next: Role of a boot loader,  Prev: History,  Up: Introduction
163*8044SWilliam.Kucharski@Sun.COM
164*8044SWilliam.Kucharski@Sun.COMGRUB features
165*8044SWilliam.Kucharski@Sun.COM=============
166*8044SWilliam.Kucharski@Sun.COM
167*8044SWilliam.Kucharski@Sun.COM   The primary requirement for GRUB is that it be compliant with the
168*8044SWilliam.Kucharski@Sun.COM"Multiboot Specification", which is described in *Note Multiboot
169*8044SWilliam.Kucharski@Sun.COMSpecification: (multiboot)Top.
170*8044SWilliam.Kucharski@Sun.COM
171*8044SWilliam.Kucharski@Sun.COM   The other goals, listed in approximate order of importance, are:
172*8044SWilliam.Kucharski@Sun.COM
173*8044SWilliam.Kucharski@Sun.COM   * Basic functions must be straightforward for end-users.
174*8044SWilliam.Kucharski@Sun.COM
175*8044SWilliam.Kucharski@Sun.COM   * Rich functionality to support kernel experts and designers.
176*8044SWilliam.Kucharski@Sun.COM
177*8044SWilliam.Kucharski@Sun.COM   * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
178*8044SWilliam.Kucharski@Sun.COM     Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
179*8044SWilliam.Kucharski@Sun.COM     supported via a chain-loading function.
180*8044SWilliam.Kucharski@Sun.COM
181*8044SWilliam.Kucharski@Sun.COM   Except for specific compatibility modes (chain-loading and the Linux
182*8044SWilliam.Kucharski@Sun.COM"piggyback" format), all kernels will be started in much the same state
183*8044SWilliam.Kucharski@Sun.COMas in the Multiboot Specification. Only kernels loaded at 1 megabyte or
184*8044SWilliam.Kucharski@Sun.COMabove are presently supported. Any attempt to load below that boundary
185*8044SWilliam.Kucharski@Sun.COMwill simply result in immediate failure and an error message reporting
186*8044SWilliam.Kucharski@Sun.COMthe problem.
187*8044SWilliam.Kucharski@Sun.COM
188*8044SWilliam.Kucharski@Sun.COM   In addition to the requirements above, GRUB has the following
189*8044SWilliam.Kucharski@Sun.COMfeatures (note that the Multiboot Specification doesn't require all the
190*8044SWilliam.Kucharski@Sun.COMfeatures that GRUB supports):
191*8044SWilliam.Kucharski@Sun.COM
192*8044SWilliam.Kucharski@Sun.COMRecognize multiple executable formats
193*8044SWilliam.Kucharski@Sun.COM     Support many of the "a.out" variants plus "ELF". Symbol tables are
194*8044SWilliam.Kucharski@Sun.COM     also loaded.
195*8044SWilliam.Kucharski@Sun.COM
196*8044SWilliam.Kucharski@Sun.COMSupport non-Multiboot kernels
197*8044SWilliam.Kucharski@Sun.COM     Support many of the various free 32-bit kernels that lack Multiboot
198*8044SWilliam.Kucharski@Sun.COM     compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux).
199*8044SWilliam.Kucharski@Sun.COM     Chain-loading of other boot loaders is also supported.
200*8044SWilliam.Kucharski@Sun.COM
201*8044SWilliam.Kucharski@Sun.COMLoad multiples modules
202*8044SWilliam.Kucharski@Sun.COM     Fully support the Multiboot feature of loading multiple modules.
203*8044SWilliam.Kucharski@Sun.COM
204*8044SWilliam.Kucharski@Sun.COMLoad a configuration file
205*8044SWilliam.Kucharski@Sun.COM     Support a human-readable text configuration file with preset boot
206*8044SWilliam.Kucharski@Sun.COM     commands. You can also load another configuration file dynamically
207*8044SWilliam.Kucharski@Sun.COM     and embed a preset configuration file in a GRUB image file. The
208*8044SWilliam.Kucharski@Sun.COM     list of commands (*note Commands::) are a superset of those
209*8044SWilliam.Kucharski@Sun.COM     supported on the command-line. An example configuration file is
210*8044SWilliam.Kucharski@Sun.COM     provided in *Note Configuration::.
211*8044SWilliam.Kucharski@Sun.COM
212*8044SWilliam.Kucharski@Sun.COMProvide a menu interface
213*8044SWilliam.Kucharski@Sun.COM     A menu interface listing preset boot commands, with a programmable
214*8044SWilliam.Kucharski@Sun.COM     timeout, is available. There is no fixed limit on the number of
215*8044SWilliam.Kucharski@Sun.COM     boot entries, and the current implementation has space for several
216*8044SWilliam.Kucharski@Sun.COM     hundred.
217*8044SWilliam.Kucharski@Sun.COM
218*8044SWilliam.Kucharski@Sun.COMHave a flexible command-line interface
219*8044SWilliam.Kucharski@Sun.COM     A fairly flexible command-line interface, accessible from the menu,
220*8044SWilliam.Kucharski@Sun.COM     is available to edit any preset commands, or write a new boot
221*8044SWilliam.Kucharski@Sun.COM     command set from scratch. If no configuration file is present,
222*8044SWilliam.Kucharski@Sun.COM     GRUB drops to the command-line.
223*8044SWilliam.Kucharski@Sun.COM
224*8044SWilliam.Kucharski@Sun.COM     The list of commands (*note Commands::) are a subset of those
225*8044SWilliam.Kucharski@Sun.COM     supported for configuration files. Editing commands closely
226*8044SWilliam.Kucharski@Sun.COM     resembles the Bash command-line (*note Bash: (features)Command
227*8044SWilliam.Kucharski@Sun.COM     Line Editing.), with <TAB>-completion of commands, devices,
228*8044SWilliam.Kucharski@Sun.COM     partitions, and files in a directory depending on context.
229*8044SWilliam.Kucharski@Sun.COM
230*8044SWilliam.Kucharski@Sun.COMSupport multiple filesystem types
231*8044SWilliam.Kucharski@Sun.COM     Support multiple filesystem types transparently, plus a useful
232*8044SWilliam.Kucharski@Sun.COM     explicit blocklist notation. The currently supported filesystem
233*8044SWilliam.Kucharski@Sun.COM     types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux
234*8044SWilliam.Kucharski@Sun.COM     ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note
235*8044SWilliam.Kucharski@Sun.COM     Filesystem::, for more information.
236*8044SWilliam.Kucharski@Sun.COM
237*8044SWilliam.Kucharski@Sun.COMSupport automatic decompression
238*8044SWilliam.Kucharski@Sun.COM     Can decompress files which were compressed by `gzip'. This
239*8044SWilliam.Kucharski@Sun.COM     function is both automatic and transparent to the user (i.e. all
240*8044SWilliam.Kucharski@Sun.COM     functions operate upon the uncompressed contents of the specified
241*8044SWilliam.Kucharski@Sun.COM     files). This greatly reduces a file size and loading time, a
242*8044SWilliam.Kucharski@Sun.COM     particularly great benefit for floppies.(1) (*note
243*8044SWilliam.Kucharski@Sun.COM     Features-Footnote-1::)
244*8044SWilliam.Kucharski@Sun.COM
245*8044SWilliam.Kucharski@Sun.COM     It is conceivable that some kernel modules should be loaded in a
246*8044SWilliam.Kucharski@Sun.COM     compressed state, so a different module-loading command can be
247*8044SWilliam.Kucharski@Sun.COM     specified to avoid uncompressing the modules.
248*8044SWilliam.Kucharski@Sun.COM
249*8044SWilliam.Kucharski@Sun.COMAccess data on any installed device
250*8044SWilliam.Kucharski@Sun.COM     Support reading data from any or all floppies or hard disk(s)
251*8044SWilliam.Kucharski@Sun.COM     recognized by the BIOS, independent of the setting of the root
252*8044SWilliam.Kucharski@Sun.COM     device.
253*8044SWilliam.Kucharski@Sun.COM
254*8044SWilliam.Kucharski@Sun.COMBe independent of drive geometry translations
255*8044SWilliam.Kucharski@Sun.COM     Unlike many other boot loaders, GRUB makes the particular drive
256*8044SWilliam.Kucharski@Sun.COM     translation irrelevant. A drive installed and running with one
257*8044SWilliam.Kucharski@Sun.COM     translation may be converted to another translation without any
258*8044SWilliam.Kucharski@Sun.COM     adverse effects or changes in GRUB's configuration.
259*8044SWilliam.Kucharski@Sun.COM
260*8044SWilliam.Kucharski@Sun.COMDetect all installed RAM
261*8044SWilliam.Kucharski@Sun.COM     GRUB can generally find all the installed RAM on a PC-compatible
262*8044SWilliam.Kucharski@Sun.COM     machine. It uses an advanced BIOS query technique for finding all
263*8044SWilliam.Kucharski@Sun.COM     memory regions. As described on the Multiboot Specification (*note
264*8044SWilliam.Kucharski@Sun.COM     Multiboot Specification: (multiboot)Top.), not all kernels make
265*8044SWilliam.Kucharski@Sun.COM     use of this information, but GRUB provides it for those who do.
266*8044SWilliam.Kucharski@Sun.COM
267*8044SWilliam.Kucharski@Sun.COMSupport Logical Block Address mode
268*8044SWilliam.Kucharski@Sun.COM     In traditional disk calls (called "CHS mode"), there is a geometry
269*8044SWilliam.Kucharski@Sun.COM     translation problem, that is, the BIOS cannot access over 1024
270*8044SWilliam.Kucharski@Sun.COM     cylinders, so the accessible space is limited to at least 508 MB
271*8044SWilliam.Kucharski@Sun.COM     and to at most 8GB. GRUB can't universally solve this problem, as
272*8044SWilliam.Kucharski@Sun.COM     there is no standard interface used in all machines. However,
273*8044SWilliam.Kucharski@Sun.COM     several newer machines have the new interface, Logical Block
274*8044SWilliam.Kucharski@Sun.COM     Address ("LBA") mode. GRUB automatically detects if LBA mode is
275*8044SWilliam.Kucharski@Sun.COM     available and uses it if available. In LBA mode, GRUB can access
276*8044SWilliam.Kucharski@Sun.COM     the entire disk.
277*8044SWilliam.Kucharski@Sun.COM
278*8044SWilliam.Kucharski@Sun.COMSupport network booting
279*8044SWilliam.Kucharski@Sun.COM     GRUB is basically a disk-based boot loader but also has network
280*8044SWilliam.Kucharski@Sun.COM     support. You can load OS images from a network by using the "TFTP"
281*8044SWilliam.Kucharski@Sun.COM     protocol.
282*8044SWilliam.Kucharski@Sun.COM
283*8044SWilliam.Kucharski@Sun.COMSupport remote terminals
284*8044SWilliam.Kucharski@Sun.COM     To support computers with no console, GRUB provides remote terminal
285*8044SWilliam.Kucharski@Sun.COM     support, so that you can control GRUB from a remote host. Only
286*8044SWilliam.Kucharski@Sun.COM     serial terminal support is implemented at the moment.
287*8044SWilliam.Kucharski@Sun.COM
288*8044SWilliam.Kucharski@Sun.COM
289*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Features-Footnotes,  Up: Features
290*8044SWilliam.Kucharski@Sun.COM
291*8044SWilliam.Kucharski@Sun.COM   (1) There are a few pathological cases where loading a very badly
292*8044SWilliam.Kucharski@Sun.COMorganized ELF kernel might take longer, but in practice this never
293*8044SWilliam.Kucharski@Sun.COMhappen.
294*8044SWilliam.Kucharski@Sun.COM
295*8044SWilliam.Kucharski@Sun.COM
296*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Role of a boot loader,  Prev: Features,  Up: Introduction
297*8044SWilliam.Kucharski@Sun.COM
298*8044SWilliam.Kucharski@Sun.COMThe role of a boot loader
299*8044SWilliam.Kucharski@Sun.COM=========================
300*8044SWilliam.Kucharski@Sun.COM
301*8044SWilliam.Kucharski@Sun.COM   The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
302*8044SWilliam.Kucharski@Sun.COM
303*8044SWilliam.Kucharski@Sun.COM     Some people like to acknowledge both the operating system and
304*8044SWilliam.Kucharski@Sun.COM     kernel when they talk about their computers, so they might say
305*8044SWilliam.Kucharski@Sun.COM     they use "GNU/Linux" or "GNU/Hurd".  Other people seem to think
306*8044SWilliam.Kucharski@Sun.COM     that the kernel is the most important part of the system, so they
307*8044SWilliam.Kucharski@Sun.COM     like to call their GNU operating systems "Linux systems."
308*8044SWilliam.Kucharski@Sun.COM
309*8044SWilliam.Kucharski@Sun.COM     I, personally, believe that this is a grave injustice, because the
310*8044SWilliam.Kucharski@Sun.COM     _boot loader_ is the most important software of all. I used to
311*8044SWilliam.Kucharski@Sun.COM     refer to the above systems as either "LILO"(1) (*note Role of a
312*8044SWilliam.Kucharski@Sun.COM     boot loader-Footnote-1::) or "GRUB" systems.
313*8044SWilliam.Kucharski@Sun.COM
314*8044SWilliam.Kucharski@Sun.COM     Unfortunately, nobody ever understood what I was talking about;
315*8044SWilliam.Kucharski@Sun.COM     now I just use the word "GNU" as a pseudonym for GRUB.
316*8044SWilliam.Kucharski@Sun.COM
317*8044SWilliam.Kucharski@Sun.COM     So, if you ever hear people talking about their alleged "GNU"
318*8044SWilliam.Kucharski@Sun.COM     systems, remember that they are actually paying homage to the best
319*8044SWilliam.Kucharski@Sun.COM     boot loader around... GRUB!
320*8044SWilliam.Kucharski@Sun.COM
321*8044SWilliam.Kucharski@Sun.COM   We, the GRUB maintainers, do not (usually) encourage Gordon's level
322*8044SWilliam.Kucharski@Sun.COMof fanaticism, but it helps to remember that boot loaders deserve
323*8044SWilliam.Kucharski@Sun.COMrecognition.  We hope that you enjoy using GNU GRUB as much as we did
324*8044SWilliam.Kucharski@Sun.COMwriting it.
325*8044SWilliam.Kucharski@Sun.COM
326*8044SWilliam.Kucharski@Sun.COM
327*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Role of a boot loader-Footnotes,  Up: Role of a boot loader
328*8044SWilliam.Kucharski@Sun.COM
329*8044SWilliam.Kucharski@Sun.COM   (1) The LInux LOader, a boot loader that everybody uses, but nobody
330*8044SWilliam.Kucharski@Sun.COMlikes.
331*8044SWilliam.Kucharski@Sun.COM
332*8044SWilliam.Kucharski@Sun.COM
333*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Naming convention,  Next: Installation,  Prev: Introduction,  Up: Top
334*8044SWilliam.Kucharski@Sun.COM
335*8044SWilliam.Kucharski@Sun.COMNaming convention
336*8044SWilliam.Kucharski@Sun.COM*****************
337*8044SWilliam.Kucharski@Sun.COM
338*8044SWilliam.Kucharski@Sun.COM   The device syntax used in GRUB is a wee bit different from what you
339*8044SWilliam.Kucharski@Sun.COMmay have seen before in your operating system(s), and you need to know
340*8044SWilliam.Kucharski@Sun.COMit so that you can specify a drive/partition.
341*8044SWilliam.Kucharski@Sun.COM
342*8044SWilliam.Kucharski@Sun.COM   Look at the following examples and explanations:
343*8044SWilliam.Kucharski@Sun.COM
344*8044SWilliam.Kucharski@Sun.COM     (fd0)
345*8044SWilliam.Kucharski@Sun.COM
346*8044SWilliam.Kucharski@Sun.COM   First of all, GRUB requires that the device name be enclosed with
347*8044SWilliam.Kucharski@Sun.COM`(' and `)'. The `fd' part means that it is a floppy disk. The number
348*8044SWilliam.Kucharski@Sun.COM`0' is the drive number, which is counted from _zero_. This expression
349*8044SWilliam.Kucharski@Sun.COMmeans that GRUB will use the whole floppy disk.
350*8044SWilliam.Kucharski@Sun.COM
351*8044SWilliam.Kucharski@Sun.COM     (hd0,1)
352*8044SWilliam.Kucharski@Sun.COM
353*8044SWilliam.Kucharski@Sun.COM   Here, `hd' means it is a hard disk drive. The first integer `0'
354*8044SWilliam.Kucharski@Sun.COMindicates the drive number, that is, the first hard disk, while the
355*8044SWilliam.Kucharski@Sun.COMsecond integer, `1', indicates the partition number (or the PC slice
356*8044SWilliam.Kucharski@Sun.COMnumber in the BSD terminology). Once again, please note that the
357*8044SWilliam.Kucharski@Sun.COMpartition numbers are counted from _zero_, not from one. This
358*8044SWilliam.Kucharski@Sun.COMexpression means the second partition of the first hard disk drive. In
359*8044SWilliam.Kucharski@Sun.COMthis case, GRUB uses one partition of the disk, instead of the whole
360*8044SWilliam.Kucharski@Sun.COMdisk.
361*8044SWilliam.Kucharski@Sun.COM
362*8044SWilliam.Kucharski@Sun.COM     (hd0,4)
363*8044SWilliam.Kucharski@Sun.COM
364*8044SWilliam.Kucharski@Sun.COM   This specifies the first "extended partition" of the first hard disk
365*8044SWilliam.Kucharski@Sun.COMdrive. Note that the partition numbers for extended partitions are
366*8044SWilliam.Kucharski@Sun.COMcounted from `4', regardless of the actual number of primary partitions
367*8044SWilliam.Kucharski@Sun.COMon your hard disk.
368*8044SWilliam.Kucharski@Sun.COM
369*8044SWilliam.Kucharski@Sun.COM     (hd1,a)
370*8044SWilliam.Kucharski@Sun.COM
371*8044SWilliam.Kucharski@Sun.COM   This means the BSD `a' partition of the second hard disk. If you
372*8044SWilliam.Kucharski@Sun.COMneed to specify which PC slice number should be used, use something
373*8044SWilliam.Kucharski@Sun.COMlike this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB
374*8044SWilliam.Kucharski@Sun.COMsearches for the first PC slice which has a BSD `a' partition.
375*8044SWilliam.Kucharski@Sun.COM
376*8044SWilliam.Kucharski@Sun.COM   Of course, to actually access the disks or partitions with GRUB, you
377*8044SWilliam.Kucharski@Sun.COMneed to use the device specification in a command, like `root (fd0)' or
378*8044SWilliam.Kucharski@Sun.COM`unhide (hd0,2)'. To help you find out which number specifies a
379*8044SWilliam.Kucharski@Sun.COMpartition you want, the GRUB command-line (*note Command-line
380*8044SWilliam.Kucharski@Sun.COMinterface::) options have argument completion. This means that, for
381*8044SWilliam.Kucharski@Sun.COMexample, you only need to type
382*8044SWilliam.Kucharski@Sun.COM
383*8044SWilliam.Kucharski@Sun.COM     root (
384*8044SWilliam.Kucharski@Sun.COM
385*8044SWilliam.Kucharski@Sun.COM   followed by a <TAB>, and GRUB will display the list of drives,
386*8044SWilliam.Kucharski@Sun.COMpartitions, or file names. So it should be quite easy to determine the
387*8044SWilliam.Kucharski@Sun.COMname of your target partition, even with minimal knowledge of the
388*8044SWilliam.Kucharski@Sun.COMsyntax.
389*8044SWilliam.Kucharski@Sun.COM
390*8044SWilliam.Kucharski@Sun.COM   Note that GRUB does _not_ distinguish IDE from SCSI - it simply
391*8044SWilliam.Kucharski@Sun.COMcounts the drive numbers from zero, regardless of their type. Normally,
392*8044SWilliam.Kucharski@Sun.COMany IDE drive number is less than any SCSI drive number, although that
393*8044SWilliam.Kucharski@Sun.COMis not true if you change the boot sequence by swapping IDE and SCSI
394*8044SWilliam.Kucharski@Sun.COMdrives in your BIOS.
395*8044SWilliam.Kucharski@Sun.COM
396*8044SWilliam.Kucharski@Sun.COM   Now the question is, how to specify a file? Again, consider an
397*8044SWilliam.Kucharski@Sun.COMexample:
398*8044SWilliam.Kucharski@Sun.COM
399*8044SWilliam.Kucharski@Sun.COM     (hd0,0)/vmlinuz
400*8044SWilliam.Kucharski@Sun.COM
401*8044SWilliam.Kucharski@Sun.COM   This specifies the file named `vmlinuz', found on the first
402*8044SWilliam.Kucharski@Sun.COMpartition of the first hard disk drive. Note that the argument
403*8044SWilliam.Kucharski@Sun.COMcompletion works with file names, too.
404*8044SWilliam.Kucharski@Sun.COM
405*8044SWilliam.Kucharski@Sun.COM   That was easy, admit it. Now read the next chapter, to find out how
406*8044SWilliam.Kucharski@Sun.COMto actually install GRUB on your drive.
407*8044SWilliam.Kucharski@Sun.COM
408*8044SWilliam.Kucharski@Sun.COM
409*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Installation,  Next: Booting,  Prev: Naming convention,  Up: Top
410*8044SWilliam.Kucharski@Sun.COM
411*8044SWilliam.Kucharski@Sun.COMInstallation
412*8044SWilliam.Kucharski@Sun.COM************
413*8044SWilliam.Kucharski@Sun.COM
414*8044SWilliam.Kucharski@Sun.COM   In order to install GRUB as your boot loader, you need to first
415*8044SWilliam.Kucharski@Sun.COMinstall the GRUB system and utilities under your UNIX-like operating
416*8044SWilliam.Kucharski@Sun.COMsystem (*note Obtaining and Building GRUB::). You can do this either
417*8044SWilliam.Kucharski@Sun.COMfrom the source tarball, or as a package for your OS.
418*8044SWilliam.Kucharski@Sun.COM
419*8044SWilliam.Kucharski@Sun.COM   After you have done that, you need to install the boot loader on a
420*8044SWilliam.Kucharski@Sun.COMdrive (floppy or hard disk). There are two ways of doing that - either
421*8044SWilliam.Kucharski@Sun.COMusing the utility `grub-install' (*note Invoking grub-install::) on a
422*8044SWilliam.Kucharski@Sun.COMUNIX-like OS, or by running GRUB itself from a floppy. These are quite
423*8044SWilliam.Kucharski@Sun.COMsimilar, however the utility might probe a wrong BIOS drive, so you
424*8044SWilliam.Kucharski@Sun.COMshould be careful.
425*8044SWilliam.Kucharski@Sun.COM
426*8044SWilliam.Kucharski@Sun.COM   Also, if you install GRUB on a UNIX-like OS, please make sure that
427*8044SWilliam.Kucharski@Sun.COMyou have an emergency boot disk ready, so that you can rescue your
428*8044SWilliam.Kucharski@Sun.COMcomputer if, by any chance, your hard drive becomes unusable
429*8044SWilliam.Kucharski@Sun.COM(unbootable).
430*8044SWilliam.Kucharski@Sun.COM
431*8044SWilliam.Kucharski@Sun.COM   GRUB comes with boot images, which are normally put in the directory
432*8044SWilliam.Kucharski@Sun.COM`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need
433*8044SWilliam.Kucharski@Sun.COMto copy the files `stage1', `stage2', and `*stage1_5' to the directory
434*8044SWilliam.Kucharski@Sun.COM`/boot/grub', and run the `grub-set-default' (*note Invoking
435*8044SWilliam.Kucharski@Sun.COMgrub-set-default::) if you intend to use `default saved' (*note
436*8044SWilliam.Kucharski@Sun.COMdefault::) in your configuration file. Hereafter, the directory where
437*8044SWilliam.Kucharski@Sun.COMGRUB images are initially placed (normally `/usr/lib/grub/i386-pc')
438*8044SWilliam.Kucharski@Sun.COMwill be called the "image directory", and the directory where the boot
439*8044SWilliam.Kucharski@Sun.COMloader needs to find them (usually `/boot/grub') will be called the
440*8044SWilliam.Kucharski@Sun.COM"boot directory".
441*8044SWilliam.Kucharski@Sun.COM
442*8044SWilliam.Kucharski@Sun.COM* Menu:
443*8044SWilliam.Kucharski@Sun.COM
444*8044SWilliam.Kucharski@Sun.COM* Creating a GRUB boot floppy::
445*8044SWilliam.Kucharski@Sun.COM* Installing GRUB natively::
446*8044SWilliam.Kucharski@Sun.COM* Installing GRUB using grub-install::
447*8044SWilliam.Kucharski@Sun.COM* Making a GRUB bootable CD-ROM::
448*8044SWilliam.Kucharski@Sun.COM
449*8044SWilliam.Kucharski@Sun.COM
450*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Creating a GRUB boot floppy,  Next: Installing GRUB natively,  Up: Installation
451*8044SWilliam.Kucharski@Sun.COM
452*8044SWilliam.Kucharski@Sun.COMCreating a GRUB boot floppy
453*8044SWilliam.Kucharski@Sun.COM===========================
454*8044SWilliam.Kucharski@Sun.COM
455*8044SWilliam.Kucharski@Sun.COM   To create a GRUB boot floppy, you need to take the files `stage1'
456*8044SWilliam.Kucharski@Sun.COMand `stage2' from the image directory, and write them to the first and
457*8044SWilliam.Kucharski@Sun.COMthe second block of the floppy disk, respectively.
458*8044SWilliam.Kucharski@Sun.COM
459*8044SWilliam.Kucharski@Sun.COM   *Caution:* This procedure will destroy any data currently stored on
460*8044SWilliam.Kucharski@Sun.COMthe floppy.
461*8044SWilliam.Kucharski@Sun.COM
462*8044SWilliam.Kucharski@Sun.COM   On a UNIX-like operating system, that is done with the following
463*8044SWilliam.Kucharski@Sun.COMcommands:
464*8044SWilliam.Kucharski@Sun.COM
465*8044SWilliam.Kucharski@Sun.COM     # cd /usr/lib/grub/i386-pc
466*8044SWilliam.Kucharski@Sun.COM     # dd if=stage1 of=/dev/fd0 bs=512 count=1
467*8044SWilliam.Kucharski@Sun.COM     1+0 records in
468*8044SWilliam.Kucharski@Sun.COM     1+0 records out
469*8044SWilliam.Kucharski@Sun.COM     # dd if=stage2 of=/dev/fd0 bs=512 seek=1
470*8044SWilliam.Kucharski@Sun.COM     153+1 records in
471*8044SWilliam.Kucharski@Sun.COM     153+1 records out
472*8044SWilliam.Kucharski@Sun.COM     #
473*8044SWilliam.Kucharski@Sun.COM
474*8044SWilliam.Kucharski@Sun.COM   The device file name may be different. Consult the manual for your
475*8044SWilliam.Kucharski@Sun.COMOS.
476*8044SWilliam.Kucharski@Sun.COM
477*8044SWilliam.Kucharski@Sun.COM
478*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Installing GRUB natively,  Next: Installing GRUB using grub-install,  Prev: Creating a GRUB boot floppy,  Up: Installation
479*8044SWilliam.Kucharski@Sun.COM
480*8044SWilliam.Kucharski@Sun.COMInstalling GRUB natively
481*8044SWilliam.Kucharski@Sun.COM========================
482*8044SWilliam.Kucharski@Sun.COM
483*8044SWilliam.Kucharski@Sun.COM   *Caution:* Installing GRUB's stage1 in this manner will erase the
484*8044SWilliam.Kucharski@Sun.COMnormal boot-sector used by an OS.
485*8044SWilliam.Kucharski@Sun.COM
486*8044SWilliam.Kucharski@Sun.COM   GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD
487*8044SWilliam.Kucharski@Sun.COMdirectly, so using it on a boot sector (the first sector of a
488*8044SWilliam.Kucharski@Sun.COMpartition) should be okay. But generally, it would be a good idea to
489*8044SWilliam.Kucharski@Sun.COMback up the first sector of the partition on which you are installing
490*8044SWilliam.Kucharski@Sun.COMGRUB's stage1. This isn't as important if you are installing GRUB on
491*8044SWilliam.Kucharski@Sun.COMthe first sector of a hard disk, since it's easy to reinitialize it
492*8044SWilliam.Kucharski@Sun.COM(e.g. by running `FDISK /MBR' from DOS).
493*8044SWilliam.Kucharski@Sun.COM
494*8044SWilliam.Kucharski@Sun.COM   If you decide to install GRUB in the native environment, which is
495*8044SWilliam.Kucharski@Sun.COMdefinitely desirable, you'll need to create a GRUB boot disk, and
496*8044SWilliam.Kucharski@Sun.COMreboot your computer with it. Otherwise, see *Note Installing GRUB
497*8044SWilliam.Kucharski@Sun.COMusing grub-install::.
498*8044SWilliam.Kucharski@Sun.COM
499*8044SWilliam.Kucharski@Sun.COM   Once started, GRUB will show the command-line interface (*note
500*8044SWilliam.Kucharski@Sun.COMCommand-line interface::). First, set the GRUB's "root device"(1)
501*8044SWilliam.Kucharski@Sun.COM(*note Installing GRUB natively-Footnote-1::) to the partition
502*8044SWilliam.Kucharski@Sun.COMcontaining the boot directory, like this:
503*8044SWilliam.Kucharski@Sun.COM
504*8044SWilliam.Kucharski@Sun.COM     grub> root (hd0,0)
505*8044SWilliam.Kucharski@Sun.COM
506*8044SWilliam.Kucharski@Sun.COM   If you are not sure which partition actually holds this directory,
507*8044SWilliam.Kucharski@Sun.COMuse the command `find' (*note find::), like this:
508*8044SWilliam.Kucharski@Sun.COM
509*8044SWilliam.Kucharski@Sun.COM     grub> find /boot/grub/stage1
510*8044SWilliam.Kucharski@Sun.COM
511*8044SWilliam.Kucharski@Sun.COM   This will search for the file name `/boot/grub/stage1' and show the
512*8044SWilliam.Kucharski@Sun.COMdevices which contain the file.
513*8044SWilliam.Kucharski@Sun.COM
514*8044SWilliam.Kucharski@Sun.COM   Once you've set the root device correctly, run the command `setup'
515*8044SWilliam.Kucharski@Sun.COM(*note setup::):
516*8044SWilliam.Kucharski@Sun.COM
517*8044SWilliam.Kucharski@Sun.COM     grub> setup (hd0)
518*8044SWilliam.Kucharski@Sun.COM
519*8044SWilliam.Kucharski@Sun.COM   This command will install the GRUB boot loader on the Master Boot
520*8044SWilliam.Kucharski@Sun.COMRecord (MBR) of the first drive. If you want to put GRUB into the boot
521*8044SWilliam.Kucharski@Sun.COMsector of a partition instead of putting it in the MBR, specify the
522*8044SWilliam.Kucharski@Sun.COMpartition into which you want to install GRUB:
523*8044SWilliam.Kucharski@Sun.COM
524*8044SWilliam.Kucharski@Sun.COM     grub> setup (hd0,0)
525*8044SWilliam.Kucharski@Sun.COM
526*8044SWilliam.Kucharski@Sun.COM   If you install GRUB into a partition or a drive other than the first
527*8044SWilliam.Kucharski@Sun.COMone, you must chain-load GRUB from another boot loader. Refer to the
528*8044SWilliam.Kucharski@Sun.COMmanual for the boot loader to know how to chain-load GRUB.
529*8044SWilliam.Kucharski@Sun.COM
530*8044SWilliam.Kucharski@Sun.COM   After using the setup command, you will boot into GRUB without the
531*8044SWilliam.Kucharski@Sun.COMGRUB floppy. See the chapter *Note Booting:: to find out how to boot
532*8044SWilliam.Kucharski@Sun.COMyour operating systems from GRUB.
533*8044SWilliam.Kucharski@Sun.COM
534*8044SWilliam.Kucharski@Sun.COM
535*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Installing GRUB natively-Footnotes,  Up: Installing GRUB natively
536*8044SWilliam.Kucharski@Sun.COM
537*8044SWilliam.Kucharski@Sun.COM   (1) Note that GRUB's root device doesn't necessarily mean your OS's
538*8044SWilliam.Kucharski@Sun.COMroot partition; if you need to specify a root partition for your OS,
539*8044SWilliam.Kucharski@Sun.COMadd the argument into the command `kernel'.
540*8044SWilliam.Kucharski@Sun.COM
541*8044SWilliam.Kucharski@Sun.COM
542*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Installing GRUB using grub-install,  Next: Making a GRUB bootable CD-ROM,  Prev: Installing GRUB natively,  Up: Installation
543*8044SWilliam.Kucharski@Sun.COM
544*8044SWilliam.Kucharski@Sun.COMInstalling GRUB using grub-install
545*8044SWilliam.Kucharski@Sun.COM==================================
546*8044SWilliam.Kucharski@Sun.COM
547*8044SWilliam.Kucharski@Sun.COM   *Caution:* This procedure is definitely less safe, because there are
548*8044SWilliam.Kucharski@Sun.COMseveral ways in which your computer can become unbootable. For example,
549*8044SWilliam.Kucharski@Sun.COMmost operating systems don't tell GRUB how to map BIOS drives to OS
550*8044SWilliam.Kucharski@Sun.COMdevices correctly--GRUB merely "guesses" the mapping. This will succeed
551*8044SWilliam.Kucharski@Sun.COMin most cases, but not always. Therefore, GRUB provides you with a map
552*8044SWilliam.Kucharski@Sun.COMfile called the "device map", which you must fix if it is wrong. *Note
553*8044SWilliam.Kucharski@Sun.COMDevice map::, for more details.
554*8044SWilliam.Kucharski@Sun.COM
555*8044SWilliam.Kucharski@Sun.COM   If you still do want to install GRUB under a UNIX-like OS (such as
556*8044SWilliam.Kucharski@Sun.COMGNU), invoke the program `grub-install' (*note Invoking grub-install::)
557*8044SWilliam.Kucharski@Sun.COMas the superuser ("root").
558*8044SWilliam.Kucharski@Sun.COM
559*8044SWilliam.Kucharski@Sun.COM   The usage is basically very simple. You only need to specify one
560*8044SWilliam.Kucharski@Sun.COMargument to the program, namely, where to install the boot loader. The
561*8044SWilliam.Kucharski@Sun.COMargument can be either a device file (like `/dev/hda') or a partition
562*8044SWilliam.Kucharski@Sun.COMspecified in GRUB's notation. For example, under Linux the following
563*8044SWilliam.Kucharski@Sun.COMwill install GRUB into the MBR of the first IDE disk:
564*8044SWilliam.Kucharski@Sun.COM
565*8044SWilliam.Kucharski@Sun.COM     # grub-install /dev/hda
566*8044SWilliam.Kucharski@Sun.COM
567*8044SWilliam.Kucharski@Sun.COM   Likewise, under GNU/Hurd, this has the same effect:
568*8044SWilliam.Kucharski@Sun.COM
569*8044SWilliam.Kucharski@Sun.COM     # grub-install /dev/hd0
570*8044SWilliam.Kucharski@Sun.COM
571*8044SWilliam.Kucharski@Sun.COM   If it is the first BIOS drive, this is the same as well:
572*8044SWilliam.Kucharski@Sun.COM
573*8044SWilliam.Kucharski@Sun.COM     # grub-install '(hd0)'
574*8044SWilliam.Kucharski@Sun.COM
575*8044SWilliam.Kucharski@Sun.COM   Or you can omit the parentheses:
576*8044SWilliam.Kucharski@Sun.COM
577*8044SWilliam.Kucharski@Sun.COM     # grub-install hd0
578*8044SWilliam.Kucharski@Sun.COM
579*8044SWilliam.Kucharski@Sun.COM   But all the above examples assume that GRUB should use images under
580*8044SWilliam.Kucharski@Sun.COMthe root directory. If you want GRUB to use images under a directory
581*8044SWilliam.Kucharski@Sun.COMother than the root directory, you need to specify the option
582*8044SWilliam.Kucharski@Sun.COM`--root-directory'. The typical usage is that you create a GRUB boot
583*8044SWilliam.Kucharski@Sun.COMfloppy with a filesystem. Here is an example:
584*8044SWilliam.Kucharski@Sun.COM
585*8044SWilliam.Kucharski@Sun.COM     # mke2fs /dev/fd0
586*8044SWilliam.Kucharski@Sun.COM     # mount -t ext2 /dev/fd0 /mnt
587*8044SWilliam.Kucharski@Sun.COM     # grub-install --root-directory=/mnt fd0
588*8044SWilliam.Kucharski@Sun.COM     # umount /mnt
589*8044SWilliam.Kucharski@Sun.COM
590*8044SWilliam.Kucharski@Sun.COM   Another example is when you have a separate boot partition which is
591*8044SWilliam.Kucharski@Sun.COMmounted at `/boot'. Since GRUB is a boot loader, it doesn't know
592*8044SWilliam.Kucharski@Sun.COManything about mountpoints at all. Thus, you need to run `grub-install'
593*8044SWilliam.Kucharski@Sun.COMlike this:
594*8044SWilliam.Kucharski@Sun.COM
595*8044SWilliam.Kucharski@Sun.COM     # grub-install --root-directory=/boot /dev/hda
596*8044SWilliam.Kucharski@Sun.COM
597*8044SWilliam.Kucharski@Sun.COM   By the way, as noted above, it is quite difficult to guess BIOS
598*8044SWilliam.Kucharski@Sun.COMdrives correctly under a UNIX-like OS. Thus, `grub-install' will prompt
599*8044SWilliam.Kucharski@Sun.COMyou to check if it could really guess the correct mappings, after the
600*8044SWilliam.Kucharski@Sun.COMinstallation. The format is defined in *Note Device map::. Please be
601*8044SWilliam.Kucharski@Sun.COMquite careful. If the output is wrong, it is unlikely that your
602*8044SWilliam.Kucharski@Sun.COMcomputer will be able to boot with no problem.
603*8044SWilliam.Kucharski@Sun.COM
604*8044SWilliam.Kucharski@Sun.COM   Note that `grub-install' is actually just a shell script and the
605*8044SWilliam.Kucharski@Sun.COMreal task is done by the grub shell `grub' (*note Invoking the grub
606*8044SWilliam.Kucharski@Sun.COMshell::). Therefore, you may run `grub' directly to install GRUB,
607*8044SWilliam.Kucharski@Sun.COMwithout using `grub-install'. Don't do that, however, unless you are
608*8044SWilliam.Kucharski@Sun.COMvery familiar with the internals of GRUB. Installing a boot loader on a
609*8044SWilliam.Kucharski@Sun.COMrunning OS may be extremely dangerous.
610*8044SWilliam.Kucharski@Sun.COM
611*8044SWilliam.Kucharski@Sun.COM
612*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Making a GRUB bootable CD-ROM,  Prev: Installing GRUB using grub-install,  Up: Installation
613*8044SWilliam.Kucharski@Sun.COM
614*8044SWilliam.Kucharski@Sun.COMMaking a GRUB bootable CD-ROM
615*8044SWilliam.Kucharski@Sun.COM=============================
616*8044SWilliam.Kucharski@Sun.COM
617*8044SWilliam.Kucharski@Sun.COM   GRUB supports the "no emulation mode" in the El Torito
618*8044SWilliam.Kucharski@Sun.COMspecification(1) (*note Making a GRUB bootable CD-ROM-Footnote-1::).
619*8044SWilliam.Kucharski@Sun.COMThis means that you can use the whole CD-ROM from GRUB and you don't
620*8044SWilliam.Kucharski@Sun.COMhave to make a floppy or hard disk image file, which can cause
621*8044SWilliam.Kucharski@Sun.COMcompatibility problems.
622*8044SWilliam.Kucharski@Sun.COM
623*8044SWilliam.Kucharski@Sun.COM   For booting from a CD-ROM, GRUB uses a special Stage 2 called
624*8044SWilliam.Kucharski@Sun.COM`stage2_eltorito'. The only GRUB files you need to have in your
625*8044SWilliam.Kucharski@Sun.COMbootable CD-ROM are this `stage2_eltorito' and optionally a config file
626*8044SWilliam.Kucharski@Sun.COM`menu.lst'. You don't need to use `stage1' or `stage2', because El
627*8044SWilliam.Kucharski@Sun.COMTorito is quite different from the standard boot process.
628*8044SWilliam.Kucharski@Sun.COM
629*8044SWilliam.Kucharski@Sun.COM   Here is an example of procedures to make a bootable CD-ROM image.
630*8044SWilliam.Kucharski@Sun.COMFirst, make a top directory for the bootable image, say, `iso':
631*8044SWilliam.Kucharski@Sun.COM
632*8044SWilliam.Kucharski@Sun.COM     $ mkdir iso
633*8044SWilliam.Kucharski@Sun.COM
634*8044SWilliam.Kucharski@Sun.COM   Make a directory for GRUB:
635*8044SWilliam.Kucharski@Sun.COM
636*8044SWilliam.Kucharski@Sun.COM     $ mkdir -p iso/boot/grub
637*8044SWilliam.Kucharski@Sun.COM
638*8044SWilliam.Kucharski@Sun.COM   Copy the file `stage2_eltorito':
639*8044SWilliam.Kucharski@Sun.COM
640*8044SWilliam.Kucharski@Sun.COM     $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
641*8044SWilliam.Kucharski@Sun.COM
642*8044SWilliam.Kucharski@Sun.COM   If desired, make the config file `menu.lst' under `iso/boot/grub'
643*8044SWilliam.Kucharski@Sun.COM(*note Configuration::), and copy any files and directories for the
644*8044SWilliam.Kucharski@Sun.COMdisc to the directory `iso/'.
645*8044SWilliam.Kucharski@Sun.COM
646*8044SWilliam.Kucharski@Sun.COM   Finally, make a ISO9660 image file like this:
647*8044SWilliam.Kucharski@Sun.COM
648*8044SWilliam.Kucharski@Sun.COM     $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
649*8044SWilliam.Kucharski@Sun.COM         -boot-load-size 4 -boot-info-table -o grub.iso iso
650*8044SWilliam.Kucharski@Sun.COM
651*8044SWilliam.Kucharski@Sun.COM   This produces a file named `grub.iso', which then can be burned into
652*8044SWilliam.Kucharski@Sun.COMa CD (or a DVD).  `mkisofs' has already set up the disc to boot from
653*8044SWilliam.Kucharski@Sun.COMthe `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB
654*8044SWilliam.Kucharski@Sun.COMon the disc.  (Note that the `-boot-load-size 4' bit is required for
655*8044SWilliam.Kucharski@Sun.COMcompatibility with the BIOS on many older machines.)
656*8044SWilliam.Kucharski@Sun.COM
657*8044SWilliam.Kucharski@Sun.COM   You can use the device `(cd)' to access a CD-ROM in your config
658*8044SWilliam.Kucharski@Sun.COMfile. This is not required; GRUB automatically sets the root device to
659*8044SWilliam.Kucharski@Sun.COM`(cd)' when booted from a CD-ROM. It is only necessary to refer to
660*8044SWilliam.Kucharski@Sun.COM`(cd)' if you want to access other drives as well.
661*8044SWilliam.Kucharski@Sun.COM
662*8044SWilliam.Kucharski@Sun.COM
663*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Making a GRUB bootable CD-ROM-Footnotes,  Up: Making a GRUB bootable CD-ROM
664*8044SWilliam.Kucharski@Sun.COM
665*8044SWilliam.Kucharski@Sun.COM   (1) El Torito is a specification for bootable CD using BIOS
666*8044SWilliam.Kucharski@Sun.COMfunctions.
667*8044SWilliam.Kucharski@Sun.COM
668*8044SWilliam.Kucharski@Sun.COM
669*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Booting,  Next: Configuration,  Prev: Installation,  Up: Top
670*8044SWilliam.Kucharski@Sun.COM
671*8044SWilliam.Kucharski@Sun.COMBooting
672*8044SWilliam.Kucharski@Sun.COM*******
673*8044SWilliam.Kucharski@Sun.COM
674*8044SWilliam.Kucharski@Sun.COM   GRUB can load Multiboot-compliant kernels in a consistent way, but
675*8044SWilliam.Kucharski@Sun.COMfor some free operating systems you need to use some OS-specific magic.
676*8044SWilliam.Kucharski@Sun.COM
677*8044SWilliam.Kucharski@Sun.COM* Menu:
678*8044SWilliam.Kucharski@Sun.COM
679*8044SWilliam.Kucharski@Sun.COM* General boot methods::        How to boot OSes with GRUB generally
680*8044SWilliam.Kucharski@Sun.COM* OS-specific notes::           Notes on some operating systems
681*8044SWilliam.Kucharski@Sun.COM* Making your system robust::   How to make your system robust
682*8044SWilliam.Kucharski@Sun.COM
683*8044SWilliam.Kucharski@Sun.COM
684*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: General boot methods,  Next: OS-specific notes,  Up: Booting
685*8044SWilliam.Kucharski@Sun.COM
686*8044SWilliam.Kucharski@Sun.COMHow to boot operating systems
687*8044SWilliam.Kucharski@Sun.COM=============================
688*8044SWilliam.Kucharski@Sun.COM
689*8044SWilliam.Kucharski@Sun.COM   GRUB has two distinct boot methods. One of the two is to load an
690*8044SWilliam.Kucharski@Sun.COMoperating system directly, and the other is to chain-load another boot
691*8044SWilliam.Kucharski@Sun.COMloader which then will load an operating system actually. Generally
692*8044SWilliam.Kucharski@Sun.COMspeaking, the former is more desirable, because you don't need to
693*8044SWilliam.Kucharski@Sun.COMinstall or maintain other boot loaders and GRUB is flexible enough to
694*8044SWilliam.Kucharski@Sun.COMload an operating system from an arbitrary disk/partition. However, the
695*8044SWilliam.Kucharski@Sun.COMlatter is sometimes required, since GRUB doesn't support all the
696*8044SWilliam.Kucharski@Sun.COMexisting operating systems natively.
697*8044SWilliam.Kucharski@Sun.COM
698*8044SWilliam.Kucharski@Sun.COM* Menu:
699*8044SWilliam.Kucharski@Sun.COM
700*8044SWilliam.Kucharski@Sun.COM* Loading an operating system directly::
701*8044SWilliam.Kucharski@Sun.COM* Chain-loading::
702*8044SWilliam.Kucharski@Sun.COM
703*8044SWilliam.Kucharski@Sun.COM
704*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Loading an operating system directly,  Next: Chain-loading,  Up: General boot methods
705*8044SWilliam.Kucharski@Sun.COM
706*8044SWilliam.Kucharski@Sun.COMHow to boot an OS directly with GRUB
707*8044SWilliam.Kucharski@Sun.COM------------------------------------
708*8044SWilliam.Kucharski@Sun.COM
709*8044SWilliam.Kucharski@Sun.COM   Multiboot (*note Multiboot Specification: (multiboot)Top.) is the
710*8044SWilliam.Kucharski@Sun.COMnative format supported by GRUB.  For the sake of convenience, there is
711*8044SWilliam.Kucharski@Sun.COMalso support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to
712*8044SWilliam.Kucharski@Sun.COMboot other operating systems, you will have to chain-load them (*note
713*8044SWilliam.Kucharski@Sun.COMChain-loading::).
714*8044SWilliam.Kucharski@Sun.COM
715*8044SWilliam.Kucharski@Sun.COM   Generally, GRUB can boot any Multiboot-compliant OS in the following
716*8044SWilliam.Kucharski@Sun.COMsteps:
717*8044SWilliam.Kucharski@Sun.COM
718*8044SWilliam.Kucharski@Sun.COM  1. Set GRUB's root device to the drive where the OS images are stored
719*8044SWilliam.Kucharski@Sun.COM     with the command `root' (*note root::).
720*8044SWilliam.Kucharski@Sun.COM
721*8044SWilliam.Kucharski@Sun.COM  2. Load the kernel image with the command `kernel' (*note kernel::).
722*8044SWilliam.Kucharski@Sun.COM
723*8044SWilliam.Kucharski@Sun.COM  3. If you need modules, load them with the command `module' (*note
724*8044SWilliam.Kucharski@Sun.COM     module::) or `modulenounzip' (*note modulenounzip::).
725*8044SWilliam.Kucharski@Sun.COM
726*8044SWilliam.Kucharski@Sun.COM  4. Run the command `boot' (*note boot::).
727*8044SWilliam.Kucharski@Sun.COM
728*8044SWilliam.Kucharski@Sun.COM   Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar
729*8044SWilliam.Kucharski@Sun.COMmanner. You load a kernel image with the command `kernel' and then run
730*8044SWilliam.Kucharski@Sun.COMthe command `boot'. If the kernel requires some parameters, just append
731*8044SWilliam.Kucharski@Sun.COMthe parameters to `kernel', after the file name of the kernel. Also,
732*8044SWilliam.Kucharski@Sun.COMplease refer to *Note OS-specific notes::, for information on your
733*8044SWilliam.Kucharski@Sun.COMOS-specific issues.
734*8044SWilliam.Kucharski@Sun.COM
735*8044SWilliam.Kucharski@Sun.COM
736*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Chain-loading,  Prev: Loading an operating system directly,  Up: General boot methods
737*8044SWilliam.Kucharski@Sun.COM
738*8044SWilliam.Kucharski@Sun.COMLoad another boot loader to boot unsupported operating systems
739*8044SWilliam.Kucharski@Sun.COM--------------------------------------------------------------
740*8044SWilliam.Kucharski@Sun.COM
741*8044SWilliam.Kucharski@Sun.COM   If you want to boot an unsupported operating system (e.g. Windows
742*8044SWilliam.Kucharski@Sun.COM95), chain-load a boot loader for the operating system. Normally, the
743*8044SWilliam.Kucharski@Sun.COMboot loader is embedded in the "boot sector" of the partition on which
744*8044SWilliam.Kucharski@Sun.COMthe operating system is installed.
745*8044SWilliam.Kucharski@Sun.COM
746*8044SWilliam.Kucharski@Sun.COM  1. Set GRUB's root device to the partition by the command
747*8044SWilliam.Kucharski@Sun.COM     `rootnoverify' (*note rootnoverify::):
748*8044SWilliam.Kucharski@Sun.COM
749*8044SWilliam.Kucharski@Sun.COM          grub> rootnoverify (hd0,0)
750*8044SWilliam.Kucharski@Sun.COM
751*8044SWilliam.Kucharski@Sun.COM  2. Set the "active" flag in the partition using the command
752*8044SWilliam.Kucharski@Sun.COM     `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note
753*8044SWilliam.Kucharski@Sun.COM     makeactive::):
754*8044SWilliam.Kucharski@Sun.COM
755*8044SWilliam.Kucharski@Sun.COM          grub> makeactive
756*8044SWilliam.Kucharski@Sun.COM
757*8044SWilliam.Kucharski@Sun.COM  3. Load the boot loader with the command `chainloader' (*note
758*8044SWilliam.Kucharski@Sun.COM     chainloader::):
759*8044SWilliam.Kucharski@Sun.COM
760*8044SWilliam.Kucharski@Sun.COM          grub> chainloader +1
761*8044SWilliam.Kucharski@Sun.COM
762*8044SWilliam.Kucharski@Sun.COM     `+1' indicates that GRUB should read one sector from the start of
763*8044SWilliam.Kucharski@Sun.COM     the partition. The complete description about this syntax can be
764*8044SWilliam.Kucharski@Sun.COM     found in *Note Block list syntax::.
765*8044SWilliam.Kucharski@Sun.COM
766*8044SWilliam.Kucharski@Sun.COM  4. Run the command `boot' (*note boot::).
767*8044SWilliam.Kucharski@Sun.COM
768*8044SWilliam.Kucharski@Sun.COM   However, DOS and Windows have some deficiencies, so you might have to
769*8044SWilliam.Kucharski@Sun.COMuse more complicated instructions. *Note DOS/Windows::, for more
770*8044SWilliam.Kucharski@Sun.COMinformation.
771*8044SWilliam.Kucharski@Sun.COM
772*8044SWilliam.Kucharski@Sun.COM
773*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Chain-loading-Footnotes,  Up: Chain-loading
774*8044SWilliam.Kucharski@Sun.COM
775*8044SWilliam.Kucharski@Sun.COM   (1) This is not necessary for most of the modern operating systems.
776*8044SWilliam.Kucharski@Sun.COM
777*8044SWilliam.Kucharski@Sun.COM
778*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: OS-specific notes,  Next: Making your system robust,  Prev: General boot methods,  Up: Booting
779*8044SWilliam.Kucharski@Sun.COM
780*8044SWilliam.Kucharski@Sun.COMSome caveats on OS-specific issues
781*8044SWilliam.Kucharski@Sun.COM==================================
782*8044SWilliam.Kucharski@Sun.COM
783*8044SWilliam.Kucharski@Sun.COM   Here, we describe some caveats on several operating systems.
784*8044SWilliam.Kucharski@Sun.COM
785*8044SWilliam.Kucharski@Sun.COM* Menu:
786*8044SWilliam.Kucharski@Sun.COM
787*8044SWilliam.Kucharski@Sun.COM* GNU/Hurd::
788*8044SWilliam.Kucharski@Sun.COM* GNU/Linux::
789*8044SWilliam.Kucharski@Sun.COM* FreeBSD::
790*8044SWilliam.Kucharski@Sun.COM* NetBSD::
791*8044SWilliam.Kucharski@Sun.COM* OpenBSD::
792*8044SWilliam.Kucharski@Sun.COM* DOS/Windows::
793*8044SWilliam.Kucharski@Sun.COM* SCO UnixWare::
794*8044SWilliam.Kucharski@Sun.COM* QNX::
795*8044SWilliam.Kucharski@Sun.COM
796*8044SWilliam.Kucharski@Sun.COM
797*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: GNU/Hurd,  Next: GNU/Linux,  Up: OS-specific notes
798*8044SWilliam.Kucharski@Sun.COM
799*8044SWilliam.Kucharski@Sun.COMGNU/Hurd
800*8044SWilliam.Kucharski@Sun.COM--------
801*8044SWilliam.Kucharski@Sun.COM
802*8044SWilliam.Kucharski@Sun.COM   Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there
803*8044SWilliam.Kucharski@Sun.COMis nothing special about it. But do not forget that you have to specify
804*8044SWilliam.Kucharski@Sun.COMa root partition to the kernel.
805*8044SWilliam.Kucharski@Sun.COM
806*8044SWilliam.Kucharski@Sun.COM  1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably
807*8044SWilliam.Kucharski@Sun.COM     the command `find /boot/gnumach' or similar can help you (*note
808*8044SWilliam.Kucharski@Sun.COM     find::).
809*8044SWilliam.Kucharski@Sun.COM
810*8044SWilliam.Kucharski@Sun.COM  2. Load the kernel and the module, like this:
811*8044SWilliam.Kucharski@Sun.COM
812*8044SWilliam.Kucharski@Sun.COM          grub> kernel /boot/gnumach root=hd0s1
813*8044SWilliam.Kucharski@Sun.COM          grub> module /boot/serverboot
814*8044SWilliam.Kucharski@Sun.COM
815*8044SWilliam.Kucharski@Sun.COM  3. Run the command `boot' (*note boot::).
816*8044SWilliam.Kucharski@Sun.COM
817*8044SWilliam.Kucharski@Sun.COM
818*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: GNU/Linux,  Next: FreeBSD,  Prev: GNU/Hurd,  Up: OS-specific notes
819*8044SWilliam.Kucharski@Sun.COM
820*8044SWilliam.Kucharski@Sun.COMGNU/Linux
821*8044SWilliam.Kucharski@Sun.COM---------
822*8044SWilliam.Kucharski@Sun.COM
823*8044SWilliam.Kucharski@Sun.COM   It is relatively easy to boot GNU/Linux from GRUB, because it
824*8044SWilliam.Kucharski@Sun.COMsomewhat resembles to boot a Multiboot-compliant OS.
825*8044SWilliam.Kucharski@Sun.COM
826*8044SWilliam.Kucharski@Sun.COM  1. Set GRUB's root device to the same drive as GNU/Linux's. Probably
827*8044SWilliam.Kucharski@Sun.COM     the command `find /vmlinuz' or similar can help you (*note find::).
828*8044SWilliam.Kucharski@Sun.COM
829*8044SWilliam.Kucharski@Sun.COM  2. Load the kernel:
830*8044SWilliam.Kucharski@Sun.COM
831*8044SWilliam.Kucharski@Sun.COM          grub> kernel /vmlinuz root=/dev/hda1
832*8044SWilliam.Kucharski@Sun.COM
833*8044SWilliam.Kucharski@Sun.COM     If you need to specify some kernel parameters, just append them to
834*8044SWilliam.Kucharski@Sun.COM     the command. For example, to set `vga' to `ext', do this:
835*8044SWilliam.Kucharski@Sun.COM
836*8044SWilliam.Kucharski@Sun.COM          grub> kernel /vmlinuz root=/dev/hda1 vga=ext
837*8044SWilliam.Kucharski@Sun.COM
838*8044SWilliam.Kucharski@Sun.COM     See the documentation in the Linux source tree for complete
839*8044SWilliam.Kucharski@Sun.COM     information on the available options.
840*8044SWilliam.Kucharski@Sun.COM
841*8044SWilliam.Kucharski@Sun.COM  3. If you use an initrd, execute the command `initrd' (*note
842*8044SWilliam.Kucharski@Sun.COM     initrd::) after `kernel':
843*8044SWilliam.Kucharski@Sun.COM
844*8044SWilliam.Kucharski@Sun.COM          grub> initrd /initrd
845*8044SWilliam.Kucharski@Sun.COM
846*8044SWilliam.Kucharski@Sun.COM  4. Finally, run the command `boot' (*note boot::).
847*8044SWilliam.Kucharski@Sun.COM
848*8044SWilliam.Kucharski@Sun.COM   *Caution:* If you use an initrd and specify the `mem=' option to the
849*8044SWilliam.Kucharski@Sun.COMkernel to let it use less than actual memory size, you will also have
850*8044SWilliam.Kucharski@Sun.COMto specify the same memory size to GRUB. To let GRUB know the size, run
851*8044SWilliam.Kucharski@Sun.COMthe command `uppermem' _before_ loading the kernel. *Note uppermem::,
852*8044SWilliam.Kucharski@Sun.COMfor more information.
853*8044SWilliam.Kucharski@Sun.COM
854*8044SWilliam.Kucharski@Sun.COM
855*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: FreeBSD,  Next: NetBSD,  Prev: GNU/Linux,  Up: OS-specific notes
856*8044SWilliam.Kucharski@Sun.COM
857*8044SWilliam.Kucharski@Sun.COMFreeBSD
858*8044SWilliam.Kucharski@Sun.COM-------
859*8044SWilliam.Kucharski@Sun.COM
860*8044SWilliam.Kucharski@Sun.COM   GRUB can load the kernel directly, either in ELF or a.out format. But
861*8044SWilliam.Kucharski@Sun.COMthis is not recommended, since FreeBSD's bootstrap interface sometimes
862*8044SWilliam.Kucharski@Sun.COMchanges heavily, so GRUB can't guarantee to pass kernel parameters
863*8044SWilliam.Kucharski@Sun.COMcorrectly.
864*8044SWilliam.Kucharski@Sun.COM
865*8044SWilliam.Kucharski@Sun.COM   Thus, we'd recommend loading the very flexible loader `/boot/loader'
866*8044SWilliam.Kucharski@Sun.COMinstead. See this example:
867*8044SWilliam.Kucharski@Sun.COM
868*8044SWilliam.Kucharski@Sun.COM     grub> root (hd0,a)
869*8044SWilliam.Kucharski@Sun.COM     grub> kernel /boot/loader
870*8044SWilliam.Kucharski@Sun.COM     grub> boot
871*8044SWilliam.Kucharski@Sun.COM
872*8044SWilliam.Kucharski@Sun.COM
873*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: NetBSD,  Next: OpenBSD,  Prev: FreeBSD,  Up: OS-specific notes
874*8044SWilliam.Kucharski@Sun.COM
875*8044SWilliam.Kucharski@Sun.COMNetBSD
876*8044SWilliam.Kucharski@Sun.COM------
877*8044SWilliam.Kucharski@Sun.COM
878*8044SWilliam.Kucharski@Sun.COM   GRUB can load NetBSD a.out and ELF directly, follow these steps:
879*8044SWilliam.Kucharski@Sun.COM
880*8044SWilliam.Kucharski@Sun.COM  1. Set GRUB's root device with `root' (*note root::).
881*8044SWilliam.Kucharski@Sun.COM
882*8044SWilliam.Kucharski@Sun.COM  2. Load the kernel with `kernel' (*note kernel::). You should append
883*8044SWilliam.Kucharski@Sun.COM     the ugly option `--type=netbsd', if you want to load an ELF
884*8044SWilliam.Kucharski@Sun.COM     kernel, like this:
885*8044SWilliam.Kucharski@Sun.COM
886*8044SWilliam.Kucharski@Sun.COM          grub> kernel --type=netbsd /netbsd-elf
887*8044SWilliam.Kucharski@Sun.COM
888*8044SWilliam.Kucharski@Sun.COM  3. Run `boot' (*note boot::).
889*8044SWilliam.Kucharski@Sun.COM
890*8044SWilliam.Kucharski@Sun.COM   For now, however, GRUB doesn't allow you to pass kernel parameters,
891*8044SWilliam.Kucharski@Sun.COMso it may be better to chain-load it instead. For more information,
892*8044SWilliam.Kucharski@Sun.COMplease see *Note Chain-loading::.
893*8044SWilliam.Kucharski@Sun.COM
894*8044SWilliam.Kucharski@Sun.COM
895*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: OpenBSD,  Next: DOS/Windows,  Prev: NetBSD,  Up: OS-specific notes
896*8044SWilliam.Kucharski@Sun.COM
897*8044SWilliam.Kucharski@Sun.COMOpenBSD
898*8044SWilliam.Kucharski@Sun.COM-------
899*8044SWilliam.Kucharski@Sun.COM
900*8044SWilliam.Kucharski@Sun.COM   The booting instruction is exactly the same as for NetBSD (*note
901*8044SWilliam.Kucharski@Sun.COMNetBSD::).
902*8044SWilliam.Kucharski@Sun.COM
903*8044SWilliam.Kucharski@Sun.COM
904*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: DOS/Windows,  Next: SCO UnixWare,  Prev: OpenBSD,  Up: OS-specific notes
905*8044SWilliam.Kucharski@Sun.COM
906*8044SWilliam.Kucharski@Sun.COMDOS/Windows
907*8044SWilliam.Kucharski@Sun.COM-----------
908*8044SWilliam.Kucharski@Sun.COM
909*8044SWilliam.Kucharski@Sun.COM   GRUB cannot boot DOS or Windows directly, so you must chain-load them
910*8044SWilliam.Kucharski@Sun.COM(*note Chain-loading::). However, their boot loaders have some critical
911*8044SWilliam.Kucharski@Sun.COMdeficiencies, so it may not work to just chain-load them. To overcome
912*8044SWilliam.Kucharski@Sun.COMthe problems, GRUB provides you with two helper functions.
913*8044SWilliam.Kucharski@Sun.COM
914*8044SWilliam.Kucharski@Sun.COM   If you have installed DOS (or Windows) on a non-first hard disk, you
915*8044SWilliam.Kucharski@Sun.COMhave to use the disk swapping technique, because that OS cannot boot
916*8044SWilliam.Kucharski@Sun.COMfrom any disks but the first one. The workaround used in GRUB is the
917*8044SWilliam.Kucharski@Sun.COMcommand `map' (*note map::), like this:
918*8044SWilliam.Kucharski@Sun.COM
919*8044SWilliam.Kucharski@Sun.COM     grub> map (hd0) (hd1)
920*8044SWilliam.Kucharski@Sun.COM     grub> map (hd1) (hd0)
921*8044SWilliam.Kucharski@Sun.COM
922*8044SWilliam.Kucharski@Sun.COM   This performs a "virtual" swap between your first and second hard
923*8044SWilliam.Kucharski@Sun.COMdrive.
924*8044SWilliam.Kucharski@Sun.COM
925*8044SWilliam.Kucharski@Sun.COM   *Caution:* This is effective only if DOS (or Windows) uses BIOS to
926*8044SWilliam.Kucharski@Sun.COMaccess the swapped disks. If that OS uses a special driver for the
927*8044SWilliam.Kucharski@Sun.COMdisks, this probably won't work.
928*8044SWilliam.Kucharski@Sun.COM
929*8044SWilliam.Kucharski@Sun.COM   Another problem arises if you installed more than one set of
930*8044SWilliam.Kucharski@Sun.COMDOS/Windows onto one disk, because they could be confused if there are
931*8044SWilliam.Kucharski@Sun.COMmore than one primary partitions for DOS/Windows. Certainly you should
932*8044SWilliam.Kucharski@Sun.COMavoid doing this, but there is a solution if you do want to do so. Use
933*8044SWilliam.Kucharski@Sun.COMthe partition hiding/unhiding technique.
934*8044SWilliam.Kucharski@Sun.COM
935*8044SWilliam.Kucharski@Sun.COM   If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or
936*8044SWilliam.Kucharski@Sun.COMWindows) will ignore the partition. If GRUB "unhide"s a DOS (or
937*8044SWilliam.Kucharski@Sun.COMWindows) partition (*note unhide::), DOS (or Windows) will detect the
938*8044SWilliam.Kucharski@Sun.COMpartition. Thus, if you have installed DOS (or Windows) on the first
939*8044SWilliam.Kucharski@Sun.COMand the second partition of the first hard disk, and you want to boot
940*8044SWilliam.Kucharski@Sun.COMthe copy on the first partition, do the following:
941*8044SWilliam.Kucharski@Sun.COM
942*8044SWilliam.Kucharski@Sun.COM     grub> unhide (hd0,0)
943*8044SWilliam.Kucharski@Sun.COM     grub> hide (hd0,1)
944*8044SWilliam.Kucharski@Sun.COM     grub> rootnoverify (hd0,0)
945*8044SWilliam.Kucharski@Sun.COM     grub> chainloader +1
946*8044SWilliam.Kucharski@Sun.COM     grub> makeactive
947*8044SWilliam.Kucharski@Sun.COM     grub> boot
948*8044SWilliam.Kucharski@Sun.COM
949*8044SWilliam.Kucharski@Sun.COM
950*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: SCO UnixWare,  Next: QNX,  Prev: DOS/Windows,  Up: OS-specific notes
951*8044SWilliam.Kucharski@Sun.COM
952*8044SWilliam.Kucharski@Sun.COMSCO UnixWare
953*8044SWilliam.Kucharski@Sun.COM------------
954*8044SWilliam.Kucharski@Sun.COM
955*8044SWilliam.Kucharski@Sun.COM   It is known that the signature in the boot loader for SCO UnixWare is
956*8044SWilliam.Kucharski@Sun.COMwrong, so you will have to specify the option `--force' to
957*8044SWilliam.Kucharski@Sun.COM`chainloader' (*note chainloader::), like this:
958*8044SWilliam.Kucharski@Sun.COM
959*8044SWilliam.Kucharski@Sun.COM     grub> rootnoverify (hd1,0)
960*8044SWilliam.Kucharski@Sun.COM     grub> chainloader --force +1
961*8044SWilliam.Kucharski@Sun.COM     grub> makeactive
962*8044SWilliam.Kucharski@Sun.COM     grub> boot
963*8044SWilliam.Kucharski@Sun.COM
964*8044SWilliam.Kucharski@Sun.COM
965*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: QNX,  Prev: SCO UnixWare,  Up: OS-specific notes
966*8044SWilliam.Kucharski@Sun.COM
967*8044SWilliam.Kucharski@Sun.COMQNX
968*8044SWilliam.Kucharski@Sun.COM---
969*8044SWilliam.Kucharski@Sun.COM
970*8044SWilliam.Kucharski@Sun.COM   QNX seems to use a bigger boot loader, so you need to boot it up,
971*8044SWilliam.Kucharski@Sun.COMlike this:
972*8044SWilliam.Kucharski@Sun.COM
973*8044SWilliam.Kucharski@Sun.COM     grub> rootnoverify (hd1,1)
974*8044SWilliam.Kucharski@Sun.COM     grub> chainloader +4
975*8044SWilliam.Kucharski@Sun.COM     grub> boot
976*8044SWilliam.Kucharski@Sun.COM
977*8044SWilliam.Kucharski@Sun.COM
978*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Making your system robust,  Prev: OS-specific notes,  Up: Booting
979*8044SWilliam.Kucharski@Sun.COM
980*8044SWilliam.Kucharski@Sun.COMHow to make your system robust
981*8044SWilliam.Kucharski@Sun.COM==============================
982*8044SWilliam.Kucharski@Sun.COM
983*8044SWilliam.Kucharski@Sun.COM   When you test a new kernel or a new OS, it is important to make sure
984*8044SWilliam.Kucharski@Sun.COMthat your computer can boot even if the new system is unbootable. This
985*8044SWilliam.Kucharski@Sun.COMis crucial especially if you maintain servers or remote systems. To
986*8044SWilliam.Kucharski@Sun.COMaccomplish this goal, you need to set up two things:
987*8044SWilliam.Kucharski@Sun.COM
988*8044SWilliam.Kucharski@Sun.COM  1. You must maintain a system which is always bootable. For instance,
989*8044SWilliam.Kucharski@Sun.COM     if you test a new kernel, you need to keep a working kernel in a
990*8044SWilliam.Kucharski@Sun.COM     different place. And, it would sometimes be very nice to even have
991*8044SWilliam.Kucharski@Sun.COM     a complete copy of a working system in a different partition or
992*8044SWilliam.Kucharski@Sun.COM     disk.
993*8044SWilliam.Kucharski@Sun.COM
994*8044SWilliam.Kucharski@Sun.COM  2. You must direct GRUB to boot a working system when the new system
995*8044SWilliam.Kucharski@Sun.COM     fails. This is possible with the "fallback" system in GRUB.
996*8044SWilliam.Kucharski@Sun.COM
997*8044SWilliam.Kucharski@Sun.COM   The former requirement is very specific to each OS, so this
998*8044SWilliam.Kucharski@Sun.COMdocumentation does not cover that topic. It is better to consult some
999*8044SWilliam.Kucharski@Sun.COMbackup tools.
1000*8044SWilliam.Kucharski@Sun.COM
1001*8044SWilliam.Kucharski@Sun.COM   So let's see the GRUB part. There are two possibilities: one of them
1002*8044SWilliam.Kucharski@Sun.COMis quite simple but not very robust, and the other is a bit complex to
1003*8044SWilliam.Kucharski@Sun.COMset up but probably the best solution to make sure that your system can
1004*8044SWilliam.Kucharski@Sun.COMstart as long as GRUB itself is bootable.
1005*8044SWilliam.Kucharski@Sun.COM
1006*8044SWilliam.Kucharski@Sun.COM* Menu:
1007*8044SWilliam.Kucharski@Sun.COM
1008*8044SWilliam.Kucharski@Sun.COM* Booting once-only::
1009*8044SWilliam.Kucharski@Sun.COM* Booting fallback systems::
1010*8044SWilliam.Kucharski@Sun.COM
1011*8044SWilliam.Kucharski@Sun.COM
1012*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Booting once-only,  Next: Booting fallback systems,  Up: Making your system robust
1013*8044SWilliam.Kucharski@Sun.COM
1014*8044SWilliam.Kucharski@Sun.COMBooting once-only
1015*8044SWilliam.Kucharski@Sun.COM-----------------
1016*8044SWilliam.Kucharski@Sun.COM
1017*8044SWilliam.Kucharski@Sun.COM   You can teach GRUB to boot an entry only at next boot time. Suppose
1018*8044SWilliam.Kucharski@Sun.COMthat your have an old kernel `old_kernel' and a new kernel
1019*8044SWilliam.Kucharski@Sun.COM`new_kernel'. You know that `old_kernel' can boot your system
1020*8044SWilliam.Kucharski@Sun.COMcorrectly, and you want to test `new_kernel'.
1021*8044SWilliam.Kucharski@Sun.COM
1022*8044SWilliam.Kucharski@Sun.COM   To ensure that your system will go back to the old kernel even if the
1023*8044SWilliam.Kucharski@Sun.COMnew kernel fails (e.g. it panics), you can specify that GRUB should try
1024*8044SWilliam.Kucharski@Sun.COMthe new kernel only once and boot the old kernel after that.
1025*8044SWilliam.Kucharski@Sun.COM
1026*8044SWilliam.Kucharski@Sun.COM   First, modify your configuration file. Here is an example:
1027*8044SWilliam.Kucharski@Sun.COM
1028*8044SWilliam.Kucharski@Sun.COM     default saved        # This is important!!!
1029*8044SWilliam.Kucharski@Sun.COM     timeout 10
1030*8044SWilliam.Kucharski@Sun.COM
1031*8044SWilliam.Kucharski@Sun.COM     title the old kernel
1032*8044SWilliam.Kucharski@Sun.COM     root (hd0,0)
1033*8044SWilliam.Kucharski@Sun.COM     kernel /old_kernel
1034*8044SWilliam.Kucharski@Sun.COM     savedefault
1035*8044SWilliam.Kucharski@Sun.COM
1036*8044SWilliam.Kucharski@Sun.COM     title the new kernel
1037*8044SWilliam.Kucharski@Sun.COM     root (hd0,0)
1038*8044SWilliam.Kucharski@Sun.COM     kernel /new_kernel
1039*8044SWilliam.Kucharski@Sun.COM     savedefault 0         # This is important!!!
1040*8044SWilliam.Kucharski@Sun.COM
1041*8044SWilliam.Kucharski@Sun.COM   Note that this configuration file uses `default saved' (*note
1042*8044SWilliam.Kucharski@Sun.COMdefault::) at the head and `savedefault 0' (*note savedefault::) in the
1043*8044SWilliam.Kucharski@Sun.COMentry for the new kernel. This means that GRUB boots a saved entry by
1044*8044SWilliam.Kucharski@Sun.COMdefault, and booting the entry for the new kernel saves `0' as the
1045*8044SWilliam.Kucharski@Sun.COMsaved entry.
1046*8044SWilliam.Kucharski@Sun.COM
1047*8044SWilliam.Kucharski@Sun.COM   With this configuration file, after all, GRUB always tries to boot
1048*8044SWilliam.Kucharski@Sun.COMthe old kernel after it booted the new one, because `0' is the entry of
1049*8044SWilliam.Kucharski@Sun.COM`the old kernel'.
1050*8044SWilliam.Kucharski@Sun.COM
1051*8044SWilliam.Kucharski@Sun.COM   The next step is to tell GRUB to boot the new kernel at next boot
1052*8044SWilliam.Kucharski@Sun.COMtime. For this, execute `grub-set-default' (*note Invoking
1053*8044SWilliam.Kucharski@Sun.COMgrub-set-default::):
1054*8044SWilliam.Kucharski@Sun.COM
1055*8044SWilliam.Kucharski@Sun.COM     # grub-set-default 1
1056*8044SWilliam.Kucharski@Sun.COM
1057*8044SWilliam.Kucharski@Sun.COM   This command sets the saved entry to `1', that is, to the new kernel.
1058*8044SWilliam.Kucharski@Sun.COM
1059*8044SWilliam.Kucharski@Sun.COM   This method is useful, but still not very robust, because GRUB stops
1060*8044SWilliam.Kucharski@Sun.COMbooting, if there is any error in the boot entry, such that the new
1061*8044SWilliam.Kucharski@Sun.COMkernel has an invalid executable format. Thus, it it even better to use
1062*8044SWilliam.Kucharski@Sun.COMthe "fallback" mechanism of GRUB. Look at next subsection for this
1063*8044SWilliam.Kucharski@Sun.COMfeature.
1064*8044SWilliam.Kucharski@Sun.COM
1065*8044SWilliam.Kucharski@Sun.COM
1066*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Booting fallback systems,  Prev: Booting once-only,  Up: Making your system robust
1067*8044SWilliam.Kucharski@Sun.COM
1068*8044SWilliam.Kucharski@Sun.COMBooting fallback systems
1069*8044SWilliam.Kucharski@Sun.COM------------------------
1070*8044SWilliam.Kucharski@Sun.COM
1071*8044SWilliam.Kucharski@Sun.COM   GRUB supports a fallback mechanism of booting one or more other
1072*8044SWilliam.Kucharski@Sun.COMentries if a default boot entry fails. You can specify multiple
1073*8044SWilliam.Kucharski@Sun.COMfallback entries if you wish.
1074*8044SWilliam.Kucharski@Sun.COM
1075*8044SWilliam.Kucharski@Sun.COM   Suppose that you have three systems, `A', `B' and `C'. `A' is a
1076*8044SWilliam.Kucharski@Sun.COMsystem which you want to boot by default. `B' is a backup system which
1077*8044SWilliam.Kucharski@Sun.COMis supposed to boot safely. `C' is another backup system which is used
1078*8044SWilliam.Kucharski@Sun.COMin case where `B' is broken.
1079*8044SWilliam.Kucharski@Sun.COM
1080*8044SWilliam.Kucharski@Sun.COM   Then you may want GRUB to boot the first system which is bootable
1081*8044SWilliam.Kucharski@Sun.COMamong `A', `B' and `C'. A configuration file can be written in this way:
1082*8044SWilliam.Kucharski@Sun.COM
1083*8044SWilliam.Kucharski@Sun.COM     default saved        # This is important!!!
1084*8044SWilliam.Kucharski@Sun.COM     timeout 10
1085*8044SWilliam.Kucharski@Sun.COM     fallback 1 2         # This is important!!!
1086*8044SWilliam.Kucharski@Sun.COM
1087*8044SWilliam.Kucharski@Sun.COM     title A
1088*8044SWilliam.Kucharski@Sun.COM     root (hd0,0)
1089*8044SWilliam.Kucharski@Sun.COM     kernel /kernel
1090*8044SWilliam.Kucharski@Sun.COM     savedefault fallback # This is important!!!
1091*8044SWilliam.Kucharski@Sun.COM
1092*8044SWilliam.Kucharski@Sun.COM     title B
1093*8044SWilliam.Kucharski@Sun.COM     root (hd1,0)
1094*8044SWilliam.Kucharski@Sun.COM     kernel /kernel
1095*8044SWilliam.Kucharski@Sun.COM     savedefault fallback # This is important!!!
1096*8044SWilliam.Kucharski@Sun.COM
1097*8044SWilliam.Kucharski@Sun.COM     title C
1098*8044SWilliam.Kucharski@Sun.COM     root (hd2,0)
1099*8044SWilliam.Kucharski@Sun.COM     kernel /kernel
1100*8044SWilliam.Kucharski@Sun.COM     savedefault
1101*8044SWilliam.Kucharski@Sun.COM
1102*8044SWilliam.Kucharski@Sun.COM   Note that `default saved' (*note default::), `fallback 1 2' and
1103*8044SWilliam.Kucharski@Sun.COM`savedefault fallback' are used. GRUB will boot a saved entry by
1104*8044SWilliam.Kucharski@Sun.COMdefault and save a fallback entry as next boot entry with this
1105*8044SWilliam.Kucharski@Sun.COMconfiguration.
1106*8044SWilliam.Kucharski@Sun.COM
1107*8044SWilliam.Kucharski@Sun.COM   When GRUB tries to boot `A', GRUB saves `1' as next boot entry,
1108*8044SWilliam.Kucharski@Sun.COMbecause the command `fallback' specifies that `1' is the first fallback
1109*8044SWilliam.Kucharski@Sun.COMentry. The entry `1' is `B', so GRUB will try to boot `B' at next boot
1110*8044SWilliam.Kucharski@Sun.COMtime.
1111*8044SWilliam.Kucharski@Sun.COM
1112*8044SWilliam.Kucharski@Sun.COM   Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot
1113*8044SWilliam.Kucharski@Sun.COMentry, because `fallback' specifies `2' as next fallback entry. This
1114*8044SWilliam.Kucharski@Sun.COMmakes sure that GRUB will boot `C' after booting `B'.
1115*8044SWilliam.Kucharski@Sun.COM
1116*8044SWilliam.Kucharski@Sun.COM   It is noteworthy that GRUB uses fallback entries both when GRUB
1117*8044SWilliam.Kucharski@Sun.COMitself fails in booting an entry and when `A' or `B' fails in starting
1118*8044SWilliam.Kucharski@Sun.COMup your system. So this solution ensures that your system is started
1119*8044SWilliam.Kucharski@Sun.COMeven if GRUB cannot find your kernel or if your kernel panics.
1120*8044SWilliam.Kucharski@Sun.COM
1121*8044SWilliam.Kucharski@Sun.COM   However, you need to run `grub-set-default' (*note Invoking
1122*8044SWilliam.Kucharski@Sun.COMgrub-set-default::) when `A' starts correctly or you fix `A' after it
1123*8044SWilliam.Kucharski@Sun.COMcrashes, since GRUB always sets next boot entry to a fallback entry.
1124*8044SWilliam.Kucharski@Sun.COMYou should run this command in a startup script such as `rc.local' to
1125*8044SWilliam.Kucharski@Sun.COMboot `A' by default:
1126*8044SWilliam.Kucharski@Sun.COM
1127*8044SWilliam.Kucharski@Sun.COM     # grub-set-default 0
1128*8044SWilliam.Kucharski@Sun.COM
1129*8044SWilliam.Kucharski@Sun.COM   where `0' is the number of the boot entry for the system `A'.
1130*8044SWilliam.Kucharski@Sun.COM
1131*8044SWilliam.Kucharski@Sun.COM   If you want to see what is current default entry, you can look at the
1132*8044SWilliam.Kucharski@Sun.COMfile `/boot/grub/default' (or `/grub/default' in some systems). Because
1133*8044SWilliam.Kucharski@Sun.COMthis file is plain-text, you can just `cat' this file. But it is
1134*8044SWilliam.Kucharski@Sun.COMstrongly recommended *not to modify this file directly*, because GRUB
1135*8044SWilliam.Kucharski@Sun.COMmay fail in saving a default entry in this file, if you change this
1136*8044SWilliam.Kucharski@Sun.COMfile in an unintended manner. Therefore, you should use
1137*8044SWilliam.Kucharski@Sun.COM`grub-set-default' when you need to change the default entry.
1138*8044SWilliam.Kucharski@Sun.COM
1139*8044SWilliam.Kucharski@Sun.COM
1140*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Configuration,  Next: Network,  Prev: Booting,  Up: Top
1141*8044SWilliam.Kucharski@Sun.COM
1142*8044SWilliam.Kucharski@Sun.COMConfiguration
1143*8044SWilliam.Kucharski@Sun.COM*************
1144*8044SWilliam.Kucharski@Sun.COM
1145*8044SWilliam.Kucharski@Sun.COM   You've probably noticed that you need to type several commands to
1146*8044SWilliam.Kucharski@Sun.COMboot your OS. There's a solution to that - GRUB provides a menu
1147*8044SWilliam.Kucharski@Sun.COMinterface (*note Menu interface::) from which you can select an item
1148*8044SWilliam.Kucharski@Sun.COM(using arrow keys) that will do everything to boot an OS.
1149*8044SWilliam.Kucharski@Sun.COM
1150*8044SWilliam.Kucharski@Sun.COM   To enable the menu, you need a configuration file, `menu.lst' under
1151*8044SWilliam.Kucharski@Sun.COMthe boot directory. We'll analyze an example file.
1152*8044SWilliam.Kucharski@Sun.COM
1153*8044SWilliam.Kucharski@Sun.COM   The file first contains some general settings, the menu interface
1154*8044SWilliam.Kucharski@Sun.COMrelated options. You can put these commands (*note Menu-specific
1155*8044SWilliam.Kucharski@Sun.COMcommands::) before any of the items (starting with `title' (*note
1156*8044SWilliam.Kucharski@Sun.COMtitle::)).
1157*8044SWilliam.Kucharski@Sun.COM
1158*8044SWilliam.Kucharski@Sun.COM     #
1159*8044SWilliam.Kucharski@Sun.COM     # Sample boot menu configuration file
1160*8044SWilliam.Kucharski@Sun.COM     #
1161*8044SWilliam.Kucharski@Sun.COM
1162*8044SWilliam.Kucharski@Sun.COM   As you may have guessed, these lines are comments. Lines starting
1163*8044SWilliam.Kucharski@Sun.COMwith a hash character (`#'), and blank lines, are ignored by GRUB.
1164*8044SWilliam.Kucharski@Sun.COM
1165*8044SWilliam.Kucharski@Sun.COM     # By default, boot the first entry.
1166*8044SWilliam.Kucharski@Sun.COM     default 0
1167*8044SWilliam.Kucharski@Sun.COM
1168*8044SWilliam.Kucharski@Sun.COM   The first entry (here, counting starts with number zero, not one!)
1169*8044SWilliam.Kucharski@Sun.COMwill be the default choice.
1170*8044SWilliam.Kucharski@Sun.COM
1171*8044SWilliam.Kucharski@Sun.COM     # Boot automatically after 30 secs.
1172*8044SWilliam.Kucharski@Sun.COM     timeout 30
1173*8044SWilliam.Kucharski@Sun.COM
1174*8044SWilliam.Kucharski@Sun.COM   As the comment says, GRUB will boot automatically in 30 seconds,
1175*8044SWilliam.Kucharski@Sun.COMunless interrupted with a keypress.
1176*8044SWilliam.Kucharski@Sun.COM
1177*8044SWilliam.Kucharski@Sun.COM     # Fallback to the second entry.
1178*8044SWilliam.Kucharski@Sun.COM     fallback 1
1179*8044SWilliam.Kucharski@Sun.COM
1180*8044SWilliam.Kucharski@Sun.COM   If, for any reason, the default entry doesn't work, fall back to the
1181*8044SWilliam.Kucharski@Sun.COMsecond one (this is rarely used, for obvious reasons).
1182*8044SWilliam.Kucharski@Sun.COM
1183*8044SWilliam.Kucharski@Sun.COM   Note that the complete descriptions of these commands, which are menu
1184*8044SWilliam.Kucharski@Sun.COMinterface specific, can be found in *Note Menu-specific commands::.
1185*8044SWilliam.Kucharski@Sun.COMOther descriptions can be found in *Note Commands::.
1186*8044SWilliam.Kucharski@Sun.COM
1187*8044SWilliam.Kucharski@Sun.COM   Now, on to the actual OS definitions. You will see that each entry
1188*8044SWilliam.Kucharski@Sun.COMbegins with a special command, `title' (*note title::), and the action
1189*8044SWilliam.Kucharski@Sun.COMis described after it. Note that there is no command `boot' (*note
1190*8044SWilliam.Kucharski@Sun.COMboot::) at the  end of each item. That is because GRUB automatically
1191*8044SWilliam.Kucharski@Sun.COMexecutes `boot' if it loads other commands successfully.
1192*8044SWilliam.Kucharski@Sun.COM
1193*8044SWilliam.Kucharski@Sun.COM   The argument for the command `title' is used to display a short
1194*8044SWilliam.Kucharski@Sun.COMtitle/description of the entry in the menu. Since `title' displays the
1195*8044SWilliam.Kucharski@Sun.COMargument as is, you can write basically anything there.
1196*8044SWilliam.Kucharski@Sun.COM
1197*8044SWilliam.Kucharski@Sun.COM     # For booting GNU/Hurd
1198*8044SWilliam.Kucharski@Sun.COM     title  GNU/Hurd
1199*8044SWilliam.Kucharski@Sun.COM     root   (hd0,0)
1200*8044SWilliam.Kucharski@Sun.COM     kernel /boot/gnumach.gz root=hd0s1
1201*8044SWilliam.Kucharski@Sun.COM     module /boot/serverboot.gz
1202*8044SWilliam.Kucharski@Sun.COM
1203*8044SWilliam.Kucharski@Sun.COM   This boots GNU/Hurd from the first hard disk.
1204*8044SWilliam.Kucharski@Sun.COM
1205*8044SWilliam.Kucharski@Sun.COM     # For booting GNU/Linux
1206*8044SWilliam.Kucharski@Sun.COM     title  GNU/Linux
1207*8044SWilliam.Kucharski@Sun.COM     kernel (hd1,0)/vmlinuz root=/dev/hdb1
1208*8044SWilliam.Kucharski@Sun.COM
1209*8044SWilliam.Kucharski@Sun.COM   This boots GNU/Linux, but from the second hard disk.
1210*8044SWilliam.Kucharski@Sun.COM
1211*8044SWilliam.Kucharski@Sun.COM     # For booting Mach (getting kernel from floppy)
1212*8044SWilliam.Kucharski@Sun.COM     title  Utah Mach4 multiboot
1213*8044SWilliam.Kucharski@Sun.COM     root   (hd0,2)
1214*8044SWilliam.Kucharski@Sun.COM     pause  Insert the diskette now^G!!
1215*8044SWilliam.Kucharski@Sun.COM     kernel (fd0)/boot/kernel root=hd0s3
1216*8044SWilliam.Kucharski@Sun.COM     module (fd0)/boot/bootstrap
1217*8044SWilliam.Kucharski@Sun.COM
1218*8044SWilliam.Kucharski@Sun.COM   This boots Mach with a kernel on a floppy, but the root filesystem at
1219*8044SWilliam.Kucharski@Sun.COMhd0s3. It also contains a `pause' line (*note pause::), which will
1220*8044SWilliam.Kucharski@Sun.COMcause GRUB to display a prompt and delay, before actually executing the
1221*8044SWilliam.Kucharski@Sun.COMrest of the commands and booting.
1222*8044SWilliam.Kucharski@Sun.COM
1223*8044SWilliam.Kucharski@Sun.COM     # For booting FreeBSD
1224*8044SWilliam.Kucharski@Sun.COM     title  FreeBSD
1225*8044SWilliam.Kucharski@Sun.COM     root   (hd0,2,a)
1226*8044SWilliam.Kucharski@Sun.COM     kernel /boot/loader
1227*8044SWilliam.Kucharski@Sun.COM
1228*8044SWilliam.Kucharski@Sun.COM   This item will boot FreeBSD kernel loaded from the `a' partition of
1229*8044SWilliam.Kucharski@Sun.COMthe third PC slice of the first hard disk.
1230*8044SWilliam.Kucharski@Sun.COM
1231*8044SWilliam.Kucharski@Sun.COM     # For booting OS/2
1232*8044SWilliam.Kucharski@Sun.COM     title OS/2
1233*8044SWilliam.Kucharski@Sun.COM     root  (hd0,1)
1234*8044SWilliam.Kucharski@Sun.COM     makeactive
1235*8044SWilliam.Kucharski@Sun.COM     # chainload OS/2 bootloader from the first sector
1236*8044SWilliam.Kucharski@Sun.COM     chainloader +1
1237*8044SWilliam.Kucharski@Sun.COM     # This is similar to "chainload", but loads a specific file
1238*8044SWilliam.Kucharski@Sun.COM     #chainloader /boot/chain.os2
1239*8044SWilliam.Kucharski@Sun.COM
1240*8044SWilliam.Kucharski@Sun.COM   This will boot OS/2, using a chain-loader (*note Chain-loading::).
1241*8044SWilliam.Kucharski@Sun.COM
1242*8044SWilliam.Kucharski@Sun.COM     # For booting Windows NT or Windows95
1243*8044SWilliam.Kucharski@Sun.COM     title Windows NT / Windows 95 boot menu
1244*8044SWilliam.Kucharski@Sun.COM     root        (hd0,0)
1245*8044SWilliam.Kucharski@Sun.COM     makeactive
1246*8044SWilliam.Kucharski@Sun.COM     chainloader +1
1247*8044SWilliam.Kucharski@Sun.COM     # For loading DOS if Windows NT is installed
1248*8044SWilliam.Kucharski@Sun.COM     # chainload /bootsect.dos
1249*8044SWilliam.Kucharski@Sun.COM
1250*8044SWilliam.Kucharski@Sun.COM   The same as the above, but for Windows.
1251*8044SWilliam.Kucharski@Sun.COM
1252*8044SWilliam.Kucharski@Sun.COM     # For installing GRUB into the hard disk
1253*8044SWilliam.Kucharski@Sun.COM     title Install GRUB into the hard disk
1254*8044SWilliam.Kucharski@Sun.COM     root    (hd0,0)
1255*8044SWilliam.Kucharski@Sun.COM     setup   (hd0)
1256*8044SWilliam.Kucharski@Sun.COM
1257*8044SWilliam.Kucharski@Sun.COM   This will just (re)install GRUB onto the hard disk.
1258*8044SWilliam.Kucharski@Sun.COM
1259*8044SWilliam.Kucharski@Sun.COM     # Change the colors.
1260*8044SWilliam.Kucharski@Sun.COM     title Change the colors
1261*8044SWilliam.Kucharski@Sun.COM     color light-green/brown blink-red/blue
1262*8044SWilliam.Kucharski@Sun.COM
1263*8044SWilliam.Kucharski@Sun.COM   In the last entry, the command `color' is used (*note color::), to
1264*8044SWilliam.Kucharski@Sun.COMchange the menu colors (try it!). This command is somewhat special,
1265*8044SWilliam.Kucharski@Sun.COMbecause it can be used both in the command-line and in the menu. GRUB
1266*8044SWilliam.Kucharski@Sun.COMhas several such commands, see *Note General commands::.
1267*8044SWilliam.Kucharski@Sun.COM
1268*8044SWilliam.Kucharski@Sun.COM   We hope that you now understand how to use the basic features of
1269*8044SWilliam.Kucharski@Sun.COMGRUB. To learn more about GRUB, see the following chapters.
1270*8044SWilliam.Kucharski@Sun.COM
1271*8044SWilliam.Kucharski@Sun.COM
1272*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: Network,  Next: Serial terminal,  Prev: Configuration,  Up: Top
1273*8044SWilliam.Kucharski@Sun.COM
1274*8044SWilliam.Kucharski@Sun.COMDownloading OS images from a network
1275*8044SWilliam.Kucharski@Sun.COM************************************
1276*8044SWilliam.Kucharski@Sun.COM
1277*8044SWilliam.Kucharski@Sun.COM   Although GRUB is a disk-based boot loader, it does provide network
1278*8044SWilliam.Kucharski@Sun.COMsupport. To use the network support, you need to enable at least one
1279*8044SWilliam.Kucharski@Sun.COMnetwork driver in the GRUB build process. For more information please
1280*8044SWilliam.Kucharski@Sun.COMsee `netboot/README.netboot' in the source distribution.
1281*8044SWilliam.Kucharski@Sun.COM
1282*8044SWilliam.Kucharski@Sun.COM* Menu:
1283*8044SWilliam.Kucharski@Sun.COM
1284*8044SWilliam.Kucharski@Sun.COM* General usage of network support::
1285*8044SWilliam.Kucharski@Sun.COM* Diskless::
1286*8044SWilliam.Kucharski@Sun.COM
1287*8044SWilliam.Kucharski@Sun.COM
1288*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: General usage of network support,  Next: Diskless,  Up: Network
1289*8044SWilliam.Kucharski@Sun.COM
1290*8044SWilliam.Kucharski@Sun.COMHow to set up your network
1291*8044SWilliam.Kucharski@Sun.COM==========================
1292*8044SWilliam.Kucharski@Sun.COM
1293*8044SWilliam.Kucharski@Sun.COM   GRUB requires a file server and optionally a server that will assign
1294*8044SWilliam.Kucharski@Sun.COMan IP address to the machine on which GRUB is running. For the former,
1295*8044SWilliam.Kucharski@Sun.COMonly TFTP is supported at the moment. The latter is either BOOTP, DHCP
1296*8044SWilliam.Kucharski@Sun.COMor a RARP server(1) (*note General usage of network
1297*8044SWilliam.Kucharski@Sun.COMsupport-Footnote-1::). It is not necessary to run both the servers on
1298*8044SWilliam.Kucharski@Sun.COMone computer. How to configure these servers is beyond the scope of this
1299*8044SWilliam.Kucharski@Sun.COMdocument, so please refer to the manuals specific to those
1300*8044SWilliam.Kucharski@Sun.COMprotocols/servers.
1301*8044SWilliam.Kucharski@Sun.COM
1302*8044SWilliam.Kucharski@Sun.COM   If you decided to use a server to assign an IP address, set up the
1303*8044SWilliam.Kucharski@Sun.COMserver and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp'
1304*8044SWilliam.Kucharski@Sun.COM(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will
1305*8044SWilliam.Kucharski@Sun.COMshow an assigned IP address, a netmask, an IP address for your TFTP
1306*8044SWilliam.Kucharski@Sun.COMserver and a gateway. If any of the addresses is wrong or it causes an
1307*8044SWilliam.Kucharski@Sun.COMerror, probably the configuration of your servers isn't set up properly.
1308*8044SWilliam.Kucharski@Sun.COM
1309*8044SWilliam.Kucharski@Sun.COM   Otherwise, run `ifconfig', like this:
1310*8044SWilliam.Kucharski@Sun.COM
1311*8044SWilliam.Kucharski@Sun.COM     grub> ifconfig --address=192.168.110.23 --server=192.168.110.14
1312*8044SWilliam.Kucharski@Sun.COM
1313*8044SWilliam.Kucharski@Sun.COM   You can also use `ifconfig' in conjuction with `bootp', `dhcp' or
1314*8044SWilliam.Kucharski@Sun.COM`rarp' (e.g. to reassign the server address manually). *Note
1315*8044SWilliam.Kucharski@Sun.COMifconfig::, for more details.
1316*8044SWilliam.Kucharski@Sun.COM
1317*8044SWilliam.Kucharski@Sun.COM   Finally, download your OS images from your network. The network can
1318*8044SWilliam.Kucharski@Sun.COMbe accessed using the network drive `(nd)'. Everything else is very
1319*8044SWilliam.Kucharski@Sun.COMsimilar to the normal instructions (*note Booting::).
1320*8044SWilliam.Kucharski@Sun.COM
1321*8044SWilliam.Kucharski@Sun.COM   Here is an example:
1322*8044SWilliam.Kucharski@Sun.COM
1323*8044SWilliam.Kucharski@Sun.COM     grub> bootp
1324*8044SWilliam.Kucharski@Sun.COM     Probing... [NE*000]
1325*8044SWilliam.Kucharski@Sun.COM     NE2000 base ...
1326*8044SWilliam.Kucharski@Sun.COM     Address: 192.168.110.23    Netmask: 255.255.255.0
1327*8044SWilliam.Kucharski@Sun.COM     Server: 192.168.110.14     Gateway: 192.168.110.1
1328*8044SWilliam.Kucharski@Sun.COM
1329*8044SWilliam.Kucharski@Sun.COM     grub> root (nd)
1330*8044SWilliam.Kucharski@Sun.COM     grub> kernel /tftproot/gnumach.gz root=sd0s1
1331*8044SWilliam.Kucharski@Sun.COM     grub> module /tftproot/serverboot.gz
1332*8044SWilliam.Kucharski@Sun.COM     grub> boot
1333*8044SWilliam.Kucharski@Sun.COM
1334*8044SWilliam.Kucharski@Sun.COM
1335*8044SWilliam.Kucharski@Sun.COMFile: grub.info,  Node: General usage of network support-Footnotes,  Up: General usage of network support
1336*8044SWilliam.Kucharski@Sun.COM
1337*8044SWilliam.Kucharski@Sun.COM   (1) RARP is not advised, since it cannot serve much information
1338*8044SWilliam.Kucharski@Sun.COM
1339