efi_loader: install device-tree on configuration table on every invocation
authorSughosh Ganu <sughosh.ganu@linaro.org>
Mon, 17 Mar 2025 08:33:56 +0000 (14:03 +0530)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 26 Mar 2025 11:28:08 +0000 (13:28 +0200)
commit7e624377e99314bdfac6cb5a3d216dff49a047e9
treec7ffbda06ba0a75a48bfc614031fcfa82d4366b7
parentb267ab2c532a69931c44e4fb43d249f756ed053f
efi_loader: install device-tree on configuration table on every invocation

The efi_install_fdt() function is called before booting an EFI binary,
either directly, or through a bootmanager. This function installs a
copy of the device-tree(DT) on the EFI configuration table, which is
passed on to the OS.

The current logic in this function does not install a DT if a
device-tree is already installed as an EFI configuration
table. However, this existing copy of the DT might not be up-to-date,
or it could be a wrong DT for the image that is being booted. Always
install a DT afresh to the configuration table before booting the EFI
binary.

Installing a new DT also involves some additional checks that are
needed to clean up memory associated with the existing DT copy. Check
for an existing copy, and free up that memory.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_helper.c