From 04d38248e37e811d6a69a71b7740d5dca35ffdc8 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 26 Jun 2019 13:58:37 +0200 Subject: [PATCH] A set of fixes mostly BLS related Fix --bls-directory option comment in grub2-switch-to-blscfg man page Resolves: rhbz#1714835 10_linux_bls: use '=' to separate --id argument due a Petitboot bug grub-set-bootflag: Print an error if failing to read from grubenv Resolves: rhbz#1702354 10_linux: generate BLS section even if no kernels are found in /boot 10_linux: don't search for OSTree kernels Signed-off-by: Javier Martinez Canillas --- ...y-option-comment-in-grub2-switch-to-.patch | 29 ++++ ...-to-separate-id-argument-due-a-Petit.patch | 33 +++++ ...g-Print-an-error-if-failing-to-read-.patch | 39 +++++ ...e-BLS-section-even-if-no-kernels-are.patch | 138 ++++++++++++++++++ ...inux-don-t-search-for-OSTree-kernels.patch | 33 +++++ grub.patches | 5 + grub2.spec | 11 +- 7 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 0303-Fix-bls-directory-option-comment-in-grub2-switch-to-.patch create mode 100644 0304-10_linux_bls-use-to-separate-id-argument-due-a-Petit.patch create mode 100644 0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch create mode 100644 0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch create mode 100644 0307-10_linux-don-t-search-for-OSTree-kernels.patch diff --git a/0303-Fix-bls-directory-option-comment-in-grub2-switch-to-.patch b/0303-Fix-bls-directory-option-comment-in-grub2-switch-to-.patch new file mode 100644 index 0000000..6c1aa0d --- /dev/null +++ b/0303-Fix-bls-directory-option-comment-in-grub2-switch-to-.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 29 May 2019 10:58:58 +0200 +Subject: [PATCH] Fix --bls-directory option comment in grub2-switch-to-blscfg + man page + +The default directory for BLS fragments is always /boot/loader/entries for +both EFI and non-EFI. Fix the man page accordingly to document this. + +Resolves: rhbz#1714835 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub-switch-to-blscfg.8 b/util/grub-switch-to-blscfg.8 +index 7d99de2d2f9..9a886282976 100644 +--- a/util/grub-switch-to-blscfg.8 ++++ b/util/grub-switch-to-blscfg.8 +@@ -23,7 +23,7 @@ The defaults file for grub-mkconfig. The default value is \fI/etc/default/grub\ + + .TP + --bls-directory=\fIDIR\fR +-Create BootLoaderSpec fragments in \fIDIR\fR. The default value is \fI/boot/loader/entries\fR on BIOS machines and \fI/boot/efi/EFI/\fBVENDOR\fI/loader/entries\fR on UEFI machines. ++Create BootLoaderSpec fragments in \fIDIR\fR. The default value is \fI/boot/loader/entries\fR. + + .TP + --backup-suffix=\fSUFFIX\fR diff --git a/0304-10_linux_bls-use-to-separate-id-argument-due-a-Petit.patch b/0304-10_linux_bls-use-to-separate-id-argument-due-a-Petit.patch new file mode 100644 index 0000000..b6494b8 --- /dev/null +++ b/0304-10_linux_bls-use-to-separate-id-argument-due-a-Petit.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 19 Jun 2019 15:57:17 +0200 +Subject: [PATCH] 10_linux_bls: use '=' to separate --id argument due a + Petitboot bug + +The GRUB menuentry command allows to separate the arguments for options +using either a '=' or a ' '. The latter is the convention used when the +menu entries are defined in the GRUB config file, but this is currently +not supported by Petitboot. + +So as a workaround define the menu entries using '--id=${bls}' instead. + +Resolves: rhbz#1721815 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux_bls.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in +index b8ee9916329..76a5b9d75bc 100644 +--- a/util/grub.d/10_linux_bls.in ++++ b/util/grub.d/10_linux_bls.in +@@ -180,7 +180,7 @@ populate_menu() + for bls in "${files[@]}" ; do + read_config "${blsdir}/${bls}.conf" + +- menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id ${bls} {\n" ++ menu="${menu}menuentry '${title}' --class ${grub_class} ${grub_arg} --id=${bls} {\n" + menu="${menu}\t linux ${linux} ${options}\n" + if [ -n "${initrd}" ] ; then + menu="${menu}\t initrd ${boot_prefix}${initrd}\n" diff --git a/0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch b/0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch new file mode 100644 index 0000000..5ac0da3 --- /dev/null +++ b/0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 20 Jun 2019 13:26:31 +0200 +Subject: [PATCH] grub-set-bootflag: Print an error if failing to read from + grubenv + +If the tool fails to read the grubenv file, it prints the following error: + + Error reading from /boot/grub2/grubenv: Success + +This is confusing for users, so instead print a proper error message. + +Resolves: rhbz#1702354 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-set-bootflag.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c +index 20062fe802b..6a79ee67444 100644 +--- a/util/grub-set-bootflag.c ++++ b/util/grub-set-bootflag.c +@@ -27,6 +27,7 @@ + #include + #include + #include /* For GRUB_ENVBLK_DEFCFG define */ ++#include + #include + #include + #include +@@ -87,6 +88,7 @@ int main(int argc, char *argv[]) + fclose (f); + if (ret != GRUBENV_SIZE) + { ++ errno = EINVAL; + perror ("Error reading from " GRUBENV); + return 1; + } diff --git a/0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch b/0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch new file mode 100644 index 0000000..dc1a6d5 --- /dev/null +++ b/0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tom Gundersen +Date: Wed, 26 Jun 2019 17:06:59 +0200 +Subject: [PATCH] 10_linux: generate BLS section even if no kernels are found + in /boot + +The 10_linux script exits if no kernels are found in the /boot directory. +This makes sense for a non-BLS configuration but doesn't when using BLS. + +Add a BLS section regardless if there are kernel images in /boot or not. +That way the grub.cfg can be generated even before a kernel is installed. +--- + util/grub.d/10_linux.in | 98 ++++++++++++++++++++++++------------------------- + 1 file changed, 48 insertions(+), 50 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 350903fa5ab..e6fd6f2a39a 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -96,6 +96,53 @@ cat <$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then +@@ -291,9 +291,7 @@ submenu_indentation="" + is_top_level=true + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` +- if [ "x${GRUB_ENABLE_BLSCFG}" != "xtrue" ]; then +- gettext_printf "Found linux image: %s\n" "$linux" >&2 +- fi ++ gettext_printf "Found linux image: %s\n" "$linux" >&2 + + basename=`basename $linux` + dirname=`dirname $linux` diff --git a/0307-10_linux-don-t-search-for-OSTree-kernels.patch b/0307-10_linux-don-t-search-for-OSTree-kernels.patch new file mode 100644 index 0000000..912119c --- /dev/null +++ b/0307-10_linux-don-t-search-for-OSTree-kernels.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 26 Jun 2019 17:11:14 +0200 +Subject: [PATCH] 10_linux: don't search for OSTree kernels + +The 10_linux script used to exit if kernels weren't found in the /boot dir +so the path where OSTree kernels are installed was added to prevent that. + +But the script should really add a section to call the blscfg command even +if kernels have not been installed, it doesn't make sense to search these. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index e6fd6f2a39a..9fd5a16fa32 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -265,12 +265,6 @@ case "x$machine" in + done ;; + esac + +-if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then +- for i in /boot/ostree/*/vmlinuz-* ; do +- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi +- done +-fi +- + case "$machine" in + i?86) GENKERNEL_ARCH="x86" ;; + mips|mips64) GENKERNEL_ARCH="mips" ;; diff --git a/grub.patches b/grub.patches index bddbbcc..4fc5e45 100644 --- a/grub.patches +++ b/grub.patches @@ -300,3 +300,8 @@ Patch0299: 0299-Fix-undefined-references-for-fdt-when-building-with-.patch Patch0300: 0300-blscfg-remove-BLS-file-size-check.patch Patch0301: 0301-Remove-bogus-load_env-after-blscfg-command-in-10_lin.patch Patch0302: 0302-blscfg-Don-t-leave-grub_errno-set-to-an-error-if-the.patch +Patch0303: 0303-Fix-bls-directory-option-comment-in-grub2-switch-to-.patch +Patch0304: 0304-10_linux_bls-use-to-separate-id-argument-due-a-Petit.patch +Patch0305: 0305-grub-set-bootflag-Print-an-error-if-failing-to-read-.patch +Patch0306: 0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch +Patch0307: 0307-10_linux-don-t-search-for-OSTree-kernels.patch diff --git a/grub2.spec b/grub2.spec index c8a86bb..4a2cfd5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 88%{?dist} +Release: 89%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -518,6 +518,15 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Jun 27 2019 Javier Martinez Canillas - 2.02-89 +- Fix --bls-directory option comment in grub2-switch-to-blscfg man page + Resolves: rhbz#1714835 +- 10_linux_bls: use '=' to separate --id argument due a Petitboot bug +- grub-set-bootflag: Print an error if failing to read from grubenv + Resolves: rhbz#1702354 +- 10_linux: generate BLS section even if no kernels are found in /boot +- 10_linux: don't search for OSTree kernels + * Tue Jun 18 2019 Sergio Durigan Junior - 2.02-88 - Use '-g' instead of '-g3' when compiling grub2. Resolves: rhbz#1708780