Page 1 of 2
need kernel headers directory to build loadable modules
Posted: Tue Mar 03, 2009 3:18 pm
by tarek.elsherbiny
I am a new to kernel and drivers and I want to build char device.
I need to compile the source code against kernel headers similar to /lib/modules/2.6.27-11-generic/build on a PC.
The problem I cant find such directory in the kernel provided on the CD to include it in the makefile
Is there any solution?
Thanks
Re: need kernel headers directory to build loadable modules
Posted: Tue Mar 03, 2009 7:14 pm
by esky-sh
Hi, there is include directory under kernel-2.6.13
Re: need kernel headers directory to build loadable modules
Posted: Wed Mar 04, 2009 2:26 pm
by tarek.elsherbiny
Thank you so much.
But I think my problem is that I need to extract the kernel in the correct location so that in .c files when I write #include<linux/init.h> the compiler would be able to locate it.
Can you please give me the Linux commands and steps to extract the kernel in a suitable directory?
Thanks
Re: need kernel headers directory to build loadable modules
Posted: Fri Mar 06, 2009 4:02 pm
by tarek.elsherbiny
OK I have included the kernel path in my $PATH env. var.
Now I get this error:
include/linux/types.h:18: error: parse error before "__kernel_dev_t"
include/linux/types.h:18: warning: type defaults to `int' in declaration of `__kernel_dev_t'
include/linux/types.h:18: warning: data definition has no type or storage class
include/linux/types.h:21: error: parse error before "dev_t"
include/linux/types.h:21: warning: type defaults to `int' in declaration of `dev_t'
include/linux/types.h:21: warning: data definition has no type or storage class
include/linux/types.h:22: error: parse error before "ino_t"
include/linux/types.h:22: warning: type defaults to `int' in declaration of `ino_t'
include/linux/types.h:22: warning: data definition has no type or storage class
include/linux/types.h:23: error: parse error before "mode_t"
include/linux/types.h:23: warning: type defaults to `int' in declaration of `mode_t'
include/linux/types.h:23: warning: data definition has no type or storage class
include/linux/types.h:24: error: parse error before "nlink_t"
include/linux/types.h:24: warning: type defaults to `int' in declaration of `nlink_t'
include/linux/types.h:24: warning: data definition has no type or storage class
include/linux/types.h:25: error: parse error before "off_t"
include/linux/types.h:25: warning: type defaults to `int' in declaration of `off_t'
include/linux/types.h:25: warning: data definition has no type or storage class
include/linux/types.h:26: error: parse error before "pid_t"
include/linux/types.h:26: warning: type defaults to `int' in declaration of `pid_t'
include/linux/types.h:26: warning: data definition has no type or storage class
include/linux/types.h:27: error: parse error before "daddr_t"
include/linux/types.h:27: warning: type defaults to `int' in declaration of `daddr_t'
include/linux/types.h:27: warning: data definition has no type or storage class
include/linux/types.h:29: error: parse error before "suseconds_t"
What dose this mean?
Re: need kernel headers directory to build loadable modules
Posted: Fri Mar 06, 2009 5:04 pm
by esky-sh
Did you successfully build linux kernel in your cross development envoirnment?
Re: need kernel headers directory to build loadable modules
Posted: Sat Mar 07, 2009 3:05 am
by tarek.elsherbiny
I did not try try to build the kernel. I am only trying to build modules.
I suspect there is problem in kernel headers. How do I install the latest kernel version?
Re: need kernel headers directory to build loadable modules
Posted: Sat Mar 07, 2009 4:09 am
by tarek.elsherbiny
If I have to compile the kernel before compiling kernel modules what is the commands for doing that?
also where is the default configuration
Re: need kernel headers directory to build loadable modules
Posted: Sat Mar 07, 2009 4:43 am
by esky-sh
Re: need kernel headers directory to build loadable modules
Posted: Sat Mar 07, 2009 6:55 am
by tarek.elsherbiny
Ok I have followed the instructions in the link and the kernel is compiled correctly.
I still get the same errors:
make -C /opt/FriendlyARM/mini2440/kernel-2.6.13 SUBDIRS=/home/tarek/workspace/hellomod modules
make[1]: Entering directory `/opt/FriendlyARM/mini2440/kernel-2.6.13'
WARNING: Symbol version dump /opt/FriendlyARM/mini2440/kernel-2.6.13/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/tarek/workspace/hellomod/hello.o
In file included from /home/tarek/workspace/hellomod/hello.c:6:
include/linux/kernel.h:104: error: parse error before "size_t"
include/linux/kernel.h:105: warning: function declaration isn't a prototype
include/linux/kernel.h:106: error: parse error before "size_t"
include/linux/kernel.h:107: warning: function declaration isn't a prototype
include/linux/kernel.h:108: error: parse error before "size_t"
include/linux/kernel.h:109: warning: function declaration isn't a prototype
include/linux/kernel.h:110: error: parse error before "size_t"
include/linux/kernel.h:111: warning: function declaration isn't a prototype
In file included from include/linux/timex.h:58,
from include/linux/sched.h:11,
from include/linux/module.h:10,
from /home/tarek/workspace/hellomod/hello.c:7:
include/linux/time.h:13: error: parse error before "time_t"
Is it possible that I need to update the kernel?
How to do that?
Thanks
Re: need kernel headers directory to build loadable modules
Posted: Sat Mar 07, 2009 5:17 pm
by esky-sh
Could you tell me what is your cross development envoirnment?
Here are steps to install gcc compliers for arm linux
viewtopic.php?f=6&t=66