diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-03-26 12:22:40 +0200 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-04-01 10:11:50 +0200 |
commit | a9203b0fefca4627096779e4eb4b1efbea43ec35 (patch) | |
tree | 578bee4bf3a4ea86f62c983e52b85be3b4396b84 /lib | |
parent | ffc1cfb8f4cbd2bd28be5877040821ccbda3e08b (diff) |
efi_loader: correct shortening of device-paths
We use short device-paths in boot options so that a file on a block device
can be found independent of the port into which the device is plugged.
Usb() device-path nodes only contain port and interface information and
therefore cannot identify a block device.
UsbWwi() device-path nodes contain the serial number of USB devices.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_device_path.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index b6dd575b13b..f35f673ce63 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -124,17 +124,13 @@ int efi_dp_match(const struct efi_device_path *a, /** * efi_dp_shorten() - shorten device-path * - * We can have device paths that start with a USB WWID or a USB Class node, - * and a few other cases which don't encode the full device path with bus - * hierarchy: + * When creating a short boot option we want to use a device-path that is + * independent of the location where the block device is plugged in. * - * * MESSAGING:USB_WWID - * * MESSAGING:USB_CLASS - * * MEDIA:FILE_PATH - * * MEDIA:HARD_DRIVE - * * MESSAGING:URI + * UsbWwi() nodes contain a serial number, hard drive paths a partition + * UUID. Both should be unique. * - * See UEFI spec (section 3.1.2, about short-form device-paths) + * See UEFI spec, section 3.1.2 for "short-form device path". * * @dp: original device-path * @Return: shortened device-path or NULL @@ -142,12 +138,7 @@ int efi_dp_match(const struct efi_device_path *a, struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp) { while (dp) { - /* - * TODO: Add MESSAGING:USB_WWID and MESSAGING:URI.. - * in practice fallback.efi just uses MEDIA:HARD_DRIVE - * so not sure when we would see these other cases. - */ - if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB) || + if (EFI_DP_TYPE(dp, MESSAGING_DEVICE, MSG_USB_WWI) || EFI_DP_TYPE(dp, MEDIA_DEVICE, HARD_DRIVE_PATH) || EFI_DP_TYPE(dp, MEDIA_DEVICE, FILE_PATH)) return dp; |