]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stub: fix passing kernel cmdline when loading via shim
authorLuca Boccassi <luca.boccassi@gmail.com>
Sun, 27 Jul 2025 19:51:43 +0000 (20:51 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 27 Jul 2025 21:44:05 +0000 (22:44 +0100)
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

index d1317a3106c745e67fbd09bd681f5785bbf6f5c4..db8821176ddc301a5666ec3891f6141e100e0428 100644 (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);