Building multiple .ko files from a single module
Sankar P
sankar.curiosity at gmail.com
Tue Apr 9 10:53:19 EDT 2013
On Tue, Apr 9, 2013 at 6:34 PM, Kristof Provost <kristof at sigsegv.be> wrote:
> On 2013-04-09 17:03:14 (+0530), Sankar P <sankar.curiosity at gmail.com> wrote:
>> I have some source files: a.c b.c c.c etc. Now I need to generate a
>> few .ko files such as, 1.ko, 2.ko, 3.ko etc.
>> <SNIP>
>> For example, consider the following association between source files
>> and the .ko files.
>>
>> a.c a.h common.c common.h => 1.ko
>> b.c b.h common.c common.h => 2.ko
>>
>
> The following (untested!) should do the trick:
> obj-$(CONFIG_MYMOD) += mymod_a.o mymod_b.o
> mymod_a-objs += a.o common.o
> mymod_b-objs += b.o common.o
>
> I'd probably recommend creating three modules though: a, b and common.
Yes, this does work :-)
I found more information at
https://www.kernel.org/doc/Documentation/kbuild/modules.txt too
Thanks.
--
Sankar P
http://psankar.blogspot.com
More information about the Kernelnewbies
mailing list