带参数的内核模块

hello.c

#include

#include

char *p="Twenty-four";

MODULE_LICENSE("GPL");

module_param(p, charp, S_IRWXU);


static int hello_init(void)

{

printk(" p is %s\n",p);

printk("hello init\n");

return 0;

}


static void hello_exit(void)

{

printk("hello exit\n");

}


module_init(hello_init);

module_exit(hello_exit);


说明:

module_param(变量名, 变量类型, 权限);
变量类型:short 、 ushort 、 int 、uint 、 long 、 ulong 、 charp 、 bool

权限:S_IRWXU   S_IRUSR   S_IWUSR   S_IXUSR


执行:

#insmod hello.ko p=jsetc


你可能感兴趣的:(S3C2440)