Using Early User Space

Early User Space

Early user space (or "INITRAMFS" for inital RAM filesystem) is a replacement for initial ram disk (initrd) in the 2.6 kernel series.

For developers the principal advantages of early user space are its tight integration with the kernel building process (there is no longer the need to take the extra step of binding a built kernel with a ram disk) and its flexibility - all that is necessary is to supply a process (which could be a shell script) called init in the root directory of the specified file system - allowing the simplified use of customised init processes.

Early user space can be used in the same way as an initrd - for instance to load device drivers before mounting a permanent root filesystem or as a working environment for a diskless system or for some other specialised purpose such as running a firewall/router.

Using Early User Space

What follows is not meant to be comprehensive guide to using early user space, but rather a brief introduction. An early user space how-to can be read [WWW] here.

The kernel build process will attempt to build in your early user space files if CONFIG_INITRAMFS_SOURCE points at either a cpio archive or to a directory. So, for instance, it is possible to build a busybox install and then point CONFIG_INITRAMFS_SOURCE at it. If the selected directory hierarchy contains an executable file called init in the root directory then the system should boot.

The init can simply be a symbolic link pointed at the executable - for instance, this is my setup:

drwxrwxr-x  2 adrian adrian 4096 Aug  4 19:25 bin
drwxrwxr-x  2 adrian adrian 4096 Jul 29 18:53 dev
drwxrwxr-x  2 adrian adrian 4096 Aug  4 23:09 etc
lrwxrwxrwx  1 adrian adrian    7 Aug 10 22:58 init -> linuxrc
lrwxrwxrwx  1 adrian adrian   11 Aug  4 19:25 linuxrc -> bin/busybox
drwxrwxr-x  2 adrian adrian 4096 Aug  4 23:08 proc
drwxrwxr-x  2 adrian adrian 4096 Aug  4 19:25 sbin
drwxrwxr-x  4 adrian adrian 4096 Jul 29 18:44 usr

In addition to CONFIG_INITRAMFS_SOURCE it is also necessary to set CONFIG_INITRAMFS_ROOT_UID and CONFIG_INITRAMFS_ROOT_GID - the kernel build process will complain if you haven't set them and force you to reconfigure the kernel.

Early user space also supports a slimmed down C library - klibc - to allow the construction of more sophisticated init applications. For more details please see the [WWW] klibc mailing list.

last edited 2005-11-16 03:44:34 by wmat