summaryrefslogtreecommitdiffstats
path: root/tools/busybox-patches/unionfs-run-init.diff
blob: a0cde9f2ba103ef8303791bfc9e4a72deb540cca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
If we find the special directory, /rorootfs move the mount point of the later
root fs on top.  We check if we have unionfs available to make the ro fs rw.
Unfortunately the unionfs code is incomplete (mmap issue).   Thus the original
mount point of the ro fs part is not moved accordingly.

Index: busybox-1.4.2/util-linux/switch_root.c
===================================================================
--- busybox-1.4.2.orig/util-linux/switch_root.c
+++ busybox-1.4.2/util-linux/switch_root.c
@@ -103,6 +103,10 @@ int switch_root_main(int argc, char *arg
 	// Overmount / with newdir and chroot into it.  The chdir is needed to
 	// recalculate "." and ".." links.
 
+	if ( !lstat("/rorootfs", &st1 ) )
+		if ( mount("/rorootfs", "/", NULL, MS_MOVE, NULL) )
+			bb_error_msg_and_die("moving rorootfs");
+
 	if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || chdir("/"))
 		bb_error_msg_and_die("moving root");