* makefile for 2.6 kernel
@ 2006-01-04 18:23 anil dahiya
2006-01-04 18:55 ` Sam Ravnborg
2006-01-10 17:44 ` anil dahiya
0 siblings, 2 replies; 6+ messages in thread
From: anil dahiya @ 2006-01-04 18:23 UTC (permalink / raw)
To: linux-kernel, kernelnewbies
hello
I want to make kernel module dummy.ko using multiple
.c and .h files. In short i am telling .c and .h files
with directory structure
1> dummy.ko should made be using module1.ko and
module2.o (i.e
module2.o uses module1.ko to make dummy.ko)
2> module1.ko made using a1/a1.c & a2/a2.c and both
.c file
use /home/include/a.h
3> module2.o should made using b/b1.c which use
use /home/module2/include/b.h
Suggest me tht should make i make module2.o or
module2.ko and then combine it with module1.o to make
dummy.ko
/home/------
|_ include _
| |
| a.h
|
|___module1_
| |__ a1 ____
| | |
| | a1.c
| |
|__ a2 ____
| | |
| | a2.c
|
|___ moudule2_
| |
| |__include _
| | |
| | b.h
| |___b1__
| |
| b1.c
Looking forward for ur reply
thanks in advance
---- Anil
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: makefile for 2.6 kernel
2006-01-04 18:23 makefile for 2.6 kernel anil dahiya
@ 2006-01-04 18:55 ` Sam Ravnborg
2006-01-06 7:20 ` Nauman Tahir
2006-01-10 17:44 ` anil dahiya
1 sibling, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2006-01-04 18:55 UTC (permalink / raw)
To: anil dahiya; +Cc: linux-kernel, kernelnewbies
On Wed, Jan 04, 2006 at 10:23:56AM -0800, anil dahiya wrote:
> hello
> I want to make kernel module dummy.ko using multiple
> .c and .h files. In short i am telling .c and .h files
> with directory structure
>
> 1> dummy.ko should made be using module1.ko and
> module2.o (i.e
> module2.o uses module1.ko to make dummy.ko)
You cannot make a module with a module as input.
It does not make sense.
Either you create a module or you don't.
So you will create following modules:
module1.ko + module2.ko
Alternatively you create one module but using the individual .o files as
input which is more likely what you want - correct?
Then your Kbuild file would look like this:
Kbuild:
obj-m := dummy.o
dummy-y := module1/a1/a1.o
dummy-y += module1/a2/a2.o
dummy-y += module2/b1/b1.o
# Tell where to find .h files
EXTRA_CFLAGS := -I$(src)/include
And to compile your module:
make -C $PATH_TO_KERNEL_SRC M=`pwd`
I assume you already read Documentation/kbuild/modules.txt - otherwise
please do so too.
Please include the source or provide an URL to the src if you need more
help.
Sam
>
> 2> module1.ko made using a1/a1.c & a2/a2.c and both
> .c file
> use /home/include/a.h
> 3> module2.o should made using b/b1.c which use
> use /home/module2/include/b.h
>
> Suggest me tht should make i make module2.o or
> module2.ko and then combine it with module1.o to make
> dummy.ko
>
>
> /home/------
> |_ include _
> | |
> | a.h
> |
> |___module1_
> | |__ a1 ____
> | | |
> | | a1.c
> | |
> |__ a2 ____
> | | |
> | | a2.c
> |
> |___ moudule2_
> | |
> | |__include _
> | | |
> | | b.h
> | |___b1__
> | |
> | b1.c
>
>
> Looking forward for ur reply
> thanks in advance
> ---- Anil
>
>
>
> __________________________________________
> Yahoo! DSL ? Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
> -
> 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: makefile for 2.6 kernel
2006-01-04 18:55 ` Sam Ravnborg
@ 2006-01-06 7:20 ` Nauman Tahir
2006-01-06 15:55 ` Sam Ravnborg
0 siblings, 1 reply; 6+ messages in thread
From: Nauman Tahir @ 2006-01-06 7:20 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: anil dahiya, linux-kernel, kernelnewbies
On 1/4/06, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Wed, Jan 04, 2006 at 10:23:56AM -0800, anil dahiya wrote:
> > hello
> > I want to make kernel module dummy.ko using multiple
> > .c and .h files. In short i am telling .c and .h files
> > with directory structure
> >
> > 1> dummy.ko should made be using module1.ko and
> > module2.o (i.e
> > module2.o uses module1.ko to make dummy.ko)
>
> You cannot make a module with a module as input.
> It does not make sense.
> Either you create a module or you don't.
>
> So you will create following modules:
> module1.ko + module2.ko
>
> Alternatively you create one module but using the individual .o files as
> input which is more likely what you want - correct?
>
> Then your Kbuild file would look like this:
>
> Kbuild:
> obj-m := dummy.o
> dummy-y := module1/a1/a1.o
> dummy-y += module1/a2/a2.o
> dummy-y += module2/b1/b1.o
>
> # Tell where to find .h files
> EXTRA_CFLAGS := -I$(src)/include
>
> And to compile your module:
> make -C $PATH_TO_KERNEL_SRC M=`pwd`
>
>
> I assume you already read Documentation/kbuild/modules.txt - otherwise
> please do so too.
>
> Please include the source or provide an URL to the src if you need more
> help.
>
> Sam
>
>
>
> >
> > 2> module1.ko made using a1/a1.c & a2/a2.c and both
> > .c file
> > use /home/include/a.h
> > 3> module2.o should made using b/b1.c which use
> > use /home/module2/include/b.h
> >
> > Suggest me tht should make i make module2.o or
> > module2.ko and then combine it with module1.o to make
> > dummy.ko
> >
> >
> > /home/------
> > |_ include _
> > | |
> > | a.h
> > |
> > |___module1_
> > | |__ a1 ____
> > | | |
> > | | a1.c
> > | |
> > |__ a2 ____
> > | | |
> > | | a2.c
> > |
> > |___ moudule2_
> > | |
> > | |__include _
> > | | |
> > | | b.h
> > | |___b1__
> > | |
> > | b1.c
> >
> >
> > Looking forward for ur reply
> > thanks in advance
> > ---- Anil
> >
hi,
Anil just put the names of your .c files where I have mentioned. Hope
this will work
#START OF MAKEFILE===========================================
TARGET = [Your Driver Name]
OBJS = [Your Driver Name (same as above)].o
MDIR = drivers/misc
EXTRA_CFLAGS = -DEXPORT_SYMTAB
CURRENT = $(shell uname -r)
KDIR = /lib/modules/$(CURRENT)/build
PWD = $(shell pwd)
DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR)
obj-m := $(TARGET).o
$(TARGET)-objs := [Names of your .c files with .o extension] [for
example file1.o file2.o ETC]
default:
make -C $(KDIR) SUBDIRS=$(PWD) modules
$(TARGET).o: $(OBJS)
$(LD) $(LD_RFLAG) -r -o $@ $(OBJS)
ifneq (,$(findstring 2.4.,$(CURRENT)))
install:
su -c "cp -v $(TARGET).o $(DEST) && /sbin/depmod -a"
else
install:
su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a"
endif
clean:
-rm -f *.o *.ko .*.cmd .*.flags *.mod.c
-include $(KDIR)/Rules.make
# END OF MAKEFILE========================================
> >
> >
> > __________________________________________
> > Yahoo! DSL ? Something to write home about.
> > Just $16.99/mo. or less.
> > dsl.yahoo.com
> >
> > -
> > 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/
> -
> 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/
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: makefile for 2.6 kernel
2006-01-06 7:20 ` Nauman Tahir
@ 2006-01-06 15:55 ` Sam Ravnborg
0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2006-01-06 15:55 UTC (permalink / raw)
To: Nauman Tahir; +Cc: anil dahiya, linux-kernel, kernelnewbies
On Thu, Jan 05, 2006 at 11:20:29PM -0800, Nauman Tahir wrote:
> hi,
> Anil just put the names of your .c files where I have mentioned. Hope
> this will work
Your Makefile try to stay compatible with 2.4 + 2.6.
And this includes a lot of extra stuff that can be removed for 2.6.
So only if the users wants to be compatible with both 2.4 AND 2.6 this
template is usefull.
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
* makefile for 2.6 kernel
2006-01-04 18:23 makefile for 2.6 kernel anil dahiya
2006-01-04 18:55 ` Sam Ravnborg
@ 2006-01-10 17:44 ` anil dahiya
2006-01-10 19:07 ` Sam Ravnborg
1 sibling, 1 reply; 6+ messages in thread
From: anil dahiya @ 2006-01-10 17:44 UTC (permalink / raw)
To: linux-kernel, kernelnewbies, sam
Hi Sam
Thanks fop your help ..but my problem is not solved it
...i putting my real problem here below.
1>my fist need is to make module1.ko made using
a1/a1.c , a1/a11.c & a2/a2.c a2/a22.c and all .c file
use /home/include/a.h
2>Now my 2nd need is to make module2.ko using
module1.ko and b/b1.c & b/b11.c (these both .c files
use /home/include/a.h and /home/module2/include/b.h)
In short my directory structure is as:
/home/------
|_ include _
| |
| a.h
|
|___module1_
| |__ a1 ____________
| | | |
| | a1.c a11.c
| |
|__ a2 ___________
| | | |
| | a2.c a22.c
|
|___ moudule2_
| |
| |__include _
| | |
| | b.h
| |___b1________
| | |
| b1.c b11.c
Looking forward for ur reply
thanks in advance
---- Anil
--- anil dahiya <ak_ait@yahoo.com> wrote:
> hello
> I want to make kernel module dummy.ko using multiple
> .c and .h files. In short i am telling .c and .h
> files
> with directory structure
>
> 1> dummy.ko should made be using module1.ko and
> module2.o (i.e
> module2.o uses module1.ko to make dummy.ko)
>
> 2> module1.ko made using a1/a1.c & a2/a2.c and both
> .c file
> use /home/include/a.h
> 3> module2.o should made using b/b1.c which use
> use /home/module2/include/b.h
>
> Suggest me tht should make i make module2.o or
> module2.ko and then combine it with module1.o to
> make
> dummy.ko
>
>
> /home/------
> |_ include _
> | |
> | a.h
> |
> |___module1_
> | |__ a1 ____
> | | |
> | | a1.c
> | |
> |__ a2 ____
> | | |
> | | a2.c
> |
> |___ moudule2_
> | |
> | |__include _
> | | |
> | | b.h
> | |___b1__
> | |
> | b1.c
>
>
> Looking forward for ur reply
> thanks in advance
> ---- Anil
>
>
>
> __________________________________________
> Yahoo! DSL Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
>
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:
> http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
>
>
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: makefile for 2.6 kernel
2006-01-10 17:44 ` anil dahiya
@ 2006-01-10 19:07 ` Sam Ravnborg
0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2006-01-10 19:07 UTC (permalink / raw)
To: anil dahiya; +Cc: linux-kernel, kernelnewbies
On Tue, Jan 10, 2006 at 09:44:19AM -0800, anil dahiya wrote:
> Hi Sam
> Thanks fop your help ..but my problem is not solved it
> ...i putting my real problem here below.
>
> 1>my fist need is to make module1.ko made using
> a1/a1.c , a1/a11.c & a2/a2.c a2/a22.c and all .c file
> use /home/include/a.h
This was covered in my first response.
>
> 2>Now my 2nd need is to make module2.ko using
> module1.ko and b/b1.c & b/b11.c (these both .c files
> use /home/include/a.h and /home/module2/include/b.h)
This does not make sense. You cannot link in one module
into anohter. And you would not be able to use module1
with module2 loaded due to name clash.
But you can certainly call one module from another module.
You just have to make sure module1 is loaded before module2.
Last time I requested an URL to the source IIRC?
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-01-10 19:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04 18:23 makefile for 2.6 kernel anil dahiya
2006-01-04 18:55 ` Sam Ravnborg
2006-01-06 7:20 ` Nauman Tahir
2006-01-06 15:55 ` Sam Ravnborg
2006-01-10 17:44 ` anil dahiya
2006-01-10 19:07 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®