Device Driver Writing Red Hat 8 & 9
Hi!
I am having trouble with the first stage of my mission.
I am trying to compile some code to make a beginners module.
When I compile it I get some errors.
1)
It doesn't know what KERN_INFO is
I looked at the /usr/include/linux/kernel.h and it only has 1 sysinfo struct in there.
I did a search on the kernel.h file and other ones I found had the #defines in them which is how I knew what to write. I added this line into my own source file which removed the error...
$define KERN_INFO "<6>"
2)
I now get a parse error before ';' in function 'init_module'
I got this off here: lwn.net/Articles/21817 (need to be logged in to see it I think)
I
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "Hello, world\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye cruel world\n");
}
I am running Redhat 8.0 with 2.4.20-24 kernel & Redhat 9 2.4.20-8
I should mention I am only typing 'gcc driver.c' to compile it.
Has anyone tryed this before?
Last edited by unicorn21; 12-14-2003 at 01:34 AM.
|