Hi,
I cannot compile even this simple hello.c LKM on Redhat 7.3 Kernel
2.4.3:
http://tldp.org/LDP/lkmpg/node11.html
(or find it at the end of this message)
I get the following error messages:
[root]# make
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c hello.c
In file included from hello.c:11:
/usr/include/linux/module.h:60: parse error before `atomic_t'
/usr/include/linux/module.h:60: warning: no semicolon at end of struct
or union
/usr/include/linux/module.h:60: warning: no semicolon at end of struct
or union
/usr/include/linux/module.h:62: parse error before `}'
/usr/include/linux/module.h:62: warning: data definition has no type
or storage class
/usr/include/linux/module.h:91: parse error before `}'
hello.c: In function `init_module':
hello.c:26: warning: implicit declaration of function `printk'
make: *** [hello.o] Error 1
Any ideas?!
thanks,
Farshad
/* hello.c
* Copyright (C) 1998 by Ori Pomerantz
*
* "Hello, world" - the kernel module version.
*/
/* The necessary header files */
/* Standard in kernel modules */
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module */
/* Deal with CONFIG_MODVERSIONS */
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
/* Initialize the module */
int init_module()
{
printk("Hello, world - this is the kernel speaking\n");
/* If we return a non zero value, it means that
* init_module failed and the kernel module
* can't be loaded */
return 0;
/* Cleanup - undid whatever init_module did */Quote:}
void cleanup_module()
{
printk("Short is the life of a kernel module\n");
Quote:}