[U-Boot] [PATCH v0 13/20] efi_loader: use proper device-paths for partitions

Rob Clark robdclark at gmail.com
Sun Aug 6 18:47:08 UTC 2017


On Sun, Aug 6, 2017 at 2:37 PM, Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
>> Date: Sun, 6 Aug 2017 20:21:45 +0200 (CEST)
>> From: Mark Kettenis <mark.kettenis at xs4all.nl>
>>
>> > Mind sending me or pastebin'ing your u-boot .config?  There are some
>> > different device-path construction depending on legacy vs
>> > CONFIG_DM+CONFIG_BLK (the legacy case *looks* right to me, and is used
>> > by vexpress_ca15_tc2.. so I think it should work..)
>>
>> See below.  The Banana Pi (and all other sunxi boards) indeed uses the
>> legacy code path.  And I think there is a bug in the legacy codepath
>> where it encodes the partition in the "file" path component.
>
> If I fix the code to not insert the partition number there, I can boot
> from SD card and SATA again.
>
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index b5acf73f98..8ba0db2d7a 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -305,8 +305,8 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
>         struct efi_device_path_file_path *fp;
>         char devname[32] = { 0 }; /* fp->str is u16[32] long */
>
> -       snprintf(devname, sizeof(devname), "%d.%d.%d", desc->if_type,
> -                desc->devnum, part);
> +       snprintf(devname, sizeof(devname), "%d.%d", desc->if_type,
> +                desc->devnum);
>
>         memcpy(buf, &ROOT, sizeof(ROOT));
>         buf += sizeof(ROOT);


Hmm, that is probably not a good idea, since now the disk object along
w/ partition objects will have same devicepath.  (One change from
before is now we have diskobjs for the disk (part=0) and child
diskobjs for each partition.. fwiw in UEFI terminology a
efi_device_path_hard_drive_path is actually a partition.. for maximum
confusion)

Probably that we have a file-path node w/ child hard-drive objects is
confusing your previous workaround.. let me see if I can come up with
something better.

BR,
-R


More information about the U-Boot mailing list