From bef244392baddf0cbbfff22ffd2e49d46a2bbddf Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 27 Jul 2025 20:51:43 +0100 Subject: [PATCH] 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 40aabfae72619e313f8bcc038e57e0d3a5433d1a --- src/boot/linux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/boot/linux.c b/src/boot/linux.c index d1317a3106c..db8821176dd 100644 --- a/src/boot/linux.c +++ b/src/boot/linux.c @@ -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); -- 2.47.3