From: Guillaume Tucker <gtucker@gtucker.io>
To: Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>
Cc: Guillaume Tucker <gtucker@gtucker.io>,
Miguel Ojeda <ojeda@kernel.org>,
rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org,
automated-testing@lists.yoctoproject.org,
Arnd Bergmann <arnd@arndb.de>,
workflows@vger.kernel.org, llvm@lists.linux.dev
Subject: [RFC PATCH 0/1] kbuild: introduce containerized builds
Date: Tue, 14 Oct 2025 11:45:10 +0200 [thread overview]
Message-ID: <20251014094511.627258-1-gtucker@gtucker.io> (raw)
This proposal emerged from an email discussion and a talk at Plumbers
last year:
https://lore.kernel.org/all/affb7aff-dc9b-4263-bbd4-a7965c19ac4e@gtucker.io/
The aim is to facilitate reproducing builds for CI bots as well as
developers using containers. It's achieved by providing a wrapper
around `make` in a separate Makefile. Here's an illustrative example
with a kernel.org toolchain in a Docker image from tuxmake:
$ make -f scripts/Makefile.container CONTAINER=tuxmake/korg-clang-21 LLVM=1 defconfig
Running in docker tuxmake/korg-clang-21
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
[...]
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
$ make -f scripts/Makefile.container CONTAINER=tuxmake/korg-clang-21 LLVM=1 -j8
Running in docker tuxmake/korg-clang-21
make: warning: -j8 forced in submake: resetting jobserver mode.
SYNC include/config/auto.conf
GEN arch/x86/include/generated/asm/orc_hash.h
WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/x86/include/generated/uapi/asm/errno.h
[...]
LD arch/x86/boot/setup.elf
OBJCOPY arch/x86/boot/setup.bin
BUILD arch/x86/boot/bzImage
Kernel: arch/x86/boot/bzImage is ready (#1)
The initial idea was to add an if-else block for when $(CONTAINER)
was defined directly in the top-level Makefile but this seemed too
intrusive, hence the approach here with a separate file. It's easy
enough to create an alias for development purposes if needed.
While the example above uses a tuxmake image, I've also started
preparing reference container images with kernel.org toolchains and
no third-party dependencies other than the base Debian distro:
https://gitlab.com/gtucker/korg-containers
These are convenient for exercising this feature but any arbitrary
image may be used of course.
Guillaume Tucker (1):
kbuild: add Makefile.container with CONTAINER option
scripts/Makefile.container | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 scripts/Makefile.container
--
2.47.3
next reply other threads:[~2025-10-14 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 9:45 Guillaume Tucker [this message]
2025-10-14 9:45 ` [RFC PATCH 1/1] kbuild: add Makefile.container with CONTAINER option Guillaume Tucker
2025-10-14 11:58 ` Miguel Ojeda
2025-10-14 14:08 ` Onur Özkan
2025-10-14 14:42 ` Guillaume Tucker
2025-10-14 14:31 ` Guillaume Tucker
2025-10-14 15:42 ` Miguel Ojeda
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=20251014094511.627258-1-gtucker@gtucker.io \
--to=gtucker@gtucker.io \
--cc=arnd@arndb.de \
--cc=automated-testing@lists.yoctoproject.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=workflows@vger.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;
as well as URLs for NNTP newsgroup(s).