grub2/0210-blscfg-Fallback-to-search-BLS-snippets-in-boot-loade.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

60 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Wed, 18 Jul 2018 08:08:06 +0200
Subject: [PATCH] blscfg: Fallback to search BLS snippets in
/boot/loader/entries
The default path to search the BLS snippets is /loader/entries, this is
only a correct assumption if $root ($root) is a boot partition but it's
not true if /boot isn't a mount point.
A user can set a blsdir grub environment variable to choose a different
path, but instead of failing when /boot is a directory inside the root
partition fallback to search the BLS in /boot/loader/entries to cover
that case as well.
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/commands/blscfg.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index 80d8814fc3f..321c93069f2 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -692,6 +692,7 @@ static int find_entry (const char *filename,
grub_device_t blsdir_dev = NULL;
const char *blsdir = NULL;
char *saved_env_buf = NULL;
+ int fallback = 0;
int r = 0;
const char *devid = grub_env_get ("boot");
@@ -797,7 +798,9 @@ static int find_entry (const char *filename,
}
read_entry_info.dirname = blsdir;
- r = blsdir_fs->dir (blsdir_dev, blsdir, read_entry, &read_entry_info);
+read_fallback:
+ r = blsdir_fs->dir (blsdir_dev, read_entry_info.dirname, read_entry,
+ &read_entry_info);
if (r != 0) {
grub_dprintf ("blscfg", "read_entry returned error\n");
grub_err_t e;
@@ -807,6 +810,14 @@ static int find_entry (const char *filename,
} while (e);
}
+ if (!nentries && !fallback && info->platform != PLATFORM_EMU) {
+ read_entry_info.dirname = "/boot" GRUB_BLS_CONFIG_PATH;
+ grub_dprintf ("blscfg", "Entries weren't found in %s, fallback to %s\n",
+ blsdir, read_entry_info.dirname);
+ fallback = 1;
+ goto read_fallback;
+ }
+
grub_dprintf ("blscfg", "Sorting %d entries\n", nentries);
grub_qsort(&entries[0], nentries, sizeof (struct bls_entry *), bls_cmp, NULL);