compiling root filesystem into kernel (preferably tmpfs root filesystem)

Travis Daygale anti_spamsys at yahoo.com
Sat Apr 4 13:18:56 PDT 2009


In both the loader and kernel compiling doc, I see snippets of information like this:
#Make space in the kernel for a root filesystem on a md device.options MD_ROOT_SIZE=10
boot_dfltrootInstructs the kernel to mount the statically compiled-in root file system.

My question is, how does one compile a root filesystem into the FreeBSD kernel?  When mounted, I want this root filesystem to run entirely in memory with no other backing store (not even a readonly flash disc nor other backing media such as DVD/CD).
The standard FreeBSD DVD install disc uses just such a root?  (Though seems to rely heavily on the rescue binaries being on a read only filesystem backed by the install DVD?) I'm still trying to reverse engineer how that was done, without much luck.  
Is there a place/documentation I should be finding?  PicoBSD, NanoBSD, NFS root diskless systems... all tantalizing close, but not the same thing (read only roots backed by media other than memory).
The root filesystem I'm wanting would presumably be in some conceptual sense similar to initramfs in Linux land, if that helps explain what I'm trying to achieve.  In fact I have a Linux distribution which consists of a single giant kernel image and when boot, runs entirely in memory, the kernel in fact can't read filesystems other than tmpfs because no filesystems are compiled in.  It appears all of this won't be possible in FreeBSD (looks like ufs is required) but it appears I can get close to this.
Indeed, I'd love a way for the root filesystem in FreeBSD to be of type tmpfs, again similar to what is possible on the Linux side, though I'm much less concerned with the type of filesystem (it just needs to be compiled into the FreeBSD kernel and needs to be a memory backed filesystem when it mounts, no other backing store).
Thanks in advance!
Trever



      


More information about the freebsd-hackers mailing list