|This is not a reference document, it's an old design document that, at least in part, led to procd|
This article attempts to state what the initscripts must and should do for the new init system being developed for OpenWrt. The goal is to deal with the race conditions that currently can occur, without losing current functionality.
The Boot process currently consists of the kernel bootstrap (not discussed here), preinit, and init. Preinit takes care of things that init can't function without, while init is responsible for starting up the rest of the system.
On a Debian desktop system there is an analogue to preinit, which uses initramfs to bring up the system enough to the point init can operate. Unfortunately initramfs is not an option on openwrt because it wastes too much space. The binaries and scripts in an initramfs cannot be retained for use in the booted system, unless they are copied to RAM (tmpfs) (if anyone know otherwise and can point out how, please contact the devs), which is why preinit exists.
Preinit looks to linux like the final boot stage to init on the rootfs. Preinit then mounts the root file system, does
pivot_root to the rootfs, and then use the real init to replace itself. Basically it transforms intself into the 'real' init and rootfs.