Grub and FreeBSD 4.9
George Hartzell
hartzell at kestrel.alerce.com
Wed May 19 09:40:51 PDT 2004
db writes:
> Hi all
>
> I'm trying to get grub working on my FreeBSD 4.9 test-box.
> [...]
Here's a description of how I did it, from the freebsd-current list in
late Februrary 2003. It was part of an ongoing thread that you might
find useful.
g.
George Hartzell writes:
> Andrew Boothman writes:
> > [...]
> > OK Guys, I think I'm still a little confused here.
> >
> > I've just had a few botched installs of GRUB so I think I need a little more
> > direction, if you could :)
> >
> > I've got GRUB on a floppy and it boots fine. If I type :
> > rootnoverify (hd0,0)
> > makeactive
> > chainloader +1
> > boot
> >
> > I get Win2k booted no problem!
> >
> > So, following the instructions in the Grub Manual, I typed
> > root(fd0)
> > setup(hd0)
> >
> > I remove the floppy from the drive and reboot
> >
> > On boot I get "Loading GRUB... Please Wait..." but after that I get "GRUB
> > Error 17" which according to the manual means that GRUB doesn't know how to
> > load the selected partition. Even though when I boot from the floppy it
> > starts no problem and I can type commands to get it to boot Win2k....
>
> That told it to install GRUB into the beginning of (hd0) [e.g. the
> Master Boot record], but configured it to use (fd0) as the root of the
> place to find stuff. Since the floppy wasn't in when you booted, it
> didn't do anything useful.
>
> There are some grub things that need to be on the disk that you give
> the "root" designation too, e.g. "stage1", etc...
>
> I don't know how/where to install those files into an NTFS partition,
> I assume that GRUB can read NTFS filesystems, and you could tuck them
> there, but I don't know for sure.
>
> Here's what I'd do.
>
> Get yourself booted into freebsd any way that you can.
>
> PRINT OUT THE INFORMATION ABOUT YOUR BIOS PARTITION TABLE AND YOUR
> FREEBSD DISKLABEL, AND SAVE IT. "fdisk -s" and "disklabel -r
> diskname" are your friends!!!!
>
> Build grub from the ports tree and install it. It installs all of the
> juicy bits into some directory in
> /usr/local/share/grub/i386-freebsd/..., which doesn't seem to be a
> place where grub can find it. I make a directory called /boot/grub
> and copy all of them there.
>
> Start grub (e.g. boot from your grub floppy). Under the 5.0 systems,
> GEOM is picky about letting you doink with disks that you have
> mounted, so you either need the "let me shoot myself in the foot
> sysctl patch
> (ftp://ftp.jurai.net/users/winter/patches/geom-foot.patch) or boot
> from something else (e.g. floppy, live cdrom, ...)
>
> Make sure that grub can see it's various interesting bits:
>
> grub> find /boot/grub/stage1
>
> and it should say:
>
> (hd0,1,a)
>
> assuming that you have Something Else (e.g. windows) in the first
> primary BIOS partition/slice, a set of FreeBSD slices in the second
> primary BIOS partition/slice, and the /boot/grub stuff is in the first
> ("a") BSD_DISKLABEL/slice.
>
> If you have the grub bits living in a Linux filesystem in the third
> primary BIOS partition, it'd say (hd0,2). If you had them in a Linux
> filesystem living in the first extended partition, it'd say (hd0,4),
> etc....
>
> That's the drive that you want to declare as your root, which just
> configures the low level grub code that "setup" installs so that it
> knows where to look for it's various useful bits.
>
> e.g.
>
> grub> root (hd0,1,a)
>
> Then you need to install grub onto somewhere where the computer will
> trip over it and boot it.
>
> One possibility is to install it into the master boot record, which
> would be:
>
> grub> setup (hd0)
>
> Here you boot process would be
>
> power on->bios->load the MBR which is really GRUB->grub loads its stage1,...
>
> Or you could leave a "normal" MBR at the beginning of the disk and
> install GRUB into the beginning of the FreeBSD BIOS partition
> (assuming that FreeBSD is in the second primary parition):
>
> grub> setup (hd0,1)
>
> If that's all that you do, thing's won't quite boot. You'll need to
> also mark that partition active, so that the stock MBR code will jump
> to it. I always do that by getting to this point, booting by hook or
> by crook (e.g. a grub boot floppy, a bootable freebsd CD, a bootable
> linux CD) and using some utility (e.g. partition magic from windows,
> fdisk from windows, fdisk from freebsd, fdisk or cfdisk from linux) to
> mark the partition active. I prefer partition magic because I believe
> that it has the most robust partition table integrity checks, but
> whatever you trust....
>
> Now, your boot process will look like:
>
> power on->bios->"real" MBR which jumps to the active parition -> (next line)
>
> ... -> GRUB at the beginning of active partition -> GRUB stage1,...
>
> When grub get's up and running, it'll look for a file called menu.lst
> (unless you override the name when you "setup") which contains the
> info for the boot menu. Here's mine (notice that there are a bunch of
> mutually exclusive things that I've tucked into the 3rd BIOS partition
> at various times and I just keep the info around for reference. As
> long as I don't actually choose any of the "wrong" selections, there's
> no trouble.
>
> default=0
> timeout=10
> title FreeBSD 4.7
> root (hd0,1,a)
> kernel /boot/loader
> title FreeBSD 5.0
> root (hd0,2,a)
> kernel /boot/loader
> title Redhat Linux 8.0
> root (hd0,2)
> kernel /boot/vmlinuz-2.4.18-14 ro root=/dev/hda3
> initrd /boot/initrd-2.4.18-14.img
> title Redhat Linux 8.0 (hires)
> root (hd0,2)
> kernel /boot/vmlinuz-2.4.18-14 ro root=/dev/hda3 vga=791
> initrd /boot/initrd-2.4.18-14.img
> title Windows 2000
> rootnoverify (hd0,0)
> chainloader +1
>
> > I then used "fdisk /mbr" on a Windows 98 boot disk to remove GRUB and get me
> > back to a normal Win2k boot. But that doesn't help me get FreeBSD dual
> > booting.....
> >
> > Can you offer any insight into how to make this work? I remember using GRUB
> > before and being very happy with it, but it was installed for me by
> > RedHat....
>
> *REMEMBER*
>
> run an "fdisk -s" and print out the output
> run and "disklabel -r ad0" (or whatever device) and print out the info.
>
> BEFORE you start playing around!!!!
>
> g.
>
>
>
>
> To Unsubscribe: send mail to majordomo at FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message
>
More information about the freebsd-hackers
mailing list