summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_helper.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-05-01 10:48:24 -0600
committerTom Rini <trini@konsulko.com>2025-05-01 10:48:24 -0600
commit152fa1b7fd6b43c727e322aec7a870a33865a248 (patch)
treeb5ad2c1af26bd0e106c96c5d717178e757ccdcf1 /lib/efi_loader/efi_helper.c
parent98a898e58499c78245e4fe36ee404b1b1208e32b (diff)
parentc0546426724099d94a497ea11ad79862daf37767 (diff)
Merge tag 'efi-2025-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-07-rc2 CI: * https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/26025 Documentation: * ti: update bash code-block directives to prompt * ti: k3: add language for code-block directive * correct uthread inline documentation UEFI: * correctly handle EFI FIT images without initrd * pass kernel load address not entry point for EFI FIT images Other: * boot:let BOOTSTAGE_RECORD_COUNT default to 50
Diffstat (limited to 'lib/efi_loader/efi_helper.c')
-rw-r--r--lib/efi_loader/efi_helper.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 3936139ca41..19fb5d03fec 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -623,6 +623,35 @@ efi_status_t efi_install_fdt(void *fdt)
}
/**
+ * efi_install_initrd() - install initrd
+ *
+ * Install the initrd located at @initrd using the EFI_LOAD_FILE2
+ * protocol.
+ *
+ * @initrd: address of initrd or NULL if none is provided
+ * @initrd_sz: size of initrd
+ * Return: status code
+ */
+efi_status_t efi_install_initrd(void *initrd, size_t initd_sz)
+{
+ efi_status_t ret;
+ struct efi_device_path *dp_initrd;
+
+ if (!initrd)
+ return EFI_SUCCESS;
+
+ dp_initrd = efi_dp_from_mem(EFI_LOADER_DATA, (uintptr_t)initrd, initd_sz);
+ if (!dp_initrd)
+ return EFI_OUT_OF_RESOURCES;
+
+ ret = efi_initrd_register(dp_initrd);
+ if (ret != EFI_SUCCESS)
+ efi_free_pool(dp_initrd);
+
+ return ret;
+}
+
+/**
* do_bootefi_exec() - execute EFI binary
*
* The image indicated by @handle is started. When it returns the allocated