diff options
14 files changed, 534 insertions, 288 deletions
diff --git a/classes/consistent_timestamps.bbclass b/classes/consistent_timestamps.bbclass index 08cc401..1f560c2 100644 --- a/classes/consistent_timestamps.bbclass +++ b/classes/consistent_timestamps.bbclass | |||
@@ -28,8 +28,8 @@ | |||
28 | ############################################################################ | 28 | ############################################################################ |
29 | 29 | ||
30 | update_file_timestaps() { | 30 | update_file_timestaps() { |
31 | # Update file timestamp to 0 seconds since Epoch time. | 31 | # Update file timestamp to 1 second since Epoch time. |
32 | TZ=UTC find ${IMAGE_ROOTFS} -exec touch -h -m -t '197001010000' {} \; | 32 | TZ=UTC find ${IMAGE_ROOTFS} -exec touch -h -m -t '197001010000.01' {} \; |
33 | } | 33 | } |
34 | 34 | ||
35 | ROOTFS_POSTINSTALL_COMMAND += "update_file_timestaps; " | 35 | ROOTFS_POSTINSTALL_COMMAND += "update_file_timestaps; " |
diff --git a/meta-intel-extras/classes/image_dd_efi.bbclass b/meta-intel-extras/classes/image_dd_efi.bbclass index 9cb2075..1f5fd9f 100644 --- a/meta-intel-extras/classes/image_dd_efi.bbclass +++ b/meta-intel-extras/classes/image_dd_efi.bbclass | |||
@@ -33,15 +33,6 @@ LICENSE = "CLOSED" | |||
33 | inherit image_dd | 33 | inherit image_dd |
34 | 34 | ||
35 | EXTRA_IMAGECMD_ext3 += "-L rootfs" | 35 | EXTRA_IMAGECMD_ext3 += "-L rootfs" |
36 | IMAGE_DEPENDS_ext3 += "initramfs-basic:do_rootfs" | ||
37 | |||
38 | IMAGE_CMD_ext3_prepend() { | ||
39 | |||
40 | # https://www.kernel.org/doc/Documentation/x86/early-microcode.txt | ||
41 | microcode="${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}" | ||
42 | cat ${microcode} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz > ${IMAGE_ROOTFS}/boot/initramfs | ||
43 | chmod 0644 ${IMAGE_ROOTFS}/boot/initramfs | ||
44 | } | ||
45 | 36 | ||
46 | do_populate_boot() { | 37 | do_populate_boot() { |
47 | 38 | ||
diff --git a/meta-intel-extras/recipes/grub/grub-efi_2.00.bbappend b/meta-intel-extras/recipes/grub/grub-efi_2.00.bbappend index 8a223fe..0104aab 100644 --- a/meta-intel-extras/recipes/grub/grub-efi_2.00.bbappend +++ b/meta-intel-extras/recipes/grub/grub-efi_2.00.bbappend | |||
@@ -30,6 +30,12 @@ | |||
30 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 30 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
31 | SRC_URI += "file://grub.cfg" | 31 | SRC_URI += "file://grub.cfg" |
32 | 32 | ||
33 | do_install[depends] += " \ | ||
34 | virtual/kernel:do_deploy \ | ||
35 | ${INITRAMFS_IMAGE}:do_rootfs \ | ||
36 | ${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', 'intel-microcode:do_deploy', '', d)} \ | ||
37 | " | ||
38 | |||
33 | do_deploy_prepend() { | 39 | do_deploy_prepend() { |
34 | 40 | ||
35 | cat > ${WORKDIR}/cfg <<EOF | 41 | cat > ${WORKDIR}/cfg <<EOF |
@@ -42,7 +48,12 @@ do_install_append() { | |||
42 | 48 | ||
43 | install -d ${D}/boot/grub2/ | 49 | install -d ${D}/boot/grub2/ |
44 | install -m 644 ${WORKDIR}/grub.cfg ${D}/boot/grub2/ | 50 | install -m 644 ${WORKDIR}/grub.cfg ${D}/boot/grub2/ |
51 | |||
52 | # https://www.kernel.org/doc/Documentation/x86/early-microcode.txt | ||
53 | microcode="${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}" | ||
54 | cat ${microcode} ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz > ${D}/boot/initramfs | ||
55 | chmod 0644 ${D}/boot/initramfs | ||
45 | } | 56 | } |
46 | 57 | ||
47 | PACKAGES += "${PN}-config" | 58 | PACKAGES += "${PN}-config" |
48 | FILES_${PN}-config = "/boot/grub2/" | 59 | FILES_${PN}-config = "/boot/grub2/ /boot/initramfs" |
diff --git a/recipes/libgsystem/libgsystem.bb b/recipes/libgsystem/libgsystem.bb deleted file mode 100644 index 0e14055..0000000 --- a/recipes/libgsystem/libgsystem.bb +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
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 | |||
30 | SUMMARY = "LibGSystem is a GIO-based library, targeted primarily for use by operating system components." | ||
31 | |||
32 | LICENSE = "LGPL-2.1" | ||
33 | LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" | ||
34 | |||
35 | inherit autotools pkgconfig | ||
36 | |||
37 | SRC_URI = "gitsm://github.com/GNOME/libgsystem.git;protocol=git" | ||
38 | SRCREV = "86c24c181ec6c3ec334a39145efc022c3e744929" | ||
39 | |||
40 | S = "${WORKDIR}/git" | ||
41 | |||
42 | DEPENDS = "glib-2.0 attr libcap" | ||
43 | |||
44 | do_configure_prepend() { | ||
45 | # Workaround a broken configure.ac. It should check first if GTK_DOC_CHECK | ||
46 | # macro is actually defined before trying to use it. For how-to see: | ||
47 | # https://developer.gnome.org/gtk-doc-manual/stable/settingup_autoconf.html.en | ||
48 | # We get a syntax error since we do not bundle gnome recipes that define this macro. | ||
49 | sed -i '/GTK_DOC_CHECK/d' ${S}/configure.ac | ||
50 | } | ||
diff --git a/recipes/ostree/ostree.bb b/recipes/ostree/ostree.bb index 39ee76c..0fcb810 100644 --- a/recipes/ostree/ostree.bb +++ b/recipes/ostree/ostree.bb | |||
@@ -35,19 +35,22 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" | |||
35 | inherit autotools pkgconfig systemd | 35 | inherit autotools pkgconfig systemd |
36 | 36 | ||
37 | SRC_URI = " \ | 37 | SRC_URI = " \ |
38 | git://github.com/GNOME/ostree.git \ | 38 | git://github.com/ostreedev/ostree.git \ |
39 | file://Fix-enable_rofiles_fuse-no-build.patch \ | ||
40 | file://Mount-boot-partition.patch \ | 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 \ | ||
41 | file://Allow-updating-files-in-the-boot-directory.patch \ | 43 | file://Allow-updating-files-in-the-boot-directory.patch \ |
44 | file://u-boot-add-bootdir-to-the-generated-uEnv.txt.patch \ | ||
42 | file://u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch \ | 45 | file://u-boot-Merge-ostree-s-and-systems-uEnv.txt.patch \ |
43 | file://Create-firmware-convenience-symlinks.patch \ | 46 | file://Create-firmware-convenience-symlinks.patch \ |
44 | " | 47 | " |
45 | 48 | ||
46 | SRCREV = "v2016.5" | 49 | SRCREV = "77af6844d8330b31d58080076afb31e08974ce09" |
47 | 50 | ||
48 | S = "${WORKDIR}/git" | 51 | S = "${WORKDIR}/git" |
49 | 52 | ||
50 | DEPENDS = "glib-2.0 e2fsprogs gpgme attr libsoup-2.4 libgsystem libassuan xz" | 53 | DEPENDS = "glib-2.0 e2fsprogs gpgme attr libsoup-2.4 libassuan xz" |
51 | # Bash is needed by the shipped dracut module. This dracut module is used to generate initramfs image. | 54 | # Bash is needed by the shipped dracut module. This dracut module is used to generate initramfs image. |
52 | # The production image do not require bash for proper working. | 55 | # The production image do not require bash for proper working. |
53 | RDEPENDS_${PN} += "bash" | 56 | RDEPENDS_${PN} += "bash" |
@@ -68,6 +71,8 @@ EXTRA_OECONF = "--with-dracut \ | |||
68 | --enable-gtk-doc-html=no \ | 71 | --enable-gtk-doc-html=no \ |
69 | --enable-man=no \ | 72 | --enable-man=no \ |
70 | --with-soup \ | 73 | --with-soup \ |
74 | --with-static-prepare-root \ | ||
75 | --disable-otmpfile \ | ||
71 | --enable-libsoup-client-certs" | 76 | --enable-libsoup-client-certs" |
72 | 77 | ||
73 | do_configure_prepend() { | 78 | do_configure_prepend() { |
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 index ffcc77c..d416543 100644 --- a/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch +++ b/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch | |||
@@ -1,34 +1,90 @@ | |||
1 | From 7f4549c6e94494460be06311c3a4d23ae684ab21 Mon Sep 17 00:00:00 2001 | 1 | From cc31c80658a90cf1b13fdf9fe8b6dde1cc9a0d24 Mon Sep 17 00:00:00 2001 |
2 | From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> | 2 | From: Gatis Paeglis <gatis.paeglis@qt.io> |
3 | Date: Wed, 20 Apr 2016 13:58:27 +0200 | 3 | Date: Mon, 22 Aug 2016 11:32:16 +0200 |
4 | Subject: [PATCH 1/3] Allow updating files in the /boot directory. | 4 | Subject: [PATCH 1/3] Allow updating files in the /boot directory |
5 | 5 | ||
6 | Until now OSTree copied only the vmlinuz and initramfs | 6 | This patch adds support for copying (or hardlinking on |
7 | binaries to the boot/ directory (which in some setups | 7 | single partition systems) all files from the deployment's |
8 | might be on a separate partition). This patch adds | 8 | /usr/lib/ostree-boot directory to the relevant |
9 | support for copying other files from the deployment's | 9 | /boot/ostree/$os-$bootcsum/ directory. This feature can |
10 | /boot directory to the real /boot. | 10 | be enabled by 'touch .ostree-bootcsumdir-source' in |
11 | 11 | /usr/lib/ostree-boot. | |
12 | How this works: | ||
13 | |||
14 | Ignore subdirectories, only files in root of the boot | ||
15 | directory are copied. There is overhead of copying files | ||
16 | to boot/, therefore the amount of files in boot/ should | ||
17 | be kept to the minimum and subdirectories shouldn't | ||
18 | really be necessary. | ||
19 | |||
20 | Files in the boot/ directory are updated only with major | ||
21 | releases, when kernel/initramfs bootcsum changes. Files | ||
22 | that require frequent updates should not be stored here. | ||
23 | --- | 12 | --- |
24 | src/libostree/ostree-sysroot-deploy.c | 52 +++++++++++++++++++++++++++++++++++ | 13 | src/libostree/ostree-sysroot-deploy.c | 101 +++++++++++++++++++++++++++++++--- |
25 | 1 file changed, 52 insertions(+) | 14 | 1 file changed, 94 insertions(+), 7 deletions(-) |
26 | 15 | ||
27 | diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c | 16 | diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c |
28 | index 8877236..8cf080e 100644 | 17 | index a05ca30..f34e3f3 100644 |
29 | --- a/src/libostree/ostree-sysroot-deploy.c | 18 | --- a/src/libostree/ostree-sysroot-deploy.c |
30 | +++ b/src/libostree/ostree-sysroot-deploy.c | 19 | +++ b/src/libostree/ostree-sysroot-deploy.c |
31 | @@ -1295,6 +1295,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, | 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, | ||
32 | g_autofree char *version_key = NULL; | 88 | g_autofree char *version_key = NULL; |
33 | g_autofree char *ostree_kernel_arg = NULL; | 89 | g_autofree char *ostree_kernel_arg = NULL; |
34 | g_autofree char *options_key = NULL; | 90 | g_autofree char *options_key = NULL; |
@@ -36,60 +92,66 @@ index 8877236..8cf080e 100644 | |||
36 | GString *title_key; | 92 | GString *title_key; |
37 | __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; | 93 | __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; |
38 | const char *val; | 94 | const char *val; |
39 | @@ -1361,6 +1362,57 @@ install_deployment_kernel (OstreeSysroot *sysroot, | 95 | @@ -1367,6 +1397,63 @@ install_deployment_kernel (OstreeSysroot *sysroot, |
40 | } | 96 | } |
41 | } | 97 | } |
42 | 98 | ||
43 | + | 99 | + if (fstatat (tree_boot_dfd, ".ostree-bootcsumdir-source", &stbuf, 0) == 0) |
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 | + { | 100 | + { |
59 | + struct dirent *dent; | 101 | + if (!glnx_dirfd_iterator_init_at (tree_boot_dfd, ".", FALSE, &dfd_iter, error)) |
60 | + | ||
61 | + if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) | ||
62 | + goto out; | 102 | + goto out; |
63 | + | 103 | + |
64 | + if (dent == NULL) | 104 | + while (TRUE) |
65 | + break; | ||
66 | + | ||
67 | + if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, 0) != 0) | ||
68 | + { | 105 | + { |
69 | + if (errno == ENOENT) | 106 | + struct dirent *dent; |
70 | + continue; | ||
71 | + glnx_set_error_from_errno (error); | ||
72 | + goto out; | ||
73 | + } | ||
74 | + | 107 | + |
75 | + if (g_str_has_prefix (dent->d_name, "vmlinuz-") || g_str_has_prefix (dent->d_name, "initramfs-") | 108 | + if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) |
76 | + || !S_ISREG(stbuf.st_mode)) | 109 | + goto out; |
77 | + continue; | 110 | + if (dent == NULL) |
111 | + break; | ||
78 | + | 112 | + |
79 | + if (fstatat (bootcsum_dfd, dent->d_name, &stbuf, 0) != 0) | 113 | + /* Skip special files - vmlinuz-* and initramfs-* are handled separately */ |
80 | + { | 114 | + if (g_str_has_prefix (dent->d_name, "vmlinuz-") || g_str_has_prefix (dent->d_name, "initramfs-")) |
81 | + if (errno != ENOENT) | 115 | + continue; |
116 | + | ||
117 | + if (fstatat (bootcsum_dfd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0) | ||
82 | + { | 118 | + { |
83 | + glnx_set_prefix_error_from_errno (error, "fstat %s", dent->d_name); | 119 | + if (errno != ENOENT) |
84 | + goto out; | 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 | + } | ||
85 | + } | 144 | + } |
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 | + } | 145 | + } |
91 | + } | 146 | + } |
92 | + | 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 | + } | ||
93 | + | 155 | + |
94 | if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0) | 156 | if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0) |
95 | { | 157 | { |
diff --git a/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch b/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch index 960367c..656887d 100644 --- a/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch +++ b/recipes/ostree/ostree/Create-firmware-convenience-symlinks.patch | |||
@@ -1,44 +1,42 @@ | |||
1 | From 310ddd84dc353d93a2cc118725b459dba643cf0b Mon Sep 17 00:00:00 2001 | 1 | From c4df63488b9e09a9aa69e32ea5c0671c9dc50c9d Mon Sep 17 00:00:00 2001 |
2 | From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> | 2 | From: Gatis Paeglis <gatis.paeglis@qt.io> |
3 | Date: Thu, 21 Apr 2016 16:54:05 +0200 | 3 | Date: Wed, 24 Aug 2016 12:29:38 +0200 |
4 | Subject: [PATCH 3/3] Create firmware convenience symlinks. | 4 | Subject: [PATCH] Create firmware convenience symlinks. |
5 | 5 | ||
6 | Later this could be moved into utils or a similar | 6 | Later this could be moved into utils or a similar |
7 | location, if other boot loader backends will need | 7 | location, if other boot loader backends will need |
8 | this functionality. | 8 | this functionality. |
9 | --- | 9 | --- |
10 | src/libostree/ostree-bootloader-uboot.c | 97 ++++++++++++++++++++++++++++++++- | 10 | src/libostree/ostree-bootloader-uboot.c | 93 ++++++++++++++++++++++++++++++++- |
11 | 1 file changed, 96 insertions(+), 1 deletion(-) | 11 | 1 file changed, 92 insertions(+), 1 deletion(-) |
12 | 12 | ||
13 | diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c | 13 | diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c |
14 | index 9bcde9c..be5e8c5 100644 | 14 | index 22251da..26a3127 100644 |
15 | --- a/src/libostree/ostree-bootloader-uboot.c | 15 | --- a/src/libostree/ostree-bootloader-uboot.c |
16 | +++ b/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) | 17 | @@ -62,6 +62,97 @@ _ostree_bootloader_uboot_get_name (OstreeBootloader *bootloader) |
18 | return "U-Boot"; | 18 | return "U-Boot"; |
19 | } | 19 | } |
20 | 20 | ||
21 | +/* It is common for firmware to search / on the boot partition for additional | 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 | 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. | 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 | 24 | + * This issue can be solved by system builders by creating a convenience symlink: |
25 | + * following way: | ||
26 | + * | 25 | + * |
27 | + * cd sysroot/boot | 26 | + * cd sysroot/boot |
28 | + * ln -s loader/second-stage-bootloader second-stage-bootloader | 27 | + * ln -s loader/second-stage-bootloader second-stage-bootloader |
29 | + * | 28 | + * |
30 | + * This function will make sure that loader/second-stage-bootloader points to the | 29 | + * 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 | 30 | + * correct target file version. This function does nothing if boot/ does not contain |
32 | + * symlink files pointing into loader/. | 31 | + * symlink files pointing into the loader/ directory. |
33 | + */ | 32 | + */ |
34 | +static gboolean | 33 | +static gboolean |
35 | +create_firmware_convenience_symlinks (OstreeBootloaderUboot *self, | 34 | +create_firmware_convenience_symlinks (OstreeBootloaderUboot *self, |
36 | + char *bootcsum_dir, | 35 | + char *bootcsum_dir, |
37 | + int bootversion, | 36 | + int bootversion, |
38 | + GCancellable *cancellable, | 37 | + GCancellable *cancellable, |
39 | + GError **error) | 38 | + GError **error) |
40 | +{ | 39 | +{ |
41 | + gboolean ret = FALSE; | ||
42 | + glnx_fd_close int loader_dfd = -1; | 40 | + glnx_fd_close int loader_dfd = -1; |
43 | + glnx_fd_close int boot_dfd = -1; | 41 | + glnx_fd_close int boot_dfd = -1; |
44 | + g_autofree char *loader_dir = NULL; | 42 | + g_autofree char *loader_dir = NULL; |
@@ -46,18 +44,18 @@ index 9bcde9c..be5e8c5 100644 | |||
46 | + | 44 | + |
47 | + loader_dir = g_strdup_printf ("boot/loader.%d/", bootversion); | 45 | + loader_dir = g_strdup_printf ("boot/loader.%d/", bootversion); |
48 | + if (!glnx_opendirat (self->sysroot->sysroot_fd, loader_dir, FALSE, &loader_dfd, error)) | 46 | + if (!glnx_opendirat (self->sysroot->sysroot_fd, loader_dir, FALSE, &loader_dfd, error)) |
49 | + goto out; | 47 | + return FALSE; |
50 | + if (!glnx_opendirat (self->sysroot->sysroot_fd, "boot", FALSE, &boot_dfd, error)) | 48 | + if (!glnx_opendirat (self->sysroot->sysroot_fd, "boot", FALSE, &boot_dfd, error)) |
51 | + goto out; | 49 | + return FALSE; |
52 | + if (!glnx_dirfd_iterator_init_take_fd (dup (boot_dfd), &dfd_iter, error)) | 50 | + if (!glnx_dirfd_iterator_init_take_fd (dup (boot_dfd), &dfd_iter, error)) |
53 | + goto out; | 51 | + return FALSE; |
54 | + | 52 | + |
55 | + while (TRUE) { | 53 | + while (TRUE) { |
56 | + struct dirent *dent; | 54 | + struct dirent *dent; |
57 | + struct stat stbuf; | 55 | + struct stat stbuf; |
58 | + | 56 | + |
59 | + if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) | 57 | + if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) |
60 | + goto out; | 58 | + return FALSE; |
61 | + if (dent == NULL) | 59 | + if (dent == NULL) |
62 | + break; | 60 | + break; |
63 | + | 61 | + |
@@ -66,7 +64,7 @@ index 9bcde9c..be5e8c5 100644 | |||
66 | + if (errno == ENOENT) | 64 | + if (errno == ENOENT) |
67 | + continue; | 65 | + continue; |
68 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "fstatat"); | 66 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "fstatat"); |
69 | + goto out; | 67 | + return FALSE; |
70 | + } | 68 | + } |
71 | + | 69 | + |
72 | + if (S_ISLNK(stbuf.st_mode)) | 70 | + if (S_ISLNK(stbuf.st_mode)) |
@@ -87,44 +85,42 @@ index 9bcde9c..be5e8c5 100644 | |||
87 | + if (errno == ENOENT) | 85 | + if (errno == ENOENT) |
88 | + continue; | 86 | + continue; |
89 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "faccessat"); | 87 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "faccessat"); |
90 | + goto out; | 88 | + return FALSE; |
91 | + } | 89 | + } |
92 | + | 90 | + |
93 | + /* In case 'ostree admin cleanup' was not run after an interrupted deployment */ | 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. */ | ||
94 | + if (unlinkat (loader_dfd, dent->d_name, 0) == -1 && errno != ENOENT) | 93 | + if (unlinkat (loader_dfd, dent->d_name, 0) == -1 && errno != ENOENT) |
95 | + { | 94 | + { |
96 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "unlinkat"); | 95 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "unlinkat"); |
97 | + goto out; | 96 | + return FALSE; |
98 | + } | 97 | + } |
99 | + /* Complete the link chain to the current boot file version */ | 98 | + /* Complete the link chain to the current boot file version. */ |
100 | + snprintf (path_buffer, sizeof(path_buffer), "..%s/%s", bootcsum_dir, dent->d_name); | 99 | + snprintf (path_buffer, sizeof(path_buffer), "..%s/%s", bootcsum_dir, dent->d_name); |
101 | + if (symlinkat (path_buffer, loader_dfd, dent->d_name) == -1) | 100 | + if (symlinkat (path_buffer, loader_dfd, dent->d_name) == -1) |
102 | + { | 101 | + { |
103 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "symlinkat"); | 102 | + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "symlinkat"); |
104 | + goto out; | 103 | + return FALSE; |
105 | + } | 104 | + } |
106 | + } | 105 | + } |
107 | + } | 106 | + } |
108 | + } | 107 | + } |
109 | + | 108 | + |
110 | + ret = TRUE; | 109 | + return TRUE; |
111 | +out: | ||
112 | + return ret; | ||
113 | +} | 110 | +} |
114 | + | 111 | + |
115 | static gboolean | 112 | static gboolean |
116 | create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, | 113 | create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, |
117 | int bootversion, | 114 | int bootversion, |
118 | @@ -130,7 +224,8 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, | 115 | @@ -138,7 +229,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, |
119 | } | 116 | } |
120 | } | 117 | } |
121 | 118 | ||
122 | - ret = TRUE; | 119 | - return TRUE; |
123 | + ret = create_firmware_convenience_symlinks (self, bootdir, bootversion, cancellable, error); | 120 | + return create_firmware_convenience_symlinks (self, bootdir, bootversion, cancellable, error); |
124 | + | ||
125 | out: | ||
126 | return ret; | ||
127 | } | 121 | } |
122 | |||
123 | static gboolean | ||
128 | -- | 124 | -- |
129 | 2.7.4 | 125 | 2.7.4 |
130 | 126 | ||
diff --git a/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch b/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch deleted file mode 100644 index 480fc21..0000000 --- a/recipes/ostree/ostree/Fix-enable_rofiles_fuse-no-build.patch +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | From b54643153cade28523cccee44fdddea2c94e0684 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> | ||
3 | Date: Mon, 25 Apr 2016 13:57:03 +0200 | ||
4 | Subject: [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 | |||
11 | diff --git a/Makefile.am b/Makefile.am | ||
12 | index 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 | ||
25 | diff --git a/configure.ac b/configure.ac | ||
26 | index 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 | -- | ||
39 | 2.7.4 | ||
40 | |||
diff --git a/recipes/ostree/ostree/Support-for-booting-without-initramfs.patch b/recipes/ostree/ostree/Support-for-booting-without-initramfs.patch new file mode 100644 index 0000000..4ec137f --- /dev/null +++ b/recipes/ostree/ostree/Support-for-booting-without-initramfs.patch | |||
@@ -0,0 +1,131 @@ | |||
1 | From a31c9083870fd934e242cc9cc56fdd39ad0a42cb Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@qt.io> | ||
3 | Date: Wed, 24 Aug 2016 12:00:14 +0200 | ||
4 | Subject: [PATCH 3/4] Support for booting without initramfs | ||
5 | |||
6 | Previously when initramfs-* was not found in a deployment's | ||
7 | boot directory, it was assumed that rootfs is prepared for | ||
8 | ostree booting by a kernel patch. | ||
9 | |||
10 | With this patch, the behaviour changes to be - if initramfs-* | ||
11 | is not found, assume that system is using a static | ||
12 | ostree-prepare-root as init process. Booting without initramfs | ||
13 | is a common use case on embedded systems. This approach is | ||
14 | also 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 | |||
22 | diff --git a/Makefile-switchroot.am b/Makefile-switchroot.am | ||
23 | index 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 | ||
36 | diff --git a/configure.ac b/configure.ac | ||
37 | index 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 | ||
62 | diff --git a/src/boot/grub2/ostree-grub-generator b/src/boot/grub2/ostree-grub-generator | ||
63 | index 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 | ||
91 | diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c | ||
92 | index 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 | -- | ||
130 | 2.7.4 | ||
131 | |||
diff --git a/recipes/ostree/ostree/deploy-add-karg-none-argument.patch b/recipes/ostree/ostree/deploy-add-karg-none-argument.patch new file mode 100644 index 0000000..5eaf68f --- /dev/null +++ b/recipes/ostree/ostree/deploy-add-karg-none-argument.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 9ca3a2cc64bc709649d0d756fa715aaef807dca8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@qt.io> | ||
3 | Date: Fri, 12 Aug 2016 11:51:04 +0200 | ||
4 | Subject: [PATCH 2/4] deploy: add --karg-none argument | ||
5 | |||
6 | If the current deployment has "rootwait root=/dev/sda2", | ||
7 | but the new deployment does not need "rootwait" anymore, | ||
8 | there is no way to clear this arg at the moment (as opposed | ||
9 | to "karg=root=", which overrides any earlier argument with | ||
10 | the same name). With "--karg-none" users can now clear all | ||
11 | the previous args and set new "root=": | ||
12 | |||
13 | ostree 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 | |||
18 | diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c | ||
19 | index 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 | -- | ||
61 | 2.7.4 | ||
62 | |||
diff --git a/recipes/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch b/recipes/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch new file mode 100644 index 0000000..2800618 --- /dev/null +++ b/recipes/ostree/ostree/ostree-prepare-root-enabler-for-simpler-kernel-arg.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From d183819e6e7bdc7a9476542cbef384285f592f3f Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@qt.io> | ||
3 | Date: Fri, 12 Aug 2016 08:50:29 +0200 | ||
4 | Subject: [PATCH 1/4] ostree-prepare-root: enabler for simpler kernel arg | ||
5 | |||
6 | With the current approach, when ostree-prepare-root is used | ||
7 | on the kernel command line as init=, it always assumes that | ||
8 | the next value in the argument list is a path to the sysroot. | ||
9 | The code for falling back to a default path (if none is provided), | ||
10 | would only work if init= is the last arg in the argument list. | ||
11 | We can not rely on that and have to explicitly provide the | ||
12 | path to the sysroot. Which defeats the purpose of a default | ||
13 | path selection code. | ||
14 | |||
15 | To keep command line neater assume that sysroot is on / when | ||
16 | using ostree-prepare-root as init. This probably is what most | ||
17 | people want anyways. Also _ostree_kernel_args* API assumes | ||
18 | that args are space separated list. Which is problematic for: | ||
19 | "init=${ostree}/usr/lib/ostree/ostree-prepare-root /" as it | ||
20 | gets split in two. | ||
21 | --- | ||
22 | src/switchroot/ostree-prepare-root.c | 15 ++++++++++++--- | ||
23 | 1 file changed, 12 insertions(+), 3 deletions(-) | ||
24 | |||
25 | diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c | ||
26 | index 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 | -- | ||
53 | 2.7.4 | ||
54 | |||
diff --git a/recipes/ostree/ostree/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 501f8d4..80677c7 100644 --- a/recipes/ostree/ostree/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,104 +1,76 @@ | |||
1 | From 86184e5a266b087ba222b03141b491241e27e284 Mon Sep 17 00:00:00 2001 | 1 | From 4d8648d35ba7fe60f428aab2240aa6044fb51c50 Mon Sep 17 00:00:00 2001 |
2 | From: Gatis Paeglis <gatis.paeglis@theqtcompany.com> | 2 | From: Gatis Paeglis <gatis.paeglis@qt.io> |
3 | Date: Thu, 21 Apr 2016 14:28:38 +0200 | 3 | Date: Tue, 23 Aug 2016 14:32:35 +0200 |
4 | Subject: [PATCH 2/3] u-boot: Merge ostree's and systems uEnv.txt | 4 | Subject: [PATCH 1/2] u-boot: Merge ostree's and systems uEnv.txt |
5 | 5 | ||
6 | This allow for simpler u-boot scripts and is a proper | 6 | This is a proper fix for: |
7 | fix for: https://bugzilla.gnome.org/show_bug.cgi?id=755787 | 7 | https://bugzilla.gnome.org/show_bug.cgi?id=755787 |
8 | 8 | ||
9 | With this patch admin can now: | 9 | With this patch, an admin (system builder) can now: |
10 | 10 | ||
11 | 1) Edit /usr/lib/ostree-boot/uEnv.txt | 11 | 1) Edit /usr/lib/ostree-boot/uEnv.txt |
12 | 2) Deploy the new tree. OSTree will append system's uEnv.txt | ||
13 | to the OSTree's managed uEnv.txt (loader/uEnv.txt). | ||
12 | 14 | ||
13 | 2) Download the update to a target. And during the deploy | 15 | It is common for u-boot systems to read in an extra env |
14 | process OSTree will prepend its env (loader/uEnv.txt) | 16 | from external /uEnv.txt. The same file OSTree uses to pass |
15 | to the system's uEnv.txt | 17 | in its env. With this patch /uEnv.txt now contains OSTree's |
18 | env + custom env added by system builders. | ||
16 | --- | 19 | --- |
17 | src/libostree/ostree-bootloader-uboot.c | 41 ++++++++++++++++++++++++++++++--- | 20 | src/libostree/ostree-bootloader-uboot.c | 40 ++++++++++++++++++++++++++++++++- |
18 | 1 file changed, 38 insertions(+), 3 deletions(-) | 21 | 1 file changed, 39 insertions(+), 1 deletion(-) |
19 | 22 | ||
20 | diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c | 23 | diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c |
21 | index f67e9bd..9bcde9c 100644 | 24 | index f95ea84..5172477 100644 |
22 | --- a/src/libostree/ostree-bootloader-uboot.c | 25 | --- a/src/libostree/ostree-bootloader-uboot.c |
23 | +++ b/src/libostree/ostree-bootloader-uboot.c | 26 | +++ b/src/libostree/ostree-bootloader-uboot.c |
24 | @@ -29,6 +29,10 @@ | 27 | @@ -95,7 +95,45 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, |
25 | #include "otutil.h" | ||
26 | 28 | ||
27 | #include <string.h> | 29 | val = ostree_bootconfig_parser_get (config, "options"); |
28 | +#include <stdlib.h> | ||
29 | +#include <stdio.h> | ||
30 | +#include <unistd.h> | ||
31 | +#include <fcntl.h> | ||
32 | |||
33 | struct _OstreeBootloaderUboot | ||
34 | { | ||
35 | @@ -69,13 +73,17 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, | ||
36 | GCancellable *cancellable, | ||
37 | GError **error) | ||
38 | { | ||
39 | + gboolean ret = FALSE; | ||
40 | g_autoptr(GPtrArray) boot_loader_configs = NULL; | ||
41 | OstreeBootconfigParser *config; | ||
42 | const char *val; | ||
43 | + g_autofree char *bootdir = NULL; | ||
44 | + g_autoptr(GFile) uenv_file = NULL; | ||
45 | + char uenv_path[PATH_MAX]; | ||
46 | |||
47 | if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs, | ||
48 | cancellable, error)) | ||
49 | - return FALSE; | ||
50 | + goto out; | ||
51 | |||
52 | /* U-Boot doesn't support a menu so just pick the first one since the list is ordered */ | ||
53 | config = boot_loader_configs->pdata[0]; | ||
54 | @@ -85,10 +93,13 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, | ||
55 | { | ||
56 | g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, | ||
57 | "No \"linux\" key in bootloader config"); | ||
58 | - return FALSE; | ||
59 | + goto out; | ||
60 | } | ||
61 | g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val)); | ||
62 | |||
63 | + bootdir = strndup (val, strrchr(val, '/') - val); | ||
64 | + g_ptr_array_add (new_lines, g_strdup_printf ("bootdir=%s/", bootdir)); | ||
65 | + | ||
66 | val = ostree_bootconfig_parser_get (config, "initrd"); | ||
67 | if (val) | ||
68 | g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val)); | ||
69 | @@ -97,7 +108,31 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, | ||
70 | if (val) | 30 | if (val) |
71 | g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val)); | 31 | - g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val)); |
72 | |||
73 | - return TRUE; | ||
74 | + /* Append user's uEnv.txt if it exists */ | ||
75 | + snprintf (uenv_path, sizeof(uenv_path), "boot/%s/uEnv.txt", bootdir); | ||
76 | + uenv_file = g_file_get_child (self->sysroot->path, uenv_path); | ||
77 | + if (g_file_query_exists (uenv_file, cancellable)) | ||
78 | + { | 32 | + { |
79 | + g_autoptr(GInputStream) instream = NULL; | 33 | + glnx_fd_close int uenv_fd = -1; |
80 | + g_autoptr(GDataInputStream) datastream = NULL; | 34 | + g_autofree char* kargs = g_strdup (val); |
81 | + gsize len; | 35 | + const char *uenv_path = NULL; |
82 | + instream = (GInputStream*)g_file_read (uenv_file, cancellable, error); | 36 | + const char *ostree_arg = NULL; |
83 | + if (!instream) | ||
84 | + goto out; | ||
85 | + | 37 | + |
86 | + datastream = g_data_input_stream_new (instream); | 38 | + g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val)); |
87 | + while (TRUE) | 39 | + |
40 | + /* Append system's uEnv.txt, if it exists in $deployment/usr/lib/ostree-boot/ */ | ||
41 | + ostree_arg = strtok (kargs, " "); | ||
42 | + while (ostree_arg != NULL && !g_str_has_prefix (ostree_arg, "ostree=")) | ||
43 | + ostree_arg = strtok (NULL, " "); | ||
44 | + if (!ostree_arg) | ||
45 | + { | ||
46 | + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, | ||
47 | + "No ostree= kernel argument found in boot loader configuration file"); | ||
48 | + return FALSE; | ||
49 | + } | ||
50 | + uenv_path = glnx_strjoina (ostree_arg + strlen ("ostree=/"), "/usr/lib/ostree-boot/uEnv.txt"); | ||
51 | + uenv_fd = openat (self->sysroot->sysroot_fd, uenv_path, O_CLOEXEC | O_RDONLY); | ||
52 | + if (uenv_fd != -1) | ||
53 | + { | ||
54 | + char *uenv = glnx_fd_readall_utf8 (uenv_fd, NULL, cancellable, error); | ||
55 | + if (!uenv) | ||
56 | + { | ||
57 | + glnx_set_prefix_error_from_errno (error, "%s", uenv_path); | ||
58 | + return FALSE; | ||
59 | + } | ||
60 | + g_ptr_array_add (new_lines, uenv); | ||
61 | + } | ||
62 | + else | ||
88 | + { | 63 | + { |
89 | + val = g_data_input_stream_read_line (datastream, &len, cancellable, error); | 64 | + if (errno != ENOENT) |
90 | + if (!val) | 65 | + { |
91 | + break; | 66 | + glnx_set_prefix_error_from_errno (error, "%s", uenv_path); |
92 | + g_ptr_array_add (new_lines, (char *)val); | 67 | + return FALSE; |
68 | + } | ||
93 | + } | 69 | + } |
94 | + } | 70 | + } |
95 | + | ||
96 | + ret = TRUE; | ||
97 | +out: | ||
98 | + return ret; | ||
99 | } | ||
100 | 71 | ||
101 | static gboolean | 72 | return TRUE; |
73 | } | ||
102 | -- | 74 | -- |
103 | 2.7.4 | 75 | 2.7.4 |
104 | 76 | ||
diff --git a/recipes/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch b/recipes/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch new file mode 100644 index 0000000..e8c8f16 --- /dev/null +++ b/recipes/ostree/ostree/u-boot-add-bootdir-to-the-generated-uEnv.txt.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From 8323c038733522f7f31fefc8921b7c1760416638 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gatis Paeglis <gatis.paeglis@qt.io> | ||
3 | Date: Mon, 22 Aug 2016 15:52:21 +0200 | ||
4 | Subject: [PATCH 3/3] u-boot: add 'bootdir' to the generated uEnv.txt | ||
5 | |||
6 | When doing a full copy of: | ||
7 | |||
8 | $deployment/usr/lib/ostree-boot -> /boot/ostree/$os-$bootcsum/ | ||
9 | |||
10 | U-Boot bootscript can use the 'bootdir' to find, for example, | ||
11 | the Device Tree (dtb) file, as in: | ||
12 | |||
13 | load ${dtype} ${disk}:${bootpart} ${a_fdt} ${bootdir}${dtbname} | ||
14 | |||
15 | Or u-boot external bootscript: | ||
16 | |||
17 | load ${dtype} ${disk}:${bootpart} ${a_scr} ${bootdir}${scriptname} | ||
18 | |||
19 | It could also be possible to point 'bootdir' directly to the | ||
20 | $deployment/usr/lib/ostree-boot, but this would add unnecessary | ||
21 | restrictions on what file system can be used for rootfs as u-boot, | ||
22 | for example, can not read from BTRFS. So having | ||
23 | bootdir=/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 | |||
29 | diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c | ||
30 | index 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 | -- | ||
51 | 2.7.4 | ||
52 | |||
diff --git a/scripts/upload.sh b/scripts/upload.sh index 96189ea..af7e1f2 100755 --- a/scripts/upload.sh +++ b/scripts/upload.sh | |||
@@ -31,7 +31,7 @@ | |||
31 | set -x | 31 | set -x |
32 | set -e | 32 | set -e |
33 | 33 | ||
34 | RELEASE=5.7 | 34 | RELEASE=5.8 |
35 | UPLOADPATH=QT@ci-files02-hki.ci.local:/srv/jenkins_data/enterprise/b2qt/yocto/${RELEASE}/ | 35 | UPLOADPATH=QT@ci-files02-hki.ci.local:/srv/jenkins_data/enterprise/b2qt/yocto/${RELEASE}/ |
36 | 36 | ||
37 | if [ -e tmp/deploy/images/${MACHINE}/b2qt-${PROJECT}-qt5-image-${MACHINE}.hdd ]; then | 37 | if [ -e tmp/deploy/images/${MACHINE}/b2qt-${PROJECT}-qt5-image-${MACHINE}.hdd ]; then |