]> git.baikalelectronics.ru Git - uboot.git/commit
efi_loader: avoid adding variables twice
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 29 Dec 2022 08:13:22 +0000 (10:13 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 29 Dec 2022 09:51:50 +0000 (10:51 +0100)
commit9002dae775bb550d3dcb04aa5757c5ea50648fa2
treea8a225ba1fefb8bc0184d07537ceefe608f7817c
parent5b9cbd7ce645d00c6e6b2e87a1f4cad9818d4497
efi_loader: avoid adding variables twice

When the efi subsystem starts we restore variables that are both in a
file or stored into the .efi_runtime section of U-Boot.  However once
a variable gets created or changed the preseeded entries will end up in
the file.  As a consequence on the next boot we will end up adding
identical variable entries twice.

Fix this by checking if the to be inserted variable already exists.
Also swap the restoration order and start with the file instead of the
builtin variables,  so a user can replace the preseeded ones if needed.

Tested-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_var_file.c
lib/efi_loader/efi_variable.c