[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Compiling a module



Hi,
I tried to follow the first example hello.c in the book linux device driver 2nd edition but I am getting a bunch of errors:
hello.c:
#define MODULE
#include <linux/module.h>
int init_module(void) { printk("<1>Hello, world\n"); return 0; }
void cleanup_module(void) { printk("<1>Goodbye cruel world\n"); }

Errors:
In file included from /usr/include/linux/sched.h:12,
                from /usr/include/linux/module.h:10,
                from hello.c:2:
/usr/include/linux/jiffies.h:16: error: syntax error before "jiffies_64"
/usr/include/linux/jiffies.h:20: error: syntax error before "get_jiffies_64"
In file included from /usr/include/linux/cpumask.h:8,
                from /usr/include/linux/sched.h:15,
                from /usr/include/linux/module.h:10,
                from hello.c:2:
/usr/include/linux/bitmap.h: In function `bitmap_empty':
/usr/include/linux/bitmap.h:15: error: `BITS_PER_LONG' undeclared (first use in this function) /usr/include/linux/bitmap.h:15: error: (Each undeclared identifier is reported only once
/usr/include/linux/bitmap.h:15: error: for each function it appears in.)
/usr/include/linux/bitmap.h: In function `bitmap_full':
/usr/include/linux/bitmap.h:29: error: `BITS_PER_LONG' undeclared (first use in this function)
/usr/include/linux/bitmap.h: In function `bitmap_equal':
/usr/include/linux/bitmap.h:44: error: `BITS_PER_LONG' undeclared (first use in this function)
/usr/include/linux/bitmap.h: In function `bitmap_shift_right':
/usr/include/linux/bitmap.h:85: error: `__shr_tmp' undeclared (first use in this function)

and it goes on and on. Any clues as to why that would be. I downloaded the header files for the debian distribution I have: kernel-headers-2.4.27-2-386 and put them in usr/src under the folder name linux. Thanks for any help Amish


Reply to: