Results 1 to 6 of 6
Hi, I just began reading a Linux device driver tutorial:
Writing device drivers in Linux: A brief tutorial
But I can't find the required init.h and module.h and some other ...
- 02-24-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 21
Can't find <linux/init.h> and <linux/module.h>
Hi, I just began reading a Linux device driver tutorial:
Writing device drivers in Linux: A brief tutorial
But I can't find the required init.h and module.h and some other header files. Should they lie in the /usr/include/linux directory? Or, if they are not installed in my system, what should I do?
- 02-24-2008 #2
You need to install the kernel-source (or kernel-devel) package.
- 02-25-2008 #3Just Joined!
- Join Date
- Feb 2008
- Posts
- 21
I just installed the kernel-devel package, but still I can't find these header files.
- 02-25-2008 #4
It could be that you also need to have the kernel-headers installed. On my openSUSE 10.3 system, the headers you mentioned are provided by kernel-source.
- 02-25-2008 #5Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
You must use the kernel headers of the kernel you are compiling against. Using the default /usr/include/linux won't work.
Makefile should like this;
----------------------------------------------------------------
TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc-3.0
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf {TARGET}.o
----------------------------------------------------------------
Pankaj.
- 02-27-2008 #6Just Joined!
- Join Date
- Feb 2008
- Posts
- 21
Thanks!

Besides, I have found that these header files are in the kernel directory instead of the standard include directory.


Reply With Quote