[U-Boot] [PATCH v6 1/1] cmd: env: extend "env [set|print] -e" to manage UEFI variables

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Oct 25 18:17:03 UTC 2019


On 10/24/19 8:17 AM, AKASHI Takahiro wrote:
> With this patch, when setting UEFI variable with "env set -e" command,
> we will be able to
> - specify vendor guid with "-guid guid",
> - specify variable attributes,  BOOTSERVICE_ACCESS, RUNTIME_ACCESS,
>   respectively with "-bs" and "-rt",
> - append a value instead of overwriting with "-a",
> - use memory as variable's value instead of explicit values given
>   at the command line with "-i address,size"
>
> If guid is not explicitly given, default value will be used.
>
> Meanwhile, "env print -e," will be modified so that it will NOT dump
> a variable's value if '-n' is specified.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>

Looks fine to me. The only strange behavior is:

=> printenv -e
OsIndicationsSupported:
    EFI_GLOBAL_VARIABLE_GUID: BS|RT, DataSize = 0x8
    00000000: 00 00 00 00 00 00 00 00                          ........
PlatformLang:
    EFI_GLOBAL_VARIABLE_GUID: NV|BS|RT, DataSize = 0x6
    00000000: 65 6e 2d 55 53 00                                en-US.
PlatformLangCodes:
    EFI_GLOBAL_VARIABLE_GUID: BS|RT, DataSize = 0x6
    00000000: 65 6e 2d 55 53 00                                en-US.
RuntimeServicesSupported:
    EFI_GLOBAL_VARIABLE_GUID: BS|RT, DataSize = 0x2
    00000000: 80 05                                            ..
=> env set -e -guid 00000001-0002-0003-0004-010203040506 a b
EFI: Entry efi_set_variable("a" 00000001-0002-0003-0004-010203040506 0 1
000000007eef7610)
EFI: Exit: efi_set_variable: 14
## Failed to set EFI variable (not found)

I would have expected
## Failed to set EFI variable (invalid parameter)

The UEFI spec has:
If a preexisting variable is rewritten with no access attributes
specified, the variable will be deleted.

But "a" is not a preexisting variable. Instead the attributes are invalid.

But as this is a bug in a code that you did not touch:

Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>


More information about the U-Boot mailing list