diff options
Diffstat (limited to 'recipes/ostree/ostree/Mount-boot-partition.patch')
-rw-r--r-- | recipes/ostree/ostree/Mount-boot-partition.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/recipes/ostree/ostree/Mount-boot-partition.patch b/recipes/ostree/ostree/Mount-boot-partition.patch new file mode 100644 index 0000000..a81f731 --- /dev/null +++ b/recipes/ostree/ostree/Mount-boot-partition.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 33642082578946fdc73ade8b78c05ba8d8521652 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> | ||
3 | Date: Mon, 7 Mar 2016 15:17:34 +0100 | ||
4 | Subject: [PATCH] ostree: Mount boot partition from user space | ||
5 | |||
6 | In the current approach we assumed that boot/ | ||
7 | |||
8 | - is on a separate boot partition | ||
9 | - boot partition is right before rootfs partition | ||
10 | - rootfs parition is provided as a *device node* | ||
11 | - has "ext2" filesystem (mount shell cmd tries to | ||
12 | auto detect FS type, mount system call does not.) | ||
13 | |||
14 | The new approch does not assume any of the above, and | ||
15 | moves this logic from early user space (initramfs) to | ||
16 | user space. Initramfs by design should be used only to | ||
17 | prepare the rootfs, other tasks should be done later. | ||
18 | --- | ||
19 | src/switchroot/ostree-remount.c | 19 ++++++++++++++++++- | ||
20 | 1 file changed, 18 insertions(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c | ||
23 | index b8d3a96..33f2645 100644 | ||
24 | --- a/src/switchroot/ostree-remount.c | ||
25 | +++ b/src/switchroot/ostree-remount.c | ||
26 | @@ -77,7 +77,7 @@ maybe_mount_tmpfs_on_var (void) | ||
27 | int | ||
28 | main(int argc, char *argv[]) | ||
29 | { | ||
30 | - const char *remounts[] = { "/sysroot", "/etc", "/home", "/root", "/tmp", "/var", NULL }; | ||
31 | + const char *remounts[] = { "/sysroot", "/etc", "/home", "/root", "/tmp", "/var", "/boot", NULL }; | ||
32 | struct stat stbuf; | ||
33 | int i; | ||
34 | |||
35 | @@ -117,5 +117,22 @@ main(int argc, char *argv[]) | ||
36 | |||
37 | maybe_mount_tmpfs_on_var (); | ||
38 | |||
39 | + /* ostree-prepare-root mounts boot/ if it is on the same partition as root filesystem. | ||
40 | + * If boot/ is not mounted, then it must be on a different partition. Try to mount | ||
41 | + * filesystem where LABEL=boot-ostree. | ||
42 | + */ | ||
43 | + if (!(lstat ("/boot/loader", &stbuf) == 0 && S_ISLNK (stbuf.st_mode))) | ||
44 | + { | ||
45 | + /* mount the real boot parition over the deployment's boot directory */ | ||
46 | + const char *mount_cmd="mount LABEL=boot-ostree /boot"; | ||
47 | + FILE *fp = popen (mount_cmd, "w"); | ||
48 | + if (fp == NULL) | ||
49 | + { | ||
50 | + perrorv ("popen failed for: %s", mount_cmd); | ||
51 | + exit (EXIT_FAILURE); | ||
52 | + } | ||
53 | + pclose (fp); | ||
54 | + } | ||
55 | + | ||
56 | exit (EXIT_SUCCESS); | ||
57 | } | ||
58 | -- | ||
59 | 2.7.0 | ||
60 | |||