Yuan ChunYang
2003-Jul-07 12:46 UTC
Difference of building modules between kernel 2.4.XX and 2.5.XX ???
In kernel 2.5, the implementation of building modules must be changed. As fellow, i programed a test . In kernel 2.4.20 ,it''s OK! But in kenel 2.5.72,you can see: # insmod testdemo.o Error inserting ''testdemo.o'': -1 Unknown symbol in module demo: no version magic, tainting kernel. demo: Unknown symbol myprintk Now i already installed module_init_tools 0.9.12. can somebody tell me why? how to resolve this problem. thanx firstly. :) yuan ################################################################################# # Makefile: # LINUX_DIR = /usr/src/lsm-2.5 #LINUX_DIR = /usr/src/linux-2.4.20-8 CC=gcc MODCFLAGS = -D__KERNEL__ -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/asm-i386/mach-default -Wall -DMODULE -O2 -DKBUILD_MODNAME=$* -DKBUILD_BASENAME=$* -Wstrict-prototypes -o $*.o testdemo.o: demo.o myprintk.o ld -m elf_i386 -r -o testdemo.o demo.o myprintk.o demo.o: demo.c myprintkp.c $(LINUX_DIR)/include/linux/version.h $(CC) $(MODCFLAGS) -c demo.c myprintk.o: myprintk.c myprintk.h $(LINUX_DIR)/include/linux/version.h $(CC) $(MODCFLAGS) -c myprintk.c clean: rm -f *.o *.o.d ####################################################################### /* * demo.c */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> extern int myprintk (void); static int __init demo_init(void) { printk("initializing..\n"); myprintk(); return 0; } static void __exit demo_exit(void) { printk("goodbye!\n"); } module_init(demo_init); module_exit(demo_exit); MODULE_LICENSE("GPL"); ################################################################################### /* * myprintk.c */ #include <linux/version.h> #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include "myprintk.h" static int myprintk (void) { printk(KERN_INFO "This is my printk!\n"); return 0; } ################################################################################## /* * myprintk.h */ #define MODULE_NAME "HELLO" static int myprintk (void); ########################################################################### _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Randy.Dunlap
2003-Jul-07 15:21 UTC
Re: Difference of building modules between kernel 2.4.XX and 2.5.XX ???
On 07 Jul 2003 20:46:49 +0800 Yuan ChunYang <cyyuanml@sonata.iscas.ac.cn> wrote: | In kernel 2.5, the implementation of building modules must be changed. | As fellow, i programed a test . | In kernel 2.4.20 ,it''s OK! | But in kenel 2.5.72,you can see: | | # insmod testdemo.o | Error inserting ''testdemo.o'': -1 Unknown symbol in module | | demo: no version magic, tainting kernel. | demo: Unknown symbol myprintk | | Now i already installed module_init_tools 0.9.12. | | can somebody tell me why? | how to resolve this problem. | thanx firstly. :) Please see http://marc.10east.com/?l=linux-ia64&m=105676403229397&w=2 and read linux/Documentation/modules.txt for how to build modules outside of the kernel tree. -- ~Randy | http://developer.osdl.org/rddunlap/ | http://www.xenotime.net/linux/ | - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html