normal/main: Discover the device to read the config from as a fallback
authorJavier Martinez Canillas <javierm@redhat.com>
Mon, 9 Jan 2023 23:30:44 +0000 (18:30 -0500)
committerFelix Zielcke <fzielcke@z-51.de>
Mon, 15 Jul 2024 15:05:20 +0000 (17:05 +0200)
commitefc4a057abdf4fca528b7d772ff8cb4a96eeaea2
tree30ea0c5d77d616e295b2445e39c05a9f122f4372
parente0b6cc207021317c36d8edfa495163b558cd299f
normal/main: Discover the device to read the config from as a fallback

When core.img is generated locally, the grub2-probe tool figures out the
device and partition that needs to be read to parse the GRUB
configuration file.

But in some cases the core.img can't be generated on the host and
instead has to be done at package build time.  In particular, this will
be true when it needs to be signed with a key that's only available on
the package building infrastructure.

In that case, the prefix variable won't have a device and partition but
only a directory path.  So there's no way for GRUB to know from which
device has to read the configuration file.

To allow GRUB to continue working on that scenario, fallback to
iterating over all the available devices if reading the config failed
when using the prefix and fw_path variables.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Co-authored-by: Robbie Harwood <rharwood@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Gbp-Pq: Topic network
Gbp-Pq: Name discover-the-device-to-read-the-config-from-as-fallback.patch
grub-core/normal/main.c