Subject: booting ramdisked kernel via grub
To: None <netbsd-users@netbsd.org>
From: Csaba Henk <csaba-ml@creo.hu>
List: netbsd-users
Date: 03/08/2006 15:10:32
Hi!

My goal is to boot a NetBSD kernel with an embedded ramdisk root image
(on i386, with current tree). I've sort of accomplished this, following
the instructions of the superb

  http://www.bsdnewsletter.com/2003/09/Features102.html

tutorial, and with a kernel config which differs from GENERIC as
follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- sys/arch/i386/conf/GENERIC	Sat Feb 25 02:33:15 2006
+++ sys/arch/i386/conf/HCS2	Mon Mar  6 23:14:18 2006
@@ -24,6 +24,13 @@
 
 #ident 		"GENERIC-$Revision: 1.731 $"
 
+# Enable the hooks used for initializing the root memory-disk.
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
+options 	MEMORY_DISK_SERVER=1
+options 	MEMORY_DISK_ROOT_SIZE=8192	# size of memory disk, in blocks
+options		MEMORY_RBFLAGS=0            # don't force single user
+
 maxusers	32		# estimated number of users
 
 # CPU support.  At least one is REQUIRED.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Only booting is not as smooth as I'd like. It works if I burn the image
onto a CD (within a "-b cdboot" iso image), but I'd like to just drop
the image on my hard drive and boot from there with the help of grub.

The problem is that grub doesn't recognize it as a netbsd-elf kernel
image (despite the "--type=netbsd" option), it categorizes the image
as multiboot-elf and then gives up with error 13: "Invalid or
unsupported executable format".

Is there anything I missed? Magic number or special preparation step?
(Grub boots the GENERIC image from the sysutils/mklivecd-produced
"xtraeme" livecd like a charm, so guess using GENERIC as a starting
point should be fine...)

TIA...

Regards,
Csaba