[RESEND v9 2/9] eficonfig: menu-driven addition of UEFI boot option

Masahisa Kojima masahisa.kojima at linaro.org
Tue Jul 19 01:06:17 CEST 2022


Hi Ilias,

On Mon, 18 Jul 2022 at 22:31, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> Hi Kojima-san
>
>
> On Fri, 15 Jul 2022 at 17:45, Masahisa Kojima
> <masahisa.kojima at linaro.org> wrote:
> >
> > This commit add the "eficonfig" command.
> > The "eficonfig" command implements the menu-driven UEFI boot option
> > maintenance feature. This commit implements the addition of
> > new boot option. User can select the block device volume having
> > efi_simple_file_system_protocol and select the file corresponding
> > to the Boot#### variable. User can also enter the description and
> > optional_data of the BOOT#### variable in utf8.
> >
> > This commit adds "include/efi_config.h", it contains the common
> > definition to be used from other menus such as UEFI Secure Boot
> > key management.
> >
> > Signed-off-by: Masahisa Kojima <masahisa.kojima at linaro.org>
> > ---
> > Changes in v9:
> > - move "efi_guid_bootmenu_auto_generated definition" into efi_bootmgr.c
> >   to address build error when CMD_EFICONFIG is disabled
> > - fix typos and comment
> > - remove file system information from error message
> > - remove unreachable code in eficonfig_choice_entry()
> > - single printf() call as much as possible
> > - call only getchar() in  eficonfig_print_msg()
> > - filter out '.' entry from file selection
> > - update the efi_disk_get_device_name() implementation
> > - add function comment
> >
> > Changes in v8:
> > - command name is change from "efimenu" to "eficonfig"
> > - function and struct prefixes is changed to "eficonfig"
> > - fix menu header string
> >
> > Changes in v7:
> > - add "efimenu" command and uefi variable maintenance code
> >   moved into cmd/efimenu.c
> > - create include/efimenu.h to define the common definition for
> >   the other menu such as UEFI Secure Boot key management
> > - update boot option edit UI, user can select description, file,
> >   and optional_data to edit in the same menu like following.
> >
> >   ** Edit Boot Option **
> >
> >      Description: debian
> >      File: virtio 0:1/EFI\debian\grubaa64.efi
> >      Optional Data: test
> >      Save
> >      Quit
> >
> [...]
>
> I'll have a look at the code as well, but something weird is happening
> on QEMU.  I got an ESP partition and I can save EFI variables in a
> ubootefi.var file.  However every time I start QEMU the options I add
> via the menu are missing although the efi variables seem to be stored
> properly.
>
> => printenv -e
> [...]
> Boot0001:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x9d
>     00000000: 01 00 00 00 8b 00 67 00 72 00 75 00 62 00 00 00  ......g.r.u.b...
>     00000010: 01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8  .....s.....J....
>     00000020: 28 f3 62 8b 01 04 15 00 92 37 29 63 f5 ad 25 93  (.b......7)c..%.
>     00000030: b9 9f 4e 0e 45 5c 1b 1e 00 04 01 2a 00 01 00 00  ..N.E\.....*....
>     00000040: 00 00 08 00 00 00 00 00 00 00 00 10 00 00 00 00  ................
>     00000050: 00 10 56 ae bd 31 33 4d 4e 94 66 ac b5 ca f0 b4  ..V..13MN.f.....
>     00000060: a6 02 02 04 04 34 00 45 00 46 00 49 00 5c 00 64  .....4.E.F.I.\.d
>     00000070: 00 65 00 62 00 69 00 61 00 6e 00 5c 00 67 00 72  .e.b.i.a.n.\.g.r
>     00000080: 00 75 00 62 00 61 00 61 00 36 00 34 00 2e 00 65  .u.b.a.a.6.4...e
>     00000090: 00 66 00 69 00 00 00 7f ff 04 00 00 00           .f.i.........
> Boot0002:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x9d
>     00000000: 01 00 00 00 8b 00 67 00 72 00 75 00 62 00 00 00  ......g.r.u.b...
>     00000010: 01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8  .....s.....J....
>     00000020: 28 f3 62 8b 01 04 15 00 92 37 29 63 f5 ad 25 93  (.b......7)c..%.
>     00000030: b9 9f 4e 0e 45 5c 1b 1e 00 04 01 2a 00 01 00 00  ..N.E\.....*....
>     00000040: 00 00 08 00 00 00 00 00 00 00 00 10 00 00 00 00  ................
>     00000050: 00 10 56 ae bd 31 33 4d 4e 94 66 ac b5 ca f0 b4  ..V..13MN.f.....
>     00000060: a6 02 02 04 04 34 00 45 00 46 00 49 00 5c 00 64  .....4.E.F.I.\.d
>     00000070: 00 65 00 62 00 69 00 61 00 6e 00 5c 00 67 00 72  .e.b.i.a.n.\.g.r
>     00000080: 00 75 00 62 00 61 00 61 00 36 00 34 00 2e 00 65  .u.b.a.a.6.4...e
>     00000090: 00 66 00 69 00 00 00 7f ff 04 00 00 00           .f.i.........
> Boot0003:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x9d
>     00000000: 01 00 00 00 8b 00 67 00 72 00 75 00 62 00 00 00  ......g.r.u.b...
>     00000010: 01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8  .....s.....J....
>     00000020: 28 f3 62 8b 01 04 15 00 92 37 29 63 f5 ad 25 93  (.b......7)c..%.
>     00000030: b9 9f 4e 0e 45 5c 1b 1e 00 04 01 2a 00 01 00 00  ..N.E\.....*....
>     00000040: 00 00 08 00 00 00 00 00 00 00 00 10 00 00 00 00  ................
>     00000050: 00 10 56 ae bd 31 33 4d 4e 94 66 ac b5 ca f0 b4  ..V..13MN.f.....
>     00000060: a6 02 02 04 04 34 00 45 00 46 00 49 00 5c 00 64  .....4.E.F.I.\.d
>     00000070: 00 65 00 62 00 69 00 61 00 6e 00 5c 00 67 00 72  .e.b.i.a.n.\.g.r
>     00000080: 00 75 00 62 00 61 00 61 00 36 00 34 00 2e 00 65  .u.b.a.a.6.4...e
>     00000090: 00 66 00 69 00 00 00 7f ff 04 00 00 00           .f.i.........
> Boot0004:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x9f
>     00000000: 01 00 00 00 8d 00 67 00 72 00 75 00 62 00 00 00  ......g.r.u.b...
>     00000010: 01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8  .....s.....J....
>     00000020: 28 f3 62 8b 01 04 15 00 92 37 29 63 f5 ad 25 93  (.b......7)c..%.
>     00000030: b9 9f 4e 0e 45 5c 1b 1e 00 04 01 2a 00 01 00 00  ..N.E\.....*....
>     00000040: 00 00 08 00 00 00 00 00 00 00 00 10 00 00 00 00  ................
>     00000050: 00 10 56 ae bd 31 33 4d 4e 94 66 ac b5 ca f0 b4  ..V..13MN.f.....
>     00000060: a6 02 02 04 04 36 00 2f 00 45 00 46 00 49 00 5c  .....6./.E.F.I.\
>     00000070: 00 64 00 65 00 62 00 69 00 61 00 6e 00 5c 00 73  .d.e.b.i.a.n.\.s
>     00000080: 00 68 00 69 00 6d 00 61 00 61 00 36 00 34 00 2e  .h.i.m.a.a.6.4..
>     00000090: 00 65 00 66 00 69 00 00 00 7f ff 04 00 00 00     .e.f.i.........
> Boot0000:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x6e
>     00000000: 01 00 00 00 62 00 6c 00 61 00 00 00 04 01 2a 00  ....b.l.a.....*.
>     00000010: 01 00 00 00 00 08 00 00 00 00 00 00 00 00 10 00  ................
>     00000020: 00 00 00 00 10 56 ae bd 31 33 4d 4e 94 66 ac b5  .....V..13MN.f..
>     00000030: ca f0 b4 a6 02 02 04 04 34 00 45 00 46 00 49 00  ........4.E.F.I.
>     00000040: 5c 00 64 00 65 00 62 00 69 00 61 00 6e 00 5c 00  \.d.e.b.i.a.n.\.
>     00000050: 67 00 72 00 75 00 62 00 61 00 61 00 36 00 34 00  g.r.u.b.a.a.6.4.
>     00000060: 2e 00 65 00 66 00 69 00 00 00 7f ff 04 00        ..e.f.i.......
> BootOrder:
>     8be4df61-93ca-11d2-aa0d-00e098032b8c (EFI_GLOBAL_VARIABLE_GUID)
>     NV|BS|RT, DataSize = 0x2
>     00000000: 00 00
>

Does the above log mean that BootOrder variable is not updated?

>
> Is that reproducible on your tests?  I can try real hardware as well
> or resetting the EFI variables

I can not reproduce the issue. Do you test with the RPMB on QEMU?
I usually test on qemu_arm64.

Thanks,
Masahisa Kojima

>
> Regards
> /Ilias


More information about the U-Boot mailing list