summaryrefslogtreecommitdiffstats
path: root/recipes
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-04-25 14:09:08 +0200
committerGatis Paeglis <gatis.paeglis@theqtcompany.com>2016-04-28 09:27:07 +0000
commit61d552148d797866ed33a9cd5e56477873cf801d (patch)
tree25b2112edb82b0b575789edacd9304a916287810 /recipes
parent4e9cd2a73231f61f8cea9903caf25264e8229b4f (diff)
downloadmeta-boot2qt-61d552148d797866ed33a9cd5e56477873cf801d.tar.gz
ostree: Update version to v2016.5
Our patches should eventually endup in the upstream repo. Change-Id: I7680a77e3426887a41c4a377eb1ac8b782847f06 Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/ostree/ostree.bb21
-rw-r--r--recipes/ostree/ostree/0001-Allow-updating-files-on-the-boot-partition.patch92
-rw-r--r--recipes/ostree/ostree/0003-Allow-updating-files-in-root-of-boot.patch104
-rw-r--r--recipes/ostree/ostree/0005-Do-not-use-grub2-mkconfig.patch60
-rw-r--r--recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch99
-rw-r--r--recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch130
-rw-r--r--recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch40
-rw-r--r--recipes/ostree/ostree/Mount-boot-partition.patch (renamed from recipes/ostree/ostree/0004-Mount-boot-partition.patch)0
-rw-r--r--recipes/ostree/ostree/u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch (renamed from recipes/ostree/ostree/0002-u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch)41
9 files changed, 305 insertions, 282 deletions
diff --git a/recipes/ostree/ostree.bb b/recipes/ostree/ostree.bb
index 4dbafd5..2cfa4f4 100644
--- a/recipes/ostree/ostree.bb
+++ b/recipes/ostree/ostree.bb
@@ -19,7 +19,7 @@
19## 19##
20############################################################################## 20##############################################################################
21 21
22SUMMARY = "Tool for managing bootable, immutable, versioned filesystem trees." 22SUMMARY = "Shared library with a reference command line tool for managing bootable, immutable, versioned filesystem trees."
23 23
24LICENSE = "LGPL-2.1" 24LICENSE = "LGPL-2.1"
25LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" 25LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
@@ -28,18 +28,21 @@ inherit autotools pkgconfig systemd
28 28
29SRC_URI = " \ 29SRC_URI = " \
30 git://github.com/GNOME/ostree.git \ 30 git://github.com/GNOME/ostree.git \
31 file://0001-Allow-updating-files-on-the-boot-partition.patch \ 31 file://Fix-enable_rofiles_fuse-no-build.patch \
32 file://0002-u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch \ 32 file://Mount-boot-partition.patch \
33 file://0003-Allow-updating-files-in-root-of-boot.patch \ 33 file://Allow-updating-files-in-the-boot-directory.patch \
34 file://0004-Mount-boot-partition.patch \ 34 file://u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch \
35 file://0005-Do-not-use-grub2-mkconfig.patch \ 35 file://Create-firmware-convenience-symlinks.patch \
36 " 36 "
37 37
38SRCREV = "efdb4d8f443768e59529c299290bee8b1f8f93c3" 38SRCREV = "v2016.5"
39 39
40S = "${WORKDIR}/git" 40S = "${WORKDIR}/git"
41 41
42DEPENDS = "glib-2.0 e2fsprogs gpgme attr libsoup-2.4 libgsystem libassuan xz" 42DEPENDS = "glib-2.0 e2fsprogs gpgme attr libsoup-2.4 libgsystem libassuan xz"
43# Bash is needed by the shipped dracut module. This dracut module is used to generate initramfs image.
44# The production image do not require bash for proper working.
45RDEPENDS_${PN} += "bash"
43RRECOMMENDS_${PN} += "gnupg" 46RRECOMMENDS_${PN} += "gnupg"
44 47
45PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" 48PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
@@ -52,8 +55,10 @@ FILES_${PN} += "${systemd_unitdir}/system/ \
52EXTRA_OECONF = "--with-dracut \ 55EXTRA_OECONF = "--with-dracut \
53 --without-selinux \ 56 --without-selinux \
54 --without-libarchive \ 57 --without-libarchive \
55 --with-grub2=no \ 58 --with-builtin-grub2-mkconfig \
59 --enable-rofiles-fuse=no \
56 --enable-gtk-doc-html=no \ 60 --enable-gtk-doc-html=no \
61 --enable-man=no \
57 --with-soup \ 62 --with-soup \
58 --enable-libsoup-client-certs" 63 --enable-libsoup-client-certs"
59 64
diff --git a/recipes/ostree/ostree/0001-Allow-updating-files-on-the-boot-partition.patch b/recipes/ostree/ostree/0001-Allow-updating-files-on-the-boot-partition.patch
deleted file mode 100644
index 0905cc1..0000000
--- a/recipes/ostree/ostree/0001-Allow-updating-files-on-the-boot-partition.patch
+++ /dev/null
@@ -1,92 +0,0 @@
1From bbb7a8ce89e3e13672c63fd4f1f19988fdf40014 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Thu, 5 Nov 2015 17:37:54 +0100
4Subject: [PATCH 1/2] Allow updating files on the boot partition
5
6Until now OSTree copied only vmlinuz and initramfs
7binaries to the boot partition. This patch adds support
8for copying other files from the /boot directory of the
9tree.
10
11How this works:
12
13Ignore subdirectories, only files in root of the boot
14directory are copied. There is overhead of copying files
15to boot partition, therefore the amount of files in the
16boot/ should be kept to the minimum and subdirectories
17shouldn't really be necessary.
18
19Files on the boot partition are updated only with major
20releases, when kernel/initramfs bootcsum changes. Files
21that require frequent updates should not be stored here.
22---
23 src/libostree/ostree-sysroot-deploy.c | 53 +++++++++++++++++++++++++++++++++++
24 1 file changed, 53 insertions(+)
25
26diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
27index f7afe3d..4d6534d 100644
28--- a/src/libostree/ostree-sysroot-deploy.c
29+++ b/src/libostree/ostree-sysroot-deploy.c
30@@ -1340,6 +1340,59 @@ install_deployment_kernel (OstreeSysroot *sysroot,
31 }
32 }
33
34+ {
35+ /* Copy other files that are stored in the boot directory. Lets keep this simple:
36+ *
37+ * - Ignore subdirectories, only files in root of the boot directory are copied. There is
38+ * overhead of copying files to boot partition, therefore the amount of files in the boot/
39+ * should be kept to the minimum and subdirectories shouldn't really be necessary.
40+ * - Files on the boot partition are updated only with major releases, when kernel/initramfs
41+ * bootcsum changes. Files that require frequent updates should not be stored here.
42+ */
43+ g_autoptr(GFileEnumerator) dir_enum = NULL;
44+ g_autoptr(GFile) deployments_bootdir = g_file_get_child (deployment_dir, "boot");
45+ dir_enum = g_file_enumerate_children (deployments_bootdir, OSTREE_GIO_FAST_QUERYINFO,
46+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
47+ NULL, error);
48+ while (TRUE)
49+ {
50+ GFileInfo *file_info = NULL;
51+ g_autoptr(GFile) source_file = NULL;
52+ g_autoptr(GFile) dest_file = NULL;
53+ g_autoptr(GFile) symlink_target = NULL;
54+ GFileType type;
55+ const char *name;
56+
57+ if (!gs_file_enumerator_iterate (dir_enum, &file_info, NULL, cancellable, error))
58+ goto out;
59+ if (file_info == NULL)
60+ break;
61+
62+ type = g_file_info_get_file_type (file_info);
63+ name = g_file_info_get_name (file_info);
64+ if (type == G_FILE_TYPE_DIRECTORY)
65+ continue;
66+ if (type == G_FILE_TYPE_SYMBOLIC_LINK)
67+ {
68+ symlink_target = g_file_get_child (bootcsumdir, g_file_info_get_symlink_target(file_info));
69+ if (!g_file_query_exists (symlink_target, NULL))
70+ continue;
71+ }
72+ if (g_str_has_prefix (name, "vmlinuz-") || g_str_has_prefix (name, "initramfs-"))
73+ continue;
74+
75+ dest_file = g_file_get_child (bootcsumdir, name);
76+ if (!g_file_query_exists (dest_file, NULL))
77+ {
78+ source_file = g_file_enumerator_get_child (dir_enum, file_info);
79+ if (!gs_file_linkcopy_sync_data (source_file, dest_file,
80+ G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA,
81+ cancellable, error))
82+ goto out;
83+ }
84+ }
85+ }
86+
87 if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0)
88 {
89 if (errno != ENOENT)
90--
912.1.4
92
diff --git a/recipes/ostree/ostree/0003-Allow-updating-files-in-root-of-boot.patch b/recipes/ostree/ostree/0003-Allow-updating-files-in-root-of-boot.patch
deleted file mode 100644
index d93da22..0000000
--- a/recipes/ostree/ostree/0003-Allow-updating-files-in-root-of-boot.patch
+++ /dev/null
@@ -1,104 +0,0 @@
1From f5a1391e64d4b17ed05fb47f23d5d35affb9f1fd Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Thu, 5 Nov 2015 14:58:56 +0100
4Subject: [PATCH] Allow updating files in root of /boot
5
6It is common for u-boot based systems to search
7top level directory of the boot partiton for
8additional files that are required for booting.
9It can be difficult to change this search logic
10if it is hardcoded somewhere low in the stack or
11in u-boot env that is in read-only memory. To
12allow updating these files you need to add a
13symlink in your ostree sysroot:
14
15cd sysroot/boot
16ln -s loader/my-special-file my-special-file
17
18The bellow code will make sure that loader/my-special-file
19points to the correct target file version.
20
21This does not break the atomic property of update.
22---
23 src/libostree/ostree-bootloader-uboot.c | 65 +++++++++++++++++++++++++++++++++
24 1 file changed, 65 insertions(+)
25
26diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
27index be1a40d..779c302 100644
28--- a/src/libostree/ostree-bootloader-uboot.c
29+++ b/src/libostree/ostree-bootloader-uboot.c
30@@ -131,6 +131,71 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
31 }
32 }
33
34+ {
35+ /* It is common for u-boot based systems to search top level directory of the boot
36+ * partiton for additional files that are required for booting. It can be difficult
37+ * to change this search logic if it is hardcoded somewhere low in the stack or in
38+ * u-boot env that is in read-only memory. To allow updating these files you need to
39+ * add a symlink in your ostree sysroot:
40+ *
41+ * cd sysroot/boot
42+ * ln -s loader/my-special-file my-special-file
43+ *
44+ * The bellow code will make sure that loader/my-special-file points to the correct
45+ * target file version.
46+ *
47+ */
48+ g_autoptr(GFile) child = NULL;
49+ int loader_fd;
50+ g_autoptr(GFileEnumerator) dir_enum = NULL;
51+ g_autoptr(GFile) real_boot = NULL;
52+ g_autofree char *loader_path = NULL;
53+ char buf[2048];
54+
55+ child = ot_gfile_resolve_path_printf (self->sysroot->path, "boot/loader.%d/", bootversion);
56+ loader_path = g_file_get_path(child);
57+ loader_fd = open (loader_path, O_RDONLY);
58+ if (loader_fd == -1) {
59+ perror("open");
60+ goto out;
61+ }
62+
63+ child = g_file_get_child (self->sysroot->path, "boot");
64+ dir_enum = g_file_enumerate_children (child, OSTREE_GIO_FAST_QUERYINFO,
65+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
66+ NULL, error);
67+
68+ while (TRUE) {
69+ const char *symlink_target, *name;
70+ GFileInfo *file_info = NULL;
71+
72+ if (!gs_file_enumerator_iterate (dir_enum, &file_info, NULL, cancellable, error)) {
73+ close(loader_fd);
74+ goto out;
75+ }
76+
77+ if (file_info == NULL)
78+ break;
79+
80+ if (g_file_info_get_is_symlink(file_info)) {
81+ symlink_target = g_file_info_get_symlink_target(file_info);
82+ if (g_str_has_prefix(symlink_target, "loader/")) {
83+ name = g_file_info_get_name(file_info);
84+ if (g_strcmp0 (name, "uEnv.txt") == 0)
85+ continue;
86+
87+ snprintf(buf, sizeof(buf), "%s/%s", loader_path, name);
88+ remove(buf);
89+ snprintf(buf, sizeof(buf), "..%s/%s", boot_path, name);
90+ if (symlinkat(buf, loader_fd, name) == -1)
91+ perror("symlinkat");
92+ }
93+ }
94+ }
95+
96+ close(loader_fd);
97+ }
98+
99 ret = TRUE;
100 out:
101 return ret;
102--
1032.1.4
104
diff --git a/recipes/ostree/ostree/0005-Do-not-use-grub2-mkconfig.patch b/recipes/ostree/ostree/0005-Do-not-use-grub2-mkconfig.patch
deleted file mode 100644
index 1414ff7..0000000
--- a/recipes/ostree/ostree/0005-Do-not-use-grub2-mkconfig.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From b613d60319beffc861f5b1faa906d2ee0c685f52 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Wed, 24 Feb 2016 18:12:27 +0100
4Subject: [PATCH] Do not use grub2-mkconfig.
5
6For details see: https://bugzilla.gnome.org/show_bug.cgi?id=762220
7---
8 src/libostree/ostree-bootloader-grub2.c | 12 +++++++++++-
9 1 file changed, 11 insertions(+), 1 deletion(-)
10
11diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c
12index 1f89914..7cfb0dc 100644
13--- a/src/libostree/ostree-bootloader-grub2.c
14+++ b/src/libostree/ostree-bootloader-grub2.c
15@@ -282,6 +282,8 @@ grub2_child_setup (gpointer user_data)
16 }
17 }
18
19+#define OSTREE_NO_GRUB2_MKCONFIG
20+
21 static gboolean
22 _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
23 int bootversion,
24@@ -300,6 +302,7 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
25 g_autoptr(GFile) config_path_efi_dir = NULL;
26 g_autofree char *grub2_mkconfig_chroot = NULL;
27
28+#ifndef OSTREE_NO_GRUB2_MKCONFIG
29 if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
30 && g_file_has_parent (self->sysroot->path, NULL))
31 {
32@@ -322,7 +325,7 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
33 tool_deployment_root = ostree_sysroot_get_deployment_directory (self->sysroot, tool_deployment);
34 grub2_mkconfig_chroot = g_file_get_path (tool_deployment_root);
35 }
36-
37+#endif
38 if (self->is_efi)
39 {
40 config_path_efi_dir = g_file_get_parent (self->config_path_efi);
41@@ -337,9 +340,16 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
42 bootversion);
43 }
44
45+#ifdef OSTREE_NO_GRUB2_MKCONFIG
46+ procctx = gs_subprocess_context_newv ("ostree-grub-generator", "-o",
47+ gs_file_get_path_cached (new_config_path),
48+ NULL);
49+#else
50 procctx = gs_subprocess_context_newv ("grub2-mkconfig", "-o",
51 gs_file_get_path_cached (new_config_path),
52 NULL);
53+#endif
54+
55 child_env = g_environ_setenv (child_env, "_OSTREE_GRUB2_BOOTVERSION", bootversion_str, TRUE);
56 /* We have to pass our state to the child */
57 if (self->is_efi)
58--
592.7.0
60
diff --git a/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch b/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
new file mode 100644
index 0000000..ffcc77c
--- /dev/null
+++ b/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
@@ -0,0 +1,99 @@
1From 7f4549c6e94494460be06311c3a4d23ae684ab21 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Wed, 20 Apr 2016 13:58:27 +0200
4Subject: [PATCH 1/3] Allow updating files in the /boot directory.
5
6Until now OSTree copied only the vmlinuz and initramfs
7binaries to the boot/ directory (which in some setups
8might be on a separate partition). This patch adds
9support for copying other files from the deployment's
10/boot directory to the real /boot.
11
12How this works:
13
14Ignore subdirectories, only files in root of the boot
15directory are copied. There is overhead of copying files
16to boot/, therefore the amount of files in boot/ should
17be kept to the minimum and subdirectories shouldn't
18really be necessary.
19
20Files in the boot/ directory are updated only with major
21releases, when kernel/initramfs bootcsum changes. Files
22that require frequent updates should not be stored here.
23---
24 src/libostree/ostree-sysroot-deploy.c | 52 +++++++++++++++++++++++++++++++++++
25 1 file changed, 52 insertions(+)
26
27diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
28index 8877236..8cf080e 100644
29--- a/src/libostree/ostree-sysroot-deploy.c
30+++ b/src/libostree/ostree-sysroot-deploy.c
31@@ -1295,6 +1295,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
32 g_autofree char *version_key = NULL;
33 g_autofree char *ostree_kernel_arg = NULL;
34 g_autofree char *options_key = NULL;
35+ g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
36 GString *title_key;
37 __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
38 const char *val;
39@@ -1361,6 +1362,57 @@ install_deployment_kernel (OstreeSysroot *sysroot,
40 }
41 }
42
43+
44+ /* Copy other files that are stored in deployment's /usr/lib/ostree-boot. Lets keep this simple:
45+ *
46+ * - Ignore subdirectories. Only files in root of the /usr/lib/ostree-boot directory are copied.
47+ * There is an overhead of copying files to boot/, therefore the amount of files in a deployment's
48+ * usr/lib/ostree-boot should be kept to the minimum and subdirectories shouldn't really
49+ * be necessary.
50+ *
51+ * - Files in /boot are updated only with major releases, when kernel/initramfs
52+ * bootcsum changes. Files that require frequent updates should not be stored here.
53+ */
54+ if (!glnx_dirfd_iterator_init_take_fd (dup (tree_boot_dfd), &dfd_iter, error))
55+ goto out;
56+
57+ while (TRUE)
58+ {
59+ struct dirent *dent;
60+
61+ if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
62+ goto out;
63+
64+ if (dent == NULL)
65+ break;
66+
67+ if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, 0) != 0)
68+ {
69+ if (errno == ENOENT)
70+ continue;
71+ glnx_set_error_from_errno (error);
72+ goto out;
73+ }
74+
75+ if (g_str_has_prefix (dent->d_name, "vmlinuz-") || g_str_has_prefix (dent->d_name, "initramfs-")
76+ || !S_ISREG(stbuf.st_mode))
77+ continue;
78+
79+ if (fstatat (bootcsum_dfd, dent->d_name, &stbuf, 0) != 0)
80+ {
81+ if (errno != ENOENT)
82+ {
83+ glnx_set_prefix_error_from_errno (error, "fstat %s", dent->d_name);
84+ goto out;
85+ }
86+ if (!glnx_file_copy_at (tree_boot_dfd, dent->d_name, &stbuf,
87+ bootcsum_dfd, dent->d_name, 0,
88+ cancellable, error))
89+ goto out;
90+ }
91+ }
92+
93+
94 if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0)
95 {
96 if (errno != ENOENT)
97--
982.7.4
99
diff --git a/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch b/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch
new file mode 100644
index 0000000..960367c
--- /dev/null
+++ b/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch
@@ -0,0 +1,130 @@
1From 310ddd84dc353d93a2cc118725b459dba643cf0b Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Thu, 21 Apr 2016 16:54:05 +0200
4Subject: [PATCH 3/3] Create firmware convenience symlinks.
5
6Later this could be moved into utils or a similar
7location, if other boot loader backends will need
8this functionality.
9---
10 src/libostree/ostree-bootloader-uboot.c | 97 ++++++++++++++++++++++++++++++++-
11 1 file changed, 96 insertions(+), 1 deletion(-)
12
13diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
14index 9bcde9c..be5e8c5 100644
15--- a/src/libostree/ostree-bootloader-uboot.c
16+++ b/src/libostree/ostree-bootloader-uboot.c
17@@ -66,6 +66,100 @@ _ostree_bootloader_uboot_get_name (OstreeBootloader *bootloader)
18 return "U-Boot";
19 }
20
21+/* It is common for firmware to search / on the boot partition for additional
22+ * files that are required for booting. It can be difficult to change this search
23+ * logic if it is hardcoded somewhere low in the stack or is in a read-only memory.
24+ * This issue can be solved from the OS installer, by creating a symlink in the
25+ * following way:
26+ *
27+ * cd sysroot/boot
28+ * ln -s loader/second-stage-bootloader second-stage-bootloader
29+ *
30+ * This function will make sure that loader/second-stage-bootloader points to the
31+ * correct target file version. This function does nothing if boot/ does not contain
32+ * symlink files pointing into loader/.
33+ */
34+static gboolean
35+create_firmware_convenience_symlinks (OstreeBootloaderUboot *self,
36+ char *bootcsum_dir,
37+ int bootversion,
38+ GCancellable *cancellable,
39+ GError **error)
40+{
41+ gboolean ret = FALSE;
42+ glnx_fd_close int loader_dfd = -1;
43+ glnx_fd_close int boot_dfd = -1;
44+ g_autofree char *loader_dir = NULL;
45+ g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
46+
47+ loader_dir = g_strdup_printf ("boot/loader.%d/", bootversion);
48+ if (!glnx_opendirat (self->sysroot->sysroot_fd, loader_dir, FALSE, &loader_dfd, error))
49+ goto out;
50+ if (!glnx_opendirat (self->sysroot->sysroot_fd, "boot", FALSE, &boot_dfd, error))
51+ goto out;
52+ if (!glnx_dirfd_iterator_init_take_fd (dup (boot_dfd), &dfd_iter, error))
53+ goto out;
54+
55+ while (TRUE) {
56+ struct dirent *dent;
57+ struct stat stbuf;
58+
59+ if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
60+ goto out;
61+ if (dent == NULL)
62+ break;
63+
64+ if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
65+ {
66+ if (errno == ENOENT)
67+ continue;
68+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "fstatat");
69+ goto out;
70+ }
71+
72+ if (S_ISLNK(stbuf.st_mode))
73+ {
74+ char path_buffer[PATH_MAX];
75+ g_autofree char *symlink_target = NULL;
76+ symlink_target = glnx_readlinkat_malloc (boot_dfd, dent->d_name, cancellable, error);
77+
78+ if (g_str_has_prefix (symlink_target, "loader/"))
79+ {
80+ if (g_strcmp0 (dent->d_name, "uEnv.txt") == 0)
81+ continue;
82+
83+ snprintf (path_buffer, sizeof(path_buffer), "%s/%s", bootcsum_dir, dent->d_name);
84+ if (faccessat (boot_dfd, path_buffer + 1, F_OK, AT_SYMLINK_NOFOLLOW) == -1)
85+ {
86+ /* This bootcsum dir does not contain the final target, do nothing. */
87+ if (errno == ENOENT)
88+ continue;
89+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "faccessat");
90+ goto out;
91+ }
92+
93+ /* In case 'ostree admin cleanup' was not run after an interrupted deployment */
94+ if (unlinkat (loader_dfd, dent->d_name, 0) == -1 && errno != ENOENT)
95+ {
96+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "unlinkat");
97+ goto out;
98+ }
99+ /* Complete the link chain to the current boot file version */
100+ snprintf (path_buffer, sizeof(path_buffer), "..%s/%s", bootcsum_dir, dent->d_name);
101+ if (symlinkat (path_buffer, loader_dfd, dent->d_name) == -1)
102+ {
103+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "symlinkat");
104+ goto out;
105+ }
106+ }
107+ }
108+ }
109+
110+ ret = TRUE;
111+out:
112+ return ret;
113+}
114+
115 static gboolean
116 create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
117 int bootversion,
118@@ -130,7 +224,8 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
119 }
120 }
121
122- ret = TRUE;
123+ ret = create_firmware_convenience_symlinks (self, bootdir, bootversion, cancellable, error);
124+
125 out:
126 return ret;
127 }
128--
1292.7.4
130
diff --git a/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch b/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch
new file mode 100644
index 0000000..480fc21
--- /dev/null
+++ b/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch
@@ -0,0 +1,40 @@
1From b54643153cade28523cccee44fdddea2c94e0684 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Mon, 25 Apr 2016 13:57:03 +0200
4Subject: [PATCH] Fix --enable_rofiles_fuse=no build
5
6---
7 Makefile.am | 2 ++
8 configure.ac | 2 +-
9 2 files changed, 3 insertions(+), 1 deletion(-)
10
11diff --git a/Makefile.am b/Makefile.am
12index 488d4b6..e49b7c5 100644
13--- a/Makefile.am
14+++ b/Makefile.am
15@@ -71,7 +71,9 @@ include Makefile-otutil.am
16 include Makefile-libostree.am
17 include Makefile-ostree.am
18 include Makefile-switchroot.am
19+if BUILDOPT_FUSE
20 include src/rofiles-fuse/Makefile-inc.am
21+endif
22 include Makefile-tests.am
23 include Makefile-boot.am
24 include Makefile-man.am
25diff --git a/configure.ac b/configure.ac
26index dca9f53..6af60e8 100644
27--- a/configure.ac
28+++ b/configure.ac
29@@ -222,7 +222,7 @@ AC_ARG_ENABLE(rofiles-fuse,
30 [AS_HELP_STRING([--enable-rofiles-fuse],
31 [generate rofiles-fuse helper [default=yes]])],,
32 enable_rofiles_fuse=yes)
33-AS_IF([ test $enable_rofiles_fuse != xno ], [
34+AS_IF([ test x$enable_rofiles_fuse != xno ], [
35 PKG_CHECK_MODULES(BUILDOPT_FUSE, $FUSE_DEPENDENCY)
36 ], [enable_rofiles_fuse=no])
37 AM_CONDITIONAL(BUILDOPT_FUSE, test x$enable_rofiles_fuse = xyes)
38--
392.7.4
40
diff --git a/recipes/ostree/ostree/0004-Mount-boot-partition.patch b/recipes/ostree/ostree/Mount-boot-partition.patch
index a81f731..a81f731 100644
--- a/recipes/ostree/ostree/0004-Mount-boot-partition.patch
+++ b/recipes/ostree/ostree/Mount-boot-partition.patch
diff --git a/recipes/ostree/ostree/0002-u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch b/recipes/ostree/ostree/u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch
index 08855de..501f8d4 100644
--- a/recipes/ostree/ostree/0002-u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch
+++ b/recipes/ostree/ostree/u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch
@@ -1,18 +1,24 @@
1From 5ee49772b001b9757d6cb21fcc587d5ddc66cdb7 Mon Sep 17 00:00:00 2001 1From 86184e5a266b087ba222b03141b491241e27e284 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> 2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Thu, 5 Nov 2015 17:39:16 +0100 3Date: Thu, 21 Apr 2016 14:28:38 +0200
4Subject: [PATCH 2/2] u-boot: Merge ostree's and systems uEnv.txt 4Subject: [PATCH 2/3] u-boot: Merge ostree's and systems uEnv.txt
5 5
6This allows for simpler u-boot scripts and is 6This allow for simpler u-boot scripts and is a proper
7a proper fix for: 7fix for: https://bugzilla.gnome.org/show_bug.cgi?id=755787
8 8
9https://bugzilla.gnome.org/show_bug.cgi?id=755787 9With this patch admin can now:
10
111) Edit /usr/lib/ostree-boot/uEnv.txt
12
132) Download the update to a target. And during the deploy
14 process OSTree will prepend its env (loader/uEnv.txt)
15 to the system's uEnv.txt
10--- 16---
11 src/libostree/ostree-bootloader-uboot.c | 42 ++++++++++++++++++++++++++++++--- 17 src/libostree/ostree-bootloader-uboot.c | 41 ++++++++++++++++++++++++++++++---
12 1 file changed, 39 insertions(+), 3 deletions(-) 18 1 file changed, 38 insertions(+), 3 deletions(-)
13 19
14diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c 20diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
15index f67e9bd..be1a40d 100644 21index f67e9bd..9bcde9c 100644
16--- a/src/libostree/ostree-bootloader-uboot.c 22--- a/src/libostree/ostree-bootloader-uboot.c
17+++ b/src/libostree/ostree-bootloader-uboot.c 23+++ b/src/libostree/ostree-bootloader-uboot.c
18@@ -29,6 +29,10 @@ 24@@ -29,6 +29,10 @@
@@ -34,9 +40,9 @@ index f67e9bd..be1a40d 100644
34 g_autoptr(GPtrArray) boot_loader_configs = NULL; 40 g_autoptr(GPtrArray) boot_loader_configs = NULL;
35 OstreeBootconfigParser *config; 41 OstreeBootconfigParser *config;
36 const char *val; 42 const char *val;
37+ g_autofree char *boot_path = NULL; 43+ g_autofree char *bootdir = NULL;
38+ g_autoptr(GFile) uenv_file = NULL; 44+ g_autoptr(GFile) uenv_file = NULL;
39+ char uenv_path[2048]; 45+ char uenv_path[PATH_MAX];
40 46
41 if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs, 47 if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs,
42 cancellable, error)) 48 cancellable, error))
@@ -54,26 +60,25 @@ index f67e9bd..be1a40d 100644
54 } 60 }
55 g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val)); 61 g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val));
56 62
57+ boot_path = strndup (val, strlen (val) - strlen ("/vmlinuz")); 63+ bootdir = strndup (val, strrchr(val, '/') - val);
58+ g_ptr_array_add (new_lines, g_strdup_printf ("bootdir=%s", boot_path)); 64+ g_ptr_array_add (new_lines, g_strdup_printf ("bootdir=%s/", bootdir));
59+ 65+
60 val = ostree_bootconfig_parser_get (config, "initrd"); 66 val = ostree_bootconfig_parser_get (config, "initrd");
61 if (val) 67 if (val)
62 g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val)); 68 g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val));
63@@ -97,7 +108,32 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, 69@@ -97,7 +108,31 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
64 if (val) 70 if (val)
65 g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val)); 71 g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val));
66 72
67- return TRUE; 73- return TRUE;
68+ /* Merge with user's uEnv.txt if it exists */ 74+ /* Append user's uEnv.txt if it exists */
69+ snprintf (uenv_path, sizeof(uenv_path), "boot/%s/uEnv.txt", boot_path); 75+ snprintf (uenv_path, sizeof(uenv_path), "boot/%s/uEnv.txt", bootdir);
70+ uenv_file = g_file_get_child (self->sysroot->path, uenv_path); 76+ uenv_file = g_file_get_child (self->sysroot->path, uenv_path);
71+ if (g_file_query_exists (uenv_file, cancellable)) 77+ if (g_file_query_exists (uenv_file, cancellable))
72+ { 78+ {
73+ g_autoptr(GInputStream) instream = NULL; 79+ g_autoptr(GInputStream) instream = NULL;
74+ g_autoptr(GDataInputStream) datastream = NULL; 80+ g_autoptr(GDataInputStream) datastream = NULL;
75+ gsize len; 81+ gsize len;
76+
77+ instream = (GInputStream*)g_file_read (uenv_file, cancellable, error); 82+ instream = (GInputStream*)g_file_read (uenv_file, cancellable, error);
78+ if (!instream) 83+ if (!instream)
79+ goto out; 84+ goto out;
@@ -95,5 +100,5 @@ index f67e9bd..be1a40d 100644
95 100
96 static gboolean 101 static gboolean
97-- 102--
982.1.4 1032.7.4
99 104