LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-09-2009, 12:32 AM   #1
k0der
LQ Newbie
 
Registered: Jun 2009
Distribution: fedora 8
Posts: 2

Rep: Reputation: 0
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 ~]$
 
Old 06-09-2009, 07:38 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by k0der View Post
/usr/include/linux/list.h:970:2: warning: #warning "don't include kernel headers in userspace"
Install and use your kernel-devel package instead.
 
Old 06-14-2009, 03:37 AM   #3
k0der
LQ Newbie
 
Registered: Jun 2009
Distribution: fedora 8
Posts: 2

Original Poster
Rep: Reputation: 0
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..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
2in1 problem thread. (nvidia kernel module vs X module, and strange workbug phenom) htedrom Linux - Software 15 10-04-2007 10:55 PM
PHP installation giving error. har! Linux - General 1 12-03-2006 09:58 AM
Help ME!! -- VMWare giving installation error surajprakash_76 Linux - Networking 2 11-11-2006 06:05 AM
monolithic kernel, avoiding lkms? m00 Linux - Security 3 11-11-2003 02:08 AM
Kernel 2.6: Problems loading LKMs... ugenn Linux - Software 1 10-19-2003 06:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration