Makefile | 5 ++++ arch/x86/Kconfig | 1 + arch/x86/kernel/setup.c | 3 +++ include/linux/bootconfig.h | 7 ++++++ init/Kconfig | 33 ++++++++++++++++++++++++++ init/main.c | 19 ++++++++++++--- lib/Makefile | 16 +++++++++++++ lib/bootconfig.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++ lib/embedded-cmdline.S | 16 +++++++++++++ tools/bootconfig/Makefile | 2 +- 10 files changed, 156 insertions(+), 4 deletions(-)
The userspace pieces (xbc_snprint_cmdline() in lib/, tools/bootconfig -C)
already landed; this series wires the rendered cmdline into the kernel.
Motivation: today the embedded bootconfig is parsed at runtime, after
parse_early_param() has already run, so early_param() handlers can't
see embedded values. Folding the kernel.* subtree into the cmdline at
build time gives a CONFIG_CMDLINE-equivalent for embedded-bootconfig
users without forcing them to maintain two cmdline sources.
Behaviorally, the "kernel" subtree is rendered to a flat string at
build time and stashed in .init.rodata. setup_arch() prepends it to
boot_command_line before parse_early_param() runs. Overflow is a soft
error: the helper logs and leaves boot_command_line untouched rather
than panicking, so an oversized embedded bconf cannot brick a boot.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (4):
bootconfig: return 0 from xbc_snprint_cmdline() for a leaf root
bootconfig: render embedded bootconfig as a kernel cmdline at build time
bootconfig: add xbc_prepend_embedded_cmdline() helper
x86/setup: prepend embedded bootconfig cmdline before parse_early_param
Makefile | 5 ++++
arch/x86/Kconfig | 1 +
arch/x86/kernel/setup.c | 3 +++
include/linux/bootconfig.h | 7 ++++++
init/Kconfig | 33 ++++++++++++++++++++++++++
init/main.c | 19 ++++++++++++---
lib/Makefile | 16 +++++++++++++
lib/bootconfig.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
lib/embedded-cmdline.S | 16 +++++++++++++
tools/bootconfig/Makefile | 2 +-
10 files changed, 156 insertions(+), 4 deletions(-)
---
base-commit: e7e28506af98ce4e1059e5ec59334b335c00a246
change-id: 20260508-bootconfig_using_tools-cfa7aa9d6a5a
Best regards,
--
Breno Leitao <leitao@debian.org>
On Wed, 27 May 2026 09:41:33 -0700 Breno Leitao <leitao@debian.org> wrote: > The userspace pieces (xbc_snprint_cmdline() in lib/, tools/bootconfig -C) > already landed; this series wires the rendered cmdline into the kernel. > > Motivation: today the embedded bootconfig is parsed at runtime, after > parse_early_param() has already run, so early_param() handlers can't > see embedded values. Folding the kernel.* subtree into the cmdline at > build time gives a CONFIG_CMDLINE-equivalent for embedded-bootconfig > users without forcing them to maintain two cmdline sources. > > Behaviorally, the "kernel" subtree is rendered to a flat string at > build time and stashed in .init.rodata. setup_arch() prepends it to > boot_command_line before parse_early_param() runs. Overflow is a soft > error: the helper logs and leaves boot_command_line untouched rather > than panicking, so an oversized embedded bconf cannot brick a boot. > Thanks Breno, yes, that is what I think about. Let me check it. And could you also check Sashiko's comments? https://sashiko.dev/#/patchset/20260527-bootconfig_using_tools-v1-0-b6906a86e7d5%40debian.org Thanks, > Signed-off-by: Breno Leitao <leitao@debian.org> > --- > Breno Leitao (4): > bootconfig: return 0 from xbc_snprint_cmdline() for a leaf root > bootconfig: render embedded bootconfig as a kernel cmdline at build time > bootconfig: add xbc_prepend_embedded_cmdline() helper > x86/setup: prepend embedded bootconfig cmdline before parse_early_param > > Makefile | 5 ++++ > arch/x86/Kconfig | 1 + > arch/x86/kernel/setup.c | 3 +++ > include/linux/bootconfig.h | 7 ++++++ > init/Kconfig | 33 ++++++++++++++++++++++++++ > init/main.c | 19 ++++++++++++--- > lib/Makefile | 16 +++++++++++++ > lib/bootconfig.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++ > lib/embedded-cmdline.S | 16 +++++++++++++ > tools/bootconfig/Makefile | 2 +- > 10 files changed, 156 insertions(+), 4 deletions(-) > --- > base-commit: e7e28506af98ce4e1059e5ec59334b335c00a246 > change-id: 20260508-bootconfig_using_tools-cfa7aa9d6a5a > > Best regards, > -- > Breno Leitao <leitao@debian.org> > -- Masami Hiramatsu (Google) <mhiramat@kernel.org>
On Fri, May 29, 2026 at 12:15:19AM +0900, Masami Hiramatsu wrote: > On Wed, 27 May 2026 09:41:33 -0700 > Breno Leitao <leitao@debian.org> wrote: > > > The userspace pieces (xbc_snprint_cmdline() in lib/, tools/bootconfig -C) > > already landed; this series wires the rendered cmdline into the kernel. > > > > Motivation: today the embedded bootconfig is parsed at runtime, after > > parse_early_param() has already run, so early_param() handlers can't > > see embedded values. Folding the kernel.* subtree into the cmdline at > > build time gives a CONFIG_CMDLINE-equivalent for embedded-bootconfig > > users without forcing them to maintain two cmdline sources. > > > > Behaviorally, the "kernel" subtree is rendered to a flat string at > > build time and stashed in .init.rodata. setup_arch() prepends it to > > boot_command_line before parse_early_param() runs. Overflow is a soft > > error: the helper logs and leaves boot_command_line untouched rather > > than panicking, so an oversized embedded bconf cannot brick a boot. > > > > Thanks Breno, yes, that is what I think about. > Let me check it. And could you also check Sashiko's comments? yes, I've spent some time on them, and it reported some good points, in fact. I will fix those and resend. Thanks! --breno
On Fri, May 29, 2026 at 12:15:19AM +0000, Masami Hiramatsu wrote: > On Wed, 27 May 2026 09:41:33 -0700 > Breno Leitao <leitao@debian.org> wrote: > > > The userspace pieces (xbc_snprint_cmdline() in lib/, tools/bootconfig -C) > > already landed; this series wires the rendered cmdline into the kernel. > > > > Motivation: today the embedded bootconfig is parsed at runtime, after > > parse_early_param() has already run, so early_param() handlers can't > > see embedded values. Folding the kernel.* subtree into the cmdline at > > build time gives a CONFIG_CMDLINE-equivalent for embedded-bootconfig > > users without forcing them to maintain two cmdline sources. > > > > Behaviorally, the "kernel" subtree is rendered to a flat string at > > build time and stashed in .init.rodata. setup_arch() prepends it to > > boot_command_line before parse_early_param() runs. Overflow is a soft > > error: the helper logs and leaves boot_command_line untouched rather > > than panicking, so an oversized embedded bconf cannot brick a boot. > > > > Thanks Breno, yes, that is what I think about. > Let me check it. And could you also check Sashiko's comments? > > https://sashiko.dev/#/patchset/20260527-bootconfig_using_tools-v1-0-b6906a86e7d5%40debian.org Ack, I will have a look at them, thanks for confirming the direction is correct. --breno
© 2016 - 2026 Red Hat, Inc.