rewrite the chapter Installation in the tutorial.

This commit is contained in:
okuji 2000-08-10 02:23:04 +00:00
parent 7ab4e9c240
commit 8b4dd784f7
2 changed files with 89 additions and 16 deletions

View file

@ -1,3 +1,10 @@
2000-08-10 OKUJI Yoshinori <okuji@gnu.org>
* docs/tutorial.texi (Installation): Divided into three sections
instead of two sections. Don't describe the usage of the the
grub shell any longer. Instead, how to use grub-install is
documented.
2000-08-09 OKUJI Yoshinori <okuji@gnu.org> 2000-08-09 OKUJI Yoshinori <okuji@gnu.org>
* stage2/builtins.c [GRUB_UTIL]: Include stdio.h. * stage2/builtins.c [GRUB_UTIL]: Include stdio.h.

View file

@ -130,10 +130,10 @@ First, you need to have GRUB itself properly installed on your system,
as a package for your OS. as a package for your OS.
To use GRUB, you need to install it on your drive. There are two ways of To use GRUB, you need to install it on your drive. There are two ways of
doing that - either using the grub shell (@pxref{Invoking the grub doing that - either using the utility @command{grub-install}
shell}) on a UNIX-like OS, or by using the native Stage 2. These are (@pxref{Invoking grub-install}) on a UNIX-like OS, or by using the
quite similar, however, the shell might probe a wrong BIOS drive, so native Stage 2. These are quite similar, however, the utility might
better be careful. probe a wrong BIOS drive, so better be careful.
Also, if you install GRUB on a UNIX-like OS, please make sure that you Also, if you install GRUB on a UNIX-like OS, please make sure that you
have an emergency boot disk ready, so that you can rescue your computer have an emergency boot disk ready, so that you can rescue your computer
@ -145,13 +145,14 @@ GRUB comes with boot images, which are normally installed in the
@file{/boot/grub}. @file{/boot/grub}.
@menu @menu
* Installing GRUB on a floppy:: * Creating a GRUB boot floppy::
* Installing GRUB on a hard disk:: * Installing GRUB natively::
* Installing GRUB using grub-install::
@end menu @end menu
@node Installing GRUB on a floppy @node Creating a GRUB boot floppy
@section Installing GRUB on a floppy @section Creating a GRUB boot floppy
To create a GRUB boot floppy, you need to take the files @file{stage1} To create a GRUB boot floppy, you need to take the files @file{stage1}
and @file{stage2} from @file{/boot/grub} directory, and write them to and @file{stage2} from @file{/boot/grub} directory, and write them to
@ -176,8 +177,8 @@ commands:
The device filename may be different. Consult the manual for your OS. The device filename may be different. Consult the manual for your OS.
@node Installing GRUB on a hard disk @node Installing GRUB natively
@section Installing GRUB on a hard disk @section Installing GRUB natively
@quotation @quotation
@strong{Caution:} Installing GRUB's stage1 in this manner will erase the @strong{Caution:} Installing GRUB's stage1 in this manner will erase the
@ -192,9 +193,9 @@ are installing GRUB on the first sector of a hard disk, since it's easy
to reinitialize it (e.g. by running @samp{FDISK /MBR} from DOS). to reinitialize it (e.g. by running @samp{FDISK /MBR} from DOS).
If you decide to install GRUB in the native environment, which is If you decide to install GRUB in the native environment, which is
definitely desirable, you'll either need to create the GRUB boot disk, definitely desirable, you'll need to create the GRUB boot disk, and
and reboot your computer with it, or run the grub shell (@pxref{Invoking reboot your computer with it. Otherwise, see @ref{Installing GRUB using
the grub shell}) as the super-user (@samp{root}). grub-install}, for more details.
Once started, GRUB will show the command-line interface (@pxref{Command Once started, GRUB will show the command-line interface (@pxref{Command
line}). First, set the GRUB's @dfn{root device}@footnote{Note that line}). First, set the GRUB's @dfn{root device}@footnote{Note that
@ -237,10 +238,75 @@ If you install GRUB into a partition or a drive other than the first
one, you must chain-load GRUB from another boot loader. Refer to the one, you must chain-load GRUB from another boot loader. Refer to the
manual for the boot loader to know how to chain-load GRUB. manual for the boot loader to know how to chain-load GRUB.
@c FIXME: you should specify --force-lba when... Now you can boot GRUB without a GRUB floppy. See the chapter
@ref{Booting} to find out how to boot your operating systems from GRUB.
That's all: now you can boot GRUB without a GRUB floppy. See the next
chapter to find out how to boot your operating systems from GRUB. @node Installing GRUB using grub-install
@section Installing GRUB using grub-install
Unfortunately, if you do want to install GRUB under a UNIX-like OS (such
as @sc{gnu}), invoke the program @command{grub-install} as the superuser
(@dfn{root}).
The usage is basically very easy. You only need to specify one argument
to the program, namely, where to install GRUB. The argument can be
either of a device file or a GRUB's drive/partition. So, this will
install GRUB into the MBR of the first IDE disk under Linux:
@example
# grub-install /dev/hda
@end example
Likewise, under Hurd, this has the same effect:
@example
# grub-install /dev/hd0
@end example
If it is the first BIOS drive, this is the same as well:
@example
# grub-install '(hd0)'
@end example
But all the above examples assume that you use GRUB images under
the root directory. If you want GRUB to use images under a directory
other than the root directory, you need to specify the option
@option{--root-directory}. The typical usage is that you create a GRUB
boot floppy with a filesystem. Here is an example:
@example
@group
# mke2fs /dev/fd0
# mount -t ext2 /dev/fd0 /mnt
# grub-install --root-directory=/mnt '(fd0)'
# umount /mnt
@end group
@end example
Another example is in case that you have a separate boot partition
which is mounted at @file{/boot}. Since GRUB is a boot loader, it
doesn't know anything about mountpoints at all. Thus, you need to run
@command{grub-install} like this:
@example
# grub-install --root-directory=/boot /dev/hda
@end example
By the way, as you may already know, it is quite difficult to guess BIOS
drives correctly under a UNIX-like OS. Thus, @command{grub-install} will
prompt you to check if it could really guess the correct mappings, after
the installation. The format is defined in @ref{Device map}. Please be
careful enough. If the output is wrong, it is unlikely that your
computer can boot with no problem.
Note that @command{grub-install} is actually just a shell script and the
real task is done by the grub shell @command{grub} (@pxref{Invoking the
grub shell}). Therefore, you may run @command{grub} directly to install
GRUB, without using @command{grub-install}. Don't do that, however,
unless you are very familiar with the internal of GRUB. Installing a
boot loader under UNIX is so dangerous.
@node Booting @node Booting