A couple of fixes

Don't make grub_strtoull() print an error if no conversion is performed
  Resolves: rhbz#1674512
Set blsdir if the BLS directory path isn't one of the looked up by default
  Resolves: rhbz#1657240

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2019-02-13 13:16:17 +01:00
parent 11b49b804e
commit e3a408a521
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
5 changed files with 96 additions and 12 deletions

View File

@ -14,13 +14,13 @@ and use that value to set the early_initrd var when running grub2-mkconfig.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/commands/blscfg.c | 80 +++++++++++++++++++++++++++++++++++++++++++--
grub-core/commands/blscfg.c | 79 +++++++++++++++++++++++++++++++++++++++++++--
util/grub.d/10_linux.in | 3 ++
util/grub.d/10_linux_bls.in | 3 ++
3 files changed, 84 insertions(+), 2 deletions(-)
3 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index aa5bf0d3220..5dcd68b401e 100644
index aa5bf0d3220..1ef2ae06cff 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -660,6 +660,33 @@ static char *expand_val(char *value)
@ -116,7 +116,7 @@ index aa5bf0d3220..5dcd68b401e 100644
for (i = 0; initrds != NULL && initrds[i] != NULL; i++)
initrd_size += sizeof (" " GRUB_BOOT_DEVICE) \
+ grub_strlen (initrds[i]) + 1;
@@ -736,12 +800,22 @@ static void create_entry (struct bls_entry *entry)
@@ -736,7 +800,16 @@ static void create_entry (struct bls_entry *entry)
}
@ -134,13 +134,7 @@ index aa5bf0d3220..5dcd68b401e 100644
for (i = 0; initrds != NULL && initrds[i] != NULL; i++)
{
grub_dprintf ("blscfg", "adding initrd %s\n", initrds[i]);
tmp = grub_stpcpy (tmp, " " GRUB_BOOT_DEVICE);
tmp = grub_stpcpy (tmp, initrds[i]);
+ grub_free(initrds[i]);
}
tmp = grub_stpcpy (tmp, "\n");
}
@@ -759,6 +833,8 @@ static void create_entry (struct bls_entry *entry)
@@ -759,6 +832,8 @@ static void create_entry (struct bls_entry *entry)
finish:
grub_free (initrd);

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 11 Feb 2019 15:14:10 +0100
Subject: [PATCH] Don't make grub_strtoull() print an error if no conversion is
performed
Callers can check if grub_errno was set to GRUB_ERR_BAD_NUMBER, so there's
no need to print an error if a conversion couldn't be performed. This just
pollutes the output with noisy error messages.
Resolves: rhbz#1674512
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/kern/misc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index f6eaa7b4df8..2477eb609ba 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -473,8 +473,7 @@ grub_strtoull (const char *str, const char ** const end, int base)
if (! found)
{
- grub_error (GRUB_ERR_BAD_NUMBER,
- N_("unrecognized number"));
+ grub_errno = GRUB_ERR_BAD_NUMBER;
return 0;
}

View File

@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 12 Feb 2019 00:57:34 +0100
Subject: [PATCH] Set blsdir if the BLS directory path isn't one of the looked
up by default
The blscfg command searches for BLS snippets in the /loader/entries and the
/boot/loader/entries directories. If the /boot/loader/entries dir real path
isn't one of these (i.e: if is in a btrfs subvolme), set the blsdir grubenv
variable so the blscfg command will be able to find the BLS config snippets.
Resolves: rhbz#1657240
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub.d/10_linux.in | 5 +++++
util/grub.d/10_linux_bls.in | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 9c240f92625..7e80245a151 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -166,6 +166,11 @@ fi
EOF
if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
+ blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries")
+ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
+ ${grub_editenv} - set blsdir="${blsdir}"
+ 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}"
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
index b14951daf82..f0ad9a3da25 100644
--- a/util/grub.d/10_linux_bls.in
+++ b/util/grub.d/10_linux_bls.in
@@ -226,6 +226,11 @@ linux_entry ()
populate_menu
if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
+ blsdir=$(make_system_path_relative_to_its_root "/boot/loader/entries")
+ if [ "x${blsdir}" != "x/loader/entries" ] && [ "x${blsdir}" != "x/boot/loader/entries" ]; then
+ ${grub_editenv} - set blsdir="${blsdir}"
+ 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}"

View File

@ -278,3 +278,5 @@ Patch0277: 0277-blscfg-add-more-options-to-blscfg-command-to-make-it.patch
Patch0278: 0278-blscfg-add-support-for-prepend-early-initrds-to-the-.patch
Patch0279: 0279-Fix-the-looking-up-grub.cfg-XXX-while-tftp-booting.patch
Patch0280: 0280-Try-to-set-fPIE-and-friends-on-libgnu.a.patch
Patch0281: 0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch
Patch0282: 0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch

View File

@ -7,7 +7,7 @@
Name: grub2
Epoch: 1
Version: 2.02
Release: 68%{?dist}
Release: 69%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+
URL: http://www.gnu.org/software/grub/
@ -473,6 +473,12 @@ rm -r /boot/grub2.tmp/ || :
%endif
%changelog
* Wed Feb 13 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.02-69
- Don't make grub_strtoull() print an error if no conversion is performed
Resolves: rhbz#1674512
- Set blsdir if the BLS directory path isn't one of the looked up by default
Resolves: rhbz#1657240
* Mon Feb 04 2019 Javier Martinez Canillas <javierm@redhat.com> - 2.02-68
- Don't build the grub2-efi-ia32-* packages on i686 (pjones)
- Add efi-export-env and efi-load-env commands (pjones)