On 2/27/26 12:47 AM, Matthew Wood wrote:
> Allow module parameters to be registered as early boot command-line
> parameters via the existing __setup infrastructure.
>
> Add an optional `early_param` field to the parameter block in the
> module! macro. When specified, the macro generates:
>
> - A setup callback that calls ModuleParam::from_setup_arg() and
> stores the result via ModuleParamAccess::set_value().
> - A static string in .init.rodata with the command-line prefix.
> - An ObsKernelParam entry in the .init.setup section linking the
> two together.
The early_param() macro on the C side creates an obs_kernel_param entry
with early=1. However, this patch handles the new early_param setting in
Rust by creating an obs_kernel_param with early=0. Non-early
obs_kernel_params are processed by obsolete_checksetup() during the
parse_args("Booting kernel") call in start_kernel(), which also handles
regular kernel_params.
Actual early parameters are handled by parse_early_param(). Note that
the command line parsed in this case is marked as __initdata, so it
would not be available for the kernel's entire lifetime, as the previous
patches assume.
So I'm somewhat confused by this patch, or perhaps I misunderstood
something?
> diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
> index 0c36194d9971..83dcc89a425a 100644
> --- a/rust/macros/lib.rs
> +++ b/rust/macros/lib.rs
[...]
> + #[link_section = ".init.setup"]
> + #[used(compiler)]
> + static #setup_name:
> ::kernel::module_param::ObsKernelParam =
> + ::kernel::module_param::ObsKernelParam {
> + str_: #setup_str_name.as_ptr().cast(),
> + setup_func:
> ::core::option::Option::Some(#setup_fn_name),
> + early: 0,
> + };
--
Thanks,
Petr