[PATCH v1 1/2] efi_loader: improve device path matching for partition lookup

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Nov 21 12:33:05 CET 2025


On Fri, 21 Nov 2025 at 12:41, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> Hi Balaji,
>
> On Fri, 21 Nov 2025 at 11:24, Balaji Selvanathan
> <balaji.selvanathan at oss.qualcomm.com> wrote:
> >
> > Hi Ilias,
> > Sorry for the late reply.
> >
> > If the boot option generation logic skips partitions, then the boot
> > option points to whole disk.
> >
> > But when capsule update calls device_is_present_and_system_part() →
> > efi_dp_find_obj() → find_handle(), it tries to match this boot device
> > path against the ESP partition handle which has path longer than boot
> > device path.
> >
> > The find_handle() logic at line 142 rejects the ESP handle because:
> > if (len_current > len)  // ESP path is longer than boot device path
> >      continue;           // Skip it!
> >
> > So capsule update fails to find the ESP partition.
> > Based on this analysis, I believe the fix I proposed would help address
> > this issue, but I'd appreciate your thoughts on whether this approach
> > makes sense or if there's a better way to handle it.
>
> It would and and what you point at is an actual problem. The reason it
> happens is that doing what is suggested would violate the EFI spec.
> OTOH I don't mind because being able to update the device without
> having to manually add a boot option is a nice feature.
> Heinirch any opinions?

Ok repsonding to myself here, but I didn't remember the EFI spec correctly.
8.5.5 says
"The directory \EFI\UpdateCapsule is checked for capsules only within
the EFI system partition on the device specified in the active boot
option determine by reference to BootNext variable or BootOrder
variable processing"

So the actrive boot option doesn't have to point to the ESP. Having
any active boot option in the same device is enough. That means we can
trigger a capsule update from automatically generated boot options.
The patch above isn't 100% correct though. I'll respond there with
comments

Cheers
/Ilias
>
> Cheers
> /Ilias
> > Thanks for your guidance!
> >
> > On 8/28/2025 5:53 PM, Ilias Apalodimas wrote:
> > > Yes it was. In fact the original patches were adding the file instead
> > > of the disk [1], but we had concerns on scanning all partitions wrt to
> > > boot time. I don't remember if anyone tested the boot time though.


More information about the U-Boot mailing list