[PATCH v1 07/14] efi: loader: bootm: pass the kernel command line to UKIs

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Oct 5 10:18:07 PDT 2026


Hi,

On 10/4/26 03:19, Johannes Schneider wrote:
> Only Linux EFI images get the barebox kernel command line as load
> options. A UKI is a plain EFI application, so root=, bootchooser.active=
> and the other bootargs never reach its kernel. Pass them to every image
> with a .linux section too: systemd-stub uses the load options as kernel
> command line unless UEFI Secure Boot is enabled, which barebox never
> reports.
> 
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Johannes Schneider <johannes.schneider at leica-geosystems.com>
> ---
>  efi/loader/bootm.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/efi/loader/bootm.c b/efi/loader/bootm.c
> index 18539565fd..8a83865458 100644
> --- a/efi/loader/bootm.c
> +++ b/efi/loader/bootm.c
> @@ -252,7 +252,7 @@ static int efi_loader_bootm(struct image_data *data)
>  	int ret = 0;
>  	void *fdt;
>  	int flags = 0;
> -	size_t size;
> +	size_t size, section_size;
>  
>  	memory_bank_first_find_space(&start, &end);
>  
> @@ -266,7 +266,10 @@ static int efi_loader_bootm(struct image_data *data)
>  		return -EINVAL;
>  	}
>  
> -	if (filetype_is_linux_efi_image(data->kernel_type)) {
> +	/* systemd-stub passes the load options on as kernel command line */
> +	if (filetype_is_linux_efi_image(data->kernel_type) ||
> +	    efi_pe_find_section((void *)os_res->start, size, ".linux",

I think this will complicate matters, because afaik systemd-stub expects the
selector for the profile (e.g. @1) to be the very first option and by passing
all options as-is, we complicate being able to choose the selector.

I am also unsure what the behavior is when there is both a .cmdline section
and extra load options. Did you check?

Here's what I had in mind (I will send a v2 next week or so):
https://lore.barebox.org/barebox/20260826121956.2936414-1-a.fatoum@pengutronix.de/

Cheers,
Ahmad

> +				&section_size)) {
>  		const char *options;
>  
>  		options = linux_bootargs_get();


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list