stub: fix passing kernel cmdline when loading via shim

This was mistakenly dropped when the custom PE loader was added.
Add it back, otherwise no smbios/addon cmdline options are passed
through.

Fixes https://github.com/systemd/systemd/issues/38349

Follow-up for 40aabfae72
This commit is contained in:
Luca Boccassi
2025-07-27 20:51:43 +01:00
parent 4fb09adec4
commit bef244392b

View File

@@ -48,6 +48,7 @@ static EFI_STATUS load_via_boot_services(
EFI_HANDLE parent,
EFI_LOADED_IMAGE_PROTOCOL* parent_loaded_image,
uint32_t compat_entry_point,
const char16_t *cmdline,
const struct iovec *kernel,
const struct iovec *initrd) {
_cleanup_(unload_imagep) EFI_HANDLE kernel_image = NULL;
@@ -96,6 +97,11 @@ static EFI_STATUS load_via_boot_services(
if (err != EFI_SUCCESS)
return log_error_status(EFI_LOAD_ERROR, "Error getting kernel image from protocol from shim: %m");
if (cmdline) {
loaded_image->LoadOptions = (void *) cmdline;
loaded_image->LoadOptionsSize = strsize16(loaded_image->LoadOptions);
}
_cleanup_(cleanup_initrd) EFI_HANDLE initrd_handle = NULL;
err = initrd_register(initrd->iov_base, initrd->iov_len, &initrd_handle);
if (err != EFI_SUCCESS)
@@ -174,6 +180,7 @@ EFI_STATUS linux_exec(
parent,
parent_loaded_image,
compat_entry_point,
cmdline,
kernel,
initrd);