In the OS world, each OS comes with its custom boot loader that knows how to load the kernel and how to pass the execution flow to it. These boot loaders often know very little about other OSes, so if you need a multi-OS environment, you have to install several different boot loaders. It is often tricky to get them to coexist and, even if you accomplish it, it's still annoying to chainload between them.
The GRUB developers wrote the Multiboot specification which aims to solve this problem. This specification defines an interface between a boot loader and the OS's kernel, so that any Multiboot-compliant boot loader can execute any Multiboot-compliant OS without knowing any of its internal details. There are several free OSes that already follow this specification, including GNU/Hurd, ForthOS, AtheOS or Syllable. (I'm sure there are many more.)
Although this is i386-specific, I think the idea is quite interesting. Therefore, I've started adapting the NetBSD kernel to this specification. I'm progressing (very) slowly, mostly because the lack of documentation on boot code, the complexity behind it and some bugs in GRUB! No matter what, I can boot a kernel directly from GRUB already, although it still lacks configuration (i.e., information about the boot device, memory mappings, etc.). Leave me some more days and I think it'll be ready :-)
What are those bugs in GRUB I said? The specification reserves some space in the Multiboot header to specify where in memory the image has to be loaded. This is required for a.out binaries but it is optional for ELF binaries... and optional means that GRUB forgets about it in the ELF case. Which is a pity because I must pass special information through there. To the curious ones, the kernel's text is mapped into the 0xc0100000 virtual address, but the boot loader must load it into the physical address 0x00100000 (because paging is not enabled and such high addresses are not available). Similarly for all the other segments.
I also hope to write a little boot(9) manual page as a result of this mini-project, explaining the overall NetBSD boot process (at least under i386). I'm sure many people could benefit from it.
Edit (23:49): Some typos and grammar incorrections pointed out by Amitai Schlair have been fixed.
Comments from the original Blogger-hosted post: