Booting FreeBSD with grub
Booting FreeBSD with grub
08. Nov. 2000
1 What is grub?
- is a bootloader which is compliant to the multiboot standard.
- understands filesystems (FFS, FAT16, FAT32, minixfs, ext2fs)
- is able to boot a multitude of OS's.
- is able to boot from the net (RARP, BOOTP, DHCP)
- gets around the 1024 cylinder limitation.
- has a boot menu, which can be configured by editing a file.
- also has a commandline interface, which is accessible during the boot
- has an integrated help system. When pressing the tab-key, possible
completions of entered commands are suggested.
2 Preparing the installation of grub
2.1 Getting grub
I was never able to compile grub from source on a FreeBSD system before
release 4.0. Therefore I used to rip grub out of a Debian Linux distribution.
Nowadays you can download a precompiled copy from ftp://alpha.gnu.org/gnu/grub/.
The last version I used is: grub-0.5.96.1-i386-pc.tar.gz
There is even a working port in the port collection now.
2.2 Putting the files
Unzip and detar the tarball by:
Now change to the directory /boot generate a subdirectory named grub
and copy the files stage1, stage2, and menu.lst into the new directory.
# tar zxvf ./grub-0.5.96.1-i386-pc.tar.gz
$ cd /boot
# su toor
# mkdir grub
# cd grub
# cp /path_to_grub/grub-0.5.96.1-i386-pc/stage1 .
# cp path_to_grub/grub-0.5.96.1-i386-pc/stage2 .
# cp /path_to_grub/grub-0.5.96.1-i386-pc/menu.lst .
2.3 Editing menu.lst
Edit the file /boot/grub/menu.lst should contain the following contents:
Remarks: The install string should reflect your personal
system. On my machine FreeBSD resides on the second SCSI disk sd1
and I prefer to boot from floppy disk.
# For booting FreeBSD
# For booting Windows NT or Windows95
title Windows NT / Windows 95 boot menu
# For loading DOS if Windows NT is installed
# chainload /bootsect.dos
The same as the above, just for Windows.
# For installing GRUB into the hard disk
title Install GRUB into the hard disk
Older versions of grub could not load the new ELF-kernel of FreeBSD.
Therefore it was neccessary to boot the kernel indirectly via /boot/loader.
Even now this is the preferred method, because of the many useful
features of /boot/loader.
2.4 Generating the bootable install disk
Since I could not compile grub under FreeBSD the final installation
has to be done via the boot disk (otherwise you could use the grub
Insert a floppy disk into your drive and issue the commands:
If everything worked you should have now a bootable install disk for
booting from floppy.
# cd /boot/grub
# dd if=stage1 of=/dev/fd0 bs=512 count=1
# dd if=stage2 of /dev/fd0 bs=512 seek=1
3 Installing grub
Reboot your machine and wait until you are in the grub shell. Then
enter (all on one line):
The first parts tells grub where to find its stage1. The second part
tells grub to install its bootsector on a floppy (fd0) (insert
a new one before hitting return, if you want to keep your install
disk). The third part tells where to find stage2 and the last part
tells where the menu file resides. I omitted the part with 0x8000
p, if you want to know more read the manual. One interesting point:
the d in front of (fd0) is described as optional
in the manual, but all installations I tried failed when this option
(hd1,a)/boot/grub/stage2 0x8000 p
- Grub's Home: http://www.gnu.org/software/grub/grub.en.html
- Download grub: ftp://alpha.gnu.org/gnu/grub/
- The grub manual: http://www.mcc.ac.uk/grub/grub_toc.html
- Erik Boleyn's original grub: http://www.uruk.org/~erich/grub/
File translated from
On 7 Mar 2001, 21:37.