Subject: Re: NetBSD and root fs
To: Marcin Jessa <lists@yazzy.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-embed
Date: 03/30/2005 16:23:09
On Wed, 30 Mar 2005, Marcin Jessa wrote:
> How can I do the same on NetBSD? How can I tell it where to find the root fs?
> My kernel config already has the options but it doesn't seem to be of help:
>
> 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=20480      # size of memory disk, in blocks

This looks good. What it does is reserve space in the kernel, where you 
can put a filesystem (ramdisk) with (I think) mdsetimage(8).

The full story is hidden in a (small) maze of Makefile(-fragment)s in 
src/distrib. Besides mdsetimage(8), makefs(8) may be interesting to look 
at. Maybe it's even possible with these two to get a working solution, I 
don't know.

If you want an example that builds a custom ramdisk, puts it into a kernel 
and makes a bootable floppy(set) + CD from it, have a look at g4u: Sources 
are at http://www.feyrer.de/g4u/g4u-2.0.tgz, instructions for rebuilding 
are at http://www.feyrer.de/g4u/#rebuilding. (Beware, I haven't tried this 
with latest -current sources; my whole g4u build tree went down in flames 
in a disk crash recently; whenever I go back to g4u development, I'll have 
to start with the above sources too. Let me know if there's something 
missing! :).


> What I get on my soekris is it loads the kernel and stops, which IMO is becouse it cannot find the init binary:
>
> NetBSD/i386 ffsv1 Primary Bootstrap
>
>>> NetBSD/i386 BIOS Boot, Revision 3.1
>>> (builds@build, Wed Dec  1 10:39:14 UTC 2004)
>>> Memory: 639/64512 k
> Press return to boot now, any other key for boot menu
> booting hd0a:netbsd - starting in 0
> open netbsd: No such file or directory

init? I'd say it doesn't find "netbsd" (== the kernel), so you don't get 
far enough to mount any root filesystem or start init or anything. Try 
interrupting the countdown, and try "ls" etc. to see what's on the disk 
(more help with "help").

For educational purpose, I recommend booting NetBSD on a "normal" PC once 
so you can see what the boot process should look. :)
Also, I've found qemu (http://fabrice.bellard.free.fr/qemu/) a fantastic 
toy when playing with kernels on i386 (which the soekris basically is).


  - Hubert

-- 
NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)