public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	oss@malat.biz, paulmck@kernel.org,
	linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH 2/3] init: use static buffers for bootconfig extra command line
Date: Wed, 29 Apr 2026 17:27:21 +0900	[thread overview]
Message-ID: <20260429172721.c89072381aa98d1090ad383f@kernel.org> (raw)
In-Reply-To: <aeJH8mhxqrwdsjxc@gmail.com>

On Fri, 17 Apr 2026 08:38:16 -0700
Breno Leitao <leitao@debian.org> wrote:

> 
> On Fri, Apr 17, 2026 at 10:44:36AM +0900, Masami Hiramatsu wrote:
> > On Wed, 15 Apr 2026 03:51:11 -0700
> > Breno Leitao <leitao@debian.org> wrote:
> >
> > But if we can do it, should we continue using bootconfig? I mean
> > it is easy to make a tool (or add a feature in tools/bootconfig)
> > which converts bootconfig file to command line string and embeds
> > it in the kernel. Hmm.
> 
> Sure, you are talking about a a tool that embeddeds it in the kernel binary,
> something like:
> 
> 
> 0) Get a kernel and define CONFIG_BOOT_CONFIG_EMBED_FILE=".bootconfig"
> 
> 1) Add an option in tools/bootconfig to convert bootconfig (.bootconfig)
>    to a cmdline string ($ bootconfig -C kernel .bootconfig).
>    Something like:
>    # tools/bootconfig/bootconfig -C kernel .bootconfig
>      mem=2G loglevel=7 debug nokaslr %
> 
> 2) At kernel build time, run that tool on .bootconfig and embed the
>    resulting string into the kernel image as a .init.rodata symbol
>    (embedded_kernel_cmdline[]).
> 
>    # gdb -batch -ex 'x/s &embedded_kernel_cmdline' vmlinux
>    0xffffffff87e108f8:    "mem=2G loglevel=7 debug nokaslr "

Yeah, I think this looks good to me.

> 
> 3) At boot, the arch's setup_arch() prepends that symbol to
>    boot_command_line right before parse_early_param() — so early_param()
>    handlers (mem=, earlycon=, loglevel=, ...) actually see kernel.*
>    keys from the embedded bootconfig.

Ah, I thought it is arch independent config, but it depends on
architecture.... Hmm.

> 
>    This needs to be architecture by architecture. Something like:
> 
> 	@@ -924,6 +925,13 @@ void __init setup_arch(char **cmdline_p)
> 		builtin_cmdline_added = true;
> 	#endif
> 
> 	+       /*
> 	+        * Prepend kernel.* keys from the embedded bootconfig (rendered at
> 	+        * build time by tools/bootconfig) so parse_early_param() below sees
> 	+        * them. No-op when CONFIG_BOOT_CONFIG_EMBED=n.
> 	+        */
> 	+       xbc_prepend_embedded_cmdline(boot_command_line, COMMAND_LINE_SIZE);
> 	+
> 		strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
> 		*cmdline_p = command_line;
> 
> Am I describing your suggestion accordingly?

I think we can start supporting this option for the architecture which 
already support CONFIG_CMDLINE. Maybe we need CONFIG_ARCH_SUPPORT_CMDLINE
option which indicates the architecture supports embedded cmdline.

Thus all of this feature can depend on that Kconfig.

Thank you,

> 
> Thanks!
> --breno


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2026-04-29  8:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 10:51 [PATCH 0/3] bootconfig: break dependency from memblock Breno Leitao
2026-04-15 10:51 ` [PATCH 1/3] bootconfig: use static buffers instead of memblock allocation Breno Leitao
2026-04-15 10:51 ` [PATCH 2/3] init: use static buffers for bootconfig extra command line Breno Leitao
2026-04-17  1:44   ` Masami Hiramatsu
2026-04-17 15:38     ` Breno Leitao
2026-04-29  8:27       ` Masami Hiramatsu [this message]
2026-04-15 10:51 ` [PATCH 3/3] init: move embedded bootconfig parsing before setup_arch() Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260429172721.c89072381aa98d1090ad383f@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=oss@malat.biz \
    --cc=paulmck@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox