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 <[email protected]>
> ---
>  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/[email protected]/

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 |

Reply via email to