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)
committerPeter Michael Green <plugwash@raspbian.org>
Sun, 28 Jul 2024 22:42:11 +0000 (22:42 +0000)
commit5d2406981f0d0e225dbad010ce00391ebe8aeb41
tree96e1323697ed0ce8b1f933f3b4442f344b95b8cf
parent84564fb15d5ef2a2b38beb53c09ad86fa5eaf83a
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