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 <javierm@redhat.com>
This commit is contained in:
parent
f6da347edf
commit
04d38248e3
@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
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 <javierm@redhat.com>
|
||||
---
|
||||
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
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
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 <javierm@redhat.com>
|
||||
---
|
||||
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"
|
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
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 <javierm@redhat.com>
|
||||
---
|
||||
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 <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/lib/envblk.h> /* For GRUB_ENVBLK_DEFCFG define */
|
||||
+#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -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;
|
||||
}
|
138
0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch
Normal file
138
0306-10_linux-generate-BLS-section-even-if-no-kernels-are.patch
Normal file
@ -0,0 +1,138 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <tgunders@redhat.com>
|
||||
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 <<EOF
|
||||
EOF
|
||||
}
|
||||
|
||||
+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
+ if [ x$dirname = x/ ]; then
|
||||
+ if [ -z "${prepare_root_cache}" ]; then
|
||||
+ prepare_grub_to_access_device ${GRUB_DEVICE}
|
||||
+ fi
|
||||
+ else
|
||||
+ if [ -z "${prepare_boot_cache}" ]; then
|
||||
+ prepare_grub_to_access_device ${GRUB_DEVICE_BOOT}
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ if [ -d /sys/firmware/efi ]; then
|
||||
+ bootefi_device="`${grub_probe} --target=device /boot/efi/`"
|
||||
+ prepare_grub_to_access_device ${bootefi_device} boot
|
||||
+ else
|
||||
+ boot_device="`${grub_probe} --target=device /boot/`"
|
||||
+ prepare_grub_to_access_device ${boot_device} boot
|
||||
+ fi
|
||||
+
|
||||
+ populate_header_warn
|
||||
+
|
||||
+ cat << EOF
|
||||
+set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
|
||||
+
|
||||
+insmod blscfg
|
||||
+blscfg
|
||||
+EOF
|
||||
+
|
||||
+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
||||
+ blsdir="/boot/loader/entries"
|
||||
+ [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})"
|
||||
+ if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then
|
||||
+ blsdir=$(make_system_path_relative_to_its_root "${blsdir}")
|
||||
+ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
|
||||
+ ${grub_editenv} - set blsdir="${blsdir}"
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ ${grub_editenv} - set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX}"
|
||||
+ if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
|
||||
+ ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
mktitle ()
|
||||
{
|
||||
local title_type
|
||||
@@ -136,53 +183,6 @@ linux_entry ()
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
fi
|
||||
|
||||
- if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
||||
- if [ x$dirname = x/ ]; then
|
||||
- if [ -z "${prepare_root_cache}" ]; then
|
||||
- prepare_grub_to_access_device ${GRUB_DEVICE}
|
||||
- fi
|
||||
- else
|
||||
- if [ -z "${prepare_boot_cache}" ]; then
|
||||
- prepare_grub_to_access_device ${GRUB_DEVICE_BOOT}
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- if [ -d /sys/firmware/efi ]; then
|
||||
- bootefi_device="`${grub_probe} --target=device /boot/efi/`"
|
||||
- prepare_grub_to_access_device ${bootefi_device} boot
|
||||
- else
|
||||
- boot_device="`${grub_probe} --target=device /boot/`"
|
||||
- prepare_grub_to_access_device ${boot_device} boot
|
||||
- fi
|
||||
-
|
||||
- populate_header_warn
|
||||
-
|
||||
- cat << EOF
|
||||
-set default_kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
||||
-
|
||||
-insmod blscfg
|
||||
-blscfg
|
||||
-EOF
|
||||
-
|
||||
- if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
||||
- blsdir="/boot/loader/entries"
|
||||
- [ -d "${blsdir}" ] && GRUB_BLS_FS="$(${grub_probe} --target=fs ${blsdir})"
|
||||
- if [ "x${GRUB_BLS_FS}" = "xbtrfs" ] || [ "x${GRUB_BLS_FS}" = "xzfs" ]; then
|
||||
- blsdir=$(make_system_path_relative_to_its_root "${blsdir}")
|
||||
- if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
|
||||
- ${grub_editenv} - set blsdir="${blsdir}"
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
||||
- if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then
|
||||
- ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}"
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
- exit 0
|
||||
- fi
|
||||
-
|
||||
if [ x$type != xsimple ] ; then
|
||||
title=$(mktitle "$type" "$version")
|
||||
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$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`
|
33
0307-10_linux-don-t-search-for-OSTree-kernels.patch
Normal file
33
0307-10_linux-don-t-search-for-OSTree-kernels.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
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 <javierm@redhat.com>
|
||||
---
|
||||
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" ;;
|
@ -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
|
||||
|
11
grub2.spec
11
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 <javierm@redhat.com> - 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 <sergiodj@redhat.com> - 2.02-88
|
||||
- Use '-g' instead of '-g3' when compiling grub2.
|
||||
Resolves: rhbz#1708780
|
||||
|
Loading…
Reference in New Issue
Block a user