summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2020-02-20 00:33:01 +0000
committerColin Walters <walters@verbum.org>2020-02-20 00:35:32 +0000
commitd5bfbc6715e8bc199a33bfb94c143261c4c53364 (patch)
treec5ba862e92a608a017315c7b3919ff94e8bbd94b
parent9eb4506c1b64de33b525f047dedee852bc585eac (diff)
downloadostree-d5bfbc6715e8bc199a33bfb94c143261c4c53364.tar.gz
prepare-root: Add a comment about the role of this service
Came up on an IRC question, docs for this are scattered around.
-rw-r--r--src/switchroot/ostree-prepare-root.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index 33c46ff4..c25d3fe9 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -29,6 +29,28 @@
* Boston, MA 02111-1307, USA.
*/
+/* The high level goal of ostree-prepare-root.service is to run inside
+ * the initial ram disk (if one is in use) and set up the `/` mountpoint
+ * to be the deployment root, using the ostree= kernel commandline
+ * argument to find the target deployment root.
+ *
+ * It's really the heart of how ostree works - basically multiple
+ * hardlinked chroot() targets are maintained, this one does the equivalent
+ * of chroot().
+ *
+ * If using systemd, an excellent reference is `man bootup`. This
+ * service runs Before=initrd-root-fs.target. At this point it's
+ * assumed that the block storage and root filesystem are mounted at
+ * /sysroot - i.e. /sysroot points to the *physical* root before
+ * this service runs. After, `/` is the deployment root.
+ *
+ * There is also a secondary mode for this service when an initrd isn't
+ * used - instead the binary must be statically linked (and the kernel
+ * must have mounted the rootfs itself) - then we set things up and
+ * exec the real init directly. This can be popular in embedded
+ * systems to increase bootup speed.
+ */
+
#include "config.h"
#include <sys/mount.h>