From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Thu, 15 Mar 2018 14:00:48 +0100 Subject: Out-of-tree module build in a dedicated build directory. In-Reply-To: References: Message-ID: <20180315130048.GA6347@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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