How does OpenBSD's startup system function?

This question is answered in the official OpenBSD FAQ. See http://www.openbsd.org/faq/faq10.html#rc, rc(8) and rc.conf(8) for details.

OpenBSD follows a typical BSD rc system, which for OpenBSD amounts to something like this:

  1. The init(8) process is executed as the last stage of the boot sequence.
  2. The init(8) program calls the script /etc/rc to begin executing further startup functions. Configuration variables are loaded in from the file /etc/rc.conf and, if present, /etc/rc.conf.local.
  3. /etc/rc will process /etc/rc.securelevel, setting the kernel securelevel to whatever value is specified.
  4. /etc/rc will launch "local" daemons (those not shipped with the OS by default) by executing /etc/rc.local, if present.
  5. On systems set up for the X Window System, XDM is optionally lauched to provide a graphical display.