need kernel headers directory to build loadable modules

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Tue Mar 03, 2009 3:18 pm

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

esky-sh
Posts: 1904
Joined: Sat Dec 20, 2008 4:21 am

Re: need kernel headers directory to build loadable modules

Post by esky-sh » Tue Mar 03, 2009 7:14 pm

Hi, there is include directory under kernel-2.6.13

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

Re: need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Wed Mar 04, 2009 2:26 pm

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

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

Re: need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Fri Mar 06, 2009 4:02 pm

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?

esky-sh
Posts: 1904
Joined: Sat Dec 20, 2008 4:21 am

Re: need kernel headers directory to build loadable modules

Post by esky-sh » Fri Mar 06, 2009 5:04 pm

Did you successfully build linux kernel in your cross development envoirnment?

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

Re: need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Sat Mar 07, 2009 3:05 am

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?

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

Re: need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Sat Mar 07, 2009 4:09 am

If I have to compile the kernel before compiling kernel modules what is the commands for doing that?
also where is the default configuration

esky-sh
Posts: 1904
Joined: Sat Dec 20, 2008 4:21 am

Re: need kernel headers directory to build loadable modules

Post by esky-sh » Sat Mar 07, 2009 4:43 am

Here you go-->
viewtopic.php?f=6&t=26

tarek.elsherbiny
Posts: 16
Joined: Mon Feb 02, 2009 7:23 am

Re: need kernel headers directory to build loadable modules

Post by tarek.elsherbiny » Sat Mar 07, 2009 6:55 am

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

esky-sh
Posts: 1904
Joined: Sat Dec 20, 2008 4:21 am

Re: need kernel headers directory to build loadable modules

Post by esky-sh » Sat Mar 07, 2009 5:17 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests