sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget'/translations/zh_CN/dev-tools/containermodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/zh_TW/dev-tools/containermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/it_IT/dev-tools/containermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ja_JP/dev-tools/containermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ko_KR/dev-tools/containermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/sp_SP/dev-tools/containermodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h%SPDX-License-Identifier: GPL-2.0-onlyh]h%SPDX-License-Identifier: GPL-2.0-only}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhA/var/lib/git/docbuild/linux/Documentation/dev-tools/container.rsthKubh)}(h#Copyright (C) 2025 Guillaume Tuckerh]h#Copyright (C) 2025 Guillaume Tucker}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubhsection)}(hhh](htitle)}(hContainerized Buildsh]hContainerized Builds}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXThe ``container`` tool can be used to run any command in the kernel source tree from within a container. Doing so facilitates reproducing builds across various platforms, for example when a test bot has reported an issue which requires a specific version of a compiler or an external test suite. While this can already be done by users who are familiar with containers, having a dedicated tool in the kernel tree lowers the barrier to entry by solving common problems once and for all (e.g. user id management). It also makes it easier to share an exact command line leading to a particular result. The main use case is likely to be kernel builds but virtually anything can be run: KUnit, checkpatch etc. provided a suitable image is available.h](hThe }(hhhhhNhNubhliteral)}(h ``container``h]h container}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubhX tool can be used to run any command in the kernel source tree from within a container. Doing so facilitates reproducing builds across various platforms, for example when a test bot has reported an issue which requires a specific version of a compiler or an external test suite. While this can already be done by users who are familiar with containers, having a dedicated tool in the kernel tree lowers the barrier to entry by solving common problems once and for all (e.g. user id management). It also makes it easier to share an exact command line leading to a particular result. The main use case is likely to be kernel builds but virtually anything can be run: KUnit, checkpatch etc. provided a suitable image is available.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hOptionsh]hOptions}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hCommand line syntax::h]hCommand line syntax:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(h-scripts/container -i IMAGE [OPTION]... CMD...h]h-scripts/container -i IMAGE [OPTION]... CMD...}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhhhubh)}(hAvailable options:h]hAvailable options:}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h``-e, --env-file ENV_FILE``h]h)}(hj:h]h-e, --env-file ENV_FILE}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj8ubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh block_quote)}(h6Path to an environment file to load in the container. h]h)}(h5Path to an environment file to load in the container.h]h5Path to an environment file to load in the container.}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjQubah}(h]h ]h"]h$]h&]uh1jOhhhKhhhhubh)}(h``-g, --gid GID``h]h)}(hjkh]h -g, --gid GID}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjiubah}(h]h ]h"]h$]h&]uh1hhhhK!hhhhubjP)}(h&Group id to use inside the container. h]h)}(h%Group id to use inside the container.h]h%Group id to use inside the container.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjubah}(h]h ]h"]h$]h&]uh1jOhhhK#hhhhubh)}(h``-i, --image IMAGE``h]h)}(hjh]h-i, --image IMAGE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhK%hhhhubjP)}(h!Container image name (required). h]h)}(h Container image name (required).h]h Container image name (required).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jOhhhK'hhhhubh)}(h``-r, --runtime RUNTIME``h]h)}(hjh]h-r, --runtime RUNTIME}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhK)hhhhubjP)}(hContainer runtime name. Supported runtimes: ``docker``, ``podman``. If not specified, the first one found on the system will be used i.e. Podman if present, otherwise Docker. h](h)}(hDContainer runtime name. Supported runtimes: ``docker``, ``podman``.h](h-Container runtime name. Supported runtimes: }(hjhhhNhNubh)}(h ``docker``h]hdocker}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh, }(hjhhhNhNubh)}(h ``podman``h]hpodman}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK+hjubh)}(hjIf not specified, the first one found on the system will be used i.e. Podman if present, otherwise Docker.h]hjIf not specified, the first one found on the system will be used i.e. Podman if present, otherwise Docker.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubeh}(h]h ]h"]h$]h&]uh1jOhhhK+hhhhubh)}(h``-s, --shell``h]h)}(hj*h]h -s, --shell}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]uh1hhhhK0hhhhubjP)}(h+Run the container in an interactive shell. h]h)}(h*Run the container in an interactive shell.h]h*Run the container in an interactive shell.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hj?ubah}(h]h ]h"]h$]h&]uh1jOhhhK2hhhhubh)}(h``-u, --uid UID``h]h)}(hjYh]h -u, --uid UID}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjWubah}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubjP)}(h}User id to use inside the container. If the ``-g`` option is not specified, the user id will also be used for the group id. h](h)}(h$User id to use inside the container.h]h$User id to use inside the container.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hjnubh)}(hVIf the ``-g`` option is not specified, the user id will also be used for the group id.h](hIf the }(hjhhhNhNubh)}(h``-g``h]h-g}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhI option is not specified, the user id will also be used for the group id.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjnubeh}(h]h ]h"]h$]h&]uh1jOhhhK6hhhhubh)}(h``-v, --verbose``h]h)}(hjh]h -v, --verbose}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhK;hhhhubjP)}(hEnable verbose output. h]h)}(hEnable verbose output.h]hEnable verbose output.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjubah}(h]h ]h"]h$]h&]uh1jOhhhK=hhhhubh)}(h``-h, --help``h]h)}(hjh]h -h, --help}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhK?hhhhubjP)}(h!Show the help message and exit. h]h)}(hShow the help message and exit.h]hShow the help message and exit.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1jOhhhKAhhhhubeh}(h]optionsah ]h"]optionsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hUsageh]hUsage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKEubh)}(hXIt's entirely up to the user to choose which image to use and the ``CMD`` arguments are passed directly as an arbitrary command line to run in the container. The tool will take care of mounting the source tree as the current working directory and adjust the user and group id as needed.h](hDIt’s entirely up to the user to choose which image to use and the }(hjhhhNhNubh)}(h``CMD``h]hCMD}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh arguments are passed directly as an arbitrary command line to run in the container. The tool will take care of mounting the source tree as the current working directory and adjust the user and group id as needed.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhj hhubh)}(hXThe container image which would typically include a compiler toolchain is provided by the user and selected via the ``-i`` option. The container runtime can be selected with the ``-r`` option, which can be either ``docker`` or ``podman``. If none is specified, the first one found on the system will be used while giving priority to Podman. Support for other runtimes may be added later depending on their popularity among users.h](htThe container image which would typically include a compiler toolchain is provided by the user and selected via the }(hj=hhhNhNubh)}(h``-i``h]h-i}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh9 option. The container runtime can be selected with the }(hj=hhhNhNubh)}(h``-r``h]h-r}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh option, which can be either }(hj=hhhNhNubh)}(h ``docker``h]hdocker}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh or }(hj=hhhNhNubh)}(h ``podman``h]hpodman}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=ubh. If none is specified, the first one found on the system will be used while giving priority to Podman. Support for other runtimes may be added later depending on their popularity among users.}(hj=hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKLhj hhubh)}(hX`By default, commands are run non-interactively. The user can abort a running container with SIGINT (Ctrl-C). To run commands interactively with a TTY, the ``--shell`` or ``-s`` option can be used. Signals will then be received by the shell directly rather than the parent ``container`` process. To exit an interactive shell, use Ctrl-D or ``exit``.h](hBy default, commands are run non-interactively. The user can abort a running container with SIGINT (Ctrl-C). To run commands interactively with a TTY, the }(hjhhhNhNubh)}(h ``--shell``h]h--shell}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh or }(hjhhhNhNubh)}(h``-s``h]h-s}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubha option can be used. Signals will then be received by the shell directly rather than the parent }(hjhhhNhNubh)}(h ``container``h]h container}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh7 process. To exit an interactive shell, use Ctrl-D or }(hjhhhNhNubh)}(h``exit``h]hexit}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKShj hhubhnote)}(hQThe only host requirement aside from a container runtime is Python 3.10 or later.h]h)}(hQThe only host requirement aside from a container runtime is Python 3.10 or later.h]hQThe only host requirement aside from a container runtime is Python 3.10 or later.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubj)}(hXOut-of-tree builds are not fully supported yet. The ``O=`` option can however already be used with a relative path inside the source tree to keep separate build outputs. A workaround to build outside the tree is to use ``mount --bind``, see the examples section further down.h]h)}(hXOut-of-tree builds are not fully supported yet. The ``O=`` option can however already be used with a relative path inside the source tree to keep separate build outputs. A workaround to build outside the tree is to use ``mount --bind``, see the examples section further down.h](h5Out-of-tree builds are not fully supported yet. The }(hjhhhNhNubh)}(h``O=``h]hO=}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh option can however already be used with a relative path inside the source tree to keep separate build outputs. A workaround to build outside the tree is to use }(hjhhhNhNubh)}(h``mount --bind``h]h mount --bind}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh(, see the examples section further down.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK`hjubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubeh}(h]usageah ]h"]usageah$]h&]uh1hhhhhhhhKEubh)}(hhh](h)}(hEnvironment Variablesh]hEnvironment Variables}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjGhhhhhKgubh)}(hX[Environment variables are not propagated to the container so they have to be either defined in the image itself or via the ``-e`` option using an environment file. In some cases it makes more sense to have them defined in the Containerfile used to create the image. For example, a Clang-only compiler toolchain image may have ``LLVM=1`` defined.h](h{Environment variables are not propagated to the container so they have to be either defined in the image itself or via the }(hjXhhhNhNubh)}(h``-e``h]h-e}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXubh option using an environment file. In some cases it makes more sense to have them defined in the Containerfile used to create the image. For example, a Clang-only compiler toolchain image may have }(hjXhhhNhNubh)}(h ``LLVM=1``h]hLLVM=1}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjXubh defined.}(hjXhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKihjGhhubh)}(hThe local environment file is more useful for user-specific variables added during development. It is passed as-is to the container runtime so its format may vary. Typically, it will look like the output of ``env``. For example::h](hThe local environment file is more useful for user-specific variables added during development. It is passed as-is to the container runtime so its format may vary. Typically, it will look like the output of }(hjhhhNhNubh)}(h``env``h]henv}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh. For example:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKohjGhhubj)}(h4INSTALL_MOD_STRIP=1 SOME_RANDOM_TEXT=One upon a timeh]h4INSTALL_MOD_STRIP=1 SOME_RANDOM_TEXT=One upon a time}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKshjGhhubh)}(hPlease also note that ``make`` options can still be passed on the command line, so while this can't be done since the first argument needs to be the executable::h](hPlease also note that }(hjhhhNhNubh)}(h``make``h]hmake}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh options can still be passed on the command line, so while this can’t be done since the first argument needs to be the executable:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKvhjGhhubj)}(hKscripts/container -i docker.io/tuxmake/korg-clang LLVM=1 make # won't workh]hKscripts/container -i docker.io/tuxmake/korg-clang LLVM=1 make # won't work}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKzhjGhhubh)}(hthis will work::h]hthis will work:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK|hjGhhubj)}(h=scripts/container -i docker.io/tuxmake/korg-clang make LLVM=1h]h=scripts/container -i docker.io/tuxmake/korg-clang make LLVM=1}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK~hjGhhubeh}(h]environment-variablesah ]h"]environment variablesah$]h&]uh1hhhhhhhhKgubh)}(hhh](h)}(hUser IDsh]hUser IDs}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXThis is an area where the behaviour will vary slightly depending on the container runtime. The goal is to run commands as the user invoking the tool. With Podman, a namespace is created to map the current user id to a different one in the container (1000 by default). With Docker, while this is also possible with recent versions it requires a special feature to be enabled in the daemon so it's not used here for simplicity. Instead, the container is run with the current user id directly. In both cases, this will provide the same file permissions for the kernel source tree mounted as a volume. The only difference is that when using Docker without a namespace, the user id may not be the same as the default one set in the image.h]hXThis is an area where the behaviour will vary slightly depending on the container runtime. The goal is to run commands as the user invoking the tool. With Podman, a namespace is created to map the current user id to a different one in the container (1000 by default). With Docker, while this is also possible with recent versions it requires a special feature to be enabled in the daemon so it’s not used here for simplicity. Instead, the container is run with the current user id directly. In both cases, this will provide the same file permissions for the kernel source tree mounted as a volume. The only difference is that when using Docker without a namespace, the user id may not be the same as the default one set in the image.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXSay, we're using an image which sets up a default user with id 1000 and the current user calling the ``container`` tool has id 1234. The kernel source tree was checked out by this same user so the files belong to user 1234. With Podman, the container will be running as user id 1000 with a mapping to id 1234 so that the files from the mounted volume appear to belong to id 1000 inside the container. With Docker and no namespace, the container will be running with user id 1234 which can access the files in the volume but not in the user 1000 home directory. This shouldn't be an issue when running commands only in the kernel tree but it is worth highlighting here as it might matter for special corner cases.h](hgSay, we’re using an image which sets up a default user with id 1000 and the current user calling the }(hj)hhhNhNubh)}(h ``container``h]h container}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)ubhX\ tool has id 1234. The kernel source tree was checked out by this same user so the files belong to user 1234. With Podman, the container will be running as user id 1000 with a mapping to id 1234 so that the files from the mounted volume appear to belong to id 1000 inside the container. With Docker and no namespace, the container will be running with user id 1234 which can access the files in the volume but not in the user 1000 home directory. This shouldn’t be an issue when running commands only in the kernel tree but it is worth highlighting here as it might matter for special corner cases.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj hhubj)}(hX0Podman's `Docker compatibility `__ mode to run ``docker`` commands on top of a Podman backend is more complex and not fully supported yet. As such, Podman will take priority if both runtimes are available on the system.h]h)}(hX0Podman's `Docker compatibility `__ mode to run ``docker`` commands on top of a Podman backend is more complex and not fully supported yet. As such, Podman will take priority if both runtimes are available on the system.h](h Podman’s }(hjMhhhNhNubh reference)}(hm`Docker compatibility `__h]hDocker compatibility}(hjWhhhNhNubah}(h]h ]h"]h$]h&]nameDocker compatibilityrefuriRhttps://podman-desktop.io/docs/migrating-from-docker/managing-docker-compatibilityuh1jUhjMubh mode to run }(hjMhhhNhNubh)}(h ``docker``h]hdocker}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjMubh commands on top of a Podman backend is more complex and not fully supported yet. As such, Podman will take priority if both runtimes are available on the system.}(hjMhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjIubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubeh}(h]user-idsah ]h"]user idsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hExamplesh]hExamples}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hThe TuxMake project provides a variety of prebuilt container images available on `Docker Hub `__. Here's the shortest example to build a kernel using a TuxMake Clang image::h](hQThe TuxMake project provides a variety of prebuilt container images available on }(hjhhhNhNubjV)}(h1`Docker Hub `__h]h Docker Hub}(hjhhhNhNubah}(h]h ]h"]h$]h&]name Docker Hubjg https://hub.docker.com/u/tuxmakeuh1jUhjubhO. Here’s the shortest example to build a kernel using a TuxMake Clang image:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hscripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 defconfig scripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 -j$(nproc)h]hscripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 defconfig scripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 -j$(nproc)}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubj)}(hX6When running a command with options within the container, it should be separated with a double dash ``--`` to not confuse them with the ``container`` tool options. Plain commands with no options don't strictly require the double dashes e.g.:: scripts/container -i docker.io/tuxmake/korg-clang make mrproperh](h)}(hWhen running a command with options within the container, it should be separated with a double dash ``--`` to not confuse them with the ``container`` tool options. Plain commands with no options don't strictly require the double dashes e.g.::h](hdWhen running a command with options within the container, it should be separated with a double dash }(hjhhhNhNubh)}(h``--``h]h--}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh to not confuse them with the }(hjhhhNhNubh)}(h ``container``h]h container}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh_ tool options. Plain commands with no options don’t strictly require the double dashes e.g.:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(h?scripts/container -i docker.io/tuxmake/korg-clang make mrproperh]h?scripts/container -i docker.io/tuxmake/korg-clang make mrproper}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hOTo run ``checkpatch.pl`` in a ``patches`` directory with a generic Perl image::h](hTo run }(hjhhhNhNubh)}(h``checkpatch.pl``h]h checkpatch.pl}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh in a }(hjhhhNhNubh)}(h ``patches``h]hpatches}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh% directory with a generic Perl image:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hEscripts/container -i perl:slim-trixie scripts/checkpatch.pl patches/*h]hEscripts/container -i perl:slim-trixie scripts/checkpatch.pl patches/*}hjQsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hXAs an alternative to the TuxMake images, the examples below refer to ``kernel.org`` images which are based on the `kernel.org compiler toolchains `__. These aren't (yet) officially available in any public registry but users can build their own locally instead using this `experimental repository `__ by running ``make PREFIX=kernel.org/``.h](hEAs an alternative to the TuxMake images, the examples below refer to }(hj_hhhNhNubh)}(h``kernel.org``h]h kernel.org}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhj_ubh images which are based on the }(hj_hhhNhNubjV)}(hO`kernel.org compiler toolchains `__h]hkernel.org compiler toolchains}(hjyhhhNhNubah}(h]h ]h"]h$]h&]namekernel.org compiler toolchainsjg*https://mirrors.edge.kernel.org/pub/tools/uh1jUhj_ubh}. These aren’t (yet) officially available in any public registry but users can build their own locally instead using this }(hj_hhhNhNubjV)}(hH`experimental repository `__h]hexperimental repository}(hjhhhNhNubah}(h]h ]h"]h$]h&]nameexperimental repositoryjg*https://gitlab.com/gtucker/korg-containersuh1jUhj_ubh by running }(hj_hhhNhNubh)}(h``make PREFIX=kernel.org/``h]hmake PREFIX=kernel.org/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj_ubh.}(hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h'To build just ``bzImage`` using Clang::h](hTo build just }(hjhhhNhNubh)}(h ``bzImage``h]hbzImage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh using Clang:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h@scripts/container -i kernel.org/clang -- make bzImage -j$(nproc)h]h@scripts/container -i kernel.org/clang -- make bzImage -j$(nproc)}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h.Same with GCC 15 as a particular version tag::h]h-Same with GCC 15 as a particular version tag:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hAscripts/container -i kernel.org/gcc:15 -- make bzImage -j$(nproc)h]hAscripts/container -i kernel.org/gcc:15 -- make bzImage -j$(nproc)}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hxFor an out-of-tree build, a trick is to bind-mount the destination directory to a relative path inside the source tree::h]hwFor an out-of-tree build, a trick is to bind-mount the destination directory to a relative path inside the source tree:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hXmkdir -p $HOME/tmp/my-kernel-build mkdir -p build sudo mount --bind $HOME/tmp/my-kernel-build build scripts/container -i kernel.org/gcc -- make mrproper scripts/container -i kernel.org/gcc -- make O=build defconfig scripts/container -i kernel.org/gcc -- make O=build -j$(nproc)h]hXmkdir -p $HOME/tmp/my-kernel-build mkdir -p build sudo mount --bind $HOME/tmp/my-kernel-build build scripts/container -i kernel.org/gcc -- make mrproper scripts/container -i kernel.org/gcc -- make O=build defconfig scripts/container -i kernel.org/gcc -- make O=build -j$(nproc)}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h>To run KUnit in an interactive shell and get the full output::h]h=To run KUnit in an interactive shell and get the full output:}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hscripts/container -s -i kernel.org/gcc:kunit -- \ tools/testing/kunit/kunit.py \ run \ --arch=x86_64 \ --cross_compile=x86_64-linux-h]hscripts/container -s -i kernel.org/gcc:kunit -- \ tools/testing/kunit/kunit.py \ run \ --arch=x86_64 \ --cross_compile=x86_64-linux-}hj/sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h$To just start an interactive shell::h]h#To just start an interactive shell:}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h)scripts/container -si kernel.org/gcc bashh]h)scripts/container -si kernel.org/gcc bash}hjKsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hTo build the HTML documentation, which requires the ``kdocs`` image built with ``make PREFIX=kernel.org/ extra`` as it's not a compiler toolchain::h](h4To build the HTML documentation, which requires the }(hjYhhhNhNubh)}(h ``kdocs``h]hkdocs}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhjYubh image built with }(hjYhhhNhNubh)}(h!``make PREFIX=kernel.org/ extra``h]hmake PREFIX=kernel.org/ extra}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhjYubh$ as it’s not a compiler toolchain:}(hjYhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h3scripts/container -i kernel.org/kdocs make htmldocsh]h3scripts/container -i kernel.org/kdocs make htmldocs}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h]examplesah ]h"]examplesah$]h&]uh1hhhhhhhhKubeh}(h]containerized-buildsah ]h"]containerized buildsah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjj jjDjAjjjjjju nametypes}(jj jDjjjuh}(jhjhjAj jjGjj jju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.