[PATCH master 1/2] efi: loader: release bootm OS staging buffer
Ahmad Fatoum
a.fatoum at barebox.org
Thu Jun 11 14:22:00 PDT 2026
The initial location of the OS image is currently kept reserved until
it's reclaimed after exiting boot services. This is unnecessary though
as the relevant parts of the PE are copied out anyway.
Therefore, free the original OS image to leave more space to the
decompresser.
Fixes: 229bc3b37e64 ("efi: loader: implement bootm handler")
Assisted-by: Codex:gpt-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
efi/loader/bootm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/efi/loader/bootm.c b/efi/loader/bootm.c
index e1f1d508c59e..a68db742e173 100644
--- a/efi/loader/bootm.c
+++ b/efi/loader/bootm.c
@@ -267,6 +267,14 @@ static int efi_loader_bootm(struct image_data *data)
goto out;
}
+ /*
+ * efi_load_pe() copied the executable image into EFI-managed memory.
+ * The bootm staging buffer is no longer needed, and keeping it in the
+ * memory map can block payloads from using their normal load address.
+ */
+ release_sdram_region(data->os_res);
+ data->os_res = NULL;
+
efiret = efi_set_load_options(handle, load_option_size, load_option);
if (efiret)
goto out;
--
2.47.3
More information about the barebox
mailing list