summaryrefslogtreecommitdiffstats
path: root/meta-boot2qt/recipes-core
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2018-03-02 13:08:39 +0200
committerSamuli Piippo <samuli.piippo@qt.io>2018-03-12 14:12:31 +0000
commit344c2f97025c6504ec986600498121bb83aaeb8f (patch)
tree3d7ec602603cb083b7c8e998eddca543ce17e57c /meta-boot2qt/recipes-core
parentd9985542d7617b43ec7180c7ade0c4f64db82b42 (diff)
downloadmeta-boot2qt-344c2f97025c6504ec986600498121bb83aaeb8f.tar.gz
Split meta-boot2qt layer
Move distro specific recipes to own layer and leave only new recipes and bbclasses to meta-boot2qt layer. This makes it easier to include meta-boot2qt to your own distro layer to get access e.g., QDB and QBSP recipes that might be useful even without boot2qt distro. Task-number: QTBUG-65871 Change-Id: I6c353774dd1668b00f2d05aa262ad866b90bdef6 Reviewed-by: Timo Aarnipuro <timo.aarnipuro@qt.io>
Diffstat (limited to 'meta-boot2qt/recipes-core')
-rw-r--r--meta-boot2qt/recipes-core/initramfs-basic/files/init.sh102
-rw-r--r--meta-boot2qt/recipes-core/initramfs-basic/init-basic.bb43
-rw-r--r--meta-boot2qt/recipes-core/initramfs-basic/initramfs-basic.bb50
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree.bb86
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch161
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Create-firmware-convenience-symlinks.patch126
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Mount-boot-partition.patch60
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch94
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Support-for-booting-without-initramfs.patch131
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/Workaround-the-SIGCHLD-handler-issue.patch54
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/deploy-add-karg-none-argument.patch62
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch54
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch52
-rw-r--r--meta-boot2qt/recipes-core/ostree/ostree/workaround-gtkdocize-configure-issue-in-autog.patch26
14 files changed, 1101 insertions, 0 deletions
diff --git a/meta-boot2qt/recipes-core/initramfs-basic/files/init.sh b/meta-boot2qt/recipes-core/initramfs-basic/files/init.sh
new file mode 100644
index 0000000..3db235b
--- /dev/null
+++ b/meta-boot2qt/recipes-core/initramfs-basic/files/init.sh
@@ -0,0 +1,102 @@
1#!/bin/sh
2
3PATH=/sbin:/bin:/usr/sbin:/usr/bin
4ROOT_MOUNT="/sysroot/"
5ROOT_DEVICE=""
6
7early_setup() {
8
9 mkdir -p /proc
10 mkdir -p /sys
11 mount -t proc proc /proc
12 mount -t sysfs sysfs /sys
13 mount -t devtmpfs none /dev
14
15 mkdir -p /run
16 mkdir -p /var/run
17}
18
19read_args() {
20
21 for arg in $(cat /proc/cmdline); do
22 value=$(echo ${arg} | cut -s -f2- -d '=')
23 case $arg in
24 root=*)
25 root=$value
26 ;;
27 debugshell*)
28 if [ -z "$value" ]; then
29 shelltimeout=30
30 else
31 shelltimeout=$value
32 fi
33 ;;
34 esac
35 done
36
37 if [ -z "$root" ] ; then
38 debug_shell "No root= specified via kernel command line."
39 else
40 case $root in
41 LABEL=*)
42 label=${root#LABEL=}
43 ;;
44 *)
45 debug_shell "This init script only supports root=LABEL=* for specifying root file system, but root=$root was provided."
46 ;;
47 esac
48 fi
49}
50
51mount_rootfs() {
52
53 mkdir -p $ROOT_MOUNT
54 mount $ROOT_DEVICE $ROOT_MOUNT
55 mount -n --move /proc $ROOT_MOUNT/proc
56 mount -n --move /sys $ROOT_MOUNT/sys
57 mount -n --move /dev $ROOT_MOUNT/dev
58
59 exec switch_root $ROOT_MOUNT /sbin/init || debug_shell "Couldn't switch_root."
60}
61
62switch_real_root() {
63
64 echo "Searching for media..."
65 C=0
66 while true
67 do
68
69 rootfs=$(findfs LABEL=$label)
70 if [ -n "$rootfs" ] ; then
71 ROOT_DEVICE=$rootfs
72 mount_rootfs
73 fi
74
75 # don't wait for more than $shelltimeout seconds, if it's set
76 if [ -n "$shelltimeout" ]; then
77 echo -n " " $(( $shelltimeout - $C ))
78 if [ $C -ge $shelltimeout ]; then
79 debug_shell "Cannot find root file system."
80 fi
81 C=$(( C + 1 ))
82 fi
83
84 sleep 1
85 done
86}
87
88debug_shell() {
89
90 echo ${1}
91 echo "Dropping to a shell."
92 exec sh
93}
94
95main() {
96
97 early_setup
98 read_args
99 switch_real_root
100}
101
102main
diff --git a/meta-boot2qt/recipes-core/initramfs-basic/init-basic.bb b/meta-boot2qt/recipes-core/initramfs-basic/init-basic.bb
new file mode 100644
index 0000000..25039e7
--- /dev/null
+++ b/meta-boot2qt/recipes-core/initramfs-basic/init-basic.bb
@@ -0,0 +1,43 @@
1############################################################################
2##
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:GPL$
9## Commercial License Usage
10## Licensees holding valid commercial Qt licenses may use this file in
11## accordance with the commercial license agreement provided with the
12## Software or, alternatively, in accordance with the terms contained in
13## a written agreement between you and The Qt Company. For licensing terms
14## and conditions see https://www.qt.io/terms-conditions. For further
15## information use the contact form at https://www.qt.io/contact-us.
16##
17## GNU General Public License Usage
18## Alternatively, this file may be used under the terms of the GNU
19## General Public License version 3 or (at your option) any later version
20## approved by the KDE Free Qt Foundation. The licenses are as published by
21## the Free Software Foundation and appearing in the file LICENSE.GPL3
22## included in the packaging of this file. Please review the following
23## information to ensure the GNU General Public License requirements will
24## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25##
26## $QT_END_LICENSE$
27##
28############################################################################
29
30SUMMARY = "Simple init script that mounts root filesystem by label."
31LICENSE = "The-Qt-Company-DCLA-2.1"
32LIC_FILES_CHKSUM = "file://${QT_LICENSE};md5=80e06902b5f0e94ad0a78ee4f7fcb74b"
33SRC_URI = "file://init.sh"
34
35S = "${WORKDIR}"
36
37do_install () {
38 install -m 0755 ${WORKDIR}/init.sh ${D}/init
39}
40
41inherit allarch
42
43FILES_${PN} += "/init"
diff --git a/meta-boot2qt/recipes-core/initramfs-basic/initramfs-basic.bb b/meta-boot2qt/recipes-core/initramfs-basic/initramfs-basic.bb
new file mode 100644
index 0000000..31388d3
--- /dev/null
+++ b/meta-boot2qt/recipes-core/initramfs-basic/initramfs-basic.bb
@@ -0,0 +1,50 @@
1############################################################################
2##
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:GPL$
9## Commercial License Usage
10## Licensees holding valid commercial Qt licenses may use this file in
11## accordance with the commercial license agreement provided with the
12## Software or, alternatively, in accordance with the terms contained in
13## a written agreement between you and The Qt Company. For licensing terms
14## and conditions see https://www.qt.io/terms-conditions. For further
15## information use the contact form at https://www.qt.io/contact-us.
16##
17## GNU General Public License Usage
18## Alternatively, this file may be used under the terms of the GNU
19## General Public License version 3 or (at your option) any later version
20## approved by the KDE Free Qt Foundation. The licenses are as published by
21## the Free Software Foundation and appearing in the file LICENSE.GPL3
22## included in the packaging of this file. Please review the following
23## information to ensure the GNU General Public License requirements will
24## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25##
26## $QT_END_LICENSE$
27##
28############################################################################
29
30DESCRIPTION = "Basic initramfs image. Useful as a template for more advanced functionality."
31LICENSE = "The-Qt-Company-DCLA-2.1"
32LIC_FILES_CHKSUM = "file://${QT_LICENSE};md5=80e06902b5f0e94ad0a78ee4f7fcb74b"
33
34# findfs from busybox fails to do its jobs, the full version from util-linux-findfs works fine
35PACKAGE_INSTALL = "init-basic busybox util-linux-findfs ${ROOTFS_BOOTSTRAP_INSTALL}"
36
37# Do not pollute the initramfs image with rootfs features
38IMAGE_FEATURES = ""
39
40export IMAGE_BASENAME = "initramfs-basic"
41IMAGE_LINGUAS = ""
42
43IMAGE_FSTYPES = "cpio.gz"
44inherit core-image
45
46IMAGE_ROOTFS_SIZE = "8192"
47IMAGE_ROOTFS_EXTRA_SPACE = "0"
48
49BAD_RECOMMENDATIONS += "busybox-syslog"
50
diff --git a/meta-boot2qt/recipes-core/ostree/ostree.bb b/meta-boot2qt/recipes-core/ostree/ostree.bb
new file mode 100644
index 0000000..e4c8076
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree.bb
@@ -0,0 +1,86 @@
1############################################################################
2##
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:GPL$
9## Commercial License Usage
10## Licensees holding valid commercial Qt licenses may use this file in
11## accordance with the commercial license agreement provided with the
12## Software or, alternatively, in accordance with the terms contained in
13## a written agreement between you and The Qt Company. For licensing terms
14## and conditions see https://www.qt.io/terms-conditions. For further
15## information use the contact form at https://www.qt.io/contact-us.
16##
17## GNU General Public License Usage
18## Alternatively, this file may be used under the terms of the GNU
19## General Public License version 3 or (at your option) any later version
20## approved by the KDE Free Qt Foundation. The licenses are as published by
21## the Free Software Foundation and appearing in the file LICENSE.GPL3
22## included in the packaging of this file. Please review the following
23## information to ensure the GNU General Public License requirements will
24## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25##
26## $QT_END_LICENSE$
27##
28############################################################################
29
30SUMMARY = "Shared library with a reference command line tool for managing bootable, immutable, versioned filesystem trees."
31
32LICENSE = "LGPL-2.1"
33LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
34
35inherit autotools pkgconfig systemd
36
37SRC_URI = " \
38 git://github.com/ostreedev/ostree.git \
39 file://Mount-boot-partition.patch \
40 file://ostree-prepare-root-enabler-for-simpler-kernel-arg.patch \
41 file://deploy-add-karg-none-argument.patch \
42 file://Support-for-booting-without-initramfs.patch \
43 file://Allow-updating-files-in-the-boot-directory.patch \
44 file://u-boot-add-bootdir-to-the-generated-uEnv.txt.patch \
45 file://Create-firmware-convenience-symlinks.patch \
46 file://Print-pull-progress-also-when-not-on-console.patch \
47 file://Workaround-the-SIGCHLD-handler-issue.patch \
48 file://workaround-gtkdocize-configure-issue-in-autog.patch \
49 "
50
51SRCREV = "8ece4d6d51bdbe3e41ab318259276bb83e553aa0"
52
53S = "${WORKDIR}/git"
54
55DEPENDS = "glib-2.0 glib-2.0-native e2fsprogs gpgme attr libsoup-2.4 libassuan xz systemd"
56# Bash is needed by the shipped dracut module. This dracut module is used to generate initramfs image.
57# The production image do not require bash for proper working.
58RDEPENDS_${PN} += "bash"
59RRECOMMENDS_${PN} += "gnupg"
60
61PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
62PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,,,"
63
64SYSTEMD_SERVICE_${PN} = "ostree-prepare-root.service ostree-remount.service"
65FILES_${PN} += "${systemd_unitdir}/system/ \
66 ${libdir}/dracut/"
67
68EXTRA_OECONF = "--with-dracut \
69 --without-selinux \
70 --without-libarchive \
71 --with-builtin-grub2-mkconfig \
72 --enable-rofiles-fuse=no \
73 --enable-gtk-doc-html=no \
74 --enable-man=no \
75 --with-soup \
76 --with-static-prepare-root \
77 --disable-otmpfile \
78 --enable-introspection=no \
79 --enable-libsoup-client-certs"
80
81do_configure_prepend() {
82 cd ${S}
83 # Update submodules and workaround bugs.
84 env NOCONFIGURE=1 ./autogen.sh
85 cd -
86}
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch b/meta-boot2qt/recipes-core/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
new file mode 100644
index 0000000..d416543
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
@@ -0,0 +1,161 @@
1From cc31c80658a90cf1b13fdf9fe8b6dde1cc9a0d24 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Mon, 22 Aug 2016 11:32:16 +0200
4Subject: [PATCH 1/3] Allow updating files in the /boot directory
5
6This patch adds support for copying (or hardlinking on
7single partition systems) all files from the deployment's
8/usr/lib/ostree-boot directory to the relevant
9/boot/ostree/$os-$bootcsum/ directory. This feature can
10be enabled by 'touch .ostree-bootcsumdir-source' in
11/usr/lib/ostree-boot.
12---
13 src/libostree/ostree-sysroot-deploy.c | 101 +++++++++++++++++++++++++++++++---
14 1 file changed, 94 insertions(+), 7 deletions(-)
15
16diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
17index a05ca30..f34e3f3 100644
18--- a/src/libostree/ostree-sysroot-deploy.c
19+++ b/src/libostree/ostree-sysroot-deploy.c
20@@ -165,12 +165,31 @@ dirfd_copy_attributes_and_xattrs (int src_parent_dfd,
21 }
22
23 static gboolean
24+hardlink_or_copy_dir_recurse (int src_parent_dfd,
25+ int dest_parent_dfd,
26+ const char *name,
27+ gboolean hardlink,
28+ GCancellable *cancellable,
29+ GError **error);
30+
31+static gboolean
32 copy_dir_recurse (int src_parent_dfd,
33 int dest_parent_dfd,
34 const char *name,
35 GCancellable *cancellable,
36 GError **error)
37 {
38+ return hardlink_or_copy_dir_recurse (src_parent_dfd, dest_parent_dfd, name, FALSE, cancellable, error);
39+}
40+
41+static gboolean
42+hardlink_or_copy_dir_recurse (int src_parent_dfd,
43+ int dest_parent_dfd,
44+ const char *name,
45+ gboolean hardlink,
46+ GCancellable *cancellable,
47+ GError **error)
48+{
49 g_auto(GLnxDirFdIterator) src_dfd_iter = { 0, };
50 glnx_fd_close int dest_dfd = -1;
51 struct dirent *dent;
52@@ -210,17 +229,27 @@ copy_dir_recurse (int src_parent_dfd,
53
54 if (S_ISDIR (child_stbuf.st_mode))
55 {
56- if (!copy_dir_recurse (src_dfd_iter.fd, dest_dfd, dent->d_name,
57- cancellable, error))
58+ if (!hardlink_or_copy_dir_recurse (src_dfd_iter.fd, dest_dfd, dent->d_name,
59+ hardlink, cancellable, error))
60 return FALSE;
61 }
62 else
63 {
64- if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf,
65- dest_dfd, dent->d_name,
66- GLNX_FILE_COPY_OVERWRITE,
67- cancellable, error))
68- return FALSE;
69+ if (hardlink)
70+ {
71+ if (!hardlink_or_copy_at (src_dfd_iter.fd, dent->d_name,
72+ dest_dfd, dent->d_name,
73+ cancellable, error))
74+ return FALSE;
75+ }
76+ else
77+ {
78+ if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf,
79+ dest_dfd, dent->d_name,
80+ GLNX_FILE_COPY_OVERWRITE,
81+ cancellable, error))
82+ return FALSE;
83+ }
84 }
85 }
86
87@@ -1301,6 +1330,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
88 g_autofree char *version_key = NULL;
89 g_autofree char *ostree_kernel_arg = NULL;
90 g_autofree char *options_key = NULL;
91+ g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
92 GString *title_key;
93 __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
94 const char *val;
95@@ -1367,6 +1397,63 @@ install_deployment_kernel (OstreeSysroot *sysroot,
96 }
97 }
98
99+ if (fstatat (tree_boot_dfd, ".ostree-bootcsumdir-source", &stbuf, 0) == 0)
100+ {
101+ if (!glnx_dirfd_iterator_init_at (tree_boot_dfd, ".", FALSE, &dfd_iter, error))
102+ goto out;
103+
104+ while (TRUE)
105+ {
106+ struct dirent *dent;
107+
108+ if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
109+ goto out;
110+ if (dent == NULL)
111+ break;
112+
113+ /* Skip special files - vmlinuz-* and initramfs-* are handled separately */
114+ if (g_str_has_prefix (dent->d_name, "vmlinuz-") || g_str_has_prefix (dent->d_name, "initramfs-"))
115+ continue;
116+
117+ if (fstatat (bootcsum_dfd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
118+ {
119+ if (errno != ENOENT)
120+ {
121+ glnx_set_prefix_error_from_errno (error, "fstatat %s", dent->d_name);
122+ goto out;
123+ }
124+
125+ if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
126+ {
127+ glnx_set_error_from_errno (error);
128+ goto out;
129+ }
130+
131+ if (S_ISDIR (stbuf.st_mode))
132+ {
133+ if (!hardlink_or_copy_dir_recurse (tree_boot_dfd, bootcsum_dfd, dent->d_name,
134+ TRUE, cancellable, error))
135+ goto out;
136+ }
137+ else
138+ {
139+ if (!hardlink_or_copy_at (tree_boot_dfd, dent->d_name,
140+ bootcsum_dfd, dent->d_name,
141+ cancellable, error))
142+ goto out;
143+ }
144+ }
145+ }
146+ }
147+ else
148+ {
149+ if (errno != ENOENT)
150+ {
151+ glnx_set_prefix_error_from_errno (error, "fstatat %s", ".ostree-bootcsumdir-source");
152+ goto out;
153+ }
154+ }
155+
156 if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0)
157 {
158 if (errno != ENOENT)
159--
1602.7.4
161
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Create-firmware-convenience-symlinks.patch b/meta-boot2qt/recipes-core/ostree/ostree/Create-firmware-convenience-symlinks.patch
new file mode 100644
index 0000000..656887d
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Create-firmware-convenience-symlinks.patch
@@ -0,0 +1,126 @@
1From c4df63488b9e09a9aa69e32ea5c0671c9dc50c9d Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Wed, 24 Aug 2016 12:29:38 +0200
4Subject: [PATCH] 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 | 93 ++++++++++++++++++++++++++++++++-
11 1 file changed, 92 insertions(+), 1 deletion(-)
12
13diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
14index 22251da..26a3127 100644
15--- a/src/libostree/ostree-bootloader-uboot.c
16+++ b/src/libostree/ostree-bootloader-uboot.c
17@@ -62,6 +62,97 @@ _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 by system builders by creating a convenience symlink:
25+ *
26+ * cd sysroot/boot
27+ * ln -s loader/second-stage-bootloader second-stage-bootloader
28+ *
29+ * This function will make sure that loader/second-stage-bootloader points to the
30+ * correct target file version. This function does nothing if boot/ does not contain
31+ * symlink files pointing into the loader/ directory.
32+ */
33+static gboolean
34+create_firmware_convenience_symlinks (OstreeBootloaderUboot *self,
35+ char *bootcsum_dir,
36+ int bootversion,
37+ GCancellable *cancellable,
38+ GError **error)
39+{
40+ glnx_fd_close int loader_dfd = -1;
41+ glnx_fd_close int boot_dfd = -1;
42+ g_autofree char *loader_dir = NULL;
43+ g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
44+
45+ loader_dir = g_strdup_printf ("boot/loader.%d/", bootversion);
46+ if (!glnx_opendirat (self->sysroot->sysroot_fd, loader_dir, FALSE, &loader_dfd, error))
47+ return FALSE;
48+ if (!glnx_opendirat (self->sysroot->sysroot_fd, "boot", FALSE, &boot_dfd, error))
49+ return FALSE;
50+ if (!glnx_dirfd_iterator_init_take_fd (dup (boot_dfd), &dfd_iter, error))
51+ return FALSE;
52+
53+ while (TRUE) {
54+ struct dirent *dent;
55+ struct stat stbuf;
56+
57+ if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
58+ return FALSE;
59+ if (dent == NULL)
60+ break;
61+
62+ if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
63+ {
64+ if (errno == ENOENT)
65+ continue;
66+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "fstatat");
67+ return FALSE;
68+ }
69+
70+ if (S_ISLNK(stbuf.st_mode))
71+ {
72+ char path_buffer[PATH_MAX];
73+ g_autofree char *symlink_target = NULL;
74+ symlink_target = glnx_readlinkat_malloc (boot_dfd, dent->d_name, cancellable, error);
75+
76+ if (g_str_has_prefix (symlink_target, "loader/"))
77+ {
78+ if (g_strcmp0 (dent->d_name, "uEnv.txt") == 0)
79+ continue;
80+
81+ snprintf (path_buffer, sizeof(path_buffer), "%s/%s", bootcsum_dir, dent->d_name);
82+ if (faccessat (boot_dfd, path_buffer + 1, F_OK, AT_SYMLINK_NOFOLLOW) == -1)
83+ {
84+ /* This bootcsum dir does not contain the final target, do nothing. */
85+ if (errno == ENOENT)
86+ continue;
87+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "faccessat");
88+ return FALSE;
89+ }
90+
91+ /* Cleanup from stray symlinks. This can happend when the previous deployment was
92+ interrupted and no cleanup routines were run before restaring the deployment. */
93+ if (unlinkat (loader_dfd, dent->d_name, 0) == -1 && errno != ENOENT)
94+ {
95+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "unlinkat");
96+ return FALSE;
97+ }
98+ /* Complete the link chain to the current boot file version. */
99+ snprintf (path_buffer, sizeof(path_buffer), "..%s/%s", bootcsum_dir, dent->d_name);
100+ if (symlinkat (path_buffer, loader_dfd, dent->d_name) == -1)
101+ {
102+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "symlinkat");
103+ return FALSE;
104+ }
105+ }
106+ }
107+ }
108+
109+ return TRUE;
110+}
111+
112 static gboolean
113 create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
114 int bootversion,
115@@ -138,7 +229,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
116 }
117 }
118
119- return TRUE;
120+ return create_firmware_convenience_symlinks (self, bootdir, bootversion, cancellable, error);
121 }
122
123 static gboolean
124--
1252.7.4
126
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Mount-boot-partition.patch b/meta-boot2qt/recipes-core/ostree/ostree/Mount-boot-partition.patch
new file mode 100644
index 0000000..a81f731
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Mount-boot-partition.patch
@@ -0,0 +1,60 @@
1From 33642082578946fdc73ade8b78c05ba8d8521652 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Mon, 7 Mar 2016 15:17:34 +0100
4Subject: [PATCH] ostree: Mount boot partition from user space
5
6In 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
14The new approch does not assume any of the above, and
15moves this logic from early user space (initramfs) to
16user space. Initramfs by design should be used only to
17prepare 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
22diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c
23index 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--
592.7.0
60
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch b/meta-boot2qt/recipes-core/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch
new file mode 100644
index 0000000..f8e7324
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Print-pull-progress-also-when-not-on-console.patch
@@ -0,0 +1,94 @@
1From b24d691d968bca608142882b453e98ed5ee267e9 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Thu, 29 Sep 2016 11:46:59 +0200
4Subject: [PATCH] Print pull progress also when not on console
5
6glnx_console_text is smart enough:
7
8"On a tty, print to the console @text followed by an ASCII art
9 progress bar whose percentage is @percentage. If stdout is not a
10 tty, a more basic line by line change will be printed."
11
12Otherwise, when pulling a lot of data, we do not get any feedback
13in a GUI application for a significant amount of time.
14---
15 src/ostree/ot-admin-builtin-switch.c | 3 +--
16 src/ostree/ot-admin-builtin-upgrade.c | 3 +--
17 src/ostree/ot-builtin-pull-local.c | 3 +--
18 src/ostree/ot-builtin-pull.c | 12 ++++--------
19 4 files changed, 7 insertions(+), 14 deletions(-)
20
21diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c
22index 895538a..7f1d6dd 100644
23--- a/src/ostree/ot-admin-builtin-switch.c
24+++ b/src/ostree/ot-admin-builtin-switch.c
25@@ -126,8 +126,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
26 { g_auto(GLnxConsoleRef) console = { 0, };
27 glnx_console_lock (&console);
28
29- if (console.is_tty)
30- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
31+ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
32
33 /* Always allow older...there's not going to be a chronological
34 * relationship necessarily.
35diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
36index 81f9bb6..8147b4f 100644
37--- a/src/ostree/ot-admin-builtin-upgrade.c
38+++ b/src/ostree/ot-admin-builtin-upgrade.c
39@@ -109,8 +109,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr
40 { g_auto(GLnxConsoleRef) console = { 0, };
41 glnx_console_lock (&console);
42
43- if (console.is_tty)
44- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
45+ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
46
47 if (opt_allow_downgrade)
48 upgraderpullflags |= OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER;
49diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
50index 5401a28..f2f5b21 100644
51--- a/src/ostree/ot-builtin-pull-local.c
52+++ b/src/ostree/ot-builtin-pull-local.c
53@@ -159,8 +159,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
54 g_variant_builder_add (&builder, "{s@v}", "depth",
55 g_variant_new_variant (g_variant_new_int32 (opt_depth)));
56
57- if (console.is_tty)
58- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
59+ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
60
61 opts = g_variant_ref_sink (g_variant_builder_end (&builder));
62 if (!ostree_repo_pull_with_options (repo, src_repo_uri,
63diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
64index 99b2593..78686b3 100644
65--- a/src/ostree/ot-builtin-pull.c
66+++ b/src/ostree/ot-builtin-pull.c
67@@ -242,20 +242,16 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
68
69 if (!opt_dry_run)
70 {
71- if (console.is_tty)
72- progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
73+ progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, &console);
74 }
75 else
76 {
77 progress = ostree_async_progress_new_and_connect (dry_run_console_progress_changed, NULL);
78 }
79
80- if (console.is_tty)
81- {
82- signal_handler_id = g_signal_connect (repo, "gpg-verify-result",
83- G_CALLBACK (gpg_verify_result_cb),
84- &console);
85- }
86+ signal_handler_id = g_signal_connect (repo, "gpg-verify-result",
87+ G_CALLBACK (gpg_verify_result_cb),
88+ &console);
89
90 if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder),
91 progress, cancellable, error))
92--
932.7.4
94
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Support-for-booting-without-initramfs.patch b/meta-boot2qt/recipes-core/ostree/ostree/Support-for-booting-without-initramfs.patch
new file mode 100644
index 0000000..4ec137f
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Support-for-booting-without-initramfs.patch
@@ -0,0 +1,131 @@
1From a31c9083870fd934e242cc9cc56fdd39ad0a42cb Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Wed, 24 Aug 2016 12:00:14 +0200
4Subject: [PATCH 3/4] Support for booting without initramfs
5
6Previously when initramfs-* was not found in a deployment's
7boot directory, it was assumed that rootfs is prepared for
8ostree booting by a kernel patch.
9
10With this patch, the behaviour changes to be - if initramfs-*
11is not found, assume that system is using a static
12ostree-prepare-root as init process. Booting without initramfs
13is a common use case on embedded systems. This approach is
14also more convenient, than having to patch the kernel.
15---
16 Makefile-switchroot.am | 3 +++
17 configure.ac | 8 ++++++++
18 src/boot/grub2/ostree-grub-generator | 8 +++++---
19 src/libostree/ostree-sysroot-deploy.c | 18 +++++++++++++-----
20 4 files changed, 29 insertions(+), 8 deletions(-)
21
22diff --git a/Makefile-switchroot.am b/Makefile-switchroot.am
23index ef837ce..70a6de7 100644
24--- a/Makefile-switchroot.am
25+++ b/Makefile-switchroot.am
26@@ -29,6 +29,9 @@ libswitchroot_mountutil_la_SOURCES = \
27 ostree_prepare_root_SOURCES = src/switchroot/ostree-prepare-root.c
28 ostree_prepare_root_LDADD = libswitchroot-mountutil.la
29 ostree_prepare_root_CFLAGS = $(AM_CFLAGS) -Isrc/switchroot
30+if BUILDOPT_STATIC_PREPARE_ROOT
31+ostree_prepare_root_LDFLAGS = --static
32+endif
33
34 ostree_remount_SOURCES = src/switchroot/ostree-remount.c
35 ostree_remount_LDADD = libswitchroot-mountutil.la
36diff --git a/configure.ac b/configure.ac
37index 4831bcc..97f3112 100644
38--- a/configure.ac
39+++ b/configure.ac
40@@ -294,6 +294,13 @@ AS_IF([test x$with_grub2_mkconfig_path = x], [
41 ],[GRUB2_MKCONFIG=$with_grub2_mkconfig_path])
42 AC_DEFINE_UNQUOTED([GRUB2_MKCONFIG_PATH], ["$GRUB2_MKCONFIG"], [The system grub2-mkconfig executible name])
43
44+AC_ARG_WITH(static-prepare-root,
45+ AS_HELP_STRING([--with-static-prepare-root],
46+ [Build static version of the 'ostree-prepare-root' binary. Useful when
47+ using 'ostree-prepare-root' as the init (PID 1) process. (default: no)]),,
48+ [with_static_prepare_root=no])
49+AM_CONDITIONAL(BUILDOPT_STATIC_PREPARE_ROOT, test x$with_static_prepare_root = xyes)
50+
51 dnl for tests
52 AS_IF([test "x$found_introspection" = xyes], [
53 AC_PATH_PROG(GJS, [gjs])
54@@ -327,6 +334,7 @@ echo "
55 libarchive (parse tar files directly): $with_libarchive
56 static deltas: yes (always enabled now)
57 O_TMPFILE: $enable_otmpfile
58+ static ostree-prepare-root $with_static_prepare_root
59 man pages (xsltproc): $enable_man
60 api docs (gtk-doc): $enable_gtk_doc
61 gjs-based tests: $have_gjs
62diff --git a/src/boot/grub2/ostree-grub-generator b/src/boot/grub2/ostree-grub-generator
63index 5673b26..ceca806 100644
64--- a/src/boot/grub2/ostree-grub-generator
65+++ b/src/boot/grub2/ostree-grub-generator
66@@ -28,7 +28,7 @@ entries_path=$(dirname $new_grub2_cfg)/entries
67
68 read_config()
69 {
70- config_file=${entries_path}/${1}
71+ config_file=${1}
72 title=""
73 initrd=""
74 options=""
75@@ -62,11 +62,13 @@ read_config()
76 populate_menu()
77 {
78 boot_prefix="${OSTREE_BOOT_PARTITION}"
79- for config in $(ls ${entries_path}); do
80+ for config in $(ls $entries_path/*.conf); do
81 read_config ${config}
82 menu="${menu}menuentry '${title}' {\n"
83 menu="${menu}\t linux ${boot_prefix}${linux} ${options}\n"
84- menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
85+ if [ -n "${initrd}" ] ; then
86+ menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
87+ fi
88 menu="${menu}}\n\n"
89 done
90 # The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
91diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
92index a05ca30..c0a0347 100644
93--- a/src/libostree/ostree-sysroot-deploy.c
94+++ b/src/libostree/ostree-sysroot-deploy.c
95@@ -1458,20 +1458,28 @@ install_deployment_kernel (OstreeSysroot *sysroot,
96 ostree_bootconfig_parser_set (bootconfig, "linux", boot_relpath);
97 }
98
99+ val = ostree_bootconfig_parser_get (bootconfig, "options");
100+ kargs = _ostree_kernel_args_from_string (val);
101+
102 if (dest_initramfs_name)
103 {
104 g_autofree char * boot_relpath = g_strconcat ("/", bootcsumdir, "/", dest_initramfs_name, NULL);
105 ostree_bootconfig_parser_set (bootconfig, "initrd", boot_relpath);
106 }
107-
108- val = ostree_bootconfig_parser_get (bootconfig, "options");
109+ else
110+ {
111+ g_autofree char *prepare_root_arg = NULL;
112+ prepare_root_arg = g_strdup_printf ("init=/ostree/boot.%d/%s/%s/%d/usr/lib/ostree/ostree-prepare-root",
113+ new_bootversion, osname, bootcsum,
114+ ostree_deployment_get_bootserial (deployment));
115+ _ostree_kernel_args_replace_take (kargs, g_steal_pointer (&prepare_root_arg));
116+ }
117
118 ostree_kernel_arg = g_strdup_printf ("ostree=/ostree/boot.%d/%s/%s/%d",
119 new_bootversion, osname, bootcsum,
120 ostree_deployment_get_bootserial (deployment));
121- kargs = _ostree_kernel_args_from_string (val);
122- _ostree_kernel_args_replace_take (kargs, ostree_kernel_arg);
123- ostree_kernel_arg = NULL;
124+ _ostree_kernel_args_replace_take (kargs, g_steal_pointer (&ostree_kernel_arg));
125+
126 options_key = _ostree_kernel_args_to_string (kargs);
127 ostree_bootconfig_parser_set (bootconfig, "options", options_key);
128
129--
1302.7.4
131
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/Workaround-the-SIGCHLD-handler-issue.patch b/meta-boot2qt/recipes-core/ostree/ostree/Workaround-the-SIGCHLD-handler-issue.patch
new file mode 100644
index 0000000..ece69b8
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/Workaround-the-SIGCHLD-handler-issue.patch
@@ -0,0 +1,54 @@
1From c7cf5cb80c57423e707d87013050c6f9cc6f6d37 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Tue, 18 Oct 2016 12:19:57 +0200
4Subject: [PATCH] Workaround the SIGCHLD handler issue
5
6REF: https://bugreports.qt.io/browse/QTBUG-56338
7---
8 src/libostree/ostree-bootloader-grub2.c | 30 ++++++++++++++++++++++--------
9 1 file changed, 22 insertions(+), 8 deletions(-)
10
11diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c
12index f3dc8e1..2c60b80 100644
13--- a/src/libostree/ostree-bootloader-grub2.c
14+++ b/src/libostree/ostree-bootloader-grub2.c
15@@ -380,14 +380,28 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
16
17 Upstream is fixed though.
18 */
19- proc = g_subprocess_launcher_spawn (launcher, error,
20- grub_exec, "-o",
21- gs_file_get_path_cached (new_config_path),
22- NULL);
23-
24- if (!g_subprocess_wait_check (proc, cancellable, error))
25- goto out;
26-
27+ //proc = g_subprocess_launcher_spawn (launcher, error,
28+ // grub_exec, "-o",
29+ // gs_file_get_path_cached (new_config_path),
30+ // NULL);
31+
32+ //if (!g_subprocess_wait_check (proc, cancellable, error))
33+ // goto out;
34+ {
35+ // REF: https://bugreports.qt.io/browse/QTBUG-56338
36+ // We do not use the chroot (grub2_child_setup) code path, so we do not
37+ // care about GSubprocessLauncher and the custom envvars passed to it.
38+ const char *cmd = glnx_strjoina (grub_exec, " -o ", gs_file_get_path_cached (new_config_path));
39+ FILE *fp = popen(cmd, "r");
40+ if (!fp) {
41+ glnx_set_prefix_error_from_errno (error, "popen (%s)", cmd);
42+ goto out;
43+ }
44+ if (pclose(fp) == -1) {
45+ glnx_set_prefix_error_from_errno (error, "pclose (%s)", cmd);
46+ goto out;
47+ }
48+ }
49 /* Now let's fdatasync() for the new file */
50 { glnx_fd_close int new_config_fd = open (gs_file_get_path_cached (new_config_path), O_RDONLY | O_CLOEXEC);
51 if (new_config_fd < 0)
52--
532.7.4
54
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/deploy-add-karg-none-argument.patch b/meta-boot2qt/recipes-core/ostree/ostree/deploy-add-karg-none-argument.patch
new file mode 100644
index 0000000..5eaf68f
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/deploy-add-karg-none-argument.patch
@@ -0,0 +1,62 @@
1From 9ca3a2cc64bc709649d0d756fa715aaef807dca8 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Fri, 12 Aug 2016 11:51:04 +0200
4Subject: [PATCH 2/4] deploy: add --karg-none argument
5
6If the current deployment has "rootwait root=/dev/sda2",
7but the new deployment does not need "rootwait" anymore,
8there is no way to clear this arg at the moment (as opposed
9to "karg=root=", which overrides any earlier argument with
10the same name). With "--karg-none" users can now clear all
11the previous args and set new "root=":
12
13ostree admin deploy --karg-none --karg=root=LABEL=rootfs
14---
15 src/ostree/ot-admin-builtin-deploy.c | 10 +++++++++-
16 1 file changed, 9 insertions(+), 1 deletion(-)
17
18diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c
19index c66c9b3..420efa3 100644
20--- a/src/ostree/ot-admin-builtin-deploy.c
21+++ b/src/ostree/ot-admin-builtin-deploy.c
22@@ -38,6 +38,7 @@ static char **opt_kernel_argv_append;
23 static gboolean opt_kernel_proc_cmdline;
24 static char *opt_osname;
25 static char *opt_origin_path;
26+static gboolean opt_kernel_arg_none;
27
28 static GOptionEntry options[] = {
29 { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Use a different operating system root than the current one", "OSNAME" },
30@@ -46,6 +47,7 @@ static GOptionEntry options[] = {
31 { "karg-proc-cmdline", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_proc_cmdline, "Import current /proc/cmdline", NULL },
32 { "karg", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv, "Set kernel argument, like root=/dev/sda1; this overrides any earlier argument with the same name", "NAME=VALUE" },
33 { "karg-append", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_kernel_argv_append, "Append kernel argument; useful with e.g. console= that can be used multiple times", "NAME=VALUE" },
34+ { "karg-none", 0, 0, G_OPTION_ARG_NONE, &opt_kernel_arg_none, "Do not import kernel arguments", NULL },
35 { NULL }
36 };
37
38@@ -77,6 +79,12 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
39 goto out;
40 }
41
42+ if (opt_kernel_proc_cmdline && opt_kernel_arg_none)
43+ {
44+ ot_util_usage_error (context, "Can't specify both --karg-proc-cmdline and --karg-none", error);
45+ goto out;
46+ }
47+
48 refspec = argv[1];
49
50 if (!ostree_sysroot_load (sysroot, cancellable, error))
51@@ -135,7 +143,7 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
52 if (!_ostree_kernel_args_append_proc_cmdline (kargs, cancellable, error))
53 goto out;
54 }
55- else if (merge_deployment)
56+ else if (merge_deployment && !opt_kernel_arg_none)
57 {
58 OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (merge_deployment);
59 g_auto(GStrv) previous_args = g_strsplit (ostree_bootconfig_parser_get (bootconfig, "options"), " ", -1);
60--
612.7.4
62
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch b/meta-boot2qt/recipes-core/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch
new file mode 100644
index 0000000..2800618
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch
@@ -0,0 +1,54 @@
1From d183819e6e7bdc7a9476542cbef384285f592f3f Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Fri, 12 Aug 2016 08:50:29 +0200
4Subject: [PATCH 1/4] ostree-prepare-root: enabler for simpler kernel arg
5
6With the current approach, when ostree-prepare-root is used
7on the kernel command line as init=, it always assumes that
8the next value in the argument list is a path to the sysroot.
9The code for falling back to a default path (if none is provided),
10would only work if init= is the last arg in the argument list.
11We can not rely on that and have to explicitly provide the
12path to the sysroot. Which defeats the purpose of a default
13path selection code.
14
15To keep command line neater assume that sysroot is on / when
16using ostree-prepare-root as init. This probably is what most
17people want anyways. Also _ostree_kernel_args* API assumes
18that args are space separated list. Which is problematic for:
19"init=${ostree}/usr/lib/ostree/ostree-prepare-root /" as it
20gets split in two.
21---
22 src/switchroot/ostree-prepare-root.c | 15 ++++++++++++---
23 1 file changed, 12 insertions(+), 3 deletions(-)
24
25diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
26index 895b2e5..449fc33 100644
27--- a/src/switchroot/ostree-prepare-root.c
28+++ b/src/switchroot/ostree-prepare-root.c
29@@ -199,10 +199,19 @@ main(int argc, char *argv[])
30 char srcpath[PATH_MAX];
31 struct stat stbuf;
32
33- if (argc < 2)
34- root_mountpoint = "/";
35+ if (getpid() == 1)
36+ {
37+ root_mountpoint = "/";
38+ }
39 else
40- root_mountpoint = argv[1];
41+ {
42+ if (argc < 2)
43+ {
44+ fprintf (stderr, "usage: ostree-prepare-root SYSROOT\n");
45+ exit (EXIT_FAILURE);
46+ }
47+ root_mountpoint = argv[1];
48+ }
49
50 root_mountpoint = realpath (root_mountpoint, NULL);
51 deploy_path = resolve_deploy_path (root_mountpoint);
52--
532.7.4
54
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch b/meta-boot2qt/recipes-core/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch
new file mode 100644
index 0000000..e8c8f16
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch
@@ -0,0 +1,52 @@
1From 8323c038733522f7f31fefc8921b7c1760416638 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@qt.io>
3Date: Mon, 22 Aug 2016 15:52:21 +0200
4Subject: [PATCH 3/3] u-boot: add 'bootdir' to the generated uEnv.txt
5
6When doing a full copy of:
7
8$deployment/usr/lib/ostree-boot -> /boot/ostree/$os-$bootcsum/
9
10U-Boot bootscript can use the 'bootdir' to find, for example,
11the Device Tree (dtb) file, as in:
12
13load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname}
14
15Or u-boot external bootscript:
16
17load ${dtype} ${disk}:${bootpart} ${a_scr} ${bootdir}${scriptname}
18
19It could also be possible to point 'bootdir' directly to the
20$deployment/usr/lib/ostree-boot, but this would add unnecessary
21restrictions on what file system can be used for rootfs as u-boot,
22for example, can not read from BTRFS. So having
23bootdir=/boot/ostree/$os-$bootcsum/ is a better approach here, as
24/boot can be on a separate partition with its own file system type.
25---
26 src/libostree/ostree-bootloader-uboot.c | 3 +++
27 1 file changed, 3 insertions(+)
28
29diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
30index f95ea84..0786626 100644
31--- a/src/libostree/ostree-bootloader-uboot.c
32+++ b/src/libostree/ostree-bootloader-uboot.c
33@@ -72,6 +72,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
34 g_autoptr(GPtrArray) boot_loader_configs = NULL;
35 OstreeBootconfigParser *config;
36 const char *val;
37+ g_autofree char *bootdir = NULL;
38
39 if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs,
40 cancellable, error))
41@@ -88,6 +89,8 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
42 return FALSE;
43 }
44 g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val));
45+ bootdir = strndup (val, strrchr(val, '/') - val);
46+ g_ptr_array_add (new_lines, g_strdup_printf ("bootdir=%s/", bootdir));
47
48 val = ostree_bootconfig_parser_get (config, "initrd");
49 if (val)
50--
512.7.4
52
diff --git a/meta-boot2qt/recipes-core/ostree/ostree/workaround-gtkdocize-configure-issue-in-autog.patch b/meta-boot2qt/recipes-core/ostree/ostree/workaround-gtkdocize-configure-issue-in-autog.patch
new file mode 100644
index 0000000..5f19007
--- /dev/null
+++ b/meta-boot2qt/recipes-core/ostree/ostree/workaround-gtkdocize-configure-issue-in-autog.patch
@@ -0,0 +1,26 @@
1From 0b6711e10d36060d80962472c892c60e8a403422 Mon Sep 17 00:00:00 2001
2From: Mikko Gronoff <mikko.gronoff@qt.io>
3Date: Thu, 2 Feb 2017 13:38:54 +0200
4Subject: [PATCH] ostree: workaround gtkdocize configure issue in autogen.sh
5
6Building meta-boot2qt morty branch content with poky 2.2.1 causes
7build break in ostree autogen.sh. Called gtkdocize script uses wrong
8docdir thus causing error trying to remove gtk-doc.make in wrong
9location
10---
11 autogen.sh | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/autogen.sh b/autogen.sh
15index 0f32089..f473fdc 100755
16--- a/autogen.sh
17+++ b/autogen.sh
18@@ -25,7 +25,7 @@ EXTRA_DIST =
19 CLEANFILES =
20 EOF
21 else
22- gtkdocize
23+ gtkdocize --docdir $srcdir --srcdir $srcdir
24 fi
25
26 cd $olddir