[PATCH 1/1] efi_loader: provide variable BootOptionSupport

Mark Kettenis mark.kettenis at xs4all.nl
Mon Oct 14 19:46:39 CEST 2024


> From: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Date: Mon, 14 Oct 2024 20:16:04 +0300
> 
> Hi Mark,
> 
> On Fri, 11 Oct 2024 at 20:53, Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
> >
> > > From: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> > > Date: Fri, 11 Oct 2024 19:33:40 +0200
> >
> > Hi Heinrich,
> >
> > > The UEFI variable BootOptionSupport is required by the UEFI specification
> > > [1]. It reports if specific types of boot options are honored.
> > >
> > > We don't support any of these extras. So we should set the value 0.
> >
> > It also says:
> >
> >   "If the global variable is not present, then an installer or
> >    application must act as if a value of 0 was returned."
> >
> > So until we support any of those extras, we don't have to provide that
> > variable.
> >
> > > [1] 3.1.4 Boot Manager Capabilities, UEFI Specification 2.10 Errata A,
> 
> It does, but is there a problem with being explicit? Are you concerned
> about the size growth?

Somewhat, yes.  The EFI code keeps growing and I'd like to avoid
people disibling CONFIG_EFI_LOADER because u-boot no longer fits into
SPI flash or something.

Cheers,

Mark

> > >
> > > Cc: Vincent Stehlé <vincent.stehle at arm.com>
> > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> > > ---
> > >  lib/efi_loader/efi_setup.c | 23 +++++++++++++++++++++++
> > >  1 file changed, 23 insertions(+)
> > >
> > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> > > index a610e032d2f..05d035f4eb5 100644
> > > --- a/lib/efi_loader/efi_setup.c
> > > +++ b/lib/efi_loader/efi_setup.c
> > > @@ -179,6 +179,22 @@ static efi_status_t efi_init_os_indications(void)
> > >                                   &os_indications_supported, false);
> > >  }
> > >
> > > +/**
> > > + * efi_init_boot_options_support() - indicate supported boot option types
> > > + */
> > > +static efi_status_t efi_init_boot_options_support(void)
> > > +{
> > > +     u32 boot_options_support = 0;
> > > +
> > > +     return efi_set_variable_int(u"BootOptionSupport",
> > > +                                 &efi_global_variable_guid,
> > > +                                 EFI_VARIABLE_BOOTSERVICE_ACCESS |
> > > +                                 EFI_VARIABLE_RUNTIME_ACCESS |
> > > +                                 EFI_VARIABLE_READ_ONLY,
> > > +                                 sizeof(boot_options_support),
> > > +                                 &boot_options_support, false);
> > > +}
> > > +
> > >  /**
> > >   * efi_init_early() - handle initialization at early stage
> > >   *
> > > @@ -261,6 +277,13 @@ efi_status_t efi_init_obj_list(void)
> > >       if (ret != EFI_SUCCESS)
> > >               goto out;
> > >
> > > +     /* Indicate supported boot option types */
> > > +     if (IS_ENABLED(CONFIG_EFI_BOOTMGR)) {
> > > +             ret = efi_init_boot_options_support();
> > > +             if (ret != EFI_SUCCESS)
> > > +                     goto out;
> > > +     }
> > > +
> > >       /* Initialize system table */
> > >       ret = efi_initialize_system_table();
> > >       if (ret != EFI_SUCCESS)
> > > --
> > > 2.45.2
> > >
> > >
> 


More information about the U-Boot mailing list