[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZusDdv3iCK1MbWDq@l-nschier-nb>
Date: Wed, 18 Sep 2024 18:44:38 +0200
From: Nicolas Schier <n.schier@....de>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH 05/23] kbuild: doc: describe the -C option precisely for
external module builds
On Tue, Sep 17, 2024 at 11:16:33PM +0900, Masahiro Yamada wrote:
> Building external modules is typically done using this command:
>
> $ make -C <KERNEL_DIR> M=<EXTMOD_DIR>
>
> Here, <KERNEL_DIR> refers to the output directory where the kernel was
> built, not the kernel source directory.
>
> When the kernel is built in-tree, there is no ambiguity, as the output
> directory and the source directory are the same.
>
> If the kernel was built in a separate build directory, <KERNEL_DIR>
> should be the kernel output directory. Otherwise, Kbuild cannot locate
> necessary build artifacts such as the .config file, etc. This has been
> the method for building external modules based on the kernel compiled in
> a separate directory for over 20 years. [1]
>
> If you pass the kernel source directory to the -C option, you must also
> specify the kernel build directory using the O= option. This approach
> works as well, though it results in a slightly longer command:
>
> $ make -C <KERNEL_SOURCE_DIR> O=<KERNEL_BUILD_DIR> M=<EXTMOD_DIR>
>
> Some people mistakenly believe that O= should point to a separate output
> directory for external modules when used together with M=. This commit
> adds more clarification to Documentation/kbuild/kbuild.rst.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=e321b2ec2eb2993b3d0116e5163c78ad923e3c54
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
>
> Documentation/kbuild/kbuild.rst | 5 +++++
> Documentation/kbuild/modules.rst | 9 ++++++---
> 2 files changed, 11 insertions(+), 3 deletions(-)
Reviewed-by: Nicolas Schier <n.schier@....de>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists