hi all i think the extra.c has to be other module.define it in init_module and exit_module formate and then try to use the exported symbols ,i think it will be fine regards --- kernelnewbies-bounce@xxxxxxxxxxxx <fermat@xxxxxxxxxxxxxxxx> wrote: > Hello, > > I am trying to port a module written for the 2.4 Kernels to 2.6 Kernels. > One of my first step was to use the kernel-build system. Following the > Documentation of the makefiles in Documentation/kbuild/makefiles.txt I > wrote following Makefile: > > ----start Makefile---- > ifneq ($(KERNELRELEASE),) > obj-m := module.o > module-objs += extra.o > > else > KDIR := /lib/modules/$(shell uname -r)/build > PWD := $(shell pwd) > > all: > $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules > > endif > ----end Makefile---- > > This Makefile should compile module.c and extra.c and link them to one > object. So I wrote two .c-files. First the module.c: > > ----start module.c---- > #include <linux/version.h> > #include <linux/init.h> > #include <linux/module.h> > #include <linux/kernel.h> > #include <linux/config.h> > #include <linux/sysctl.h> > #include <linux/devfs_fs_kernel.h> > #include <linux/proc_fs.h> > > int test_int = 0; > > void test_function(void) { > return ; > } > > static int __init mymodule_init (void) { > printk (KERN_INFO "module starts\n"); > return (0); > } > > static void __exit mymodule_exit (void) { > printk(KERN_INFO "module ends\n"); > return; > } > > module_init(mymodule_init); > module_exit(mymodule_exit); > > MODULE_LICENSE("GPL"); > > EXPORT_SYMBOL (test_function); > EXPORT_SYMBOL (test_int); > ----end module.c---- > > and a extra.c which uses the test_function and test_int defined and > exportet in module.c: > > ----start extra.c---- > extern void test_function(void); > extern int test_int; > > void try_this(void) { > test_function(); > test_int++; > return; > } > ----end extra.c---- > > So I thought that try_this would use the test_function defined and > exportet in module.c. But compiling the function results in following > output: > > ----start output---- > formate@albana:~/imt/VDrive/test> make === Message Truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/