[-- Attachment #1: Type: text/plain, Size: 4964 bytes --] Hi there! I try to compile my driver for 2.6.0-t1. I can insmod 2 modules out of 3, and i dont know why the 3rd fails. Changes I did for 2.6.0-t1 to my driver: - added -DKBUILD_MODNAME=<name> - renamed MINOR() to minor() - removed MOD_INC/DEC_USE_COUNT - removed MODULE_PARM* --------------------------------- A module thats working: gcc: gcc -Wall -O3 -finline-functions -Wstrict-prototypes -falign-functions=4 -I/lib/modules/2.6.0-test1-ac1/build/include -I/lib/modules/2.6.0-test1-ac1/build/include/asm/mach-default -I./include -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DKBUILD_MODNAME=working -c working.c -o working.o insmod: # insmod ./working.o kmsg: Jul 15 11:26:28 phoebee working: no version magic, tainting kernel. Jul 15 11:26:28 phoebee working: module license 'TechnoTrend' taints kernel. objdump -h: # objdump -h working.o working.o: file format elf32-i386 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000166 00000000 00000000 00000040 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 1 .data 00000078 00000000 00000000 000001c0 2**5 CONTENTS, ALLOC, LOAD, RELOC, DATA 2 .bss 00000018 00000000 00000000 00000238 2**2 ALLOC 3 .gnu.linkonce.this_module 00000200 00000000 00000000 00000280 2**7 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 4 .modinfo 0000004a 00000000 00000000 00000480 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 5 .rodata.str1.1 0000004c 00000000 00000000 000004ca 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .rodata.str1.32 00000025 00000000 00000000 00000520 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 7 .init.text 000000d8 00000000 00000000 00000550 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 8 .exit.text 0000006a 00000000 00000000 00000630 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 9 .comment 00000042 00000000 00000000 0000069a 2**0 CONTENTS, READONLY -------------------------------- The module thats not working: gcc: gcc -Wall -O3 -finline-functions -Wstrict-prototypes -falign-functions=4 -I/lib/modules/2.6.0-test1-ac1/build/include -I/lib/modules/2.6.0-test1-ac1/build/include/asm/mach-default -I./include -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DKBUILD_MODNAME=not_working -c not_working.c -o not_working.o insmod: # insmod ./not_working.o Error inserting './not_working.o': -1 Invalid module format kmsg: Jul 15 11:27:55 phoebee not_working: no version magic, tainting kernel. Jul 15 11:27:55 phoebee not_working: module license 'TechnoTrend' taints kernel. objdump -h: # objdump -h not_working.o not_working.o: file format elf32-i386 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000bb3 00000000 00000000 00000040 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 1 .data 00000080 00000000 00000000 00000c00 2**5 CONTENTS, ALLOC, LOAD, RELOC, DATA 2 .bss 00000004 00000000 00000000 00000c80 2**2 ALLOC 3 .gnu.linkonce.this_module 00000200 00000000 00000000 00000c80 2**7 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 4 .modinfo 0000004a 00000000 00000000 00000e80 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 5 .rodata.str1.32 00000378 00000000 00000000 00000ee0 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 6 .rodata.str1.1 0000000c 00000000 00000000 00001258 2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA 7 .rodata 0000004c 00000000 00000000 00001264 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 8 .fixup 00000068 00000000 00000000 000012b0 2**0 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 9 __ex_table 00000040 00000000 00000000 00001318 2**2 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 10 .init.text 000000cc 00000000 00000000 00001360 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 11 .exit.text 00000050 00000000 00000000 00001430 2**4 CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 12 .comment 00000042 00000000 00000000 00001480 2**0 CONTENTS, READONLY -------------------------------- What is wrong with the not_working.o? And do I have to use try_module_get(mod) & module_put(mod) since MOD_INC/DEC_USE_COUNT are deprecated? What about the MODULE_PARM? any replacement? Sorry if I'm asking already answered questions. Regards, Martin -- MyExcuse: backup tape overwritten with copy of system manager's favourite CD Martin Zwickel <martin.zwickel@technotrend.de> Research & Development TechnoTrend AG <http://www.technotrend.de> [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
On Tue, 15 Jul 2003 11:36:10 +0200 Martin Zwickel <martin.zwickel@technotrend.de> wrote: | Hi there! | | I try to compile my driver for 2.6.0-t1. | | I can insmod 2 modules out of 3, and i dont know why the 3rd fails. | | Changes I did for 2.6.0-t1 to my driver: | - added -DKBUILD_MODNAME=<name> | - renamed MINOR() to minor() | - removed MOD_INC/DEC_USE_COUNT | - removed MODULE_PARM* | | --------------------------------- | A module thats working: | gcc: | gcc -Wall -O3 -finline-functions -Wstrict-prototypes -falign-functions=4 | -I/lib/modules/2.6.0-test1-ac1/build/include | -I/lib/modules/2.6.0-test1-ac1/build/include/asm/mach-default -I./include | -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DKBUILD_MODNAME=working -c working.c -o | working.o Use correct build/make for 2.5/2.6. See linux/Documentation/modules.txt and linux/Documentation/kbuild/makefiles.txt . It's very simple and works well. | insmod: | # insmod ./working.o You should insmod working.ko, not working.o . (after building modules correctly) | kmsg: | Jul 15 11:26:28 phoebee working: no version magic, tainting kernel. | Jul 15 11:26:28 phoebee working: module license 'TechnoTrend' taints kernel. | | objdump -h: | # objdump -h working.o | working.o: file format elf32-i386 | Sections: | Idx Name Size VMA LMA File off Algn | 0 .text 00000166 00000000 00000000 00000040 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 1 .data 00000078 00000000 00000000 000001c0 2**5 | CONTENTS, ALLOC, LOAD, RELOC, DATA | 2 .bss 00000018 00000000 00000000 00000238 2**2 | ALLOC | 3 .gnu.linkonce.this_module 00000200 00000000 00000000 00000280 2**7 | CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD | 4 .modinfo 0000004a 00000000 00000000 00000480 2**5 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 5 .rodata.str1.1 0000004c 00000000 00000000 000004ca 2**0 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 6 .rodata.str1.32 00000025 00000000 00000000 00000520 2**5 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 7 .init.text 000000d8 00000000 00000000 00000550 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 8 .exit.text 0000006a 00000000 00000000 00000630 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 9 .comment 00000042 00000000 00000000 0000069a 2**0 | CONTENTS, READONLY | -------------------------------- | The module thats not working: | gcc: | gcc -Wall -O3 -finline-functions -Wstrict-prototypes -falign-functions=4 | -I/lib/modules/2.6.0-test1-ac1/build/include | -I/lib/modules/2.6.0-test1-ac1/build/include/asm/mach-default -I./include | -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DKBUILD_MODNAME=not_working -c | not_working.c -o not_working.o | | insmod: | # insmod ./not_working.o | Error inserting './not_working.o': -1 Invalid module format | | kmsg: | Jul 15 11:27:55 phoebee not_working: no version magic, tainting kernel. | Jul 15 11:27:55 phoebee not_working: module license 'TechnoTrend' taints kernel. | | objdump -h: | # objdump -h not_working.o | not_working.o: file format elf32-i386 | Sections: | Idx Name Size VMA LMA File off Algn | 0 .text 00000bb3 00000000 00000000 00000040 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 1 .data 00000080 00000000 00000000 00000c00 2**5 | CONTENTS, ALLOC, LOAD, RELOC, DATA | 2 .bss 00000004 00000000 00000000 00000c80 2**2 | ALLOC | 3 .gnu.linkonce.this_module 00000200 00000000 00000000 00000c80 2**7 | CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD | 4 .modinfo 0000004a 00000000 00000000 00000e80 2**5 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 5 .rodata.str1.32 00000378 00000000 00000000 00000ee0 2**5 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 6 .rodata.str1.1 0000000c 00000000 00000000 00001258 2**0 | CONTENTS, ALLOC, LOAD, READONLY, DATA | 7 .rodata 0000004c 00000000 00000000 00001264 2**2 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA | 8 .fixup 00000068 00000000 00000000 000012b0 2**0 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 9 __ex_table 00000040 00000000 00000000 00001318 2**2 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA | 10 .init.text 000000cc 00000000 00000000 00001360 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 11 .exit.text 00000050 00000000 00000000 00001430 2**4 | CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE | 12 .comment 00000042 00000000 00000000 00001480 2**0 | CONTENTS, READONLY | -------------------------------- | | What is wrong with the not_working.o? Don't know exactly, but insmod not_working.ko after it is built. | And do I have to use try_module_get(mod) & module_put(mod) since | MOD_INC/DEC_USE_COUNT are deprecated? | What about the MODULE_PARM? any replacement? Here is the FAQ for 2.5/2.6 modules: http://www.kernel.org/pub/linux/kernel/people/rusty/modules/FAQ | Sorry if I'm asking already answered questions. -- ~Randy
[-- Attachment #1: Type: text/plain, Size: 323 bytes --] Thanks for the hints! Got it working now. (well, not the way i supposed to do, but it works... :) Regards, Martin ps.: the kbuild system is strange -- MyExcuse: waste water tank overflowed onto computer Martin Zwickel <martin.zwickel@technotrend.de> Research & Development TechnoTrend AG <http://www.technotrend.de> [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]