Subject: Adding Multiboot support (or not)
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 12/28/2005 17:25:34
Hi all,

[ I'm not sure if this is the correct list to send this message or if it
  should have gone to port-i386... ]

The GRUB [1] developers came up with the idea of designing a
"standard" protocol between boot loaders and OS kernels, known
as the Multiboot Specification [2] (I'll use MB for simplicity).  The
idea behind this protocol is to enable any MB-compliant boot loader
to execute a MB-compliant kernel without knowing any of its
internal details.  (This way, you'd install your boot loader of choice
and have it load any OS without "dirty tricks".)

I think the idea is quite interesting and it could simplify the boot
process on machines with multiple OSes installed in them (think of
chainloading several bootloaders, one after the other).  This is
why I've spent the last two days trying to adapt the NetBSD kernel
to support MB.

Basically, the following is needed:

- Add a little header within the first 8K of the kernel.
- Add some new code to process the MB information structure passed
  by the loader and generate the appropriate information required by
  the NetBSD kernel (aka, bootinfo structures and such).
- Fix a bug in GRUB, heh.

Note that this does not change the traditional boot process at all and
that it's completely optional based on a kernel option.  Also note that,
at the moment, it is i386 specific; however, GRUB 2 will possibly work on
more platforms, so it'd be possibly extended to them in a future, too.

I've uploaded a proof of concept to:

    ftp://ftp.NetBSD.org/pub/NetBSD/misc/jmmv/multiboot.diff

but keep in mind that there is still a lot of work to do before this
can be considered "good" or "correct".  It currently lacks multiple feature=
s
but it already allows GRUB (or, theorically, any other MB-compliant boot
loader) to boot a NetBSD kernel directly.

I'm sending this mail because I'd like to know if this will be accepted or
not before I spend too much time on it (I'll certainly have to spend severa=
l
more days to get it right).

1: http://www.gnu.org/software/grub/
2: http://www.gnu.org/software/grub/manual/multiboot/

Thanks,

--
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/
The NetBSD Project - http://www.NetBSD.org/