tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cgd on root

On Sun, Feb 10, 2008 at 02:03:20PM +0100, Jan Danielsson wrote:
 >    The big question is where to store the cgd parameter file. My goal is
 > to be able to boot from an USB memory stick. It should contain the
 > kernel I boot from, and the parameter file, so I have a separation
 > between the hard drive containing the root, and the parameter file.
 >    But how do I read the parameter file without a root file system (I
 > don't want to have to mount root on the memory key, because then I'd be
 > stuck with it, afaict. And a memory disk would just lead to the troubles
 > of init.root).

The Linux solution is to create a memory disk image, load it with the
kernel, mount it as root, then after the real root is ready, pick the
memory disk ("initrd") up and slip the real root in while nobody's
looking. I have never liked this, because the substitution is ugly and
the initrd images are hard to work with and create management hassles.

There's a hack that can make this kind of approach less unpleasant: in
principle one can have a fs without mounting root, by making it
proc0's current directory. This would allow loading keys or whatnot
from ".". Accesses to "/" would yield ENOENT. Then after mounting root
it can be told to go away.

Right now, the namei code would need some attention to make this work
(but relatively speaking, not much) and I'm not sure if the code that
keeps track of mounted filesystems can handle this either, but I don't
think it would be that difficult a hack.

Then you could do something like 

   config netbsd moot on wd0a type ? root on cgd0a type ?

to set it up.

David A. Holland

Home | Main Index | Thread Index | Old Index