Messages in this thread |  | | Date | Mon, 30 Oct 2000 22:06:44 -0500 | From | Matt Yourst <> | Subject | Re: / on ramfs, possible? [yes! - patch included] |
| |
Hi,
I read your post and I think I have just what you're looking for. I've attached a patch that allows you to mount root as ramfs and populate it directly from a tar archive (specified just like an initrd image, but without having to deal with a fixed-size initrd or pivot_root at all.) This was based on some earlier work from the Linux router project that I rewrote and ported to 2.2 and 2.4 a few months ago. I didn't post it to the list since I figured it was too late for 2.4.0, but if you're interested, here it is.
Here's the Configure.help description:
CONFIG_RAMFS_ROOT Allow the kernel to mount a ramfs namespace as the root filesystem or as a pre-root filesystem for running a /linuxrc script (similar to how initial RAM disk (initrd) support works.)
Since ramfs has no physical or virtual block device to provide its data as an initrd image would, you must provide a standard tar format archive to be extracted into the empty ramfs root filesystem. Currently this tar archive may *not* be compressed (i.e., tar.gz style); if compression is desired, use a bootloader with automatic gunzip support such as GRUB.
To specify the tar archive used to build the root filesystem, use the initrd=<filename> kernel command line option (except with a tar archive instead of a real ext2/minix/romfs filesystem image.)
To mount the tar archive as the actual root filesystem, specify the same initrd=<filename> option above and also include "root=/dev/ramfs" in the kernel command line.
You may enable both this option and initrd support; however, if a tar archive is detected instead of an initrd-supported filesystem image, this option will override initrd support.
Note: Some versions of GNU tar create invalid archives that cannot be extracted by the kernel. In particular, tar may add a file to an archive without previously adding its containing directory. If your ramfs archive does not mount correctly because of this, try creating it in another way or with another file order.
(Patch should apply to 2.4.0-test10-pre6 on i386. It needs to be updated for other architectures, mostly in setup.c though.)
I hope this is helpful. Maybe the maintainers would like to comment on this too (i.e., might it be considered for 2.4.1, etc.?)
- Matt Yourst
------------------------------------------------------------- Matt T. Yourst Massachusetts Institute of Technology yourst@mit.edu 617.225.7690 513 French House - 476 Memorial Drive - Cambridge, MA 02136 -------------------------------------------------------------[unhandled content-type:application/octet-stream] |  |