<div dir="ltr"><div>Hi Stephens,<br></div><div><br></div><div>Try this below one.<br><div><br></div><div>obj-$(CONFIG_FOO) += <span style="font-family:arial,sans-serif;font-size:13px"> </span><span style="font-family:arial,sans-serif;font-size:13px">foo.o</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">foo-y := </span><span style="font-family:arial,sans-serif;font-size:13px">bar.o baz.o</span></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">
This compiles module foo.ko from the foo.c , bar,c baz.c</div><div class="gmail_extra"><br></div><div class="gmail_extra">Refer this for more information on Kbuild.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
<a href="https://www.kernel.org/doc/Documentation/kbuild/modules.txt">https://www.kernel.org/doc/Documentation/kbuild/modules.txt</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Regards,</div><div class="gmail_extra">
Yuva</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 1:48 AM, Arlie Stephens <span dir="ltr"><<a href="mailto:arlie@worldash.org" target="_blank">arlie@worldash.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Folks,<br>
<br>
I've got a module, call it foo, presently built from a single source<br>
file, drivers/char/foo.c It's gotten enormous, so I want to split it.<br>
Ideally I'd keep the original name for one of the source files. So<br>
what I want is a module named foo, build from source files foo.c,<br>
bar.c and baz.c<br>
<br>
kbuild is being uncooperative.<br>
<br>
The following works:<br>
<br>
obj-$(CONFIG_FOO) += foo_renamed.o<br>
foo_renamed-objs := foo.o bar.o baz.o<br>
<br>
I'd just prefer not to rename either the module or the original source<br>
file. Is this supposed to be possible, and if so, how?<br>
<br>
I'm on RHEL 6.1, aka kernel 2.6.32, in case that matters. Also, in<br>
case that matters, I'm building the module into the kerenl ("y" not<br>
"m" in the config.)<br>
<br>
<br>
----what I've tried----<br>
The following gives me warnings from make:<br>
<br>
obj-$(CONFIG_FOO) += foo.o<br>
foo-objs := foo.o bar.o baz.o<br>
<br>
<br>
The following never compiles foo.c:<br>
<br>
obj-$(CONFIG_FOO) += foo.o<br>
foo-objs := bar.o baz.o<br>
<br>
<br>
Thanks for any insight,<br>
<br>
--<br>
Arlie<br>
<br>
(Arlie Stephens <a href="mailto:arlie@worldash.org">arlie@worldash.org</a>)<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div></div>