All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: Re: [RFC PATCH 1/1] eficonfig: Add a 'scan-only' mode in eficonfig
Date: Thu, 2 Mar 2023 15:44:45 +0900	[thread overview]
Message-ID: <20230302064445.GA46754@laputa> (raw)
In-Reply-To: <CADQ0-X_LnNnZH7We29Ev_NYnz4KivxwwDj_W4NBshAZpzHuPmg@mail.gmail.com>

On Thu, Mar 02, 2023 at 11:21:05AM +0900, Masahisa Kojima wrote:
> Hi Ilias,
> 
> On Wed, 1 Mar 2023 at 23:44, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > eficonfig will automatically scan and add Boot#### variables on launch.
> > It will also perform automatic management of the automatically added
> > variables (e.g it might decide to delete a boot option if the DP
> > disappears).  This functionality is useful outside the context of
> > eficonfig as well.
> >
> > So let's add a -a flag to eficonfig that will only perform the
> > automatic variable management and exit.  That would allow users
> > to define a bootcmd along the lines of 'eficonfig -a && bootefi bootmgr',
> > that matches the §3.5.1.1 'Removable Media Boot Behavior' behaviour
> > described in the EFI spec.
> >
> > Open questions:
> > - Is this ok to add on eficonfig? Similar functionality is described in the EFI
> >   spec as part of the efibootmgr
> > - Having the functionality on the command gives us the flexibility to run the
> >   run the command when needed.  Alternatively we could move it to the efibootmgr
> >   and hide it behing a Kconfig option
> 
> In current implementation, "bootmenu" and "eficonfig" invoke this
> automatic load option
> management function, but I think "bootmenu" should not have responsibility for
> load option management.
> So I'll vote for moving this automatic load option management into efibootmgr,
> then it is invoked in efi subsystem initialization.

Basically +1, but
I think that we can implement this kind of action by using 'event' hook
as "removable media support" itself is implemented.

-Takahiro Akashi


> Regards,
> Masahisa Kojima
> 
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >  cmd/eficonfig.c | 23 ++++++++++++++++++++---
> >  1 file changed, 20 insertions(+), 3 deletions(-)
> >
> > diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c
> > index 720f52b48b8c..9b6631816997 100644
> > --- a/cmd/eficonfig.c
> > +++ b/cmd/eficonfig.c
> > @@ -2693,10 +2693,18 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
> >  {
> >         efi_status_t ret;
> >         struct efimenu *efi_menu;
> > +       bool exit_on_scan = false;
> >
> > -       if (argc > 1)
> > +       if (argc > 2)
> >                 return CMD_RET_USAGE;
> >
> > +       if (argc > 1) {
> > +               if (!strcmp(argv[1], "-a"))
> > +                       exit_on_scan = true;
> > +               else
> > +                       return CMD_RET_FAILURE;
> > +       }
> > +
> >         ret = efi_init_obj_list();
> >         if (ret != EFI_SUCCESS) {
> >                 log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
> > @@ -2713,6 +2721,9 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
> >         if (ret != EFI_SUCCESS && ret != EFI_NOT_FOUND)
> >                 return ret;
> >
> > +       if (exit_on_scan)
> > +               return EFI_SUCCESS;
> > +
> >         while (1) {
> >                 efi_menu = eficonfig_create_fixed_menu(maintenance_menu_items,
> >                                                        ARRAY_SIZE(maintenance_menu_items));
> > @@ -2734,8 +2745,14 @@ static int do_eficonfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
> >         return CMD_RET_SUCCESS;
> >  }
> >
> > +static char eficonfig_help_text[] =
> > +       " - UEFI menu to configure UEFI variables\n"
> > +       "\n"
> > +       "eficonfig - Spawn the configuration menu\n"
> > +       "  -a Scan, configure Boot#### variables and exit\n";
> > +
> >  U_BOOT_CMD(
> > -       eficonfig, 1, 0, do_eficonfig,
> > +       eficonfig, 2, 0, do_eficonfig,
> >         "provide menu-driven UEFI variable maintenance interface",
> > -       ""
> > +       eficonfig_help_text
> >  );
> > --
> > 2.39.2
> >

  reply	other threads:[~2023-03-02  6:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01 14:44 [RFC PATCH 1/1] eficonfig: Add a 'scan-only' mode in eficonfig Ilias Apalodimas
2023-03-02  2:21 ` Masahisa Kojima
2023-03-02  6:44   ` AKASHI Takahiro [this message]
2023-03-02  9:07     ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230302064445.GA46754@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.