Bootconfig updates for v7.3:

- bootconfig: Support build-time command line rendering for embedded bootconfig
  . bootconfig: render descendant keys when xbc_snprint_cmdline() root has a
    value. Fix xbc_snprint_cmdline() to render descendant keys when the root
    has both a value and subkeys, and treats empty subtrees correctly.
  . bootconfig: render embedded bootconfig as a kernel cmdline at build time.
    Add build-time pipeline using tools/bootconfig -C to render the embedded
    bootconfig "kernel" subtree into .init.rodata as a cmdline string.
  . bootconfig: clean build-time tools/bootconfig from make clean.
  . bootconfig: add xbc_prepend_embedded_cmdline() helper.
    Add helper to prepend embedded bootconfig cmdline into boot_command_line
    early before parse_early_param().
  . x86/setup: prepend embedded bootconfig cmdline before parse_early_param.
    Wire early prepend helper in x86 setup_arch() so early_param handlers see
    values from the embedded bootconfig. (So this feature is currently x86 only)
  . bootconfig: skip runtime kernel.* render once prepended early.
    Avoid duplicating "kernel" keys in setup_boot_config().
  . init/main.c: use bootconfig_cmdline_requested() for the runtime opt-in.
    Refactor setup_boot_config() to share bootconfig_cmdline_requested().
  . Documentation: bootconfig: document build-time cmdline rendering.
    Document CONFIG_CMDLINE_FROM_BOOTCONFIG usage, requirements, and precedence.
init/main.c: use bootconfig_cmdline_requested() for the runtime opt-in

setup_boot_config() open-coded the same "is bootconfig requested on the
kernel command line?" check that setup_arch() performs via the shared
bootconfig_cmdline_requested() helper. Switch it to the helper so the
early (setup_arch) and late (setup_boot_config) paths use one parser and
cannot disagree on what counts as opt-in.

The helper also reports the offset of the init arguments following a "--"
separator, which is exactly what initargs_offs needs, so the local
parse_args() call, its bootconfig_params() callback and the tmp_cmdline
copy are removed.

No functional change intended.

Link: https://lore.kernel.org/all/20260626-bootconfig_using_tools-v7-9-24ab72139c29@debian.org/

Suggested-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 file changed