- 论坛徽章:
- 0
|
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
hello.c:
#include
#include
#include
static int count;
static char *string;
MODULE_PARM(count,"l");
MODULE_PARM(string,"s");
int init_module(void)
{
printk("hello, I am the kernel module.\n");
printk("count->%d,\n",count);
printk("string->%s.\n",string);
return 0;
}
void cleanup_module(void)
{
printk("Goodbye\n");
}
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Makefile:
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/23059/showart_226354.html |
|