Re: Building multiple .ko files from a single module
On Tue, Apr 9, 2013 at 6:34 PM, Kristof Provost wrote: > On 2013-04-09 17:03:14 (+0530), Sankar P 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. >> >> 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 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building multiple .ko files from a single module
On 2013-04-09 17:03:14 (+0530), Sankar P 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. > > 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. Regards, Kristof ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Building multiple .ko files from a single module
Hi Sankar, On Tue, Apr 9, 2013 at 4:33 AM, Sankar P wrote: > 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 I'm not entirely sure if I got your question correct but you might want to have a look at the file Linux/drivers/net/wireless/iwlwifi/Makefile for reference. Happy hacking, Moritz ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Building multiple .ko files from a single module
Hi, 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. I know the correspondence between the source files and the .ko file. Is there a way I could achieve this with a single Makefile ? All the tutorials and the help pages seem to focus on creating a single .ko file from a Makefile, as that is the usual case. However, I need to have different modules generated from my sources. For some shareability reasons, I cannot move the sources to different folders either. Can someone please show me how it should be done ? 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 Thank you. -- Sankar P http://psankar.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies