Subject: Re: @booted_kernel magic symlink?
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 04/29/2006 00:06:42
>>> [.../kern/rootdev...]
>> Of course, this doesn't help the case where your rootdev isn't
>> present in /dev (whether because you booted from somewhere unusual
>> or because /dev is not fully populated), which is when you need it
>> most.  I'll definitely have to look at fixing it.
> yeah - hence my comment about it being largely useless.
> fixes would be great!

Heh.

I hacked on it a bit, trying to fix it.  I reached a point where I had
it working in that you could mount /kern/rootdev on /, even though
anything that tries to stat it, such as ls -l, returns EBADF (this
comes from spec_getattr, which is genfs_ebadf).

Then, remembering that I hadn't actually tried it before, I booted my
previous kernel, without my changes.  It behaves the same way.

This was with a fairly old kernel (my mutant 1.4T); I've tried 2.0 and
find it behaves basically the same way (I can't use mount, because it
tries to open/stat/something the device, but "mount_ffs -o update
/kern/rootdev /" works fine).  I don't have any easy way to try
anything newer.

Have you actually tried mounting /kern/rootdev on /, or have you just
assumed that because ls -l shows EBADF, it won't work?  If you aren't
sure you've tried it, try it.  You may be surprised.

I certainly was.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B