Out-of-tree module build in a dedicated build directory.

Greg KH greg at kroah.com
Thu Mar 15 09:00:48 EDT 2018


On Thu, Mar 15, 2018 at 01:14:57PM +0100, Aleksei Fedotov wrote:
> Hello,
> 
> I have a question regarding building of out-of-tree kernel modules in
> separate build directory.
> 
> I have a source tree containing two out-of-tree kernel modules which is spread
> in two directories, module1 and module2. The build produces two independent
> modules: module1.ko and module2.ko.
> 
> $ tree --charset=ascii
> .
> |-- Kbuild
> |-- module1
> |   |-- Kbuild
> |   `-- task1.c
> `-- module2
>     |-- Kbuild
>     `-- task2.c
> 
> The root Kbuild points on sub-directories where the actual modules are located:
> 
> $ cat Kbuild
> obj-y += module1/
> obj-y += module2/
> 
> I want to use a dedicated build directory, so I could build the same set of
> sources for different platforms (ARM and x86).
> 
> It looks like passing O= or KBUILD_OUTPUT= doesn't work for out of tree modules.

It doesn't?  It should, what is the result when you try to do that?

And do you have a pointer to your Makefile, perhaps you are doing
something "wrong" in it?

thanks,

greg k-h



More information about the Kernelnewbies mailing list