[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling 2.6 kernel module
Greg,
Here is the directory structure.
test-module
|
+-- test1
| |
| +--test1.c
| +--Makefile
|
+-- test2
| |
| +---test2.c
| +---Makefile
|
+-- system
|
+ Makefile
The toplevel makefile is "test-module/system/Makefile", and this will
try to invoke "test1/Makefile", and "test2/Makefile", and build a single
module.
#system/Makefile :
#------------------
KERNEL_SRC_DIR = /usr/src/linux-2.6
obj-m := ../test1/
obj-m += ../test2/
all :
make -C $(KERNEL_SRC_DIR) M='pwd' modules
#test1/Makefile :
#----------------
obj-m += test1.o
#test2/Makefile :
#-----------------
obj-m += test2.o
This could build test1.ko, and test2.ko separately, but not into a
single module. I tried the following in system/Makefile, and this works.
obj-m := complete.o
complete-objs := ../test1/test1.o ../test2/test2.o
Then complete.ko is built properly, and I could install it successfully.
But I want something like this.
----------------------------
#build a single module from .o files in the "obj" directory.
obj-m := complete.o
complete-objs := ../obj/test1.o ../obj/test2.o
#Build all needed object files recursively in to a single "obj"
directory
obj-m += ../test1/
obj-m += ../test2/
----------------------------
Thanks
Suren
On Mon, 2005-05-02 at 13:11, Greg KH wrote:
> On Mon, May 02, 2005 at 01:11:19PM -0700, suren wrote:
> > Hi,
> > Did anybody tried to build a kernel loadable module on 2.6 kernel?
> >
> > I am trying to build a single module where the required C files spreads
> > across multiple directories(with each subdirectory has a makefile). I am
> > not able make a single module out of these multiple directories.
> > However, I could build and do insmod if all the C files are in one
> > single directory.
> >
> > If anybody succeeded in building a kernel module with multiple
> > directories, Can you please let me know the procedure.
>
> You can not do this. Sorry. Have a pointer to your code to help show
> you how you can structure your modules?
>
> thanks,
>
> greg k-h
>
> greg k-h
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/