From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
paulmck@kernel.org, Nicolas Schier <nsc@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH v2 3/6] bootconfig: render embedded bootconfig as a kernel cmdline at build time
Date: Mon, 8 Jun 2026 11:29:11 +0900 [thread overview]
Message-ID: <20260608112911.ec62dfd24adf235b6db5506b@kernel.org> (raw)
In-Reply-To: <20260605-bootconfig_using_tools-v2-3-d309f544b5f7@debian.org>
Hi Breno,
On Fri, 05 Jun 2026 05:03:34 -0700
Breno Leitao <leitao@debian.org> wrote:
> diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
> index 90eb47c9d8de..aa75a7828685 100644
> --- a/tools/bootconfig/Makefile
> +++ b/tools/bootconfig/Makefile
> @@ -15,10 +15,14 @@ override CFLAGS += -Wall -g -I$(CURDIR)/include
> ALL_TARGETS := bootconfig
> ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
>
> -all: $(ALL_PROGRAMS) test
> +all: $(ALL_PROGRAMS)
>
> +# bootconfig is a build host tool: Kbuild's prepare hook runs it on the
> +# build machine to render the embedded cmdline, so always compile it with
> +# $(HOSTCC). Using $(CC) would cross-compile it under ARCH=... builds and
> +# fail to exec on the host ("Exec format error").
> $(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC)
> - $(CC) $(filter %.c,$^) $(CFLAGS) $(LDFLAGS) -o $@
> + $(HOSTCC) $(filter %.c,$^) $(CFLAGS) $(LDFLAGS) -o $@
> Is it safe to pass $(CFLAGS) and $(LDFLAGS) to $(HOSTCC) here?
> When cross-compiling, $(CFLAGS) and $(LDFLAGS) often contain target-specific
> flags. Passing these target flags to the host compiler might cause it to fail,
> or incorrectly generate binaries for the target architecture that fail to
> execute on the build host.
Sashiko found a problem here. Hmm, I would like to build the bootconfig
tool just as a tool. (like `cd tools/bootconfig; make`)
Can we identify the build (make) is called from kernel build process or not
and switching CC/CFLAGS/LDFLAGS?
>
> Additionally, since bootconfig is an administrative utility meant to be
> deployed on the target system, will permanently hardcoding $(HOSTCC) prevent
> users from cross-compiling it for their target devices?
This is also a good point. We need cros build binary and host binary.
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-06-08 2:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 12:03 [PATCH v2 0/6] bootconfig: embed kernel.* cmdline at build time Breno Leitao
2026-06-05 12:03 ` [PATCH v2 1/6] bootconfig: fix NULL-pointer arithmetic in xbc_snprint_cmdline() Breno Leitao
2026-06-05 12:03 ` [PATCH v2 2/6] bootconfig: render descendant keys when xbc_snprint_cmdline() root has a value Breno Leitao
2026-06-05 12:03 ` [PATCH v2 3/6] bootconfig: render embedded bootconfig as a kernel cmdline at build time Breno Leitao
2026-06-08 2:29 ` Masami Hiramatsu [this message]
2026-06-05 12:03 ` [PATCH v2 4/6] bootconfig: clean build-time tools/bootconfig from make clean Breno Leitao
2026-06-05 12:03 ` [PATCH v2 5/6] bootconfig: add xbc_prepend_embedded_cmdline() helper Breno Leitao
2026-06-05 12:03 ` [PATCH v2 6/6] x86/setup: prepend embedded bootconfig cmdline before parse_early_param Breno Leitao
2026-06-08 10:19 ` Masami Hiramatsu
2026-06-08 14:41 ` 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=20260608112911.ec62dfd24adf235b6db5506b@kernel.org \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=paulmck@kernel.org \
--cc=tglx@kernel.org \
--cc=x86@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