From 8b4dd784f7f85221ffb91f60cad95d2d0e1b9a3c Mon Sep 17 00:00:00 2001 From: okuji Date: Thu, 10 Aug 2000 02:23:04 +0000 Subject: [PATCH] rewrite the chapter Installation in the tutorial. --- ChangeLog | 7 ++++ docs/tutorial.texi | 98 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 89 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c28255349..c2b85b704 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-08-10 OKUJI Yoshinori + + * 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 * stage2/builtins.c [GRUB_UTIL]: Include stdio.h. diff --git a/docs/tutorial.texi b/docs/tutorial.texi index f4a57279d..07ed76930 100644 --- a/docs/tutorial.texi +++ b/docs/tutorial.texi @@ -130,10 +130,10 @@ First, you need to have GRUB itself properly installed on your system, as a package for your OS. 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 -shell}) on a UNIX-like OS, or by using the native Stage 2. These are -quite similar, however, the shell might probe a wrong BIOS drive, so -better be careful. +doing that - either using the utility @command{grub-install} +(@pxref{Invoking grub-install}) on a UNIX-like OS, or by using the +native Stage 2. These are quite similar, however, the utility might +probe a wrong BIOS drive, so better be careful. 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 @@ -145,13 +145,14 @@ GRUB comes with boot images, which are normally installed in the @file{/boot/grub}. @menu -* Installing GRUB on a floppy:: -* Installing GRUB on a hard disk:: +* Creating a GRUB boot floppy:: +* Installing GRUB natively:: +* Installing GRUB using grub-install:: @end menu -@node Installing GRUB on a floppy -@section Installing GRUB on a floppy +@node Creating a GRUB boot floppy +@section Creating a GRUB boot floppy 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 @@ -176,8 +177,8 @@ commands: The device filename may be different. Consult the manual for your OS. -@node Installing GRUB on a hard disk -@section Installing GRUB on a hard disk +@node Installing GRUB natively +@section Installing GRUB natively @quotation @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). If you decide to install GRUB in the native environment, which is -definitely desirable, you'll either need to create the GRUB boot disk, -and reboot your computer with it, or run the grub shell (@pxref{Invoking -the grub shell}) as the super-user (@samp{root}). +definitely desirable, you'll need to create the GRUB boot disk, and +reboot your computer with it. Otherwise, see @ref{Installing GRUB using +grub-install}, for more details. Once started, GRUB will show the command-line interface (@pxref{Command 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 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