[opensuse] writing a module
Hellow there, I'm trying to write a module, in my source i've added the following line #include <linux/module.h> Since the preprocessor did not found it, i set the variable C_INCLUDE_PATH=/usr/src/linux-2.6.22.5-31/include When i try to compile the source, the preprocessor tell me the following ----------------------------------------------------------------------------------------------------------------- In file included from /usr/src/linux-2.6.22.5-31/include/linux/thread_info.h:20, from /usr/src/linux-2.6.22.5-31/include/linux/preempt.h:9, from /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:49, from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/bitops.h:9:24: error: asm/bitops.h: No such file or directory In file included from /usr/src/linux-2.6.22.5-31/include/linux/preempt.h:9, from /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:49, from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/thread_info.h:21:29: error: asm/thread_info.h: No such file or directory In file included from /usr/src/linux-2.6.22.5-31/include/linux/preempt.h:10, from /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:49, from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/linkage.h:4:25: error: asm/linkage.h: No such file or directory In file included from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:57:24: error: asm/system.h: No such file or directory In file included from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:290: error: expected declaration specifiers or ‘...’ before ‘bool’ /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h: In function ‘double_spin_lock’: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:294: error: ‘l1_first’ undeclared (first use in this function) /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:294: error: (Each undeclared identifier is reported only once /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:294: error: for each function it appears in.) /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h: At top level: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:309: error: expected declaration specifiers or ‘...’ before ‘bool’ /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h: In function ‘double_spin_unlock’: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:313: error: ‘l1_taken_first’ undeclared (first use in this function) /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:326:24: error: asm/atomic.h: No such file or directory /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h: At top level: /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:332: error: expected ‘)’ before ‘*’ token In file included from /usr/src/linux-2.6.22.5-31/include/linux/module.h:10, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/list.h:970:2: warning: #warning "don't include kernel headers in userspace" In file included from /usr/src/linux-2.6.22.5-31/include/linux/module.h:13, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/cache.h:5:23: error: asm/cache.h: No such file or directory In file included from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/module.h:19:23: error: asm/local.h: No such file or directory /usr/src/linux-2.6.22.5-31/include/linux/module.h:21:24: error: asm/module.h: No such file or directory In file included from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/module.h:48: error: field ‘attr’ has incomplete type /usr/src/linux-2.6.22.5-31/include/linux/module.h:49: error: expected specifier-qualifier-list before ‘ssize_t’ /usr/src/linux-2.6.22.5-31/include/linux/module.h:59: error: field ‘kobj’ has incomplete type ------------------------------------------------------------------------------------------------------------------------- Any suggestion? Many thanks, Fernando -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 10 January 2008 07:06:46 pm Fernando Benedictti wrote:
Hellow there,
I'm trying to write a module, in my source i've added the following line
#include <linux/module.h>
Since the preprocessor did not found it, i set the variable
C_INCLUDE_PATH=/usr/src/linux-2.6.22.5-31/include
When i try to compile the source, the preprocessor tell me the following
...
In file included from /usr/src/linux-2.6.22.5-31/include/linux/thread_info.h:20, from /usr/src/linux-2.6.22.5-31/include/linux/preempt.h:9, from /usr/src/linux-2.6.22.5-31/include/linux/spinlock.h:49, from /usr/src/linux-2.6.22.5-31/include/linux/module.h:9, from simple_module.c:2: /usr/src/linux-2.6.22.5-31/include/linux/bitops.h:9:24: error: asm/bitops.h: No such file or directory
There is number of 'asm-<architecture>' directories, but no 'asm' alone, so it seems that you have forgotten to define <architecture>. -- Regards, Rajko -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, Jan 10, 2008 at 11:06:46PM -0200, Fernando Benedictti wrote:
Hellow there,
I'm trying to write a module, in my source i've added the following line
#include <linux/module.h>
Since the preprocessor did not found it, i set the variable
C_INCLUDE_PATH=/usr/src/linux-2.6.22.5-31/include
When i try to compile the source, the preprocessor tell me the following
Try reading the documentation on how to make a kernel module makefile in the Documentation/kbuild/ directory in the kernel tree. You do not need to define something like this, the kernel build system does it all for you. Also, try reading the first few chapters of "Linux Device Drivers, third edition", free online, which explains how to do this also. The best place to ask these kinds of questions is on the kernelnewbies mailing list. Also look at the documentation at kernelnewbies.org on how to do this, it should help explain it too. good luck, greg k-h -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Fernando Benedictti
-
Greg KH
-
Rajko M.