Subject: memory disk kernel help needed
To: None <tech-install@netbsd.org>
From: Jim Miller <jj1022@jcmco.com>
List: tech-install
Date: 03/23/2002 22:36:42
Hi,

I'm having a terrible time building a NetBSD/i386 1.5.2 memory disk
kernel.  The target system is an embedded system made by Soekris
Engineering and uses a compact flash flashcard as the boot disk.
NetBSD runs fine on this system in a 'normal' configuration where the
root filesystem is mounted directly from the flashcard.  My problem is
when I try to use a memory disk in the kernel as the root fs.

The NetBSD boot loader loads my memory disk kernel but as soon as it
is done loading it reboots - no messages, no panic, no debugger,
nothing.  I've used the commands in the install floppy Makefile as an
example but still have had no success.

My goal is to have the root filesystem on the memory disk with /,
/etc, /sbin, /dev, and /var.  The only "normal" filesystem will be
/usr mounted directly from the flashcard.

Thanks in advance for any help you might be able to provide.

Jim

--------excerpts from my ramdisk kernel config file:

# 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=0    # no userspace memory disk support
options         MINIROOTSIZE=34000      # size of memory disk, in blocks

pseudo-device   md              1       # memory disk device (ramdisk)

(NOTE: with the exception of the lines above, the kernel config is one
that I have booted successfully numerous times)

--------The final message from the memory disk kernel build:

ld -Ttext c0100000 -e start -X -o netbsd ${SYSTEM_OBJ} vers.o
text    data    bss     dec     hex     filename
927929  17468508        148148  18544585        11af7c9 netbsd

--------My memory disk image is stored in /image, 34000 blocks long:
--------(the netbsd in there is one that boots successfully when not
--------using a memory disk; I don't know that it is necessary)

buildbox# ls -l /image 
-rw-r--r--  1 root  wheel  17408000 Feb 19 22:02 /image
buildbox# vnconfig vnd0 /image 
buildbox# mount /dev/vnd0a /mnt
buildbox# ls /mnt
altroot boot    etc     mnt     root    stand   var
bin     dev     home    netbsd  sbin    tmp
buildbox# umount /mnt
buildbox# vnconfig -u vnd0

--------mdsetimage seems to have no complaints:

buildbox# mdsetimage -v /sys/arch/i386/compile/SOEKRIS.MD/netbsd /image 
got symbols from /sys/arch/i386/compile/SOEKRIS.MD/netbsd
mapped /sys/arch/i386/compile/SOEKRIS.MD/netbsd
/sys/arch/i386/compile/SOEKRIS.MD/netbsd is an ELF32 binary
_md_root_size is at offset 0xecae0 in /sys/arch/i386/compile/SOEKRIS.MD/netbsd
_md_root_size has value 0x109a000
_md_root_image is at offset 0xecb00 in /sys/arch/i386/compile/SOEKRIS.MD/netbsd
copying image from /image into /sys/arch/i386/compile/SOEKRIS.MD/netbsd
done copying image
exiting
buildbox# 

--------my Sandisk CF adapter appears as sd0, and I copy the memory disk
--------kernel over to the bootable "a" partition with is nothing but
--------a bootblock and the memory disk kernel:

buildbox# mount /dev/sd0a /flashcard
buildbox# cp /sys/arch/i386/compile/SOEKRIS.MD/netbsd /flashcard
buildbox# ls -l /flashcard
total 18177
-r--------  1 root     wheel     40960 Mar  9 18:21 boot
-rwxr-xr-x  1 jmiller  wsrc   18542003 Mar  9 19:32 netbsd
drwxrwxrwx  3 root     wheel       512 Mar  9 18:20 usr
buildbox# umount /flashcard
buildbox# 

--------soekris board finds the biosboot_com0 loader OK and loads an ~18MB
--------kernel, then reboots:

 5 Seconds to automatic boot.   Press Ctrl-P for entering Monitor.


>> NetBSD/i386 BIOS Boot, Revision 2.7
>> (he@hamster.urc.uninett.no, Sat Aug 18 05:01:30 CEST 2001)
>> Memory: 639/64512 k
Use hd1a:netbsd to boot sd0 when wd0 is also installed
Press return to boot now, any other key for boot menu
booting wd0a:netbsd - starting in 0 
927933+17468508+148152 [65+77104+58027]=0x11d19b8


POST: 0123456789bcdefghiajklnop