LKMs giving strange error on installation of kernel module
When i compiled the following module program -
#include<linux/module.h> #include<linux/init.h> #include<linux/kernel.h> int my_init() // Entry point for the module { printk(KERN_INFO "Hello , Kernel!!"); return 0; } void my_cleanup() // Exit point for the module { printk(KERN_INFO "Good Bye, Kernel!!"); } //module_init(my_init); // Macro telling entry point //module_exit(my_cleanup); // Macro telling exit point ~ On Compilation The header files were told to be missing - linux/module.h,kernel.h,init.h and when these were copied to /usr/include/linux from /lib/modules/2.6.23.1-42.fc8/build/include/linux/ and compiled again then the header files linux/kobj.h,cache.h,list.h, moduleparam.h,stringify.h and asm/cache.h,local.h,module.h were told to be missing by the compiler.I again copied these header files from the same source as already told then the following werror is shown by the compiler - [RichJeet@localhost ~]$ gcc -c -O3 kernel.c In file included from /usr/include/linux/module.h:9, from kernel.c:1: /usr/include/linux/list.h:970:2: warning: #warning "don't include kernel headers in userspace" In file included from /usr/include/linux/module.h:18, from kernel.c:1: /usr/include/asm/local.h:4:26: error: linux/percpu.h: No such file or directory /usr/include/asm/local.h:5:24: error: asm/system.h: No such file or directory /usr/include/asm/local.h:6:24: error: asm/atomic.h: No such file or directory In file included from /usr/include/linux/module.h:18, from kernel.c:1: /usr/include/asm/local.h:10: error: expected specifier-qualifier-list before ‘atomic_long_t’ /usr/include/asm/local.h: In function ‘local_inc’: /usr/include/asm/local.h:22: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:20: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:20: error: memory input 1 is not directly addressable /usr/include/asm/local.h: In function ‘local_dec’: /usr/include/asm/local.h:29: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:27: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:27: error: memory input 1 is not directly addressable /usr/include/asm/local.h: In function ‘local_add’: /usr/include/asm/local.h:36: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:34: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:34: error: memory input 2 is not directly addressable /usr/include/asm/local.h: In function ‘local_sub’: /usr/include/asm/local.h:44: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:42: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:42: error: memory input 2 is not directly addressable /usr/include/asm/local.h: In function ‘local_sub_and_test’: /usr/include/asm/local.h:63: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:61: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:61: error: memory input 3 is not directly addressable /usr/include/asm/local.h: In function ‘local_dec_and_test’: /usr/include/asm/local.h:82: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:80: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:80: error: memory input 2 is not directly addressable /usr/include/asm/local.h: In function ‘local_inc_and_test’: /usr/include/asm/local.h:101: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:99: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:99: error: memory input 2 is not directly addressable /usr/include/asm/local.h: In function ‘local_add_negative’: /usr/include/asm/local.h:121: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:119: error: invalid lvalue in asm output 0 /usr/include/asm/local.h:119: error: memory input 3 is not directly addressable /usr/include/asm/local.h: In function ‘local_add_return’: /usr/include/asm/local.h:145: error: ‘local_t’ has no member named ‘a’ /usr/include/asm/local.h:143: error: invalid lvalue in asm output 1 /usr/include/asm/local.h:143: error: memory input 3 is not directly addressable In file included from /usr/include/linux/module.h:20, from kernel.c:1: /usr/include/asm/module.h:69:2: error: #error unknown processor family In file included from kernel.c:1: /usr/include/linux/module.h: At top level: /usr/include/linux/module.h:47: error: field ‘attr’ has incomplete type /usr/include/linux/module.h:58: error: field ‘kobj’ has incomplete type kernel.c: In function ‘my_init’: kernel.c:7: error: ‘KERN_INFO’ undeclared (first use in this function) kernel.c:7: error: (Each undeclared identifier is reported only once kernel.c:7: error: for each function it appears in.) kernel.c:7: error: expected ‘)’ before string constant kernel.c: In function ‘my_cleanup’: kernel.c:13: error: ‘KERN_INFO’ undeclared (first use in this function) kernel.c:13: error: expected ‘)’ before string constant [RichJeet@localhost ~]$ my machine information as obtained from uname command is as below - [RichJeet@localhost ~]$ uname -a Linux localhost.localdomain 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:55:12 EDT 2007 i686 athlon i386 GNU/Linux [RichJeet@localhost ~]$ |
Quote:
|
u mean there is some problem in my linux distro..cant i do it without using kernel devel package..where can i find it so that i can install it on my system.
thaks for help anyways.. |
All times are GMT -5. The time now is 09:48 AM. |