error while compilation of user device driver
Hi, Im a newbie to linux and im trying to do a homework of adding a device to the kernel. Please point out my mistakes in the forum I am trying the sample driver memory.c which i net to load into my kernel my memory.c looks like this Code: #include <linux/init.h> Code: obj-m += memory.o sathish/sathish-desktop:~$ make memory cc memory.c -o memory memory.c:1:24: error: linux/init.h: No such file or directory memory.c:4:26: error: linux/config.h: No such file or directory memory.c:7:26: error: linux/module.h: No such file or directory memory.c:13:40: error: linux/slab.h: No such file or directory memory.c:25:27: error: linux/proc_fs.h: No such file or directory In file included from /usr/include/asm/fcntl.h:1, from /usr/include/linux/fcntl.h:4, from memory.c:28: /usr/include/asm-generic/fcntl.h:96: error: expected specifier-qualifier-list before 'pid_t' memory.c:31:45: error: asm/system.h: No such file or directory memory.c:34:49: error: asm/uaccess.h: No such file or directory memory.c:37: error: expected declaration specifiers or '...' before string constant memory.c:37: warning: data definition has no type or storage class memory.c:41: warning: 'struct file' declared inside parameter list memory.c:41: warning: its scope is only this definition or declaration, which is probably not what you want memory.c:41: warning: 'struct inode' declared inside parameter list memory.c:42: warning: 'struct file' declared inside parameter list memory.c:42: warning: 'struct inode' declared inside parameter list memory.c:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'memory_read' memory.c:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'memory_write' memory.c:49: error: variable 'memory_fops' has initializer but incomplete type memory.c:50: error: unknown field 'read' specified in initializer memory.c:50: error: 'memory_read' undeclared here (not in a function) memory.c:50: warning: excess elements in struct initializer memory.c:50: warning: (near initialization for 'memory_fops') memory.c:51: error: unknown field 'write' specified in initializer memory.c:51: error: 'memory_write' undeclared here (not in a function) memory.c:51: warning: excess elements in struct initializer memory.c:51: warning: (near initialization for 'memory_fops') memory.c:52: error: unknown field 'open' specified in initializer memory.c:52: warning: excess elements in struct initializer memory.c:52: warning: (near initialization for 'memory_fops') memory.c:53: error: unknown field 'release' specified in initializer memory.c:53: warning: excess elements in struct initializer memory.c:53: warning: (near initialization for 'memory_fops') memory.c:57: warning: data definition has no type or storage class memory.c:57: warning: parameter names (without types) in function declaration memory.c:58: warning: data definition has no type or storage class memory.c:58: warning: parameter names (without types) in function declaration memory.c: In function 'memory_init': memory.c:81: error: 'GFP_KERNEL' undeclared (first use in this function) memory.c:81: error: (Each undeclared identifier is reported only once memory.c:81: error: for each function it appears in.) memory.c:86: warning: incompatible implicit declaration of built-in function 'memset' memory.c: At top level: memory.c:116: warning: 'struct file' declared inside parameter list memory.c:116: warning: 'struct inode' declared inside parameter list memory.c:116: error: conflicting types for 'memory_open' memory.c:41: note: previous declaration of 'memory_open' was here memory.c:125: warning: 'struct file' declared inside parameter list memory.c:125: warning: 'struct inode' declared inside parameter list memory.c:125: error: conflicting types for 'memory_release' memory.c:42: note: previous declaration of 'memory_release' was here memory.c:136: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'memory_read' memory.c:158: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'memory_write' make: *** [memory] Error 1 sathish/sathish-desktop:~$ Please let me know the reason for this error , i tried sudo apt-get update but in vain. Thanks in advance. |
No comments:
Post a Comment