The need for the "a.out kludge" came from two different problems:
- The kernel's ELF image was incorrectly linked because it did not set the correct physical load addresses for the segments it contained, thus GRUB could not load it because it thought there was not enough memory.
The "a.out kludge" was used here to tell the boot loader which was the correct address to load the binary image into. Pavel Cahyna fixed this issue back in May, removing the need for the hack in this specific case. - The native boot loader constructs a minimal ELF image that contains the kernel symbol table (ksyms) and sticks it just after the BSS space in memory. GRUB did not do this so the NetBSD kernel resorted to manually creating this image itself based on the data passed in by GRUB. In order to be successful, some space was reserved after the BSS section by using the "a.out kludge" (tricking the bootloader to think that this section was larger than it actually was) so that the kernel's bootstrapping process could freely access it. Pavel's fix did not address this problem so, when booting a NetBSD Multiboot kernel with an unpatched GRUB, ksyms did not work.
The results are much clearer and less error-prone code as well as the ability to boot NetBSD straight from a stock GRUB installation! Keep in mind that this will go into 4.0, so setting up dual-boot machines will be easier than ever :-)
I've prepared a couple of screenshots for your pleasure. First, a look at the configuration used to boot a Multiboot-enabled NetBSD kernel:
And then a look at the messages printed by the kernel as well as a demonstration that ksyms work by invoking a backtrace in the debugger (ddb):