Re: How to build an external module in a specified directory?

2017-01-03 Thread Alexander Kapshuk
On Tue, Jan 3, 2017 at 4:11 PM, Alexander Kapshuk
 wrote:
> On Tue, Jan 3, 2017 at 9:32 AM, Shiyao Ma  wrote:
>> Hi Alexander,
>>
>>
>> Looking at that Makefile:
>>
>> # Use make M=dir to specify directory of external module to build
>> # Old syntax make ... SUBDIRS=$PWD is still supported
>> # Setting the environment variable KBUILD_EXTMOD take precedence
>> ifdef SUBDIRS
>>   KBUILD_EXTMOD ?= $(SUBDIRS)
>> endif
>>
>> ifeq ("$(origin M)", "command line")
>>   KBUILD_EXTMOD := $(M)
>> endif
>>
>>
>> So specifying KBUILD_EXTMOD or M is the same thing, which tells KBUILD the
>> directory that the Makefile for the module is in.
>> And by default, KBUILD will build the module in KBUILD_EXTMOD.
>>
>> What I want is tell KBUILD to build the modules in a specified directory.
>>
>>
>>
>> Regards.
>>
>>
>>
>>
>>
>> On Jan 2, 2017, 20:30 +0800, Alexander Kapshuk
>> , wrote:
>>
>> On Mon, Jan 2, 2017 at 1:39 PM, Shiyao Ma  wrote:
>>
>> Hi,
>>
>> When building an external module, for example, given this command,
>> all:
>> $(MAKE) -C $(KDIR) M=$$PWD
>>
>> It will build the ko file in the $PWD.
>>
>> How to specify a location for the .ko files?
>>
>>
>> Regards.
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>> Perhaps KBUILD_EXTMOD is what you're looking for.
>>
>> /path/to/kernel/sources/Makefile:183,185
>> # Use make M=dir to specify directory of external module to build
>> # Old syntax make ... SUBDIRS=$PWD is still supported
>> # Setting the environment variable KBUILD_EXTMOD take precedence
>
> I haven't verified this, but perhaps KBUILD_OUTPUT would better server
> your purposes.
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/kbuild/kbuild.txt?id=refs/tags/v4.10-rc2
> KBUILD_OUTPUT
> --
> Specify the output directory when building the kernel.
> The output directory can also be specified using "O=...".
> Setting "O=..." takes precedence over KBUILD_OUTPUT.

Tain't it either. Just verified it on my system.

Don't have an answer for you at the moment. Sorry.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to build an external module in a specified directory?

2017-01-03 Thread Alexander Kapshuk
On Tue, Jan 3, 2017 at 9:32 AM, Shiyao Ma  wrote:
> Hi Alexander,
>
>
> Looking at that Makefile:
>
> # Use make M=dir to specify directory of external module to build
> # Old syntax make ... SUBDIRS=$PWD is still supported
> # Setting the environment variable KBUILD_EXTMOD take precedence
> ifdef SUBDIRS
>   KBUILD_EXTMOD ?= $(SUBDIRS)
> endif
>
> ifeq ("$(origin M)", "command line")
>   KBUILD_EXTMOD := $(M)
> endif
>
>
> So specifying KBUILD_EXTMOD or M is the same thing, which tells KBUILD the
> directory that the Makefile for the module is in.
> And by default, KBUILD will build the module in KBUILD_EXTMOD.
>
> What I want is tell KBUILD to build the modules in a specified directory.
>
>
>
> Regards.
>
>
>
>
>
> On Jan 2, 2017, 20:30 +0800, Alexander Kapshuk
> , wrote:
>
> On Mon, Jan 2, 2017 at 1:39 PM, Shiyao Ma  wrote:
>
> Hi,
>
> When building an external module, for example, given this command,
> all:
> $(MAKE) -C $(KDIR) M=$$PWD
>
> It will build the ko file in the $PWD.
>
> How to specify a location for the .ko files?
>
>
> Regards.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
> Perhaps KBUILD_EXTMOD is what you're looking for.
>
> /path/to/kernel/sources/Makefile:183,185
> # Use make M=dir to specify directory of external module to build
> # Old syntax make ... SUBDIRS=$PWD is still supported
> # Setting the environment variable KBUILD_EXTMOD take precedence

I haven't verified this, but perhaps KBUILD_OUTPUT would better server
your purposes.
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/kbuild/kbuild.txt?id=refs/tags/v4.10-rc2
KBUILD_OUTPUT
--
Specify the output directory when building the kernel.
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to build an external module in a specified directory?

2017-01-03 Thread Shiyao Ma
Hi Alexander,


Looking at that Makefile:

# Use make M=dir to specify directory of external module to build
# Old syntax make ... SUBDIRS=$PWD is still supported
# Setting the environment variable KBUILD_EXTMOD take precedence
ifdef SUBDIRS
  KBUILD_EXTMOD ?= $(SUBDIRS)
endif

ifeq ("$(origin M)", "command line")
  KBUILD_EXTMOD := $(M)
endif


So specifying KBUILD_EXTMOD or M is the same thing, which tells KBUILD the 
directory that the Makefile for the module is in.
And by default, KBUILD will build the module in KBUILD_EXTMOD.

What I want is tell KBUILD to build the modules in a specified directory.



Regards.





On Jan 2, 2017, 20:30 +0800, Alexander Kapshuk , 
wrote:
> On Mon, Jan 2, 2017 at 1:39 PM, Shiyao Ma  wrote:
> > Hi,
> >
> > When building an external module, for example, given this command,
> > all:
> > $(MAKE) -C $(KDIR) M=$$PWD
> >
> > It will build the ko file in the $PWD.
> >
> > How to specify a location for the .ko files?
> >
> >
> > Regards.
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
> Perhaps KBUILD_EXTMOD is what you're looking for.
>
> /path/to/kernel/sources/Makefile:183,185
> # Use make M=dir to specify directory of external module to build
> # Old syntax make ... SUBDIRS=$PWD is still supported
> # Setting the environment variable KBUILD_EXTMOD take precedence
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to build an external module in a specified directory?

2017-01-02 Thread Alexander Kapshuk
On Mon, Jan 2, 2017 at 1:39 PM, Shiyao Ma  wrote:
> Hi,
>
> When building an external module, for example, given this command,
> all:
> $(MAKE) -C $(KDIR) M=$$PWD
>
> It will build the ko file in the $PWD.
>
> How to specify a location for the .ko files?
>
>
> Regards.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

Perhaps KBUILD_EXTMOD is what you're looking for.

/path/to/kernel/sources/Makefile:183,185
# Use make M=dir to specify directory of external module to build
# Old syntax make ... SUBDIRS=$PWD is still supported
# Setting the environment variable KBUILD_EXTMOD take precedence

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


How to build an external module in a specified directory?

2017-01-02 Thread Shiyao Ma
Hi,

When building an external module, for example, given this command,
all:
$(MAKE) -C $(KDIR) M=$$PWD

It will build the ko file in the $PWD.

How to specify a location for the .ko files?


Regards.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies