Skip to content

efi_loader: fix disk objects + device-paths

Rob Clark u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4efi: add some more device path structuresinclude/efi_api.h+47 -20 replies
2/4efi_loader: add udevice to EFI device-path mappinginclude/efi_loader.h lib/efi_loader/Makefile lib/efi_loader/efi_devpath.c+185 -00 replies
2/4efi_loader: add udevice to EFI device-path mapping+0 -02 replies
3/4efi_loader: make disk objects for partitionslib/efi_loader/efi_disk.c+53 -201 reply
3/4efi_loader: make disk objects for partitions+0 -00 replies
4/4efi_loader: use efi_devpath to get correct boot device-pathcmd/bootefi.c+26 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/4] efi_loader: fix disk objects + device-paths

Currently u-boot completely gets block-io objects (and their associated device-paths) wrong, which prevents grub2 from figuring out the boot device+partition, which prevents it from automatically finding it's grub.cfg.

Currently efi_loader creates a block-io object per disk, for example on a board with 3 partitions on an sd-card and 4 partitions on a usb disk:

/File(sdhci at 07864000.blk)/EndEntire
/File(usb_mass_storage.lun0)/EndEntire

at least grub manages to match up the loaded_image device-path, but it cannot figure out which partition it was on. So you end up with prefix=(hd1)/EFI/fedora instead of prefix=(hd1,msdos1)/EFI/fedora. With this patchset, you end up with:

/ACPI(133741d0,0)/UnknownMessaging(1d)/EndEntire /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(0,800,64000,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(1,64800,200000,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/UnknownMessaging(1d)/HD(2,264800,19a000,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/EndEntire /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(0,800,60000,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(1,61000,155000,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(2,20fa800,1bbf8800,0000000000000000,1,0)/EndEntire /ACPI(133741d0,0)/USB(0,0)/USB(0,0)/USB(0,0)/HD(3,1b6800,1f44000,0000000000000000,1,0)/EndEntire

(Note that "UnknownMessaging(1d)" is actually the MMC node in the device- path, but grub wasn't updated to print out some of the newer device-path sub-types.)

Since we use DM to generate the device-paths from u-boot's device hierarchy, legacy devices will still be broken. I kept them working as they did previously and tried to minimize the ifdeffery, but things will get much cleaner when legacy support is removed.

Peter Jones (1):
efi: add some more device path structures

Rob Clark (3):
efi_loader: add udevice to EFI device-path mapping
efi_loader: make disk objects for partitions
efi_loader: use efi_devpath to get correct boot device-path

 cmd/bootefi.c                |  31 ++++++--
 include/efi_api.h            |  49 +++++++++++-
 include/efi_loader.h         |   9 +++
 lib/efi_loader/Makefile      |   1 +
 lib/efi_loader/efi_devpath.c | 175 +++++++++++++++++++++++++++++++++++++++++++
 lib/efi_loader/efi_disk.c    |  73 +++++++++++++-----
 6 files changed, 311 insertions(+), 27 deletions(-)
 create mode 100644 lib/efi_loader/efi_devpath.c
Signature · 1 line
2.13.0