linux/module.h does not exist
I wrote following program in my home directory.
Code:
#include <linux/kernel.h> Code:
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c Code:
sample2.c:3:26: error: linux/module.h: No such file or directory I did all this in my home directory. |
You are using a header, only present in the kernel source code.
( ? May be you have /usr/src/linux/include/linux/module.h ? ). The kernel headers in /usr/incude/linux etc. : headers used when your glibc = libc6 was created. (And those headers are meant for application builds.) gcc -I<path-to-kernel-source>/include ( I don't know / remember the order of the CFLAGS, -I/<> , sample2.c ) ..... |
Ok I did try what you said but it did not worked.
|
Quote:
|
Tried
Code:
sudo apt-get install linux-headers-generic Code:
Reading package lists... Done page 48 left hand column. |
Quote:
- the above two definitely enable checking file presence. |
Kernel source is installed.
Which file are you pointing to ? Code:
find linux-headers-2.6.28-11-generic/ -name module.h Code:
/usr/src/linux-headers-2.6.28-11-generic/include/linux/module.h I looked at man page of gcc and searched for DMODULE D__KERNEL and DLINUX got following Quote:
|
Quote:
Code:
#include <some_path2/some_file.h> Assuming the Code:
#include <linux/module.h> C99 standard is: http://www.open-std.org/JTC1/SC22/wg...docs/n1124.pdf . And the item to look for is "Source file inclusion". 'gcc' documentation is, for example, http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc.pdf , and the item to look for is "Options Controlling the Preprocessor". |
From the second link you gave
page 125 of the 2nd pdf says Quote:
also on page 121 Quote:
|
Quote:
Regarding Quote:
Anyway, first concentrate on the '-I'. |
Quote:
Please stay on this thread I want to dig it till I solve it. |
Quote:
is not clear ? Regarding Quote:
Code:
#include <linux/module.h> |
I also suggest to read section 6.10.3 of the C99 standard - after you're done with the '#include' issue.
|
device driver
hi tsmsr:
have you resolved the question yet? if not, please contact me. email: runcoderzhcn@gmail.com I have see the same question and resolved it successfully. |
I had missed one line of code from the link I gave
following is new program Code:
#include <linux/kernel.h> Code:
gcc -Wall -DMODULE -D__KERNEL -DLINUX -c sample2.c Now see I think it is easy to tell now as what is the error. Also as some one pointed out about linux/module.h I did a find on module.h Code:
/usr/src/linux-headers-2.6.28-11-generic/include/linux/module.h Which module.h should I include using -I directive as you specified above that is my problem. After this I tried having a make file Code:
obj-m+=sample2.o Code:
make: *** /lib/modules//build/M=/home/tkmsr/LKP/pandora/temp/sample2: No such file or directory. Stop. Code:
v=$(uname -r) |
All times are GMT -5. The time now is 07:16 PM. |