* Linux 2.6 kernel module compilation without using KBUILD
@ 2007-11-28 8:09 murtuja bharmal
2007-11-28 9:00 ` Sam Ravnborg
0 siblings, 1 reply; 6+ messages in thread
From: murtuja bharmal @ 2007-11-28 8:09 UTC (permalink / raw)
To: linux-kernel
Hello All,
I want to compile external linux kernel module without
using KBUILD.
I tried to find out whole process of kernel module
compilation using KBUILD after enabling flag
KBUILD_VERBOSE=1.
If we look at 2.6 kernel module building process.
1. gcc is making ".hello.o.d" and ".tmp_hello.o"
from "hello.c" file.
2. Creating "hello.o" file using ".hello.o.d"
and ".tmp_hello.o".
3. Running Script "scripts/mod/modpost" to
create "hello.mod.c" using hello.o.
4. gcc is making "hello.mod.o" after compiling
"hello-mod.c" file.
5. finally "ld" is linking "hello.o"
and "hello.mod.o" and making "hello.ko".
Step 2 of above process is not very much cleared, how
it is making hello-2.o from ".hello.o.d" and
".tmp_hello.o".
What is ".tmp_hello.o.
Do we have any document which describe how to make
kernel module without using KBUILD.
Any pointer of information is very helpful for me.
Thanks
Murtuja Bharmal
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linux 2.6 kernel module compilation without using KBUILD
2007-11-28 8:09 Linux 2.6 kernel module compilation without using KBUILD murtuja bharmal
@ 2007-11-28 9:00 ` Sam Ravnborg
2007-11-28 9:53 ` murtuja bharmal
0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2007-11-28 9:00 UTC (permalink / raw)
To: murtuja bharmal; +Cc: linux-kernel, linux-kbuild
On Wed, Nov 28, 2007 at 12:09:51AM -0800, murtuja bharmal wrote:
> Hello All,
>
> I want to compile external linux kernel module without
> using KBUILD.
...
> Do we have any document which describe how to make
> kernel module without using KBUILD.
No.
Becasue building kernel modules without using kbuild is highly
discouraged and vulnerable for all sort of config related issues.
As a simple example the module may become unuseable if just one
change is made to the configuration because this changes
the parameters passed to gcc which again affects the code
being built.
Can you try to enlighting why you want to avoid kbuild.
If you have a specific problem then maybe kbuild already can
do what you need.
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linux 2.6 kernel module compilation without using KBUILD
2007-11-28 9:00 ` Sam Ravnborg
@ 2007-11-28 9:53 ` murtuja bharmal
2007-11-28 9:56 ` Robert P. J. Day
2007-11-28 10:59 ` Sam Ravnborg
0 siblings, 2 replies; 6+ messages in thread
From: murtuja bharmal @ 2007-11-28 9:53 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, linux-kbuild
--- Sam Ravnborg <sam@ravnborg.org> wrote:
> On Wed, Nov 28, 2007 at 12:09:51AM -0800, murtuja
> bharmal wrote:
> > Hello All,
> >
> > I want to compile external linux kernel module
> without
> > using KBUILD.
> ...
> > Do we have any document which describe how to make
> > kernel module without using KBUILD.
>
> No.
> Becasue building kernel modules without using kbuild
> is highly
> discouraged and vulnerable for all sort of config
> related issues.
> As a simple example the module may become unuseable
> if just one
> change is made to the configuration because this
> changes
> the parameters passed to gcc which again affects the
> code
> being built.
>
> Can you try to enlighting why you want to avoid
> kbuild.
> If you have a specific problem then maybe kbuild
> already can
> do what you need.
>
> Sam
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
Hello Sam,
My intention is to just understand whole
process of making kernel module.
Actually I am working on one project in which I have
to port lots of 2.4 kernel module in 2.6 kernel.
So I thought lets first try to understand, what is
going behind KBUILD.
I also gone through linux/Documentation/kbuild/ but
didn't get very much information.
Even after running it on Verbose Mode, I am not very
much clear.
Thanks
Murtuja Bharmal
____________________________________________________________________________________
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linux 2.6 kernel module compilation without using KBUILD
2007-11-28 9:53 ` murtuja bharmal
@ 2007-11-28 9:56 ` Robert P. J. Day
2007-11-28 10:40 ` murtuja bharmal
2007-11-28 10:59 ` Sam Ravnborg
1 sibling, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2007-11-28 9:56 UTC (permalink / raw)
To: murtuja bharmal; +Cc: Sam Ravnborg, linux-kernel, linux-kbuild
On Wed, 28 Nov 2007, murtuja bharmal wrote:
> Hello Sam,
>
> My intention is to just understand whole process of making kernel
> module. Actually I am working on one project in which I have to port
> lots of 2.4 kernel module in 2.6 kernel. So I thought lets first try
> to understand, what is going behind KBUILD. I also gone through
> linux/Documentation/kbuild/ but didn't get very much information.
> Even after running it on Verbose Mode, I am not very much clear.
>
> Thanks
> Murtuja Bharmal
you'd probably be better off asking this on the kernel newbies list
rather than the main kernel list. and, as an intro to porting 2.4 to
2.6 modules, you might want to start here:
http://lwn.net/Articles/driver-porting/
and, as others have suggested, you're probably better off just
figuring out the 2.6 kbuild structure. trying to do this manually
without kbuild is just making this way more difficult than it has to
be.
rday
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://crashcourse.ca
========================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linux 2.6 kernel module compilation without using KBUILD
2007-11-28 9:56 ` Robert P. J. Day
@ 2007-11-28 10:40 ` murtuja bharmal
0 siblings, 0 replies; 6+ messages in thread
From: murtuja bharmal @ 2007-11-28 10:40 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: Sam Ravnborg, linux-kernel, linux-kbuild
--- "Robert P. J. Day" <rpjday@crashcourse.ca> wrote:
> On Wed, 28 Nov 2007, murtuja bharmal wrote:
>
> > Hello Sam,
> >
> > My intention is to just understand whole process
> of making kernel
> > module. Actually I am working on one project in
> which I have to port
> > lots of 2.4 kernel module in 2.6 kernel. So I
> thought lets first try
> > to understand, what is going behind KBUILD. I also
> gone through
> > linux/Documentation/kbuild/ but didn't get very
> much information.
> > Even after running it on Verbose Mode, I am not
> very much clear.
> >
> > Thanks
> > Murtuja Bharmal
>
> you'd probably be better off asking this on the
> kernel newbies list
> rather than the main kernel list. and, as an intro
> to porting 2.4 to
> 2.6 modules, you might want to start here:
>
> http://lwn.net/Articles/driver-porting/
>
> and, as others have suggested, you're probably
> better off just
> figuring out the 2.6 kbuild structure. trying to do
> this manually
> without kbuild is just making this way more
> difficult than it has to
> be.
>
> rday
>
>
========================================================================
> Robert P. J. Day
> Linux Consulting, Training and Annoying Kernel
> Pedantry
> Waterloo, Ontario, CANADA
>
> http://crashcourse.ca
>
========================================================================
>
Hello Robert,
I think I am not very much clear. Let me try to
clarify more.
My intention is not build or port kernel driver
without using KBUILD.
I know about driver porting and Writing makefile using
KBUILD.
I don't have any issue about that.
I just want understand the whole process for clearity
thats it.
unfortunately I didn't get any answer from linux-doc
and linux-admin about this issue.
Let me try to understand KBUILD internal architecture
more by self.
Any Way.
Thanks for your view.
Murtuja Bharmal
____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Linux 2.6 kernel module compilation without using KBUILD
2007-11-28 9:53 ` murtuja bharmal
2007-11-28 9:56 ` Robert P. J. Day
@ 2007-11-28 10:59 ` Sam Ravnborg
1 sibling, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2007-11-28 10:59 UTC (permalink / raw)
To: murtuja bharmal; +Cc: linux-kernel, linux-kbuild
>
> My intention is to just understand whole
> process of making kernel module.
The short story....
kbuild knows that .o files listed with obj-m are modules.
So if you have:
obj-m := foo.o
the kbuild will know that it has to build a module named foo.o.
If foo.o consist of composite objects then kbuild
is told so using:
foo-y := bar.o baz.o
So in this case kbuild will build bar.o and baz.o and
use these for the resulting module named foo.
When building baz.o kbuild uses make to search for the source file.
First it look for baz.c - if it fails it look for baz.s
Does both fail kbuild give up (there are some corner cases but ignore that).
When foo.o is ready is uses some linker magic to link in version information
and the end result is foo.ko.
foo.ko has a number of unresolved symbols that are:
1) during build time checked if kernel or other modules define them
2) during load time they are resolved
The above is general stuff - if you need more details please be specific.
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-11-28 10:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-28 8:09 Linux 2.6 kernel module compilation without using KBUILD murtuja bharmal
2007-11-28 9:00 ` Sam Ravnborg
2007-11-28 9:53 ` murtuja bharmal
2007-11-28 9:56 ` Robert P. J. Day
2007-11-28 10:40 ` murtuja bharmal
2007-11-28 10:59 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox