[PATCH 0/3][try 1] init: enable system-on-initramfs

From: Bodo Eggert
Date: Fri Jul 13 2007 - 14:56:41 EST


I toyed with setting up a diskless system in initramfs. In the process, I
came across some things:

1) There is no way to have the kernel not mount a filesystem,
unless you use /init or rdinit=.

1a) In the process of writing these patches, I found prepare_namespace not to
be called if /init is present. prepare_namespace will call
security_sb_post_mountroot after mounting the root fs. I did not yet see
a way to call this from /init, and grepping kinit for "security" did not
help, too.

This is probably a bug, but using the features of this patchset, you'll
avoid hitting it. Therefore this patchset does nothing about that.

2) If you want to use tmpfs, you need a script which essentially duplicates
the work the kernel just did: Mount the root fs, unpack or move the files.
Using tmpfs instead for the first root mount is as cheap as using ramfs,
as long as tmpfs is used anyway (and most likely it is).

2a) I figured if you prepared the root fs to contain a running system, you
woud probably also set up a runnable system on it. Therefore I changed
the default to boot from tmpfs if there was no /init nor a root= option.
(If there is a /init, it will be executed as usural.)

Unfortunately the way I do it, this will override the rdev setting, but
that should be OK, since rdev is dead. Isn't it?

3) While I was at it, I figured I would not need most of the init/mount*
code anymore. Therefore I made patch 3, which ifdefs it out as far as
possible while still aiming for a small change.

Patch 1 adds the capability to use root=rootfs.
Patch 2 adds the capability to use tmpfs for root, default root=rootfs.
ramfs becomes optional if rootfs=tmpfs.
Patch 3 allows to remove the capability of automounting filesystems.

All patches appyl to 2.6.22.1
--
Fun things to slip into your budget
Remuneration compensation upgrade. (otherwise called a pay raise).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/