blob: 07d428ee07acf855aa3130e1c535d0e5b6353362 [file] [log] [blame] [raw]
<HTML>
<HEAD>
<TITLE>GRUB Installation Guide</TITLE>
</HEAD>
<BODY>
<CENTER><H1>GRUB Installation Guide</H1></CENTER>
<CENTER><H3>by
<A HREF=http://www.uruk.org/~erich/>Erich Boleyn</A></H3></CENTER>
<HR>
<H2>Contents</H2>
<UL>
<LI><A HREF="#raw">Install using "rawrite" or "dd" to floppy disk</A>
<LI><A HREF="#automated">Automated Install using GRUB</A>
</UL>
<H3>Getting Started Quickly</H3>
If you just want to use GRUB, or simply try it out quickly, try the
<A HREF="#raw">Install using "rawrite" or "dd" to floppy disk</A> in the
following section to create a "raw" GRUB floppy.<P>
<HR>
<H2><A NAME="raw">Install using "rawrite" or "dd" to floppy disk</A></H2>
This installation method can generally only access the command-line
part of the interface (since there is no filesystem in which to
find a config-file). It is also by far the simplest installation
method to get going.<P>
<B>NOTE:</B> This will destroy any data currently on the floppy.<P>
Execute your OS's equivalent of (this should work for recent FreeBSD
versions and Linux just fine):<P>
<pre>
dd if=bin/stage1 of=/dev/fd0 bs=512 count=1
dd if=bin/stage2 of=/dev/fd0 bs=512 seek=1
</pre>
Under <B>DOS/Windows/NT</B>, courtesy of Eric
Hanchrow (erich@microsoft.com):
<UL>
<LI>Use the <B>copy /b</B> command to binary concatenate the stage1
and stage2 files together via:
<pre>
copy /b stage1 + stage2 grub.raw
</pre>
<LI>Use rawrite.exe (which is available in many places on the net and in
some Linux distributions) to write grub.raw to a floppy.
</UL>
<HR>
<H2><A NAME="automated">Automated Install using GRUB</A></H2>
<B>IMPORTANT NOTE:</B> If the stage1 is installed on a specific
partition, this can erase the normal boot-sector used by an OS.
GRUB can boot Linux, FreeBSD, NetBSD, Mach, and the GNU HURD directly,
so this may be desired. Generally, it is a good idea to back up the
first sector of a partition if installing GRUB's stage1 there.
For the first sector of a hard disk, this is OK, since it's easy
to reinitialize it via "FDISK /MBR" in DOS, or other methods in other
OSes.<P>
GRUB has a command called "install=" which is described in
the <A HREF=commands.txt>list of commands</A>. The purpose
of this section is to give examples and describe how to use the command
in different situations.<P>
<B>NOTE:</B> Given that "install=" can be used in config-file entries,
this could very easily be used as part of a completely automated set of
install scripts for an OS.<P>
First, you make a "raw" GRUB floppy created via <A HREF="#raw">Install
using "rawrite" or "dd" to floppy disk</A> above. Actually, any booting
copy of GRUB of the right version number will work fine, this is simply
a way to get the process started easily.<P>
On the partition that is the desired area for GRUB to be installed in
(call it the "install partition"), make a "/boot/grub" directory and
place the stage2 and menu.lst (config file) there. (If desired, place
a stage1.5 there as well)<P>
Now use the "install=" command appropriately, and you're done!<P>
Examples of how to use the "install=" command:<P>
<UL>
<LI><B>Making a Hard Disk bootable with GRUB's stage2 on PC partition
number 2:</B> Make a directory in the partition called "/boot/grub",
place the stage2 (and if desired, your config file called "menu.lst"),
then run the following command after getting GRUB's command-line from
booting the floppy:
<pre>
install= (fd0)+1 (hd0) (hd0,2)/boot/grub/stage2 0x8000 p
</pre>
This tells GRUB to grab the first sector of the floppy and use it as
the stage1, create a blocklist using the file "/boot/grub/stage2" on
the first hard disk, partition number 2, merge them together, set the
load address to 0x8000 (correct for a stage2), write the "install
partition" number into the first sector of the stage2 (the "p" at the
end), then write the result to the first sector of the hard disk.<P>
<LI><B>Same as above, but placing the stage1 on the floppy, then having
it start the stage2 on the hard disk:</B> The difference here is you're
telling GRUB's stage1 to read from the first hard disk no matter where
stage1 is being run from:
<pre>
install= (fd0)+1 d (fd0) (hd0,2)/boot/grub/stage2 0x8000 p
</pre>
The "d" option near the beginning is what sets the "forced" loading
from the disk where the stage2 was installed from. The rest of the
options are the same except for the "destination device" to place the
finished stage1 on is changed to the floppy disk.<P>
<LI><B>Installing from an "install directory" to the second hard disk:</B>
Here we're loading the stage1 from a file on the first hard disk,
installing stage2 from the first BSD "a" partition on the second hard disk,
and setting the "config file" of the stage2 to a different value than
usual:
<pre>
install= (hd0,2)/boot/grub/stage1 (hd1) (hd1,a)/boot/grub/stage2 0x8000 p /grubdir/configfile
</pre>
</UL>
An easily imaginable way of using this as part of an automated
installation process would be to note that the commands listed above
can be part of any sequence of commands in an entry in a GRUB config
file, so this could be automated even more by using a GRUB floppy with
a filesystem and config file, with an entry such as:<P>
<pre>
# Start of entries
title= Linux HD install
# install command
install= (fd0)+1 (hd0) (hd0,1)/boot/grub/stage2 0x8000 p
# actually boot here
root= (hd0,1)
kernel= /zImage root=/dev/hda2
</pre>
...then have the install script continue from there after boot of the OS.<P>
<HR>
<A HREF=mailto:erich@uruk.org><I>erich@uruk.org</I></A><P>
</BODY>
</HTML>